@faasjs/ant-design 8.0.0-beta.3 → 8.0.0-beta.31

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.d.ts CHANGED
@@ -1,231 +1,456 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { DrawerProps as DrawerProps$1, ModalProps as ModalProps$1, ConfigProviderProps as ConfigProviderProps$1, FormItemProps as FormItemProps$1, InputProps, SelectProps, RadioProps, InputNumberProps, SwitchProps, DatePickerProps, FormInstance, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, DescriptionsProps, FormProps as FormProps$1, ButtonProps, TabsProps as TabsProps$1, GlobalToken } from 'antd';
3
- export { Drawer, Modal } from 'antd';
4
- import { MessageInstance } from 'antd/es/message/interface';
5
- import { NotificationInstance } from 'antd/es/notification/interface';
6
- import { BrowserRouterProps, RouteProps } from 'react-router-dom';
7
- import * as react from 'react';
8
- import { JSX, CSSProperties, Dispatch, SetStateAction, ReactElement, FC, ReactNode, LazyExoticComponent, ComponentType } from 'react';
9
- export { lazy } from 'react';
10
- import { FaasDataWrapperProps as FaasDataWrapperProps$1, FaasDataInjection as FaasDataInjection$1, FaasReactClientOptions, ErrorBoundaryProps } from '@faasjs/react';
11
- export { ErrorBoundaryProps, FaasDataWrapperRef, FaasReactClient, FaasReactClientOptions, faas, useFaas } from '@faasjs/react';
12
- import { FaasActionUnionType, FaasAction } from '@faasjs/types';
13
- import { Dayjs } from 'dayjs';
14
- import * as antd_es_form_FormItem from 'antd/es/form/FormItem';
15
- import * as antd_es_form from 'antd/es/form';
16
- import { RuleObject } from 'antd/es/form';
17
- import { FilterValue, SorterResult, TableCurrentDataSource } from 'antd/es/table/interface';
18
- import * as antd_es_form_context from 'antd/es/form/context';
19
- import * as _rc_component_form from '@rc-component/form';
20
- import * as antd_es_form_hooks_useFormInstance from 'antd/es/form/hooks/useFormInstance';
21
- import * as antd_es_form_Form from 'antd/es/form/Form';
22
- import { Tab } from '@rc-component/tabs/lib/interface';
1
+ import { ErrorBoundaryProps, FaasDataInjection, FaasDataInjection as FaasDataInjection$1, FaasDataWrapperProps as FaasDataWrapperProps$1, FaasDataWrapperRef, FaasReactClient, FaasReactClientOptions, faas, useFaas } from "@faasjs/react";
2
+ import { ButtonProps, ConfigProviderProps as ConfigProviderProps$1, DatePickerProps, DescriptionsProps, Drawer, DrawerProps as DrawerProps$1, FormInstance, FormItemProps as FormItemProps$1, FormProps as FormProps$1, GlobalToken, InputNumberProps, InputProps, Modal, ModalProps as ModalProps$1, RadioProps, SelectProps, SwitchProps, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, TabsProps as TabsProps$1 } from "antd";
3
+ import { BrowserRouterProps, RouteProps } from "react-router-dom";
4
+ import * as _$react from "react";
5
+ import { CSSProperties, ComponentType, Dispatch, FC, JSX, LazyExoticComponent, ReactElement, ReactNode, SetStateAction, lazy } from "react";
6
+ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
7
+ import { Dayjs } from "dayjs";
8
+ import { FaasActionPaths, FaasParams } from "@faasjs/types";
9
+ import * as _$antd_es_form0 from "antd/es/form/index.js";
10
+ import { RuleObject } from "antd/es/form/index.js";
11
+ import { FilterValue, SorterResult, TableCurrentDataSource } from "antd/es/table/interface.js";
12
+ import * as _$antd_es_form_Form0 from "antd/es/form/Form.js";
13
+ import * as _$antd_es_form_hooks_useFormInstance0 from "antd/es/form/hooks/useFormInstance.js";
14
+ import * as _$_rc_component_form0 from "@rc-component/form";
15
+ import * as _$antd_es_form_context0 from "antd/es/form/context.js";
16
+ import * as _$antd_es_form_FormItem0 from "antd/es/form/FormItem/index.js";
17
+ import { Tab } from "@rc-component/tabs/lib/interface.js";
18
+ import { MessageInstance } from "antd/es/message/interface.js";
19
+ import { NotificationInstance } from "antd/es/notification/interface.js";
23
20
 
21
+ //#region src/Loading/index.d.ts
22
+ /**
23
+ * Props for the {@link Loading} component.
24
+ */
24
25
  type LoadingProps = {
25
- style?: React.CSSProperties;
26
- size?: 'small' | 'default' | 'large';
27
- loading?: boolean;
28
- children?: React.ReactNode;
26
+ /** Inline styles applied to the loading wrapper. */style?: React.CSSProperties;
27
+ /**
28
+ * Ant Design spinner size.
29
+ *
30
+ * @default 'large'
31
+ */
32
+ size?: 'small' | 'default' | 'large';
33
+ /**
34
+ * Whether the loading indicator should be shown.
35
+ *
36
+ * @default true
37
+ */
38
+ loading?: boolean; /** Content rendered when `loading` is `false`. */
39
+ children?: React.ReactNode;
29
40
  };
30
41
  /**
31
- * Loading component based on Spin
42
+ * Render an Ant Design loading spinner with an optional content fallback.
43
+ *
44
+ * @param {LoadingProps} props - Loading indicator props and optional wrapped children.
32
45
  *
33
46
  * @example
34
47
  * ```tsx
35
- * <Loading /> // display loading
48
+ * import { Loading } from '@faasjs/ant-design'
36
49
  *
37
- * <Loading loading={ !remoteData }>
38
- * <div>{remoteData}</div>
39
- * </Loading>
50
+ * export function Page({ remoteData }: { remoteData?: string }) {
51
+ * return (
52
+ * <>
53
+ * <Loading />
54
+ * <Loading loading={!remoteData}>
55
+ * <div>{remoteData}</div>
56
+ * </Loading>
57
+ * </>
58
+ * )
59
+ * }
40
60
  * ```
41
61
  */
42
- declare function Loading(props: LoadingProps): react_jsx_runtime.JSX.Element;
43
-
44
- type FaasDataInjection<T = any> = Partial<FaasDataInjection$1<T>>;
45
- interface FaasDataWrapperProps<T = any> extends FaasDataWrapperProps$1<T> {
46
- loadingProps?: LoadingProps;
47
- loading?: JSX.Element;
62
+ declare function Loading(props: LoadingProps): _$react_jsx_runtime0.JSX.Element;
63
+ //#endregion
64
+ //#region src/FaasDataWrapper/index.d.ts
65
+ /**
66
+ * Ant Design wrapper props for the underlying `@faasjs/react` data wrapper.
67
+ *
68
+ * @template T - Action path or response data type used for inference.
69
+ */
70
+ interface FaasDataWrapperProps<T extends FaasActionPaths = any> extends FaasDataWrapperProps$1<T> {
71
+ /** Props forwarded to the built-in {@link Loading} fallback. */
72
+ loadingProps?: LoadingProps;
73
+ /** Explicit loading element that overrides the built-in {@link Loading} fallback. */
74
+ loading?: JSX.Element;
48
75
  }
49
-
50
76
  /**
51
- * FaasDataWrapper component with Loading
77
+ * Render the `@faasjs/react` data wrapper with an Ant Design loading fallback.
78
+ *
79
+ * When `loading` is not provided, the component renders {@link Loading} with `loadingProps` while
80
+ * the wrapped FaasJS request is pending.
81
+ *
82
+ * @template T - Action path or response data type used for inference.
83
+ * @param {FaasDataWrapperProps<T>} props - Wrapper props including loading fallbacks and request configuration.
52
84
  *
53
85
  * @example
54
86
  * ```tsx
55
- * function MyComponent (props: FaasDataInjection) {
56
- * return <div>{ props.data }</div>
87
+ * import { Alert, Button } from 'antd'
88
+ * import { FaasDataWrapper } from '@faasjs/ant-design'
89
+ *
90
+ * type User = {
91
+ * name: string
92
+ * }
93
+ *
94
+ * function UserView(props: {
95
+ * data?: User
96
+ * error?: Error
97
+ * reload?: () => void
98
+ * }) {
99
+ * if (props.error) {
100
+ * return (
101
+ * <Alert
102
+ * type="error"
103
+ * message={props.error.message}
104
+ * action={
105
+ * <Button size="small" onClick={() => props.reload?.()}>
106
+ * Retry
107
+ * </Button>
108
+ * }
109
+ * />
110
+ * )
111
+ * }
112
+ *
113
+ * return <div>Hello, {props.data?.name}</div>
57
114
  * }
58
115
  *
59
- * function MyPage () {
60
- * return <FaasDataWrapper action="test" params={{ a: 1 }}>
61
- * <MyComponent />
62
- * </FaasDataWrapper>
116
+ * // Render-prop mode
117
+ * export function UserProfile(props: { id: number }) {
118
+ * return (
119
+ * <FaasDataWrapper<User>
120
+ * action="user/get"
121
+ * params={{ id: props.id }}
122
+ * loading={<div>Loading user...</div>}
123
+ * render={({ data, error, reload }) => {
124
+ * if (error) {
125
+ * return (
126
+ * <Alert
127
+ * type="error"
128
+ * message={error.message}
129
+ * action={
130
+ * <Button size="small" onClick={() => reload()}>
131
+ * Retry
132
+ * </Button>
133
+ * }
134
+ * />
135
+ * )
136
+ * }
137
+ *
138
+ * return <div>Hello, {data.name}</div>
139
+ * }}
140
+ * />
141
+ * )
142
+ * }
143
+ *
144
+ * // Children injection mode
145
+ * export function UserProfileWithChildren(props: { id: number }) {
146
+ * return (
147
+ * <FaasDataWrapper<User>
148
+ * action="user/get"
149
+ * params={{ id: props.id }}
150
+ * loading={<div>Loading user...</div>}
151
+ * >
152
+ * <UserView />
153
+ * </FaasDataWrapper>
154
+ * )
63
155
  * }
64
156
  * ```
65
157
  */
66
- declare function FaasDataWrapper<T = any>(props: FaasDataWrapperProps<T>): JSX.Element;
158
+ declare function FaasDataWrapper<T extends FaasActionPaths = any>(props: FaasDataWrapperProps<T>): JSX.Element;
67
159
  /**
68
- * HOC to wrap a component with FaasDataWrapper and Loading
160
+ * Wrap a component with {@link FaasDataWrapper} and its Ant Design loading fallback.
161
+ *
162
+ * @template Path - Action path or response data type used for inference.
163
+ * @template TComponentProps - Component props including injected Faas data fields.
164
+ * @param {React.FC<TComponentProps & Record<string, any>>} Component - Component that consumes injected Faas data props.
165
+ * @param {FaasDataWrapperProps<Path>} faasProps - Request configuration forwarded to {@link FaasDataWrapper}.
166
+ * @returns Higher-order component that injects Faas data props.
69
167
  *
70
168
  * @example
71
169
  * ```tsx
72
- * const MyComponent = withFaasData(({ data }) => <div>{data.name}</div>, { action: 'test', params: { a: 1 } })
170
+ * import { withFaasData } from '@faasjs/ant-design'
171
+ *
172
+ * const UserCard = withFaasData(
173
+ * ({ data, error, reload }) =>
174
+ * error ? (
175
+ * <a onClick={() => reload()}>Retry</a>
176
+ * ) : (
177
+ * <div>{data.name}</div>
178
+ * ),
179
+ * { action: 'user/get', params: { id: 1 } },
180
+ * )
73
181
  * ```
74
182
  */
75
- declare function withFaasData<PathOrData extends FaasActionUnionType, TComponentProps extends Required<FaasDataInjection<PathOrData>> = Required<FaasDataInjection<PathOrData>>>(Component: React.FC<TComponentProps & Record<string, any>>, faasProps: FaasDataWrapperProps<PathOrData>): React.FC<Omit<TComponentProps, keyof FaasDataInjection<PathOrData>>>;
76
-
183
+ declare function withFaasData<Path extends FaasActionPaths, TComponentProps extends Required<FaasDataInjection$1<Path>> = Required<FaasDataInjection$1<Path>>>(Component: React.FC<TComponentProps & Record<string, any>>, faasProps: FaasDataWrapperProps<Path>): React.FC<Omit<TComponentProps, keyof FaasDataInjection$1<Path>>>;
184
+ //#endregion
185
+ //#region src/Config/index.d.ts
186
+ /**
187
+ * Fully resolved theme object consumed by `@faasjs/ant-design` components.
188
+ */
189
+ type ResolvedTheme = {
190
+ /** Current language code used for built-in copy. */lang: string; /** Shared copy used by multiple components. */
191
+ common: {
192
+ blank: string;
193
+ all: string;
194
+ submit: string;
195
+ pageNotFound: string;
196
+ add: string;
197
+ delete: string;
198
+ required: string;
199
+ search: string;
200
+ reset: string;
201
+ }; /** Theme values consumed by the `Blank` component. */
202
+ Blank: {
203
+ text: string;
204
+ }; /** Theme values consumed by the `Form` component. */
205
+ Form: {
206
+ submit: {
207
+ text: string;
208
+ };
209
+ }; /** Theme values consumed by the `Title` component. */
210
+ Title: {
211
+ separator: string;
212
+ suffix: string;
213
+ }; /** Theme values consumed by the `Link` component. */
214
+ Link: {
215
+ target?: string;
216
+ style: CSSProperties;
217
+ };
218
+ };
219
+ type ConfigContextValue = {
220
+ theme: ResolvedTheme;
221
+ };
222
+ /**
223
+ * Props for the `@faasjs/ant-design` {@link ConfigProvider}.
224
+ */
77
225
  interface ConfigProviderProps {
78
- faasClientOptions?: FaasReactClientOptions;
79
- children: React.ReactNode;
80
- theme?: {
81
- lang?: string;
82
- common?: {
83
- blank?: string;
84
- all?: string;
85
- submit?: string;
86
- pageNotFound?: string;
87
- add?: string;
88
- delete?: string;
89
- required?: string;
90
- search?: string;
91
- reset?: string;
92
- };
93
- Blank?: {
94
- text?: string;
95
- };
96
- Form?: {
97
- submit?: {
98
- text?: string;
99
- };
100
- };
101
- Title?: {
102
- /** ' - ' as default */
103
- separator?: string;
104
- suffix?: string;
105
- };
106
- Link?: {
107
- /** '_blank' as default */
108
- target?: string;
109
- style?: CSSProperties;
110
- };
226
+ /** Optional FaasJS client options used to initialize {@link FaasReactClient}. */
227
+ faasClientOptions?: FaasReactClientOptions;
228
+ /** Descendant components that consume the resolved config context. */
229
+ children: React.ReactNode;
230
+ /** Theme overrides merged with the built-in defaults. */
231
+ theme?: {
232
+ /** Language code used to select localized defaults. */lang?: string; /** Common shared copy and labels used across components. */
233
+ common?: {
234
+ blank?: string;
235
+ all?: string;
236
+ submit?: string;
237
+ pageNotFound?: string;
238
+ add?: string;
239
+ delete?: string;
240
+ required?: string;
241
+ search?: string;
242
+ reset?: string;
243
+ }; /** Blank-component theme overrides. */
244
+ Blank?: {
245
+ text?: string;
246
+ }; /** Form-component theme overrides. */
247
+ Form?: {
248
+ submit?: {
249
+ text?: string;
250
+ };
251
+ }; /** Title-component theme overrides. */
252
+ Title?: {
253
+ /**
254
+ * Separator inserted between title segments.
255
+ *
256
+ * @default ' - '
257
+ */
258
+ separator?: string; /** Suffix appended to generated page titles. */
259
+ suffix?: string;
260
+ }; /** Link-component theme overrides. */
261
+ Link?: {
262
+ /**
263
+ * Default target used by the `Link` component when `props.target` is omitted.
264
+ *
265
+ * @default '_blank'
266
+ */
267
+ target?: string; /** Default inline styles merged into every `Link`. */
268
+ style?: CSSProperties;
111
269
  };
270
+ };
112
271
  }
113
- declare const ConfigContext: react.Context<Partial<ConfigProviderProps>>;
114
272
  /**
115
- * Config for `@faasjs/ant-design` components.
273
+ * Low-level React context that stores the resolved theme from {@link ConfigProvider}.
274
+ *
275
+ * Most app code should call {@link useConfigContext} instead of reading this context directly.
116
276
  *
117
277
  * @example
118
278
  * ```tsx
119
- * import { ConfigProvider } from '@faasjs/ant-design'
279
+ * import { ConfigContext, ConfigProvider } from '@faasjs/ant-design'
280
+ * import { useContext } from 'react'
120
281
  *
121
- * <ConfigProvider theme={{ common: { blank: 'Empty' } }}>
122
- * <Blank />
123
- * </ConfigProvider>
282
+ * function OrdersHeader() {
283
+ * const { theme } = useContext(ConfigContext)
284
+ *
285
+ * return <h1>{`Orders - ${theme.Title.suffix}`}</h1>
286
+ * }
287
+ *
288
+ * export function OrdersPage() {
289
+ * return (
290
+ * <ConfigProvider
291
+ * theme={{
292
+ * common: { blank: 'No orders yet' },
293
+ * Title: { suffix: 'Acme Admin' },
294
+ * }}
295
+ * >
296
+ * <OrdersHeader />
297
+ * </ConfigProvider>
298
+ * )
299
+ * }
124
300
  * ```
125
301
  */
126
- declare function ConfigProvider(props: ConfigProviderProps): react_jsx_runtime.JSX.Element;
127
- declare function useConfigContext(): Partial<ConfigProviderProps>;
128
-
129
- interface DrawerProps extends DrawerProps$1 {
130
- children?: JSX.Element | JSX.Element[];
131
- }
132
- type setDrawerProps = Dispatch<SetStateAction<DrawerProps>>;
302
+ declare const ConfigContext: _$react.Context<ConfigContextValue>;
133
303
  /**
134
- * Hook style drawer
304
+ * Provide theme overrides and optional FaasJS client initialization for descendants.
305
+ *
306
+ * Theme overrides are merged with the built-in defaults. When `theme.lang` is omitted, the
307
+ * provider infers a default language from `navigator.language`.
135
308
  *
309
+ * @param {ConfigProviderProps} props - Theme overrides and optional FaasJS client configuration.
310
+ *
311
+ * @example
136
312
  * ```tsx
137
- * function Example() {
138
- * const { drawer, setDrawerProps } = useDrawer()
313
+ * import { Blank, ConfigProvider } from '@faasjs/ant-design'
139
314
  *
140
- * return <>
141
- * <Button onClick={ () => setDrawerProps(prev => ({ open: !prev.open})) }>
142
- * Toggle
143
- * </Button>
144
- * {drawer}
145
- * </>
315
+ * function OrdersEmptyState() {
316
+ * return <Blank />
317
+ * }
318
+ *
319
+ * export function OrdersPage() {
320
+ * return (
321
+ * <ConfigProvider
322
+ * theme={{
323
+ * common: { blank: 'No orders yet' },
324
+ * Title: { suffix: 'Acme Admin' },
325
+ * }}
326
+ * >
327
+ * <OrdersEmptyState />
328
+ * </ConfigProvider>
329
+ * )
146
330
  * }
147
331
  * ```
148
332
  */
149
- declare function useDrawer(init?: DrawerProps): {
150
- drawer: react_jsx_runtime.JSX.Element;
151
- drawerProps: DrawerProps;
152
- setDrawerProps: setDrawerProps;
153
- };
154
-
333
+ declare function ConfigProvider(props: ConfigProviderProps): _$react_jsx_runtime0.JSX.Element | null;
155
334
  /**
156
- * Styled error boundary.
335
+ * Read the current `@faasjs/ant-design` config context.
336
+ *
337
+ * @returns Current config context value containing the resolved theme.
338
+ *
339
+ * @example
340
+ * ```tsx
341
+ * import { ConfigProvider, useConfigContext } from '@faasjs/ant-design'
342
+ *
343
+ * function OrdersSummary() {
344
+ * const { theme } = useConfigContext()
345
+ *
346
+ * return (
347
+ * <>
348
+ * <h1>{`Orders - ${theme.Title.suffix}`}</h1>
349
+ * <p>{theme.common.blank}</p>
350
+ * </>
351
+ * )
352
+ * }
353
+ *
354
+ * export function OrdersPage() {
355
+ * return (
356
+ * <ConfigProvider
357
+ * theme={{
358
+ * common: { blank: 'No orders yet' },
359
+ * Title: { suffix: 'Acme Admin' },
360
+ * }}
361
+ * >
362
+ * <OrdersSummary />
363
+ * </ConfigProvider>
364
+ * )
365
+ * }
366
+ * ```
157
367
  */
158
- declare function ErrorBoundary(props: ErrorBoundaryProps): react_jsx_runtime.JSX.Element;
159
-
160
- interface ModalProps extends ModalProps$1 {
161
- children?: JSX.Element | JSX.Element[] | string;
162
- }
163
- type setModalProps = Dispatch<SetStateAction<ModalProps>>;
368
+ declare function useConfigContext(): ConfigContextValue;
369
+ //#endregion
370
+ //#region src/ErrorBoundary/index.d.ts
164
371
  /**
165
- * Hook style modal
372
+ * Styled error boundary.
166
373
  *
374
+ * When `errorChildren` is not provided, the fallback UI renders an Ant Design `Alert` containing
375
+ * the captured error message and description.
376
+ *
377
+ * @param {ErrorBoundaryProps} props - Error boundary props forwarded to the underlying React implementation.
378
+ *
379
+ * @example
167
380
  * ```tsx
168
- * function Example() {
169
- * const { modal, setModalProps } = useModal()
381
+ * import { ErrorBoundary } from '@faasjs/ant-design'
170
382
  *
171
- * return <>
172
- * <Button onClick={() => setModalProps({ open: true })}>Open Modal</Button>
173
- * {modal}
174
- * </>
383
+ * export function Page() {
384
+ * return (
385
+ * <ErrorBoundary>
386
+ * <DangerousWidget />
387
+ * </ErrorBoundary>
388
+ * )
175
389
  * }
176
390
  * ```
177
391
  */
178
- declare function useModal(init?: ModalProps): {
179
- modal: react_jsx_runtime.JSX.Element;
180
- modalProps: ModalProps;
181
- setModalProps: setModalProps;
182
- };
183
-
392
+ declare function ErrorBoundary(props: ErrorBoundaryProps): _$react_jsx_runtime0.JSX.Element;
393
+ //#endregion
394
+ //#region src/App/index.d.ts
395
+ /**
396
+ * Props for the root {@link App} shell.
397
+ *
398
+ * `App` composes the Ant Design provider tree, FaasJS config provider, shared modal and drawer
399
+ * state, and optional browser routing into a single wrapper component.
400
+ */
184
401
  interface AppProps {
185
- children: React.ReactNode;
186
- /** @see https://ant.design/components/config-provider/#API */
187
- configProviderProps?: ConfigProviderProps$1;
188
- /**
189
- * `false` to disable BrowserRouter.
190
- *
191
- * Auto disable when not in browser.
192
- *
193
- * @see https://api.reactrouter.com/v7/interfaces/react_router.BrowserRouterProps.html
194
- */
195
- browserRouterProps?: BrowserRouterProps | false;
196
- /** @see https://faasjs.com/doc/ant-design/#errorboundary */
197
- errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>;
198
- /** @see https://faasjs.com/doc/ant-design/#configprovider */
199
- faasConfigProviderProps?: Omit<ConfigProviderProps, 'children'> | false;
200
- }
201
- interface useAppProps {
202
- message: MessageInstance;
203
- notification: NotificationInstance;
204
- modalProps: ModalProps;
205
- setModalProps: setModalProps;
206
- drawerProps: DrawerProps;
207
- setDrawerProps: setDrawerProps;
402
+ /** Descendant elements rendered inside all configured providers. */
403
+ children: React.ReactNode;
404
+ /**
405
+ * Props forwarded to Ant Design's `ConfigProvider`.
406
+ *
407
+ * @see [Ant Design ConfigProvider API](https://ant.design/components/config-provider/#API)
408
+ */
409
+ configProviderProps?: ConfigProviderProps$1;
410
+ /**
411
+ * Props forwarded to React Router's `BrowserRouter`, or `false` to disable browser routing.
412
+ *
413
+ * Routing is enabled automatically when running in a browser and this prop is not `false`.
414
+ *
415
+ * @see [React Router BrowserRouterProps](https://api.reactrouter.com/v7/interfaces/react_router.BrowserRouterProps.html)
416
+ */
417
+ browserRouterProps?: BrowserRouterProps | false;
418
+ /**
419
+ * Props forwarded to {@link ErrorBoundary}.
420
+ *
421
+ * @see [FaasJS Ant Design ErrorBoundary docs](https://faasjs.com/doc/ant-design/#errorboundary)
422
+ */
423
+ errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>;
424
+ /**
425
+ * Props forwarded to {@link ConfigProvider}, or `false` to skip the FaasJS config layer.
426
+ *
427
+ * @see [FaasJS Ant Design ConfigProvider docs](https://faasjs.com/doc/ant-design/#configprovider)
428
+ */
429
+ faasConfigProviderProps?: Omit<ConfigProviderProps, 'children'> | false;
208
430
  }
431
+ declare function createOnErrorHandler(messageApi: {
432
+ error: (message: string) => void;
433
+ }): (action: string) => (res: any) => Promise<void>;
209
434
  /**
210
- * App component with Ant Design & FaasJS
435
+ * Render the root provider shell for a FaasJS Ant Design application.
211
436
  *
212
- * - Based on Ant Design's [ConfigProvider](https://ant.design/components/config-provider/).
213
- * - Integrated Ant Design's [Message](https://ant.design/components/message/) and [Notification](https://ant.design/components/notification/).
214
- * - Based on FaasJS's [ConfigProvider](https://faasjs.com/doc/ant-design/#configprovider).
215
- * - Integrated FaasJS's [Modal](https://faasjs.com/doc/ant-design/#usemodal), [Drawer](https://faasjs.com/doc/ant-design/#usedrawer) and [ErrorBoundary](https://faasjs.com/doc/ant-design/#errorboundary).
216
- * - Integrated React Router's [BrowserRouter](https://api.reactrouter.com/v7/interfaces/react_router.BrowserRouterProps.html).
437
+ * `App` initializes Ant Design message and notification APIs, exposes hook-managed modal and
438
+ * drawer state through {@link AppContext}, wraps descendants with {@link ErrorBoundary}, and
439
+ * optionally mounts React Router's `BrowserRouter`.
440
+ *
441
+ * @param {AppProps} props - App shell props including providers, routing, and error handling options.
217
442
  *
218
443
  * @example
219
444
  * ```tsx
220
445
  * import { App } from '@faasjs/ant-design'
221
446
  *
222
- * export default function () {
447
+ * export default function Page() {
223
448
  * return (
224
449
  * <App
225
- * configProviderProps={{}} // https://ant.design/components/config-provider/#API
226
- * browserRouterProps={{}} // https://api.reactrouter.com/v7/interfaces/react_router.BrowserRouterProps.html
227
- * errorBoundaryProps={{}} // https://faasjs.com/doc/ant-design/#errorboundary
228
- * faasConfigProviderProps={{}} // https://faasjs.com/doc/ant-design/#configprovider
450
+ * configProviderProps={{}}
451
+ * browserRouterProps={{}}
452
+ * errorBoundaryProps={{}}
453
+ * faasConfigProviderProps={{}}
229
454
  * >
230
455
  * <div>content</div>
231
456
  * </App>
@@ -233,673 +458,890 @@ interface useAppProps {
233
458
  * }
234
459
  * ```
235
460
  */
236
- declare function App(props: AppProps): react_jsx_runtime.JSX.Element;
237
- declare namespace App {
238
- var useApp: <NewT extends useAppProps = useAppProps>() => Readonly<NewT>;
239
- }
461
+ declare function App(props: AppProps): _$react_jsx_runtime0.JSX.Element;
462
+ //#endregion
463
+ //#region src/Blank/index.d.ts
240
464
  /**
241
- * Get app context.
242
- *
243
- * ```ts
244
- * import { useApp } from '@faasjs/ant-design'
245
- *
246
- * const { message, notification, setModalProps, setDrawerProps } = useApp()
247
- * ```
465
+ * Props for the {@link Blank} placeholder component.
248
466
  */
249
- declare const useApp: <NewT extends useAppProps = useAppProps>() => Readonly<NewT>;
250
-
251
467
  interface BlankProps {
252
- value?: any;
253
- text?: string;
468
+ /** Value to render when it is present. */
469
+ value?: any;
470
+ /** Placeholder text shown when `value` is empty. */
471
+ text?: string;
254
472
  }
255
473
  /**
256
- * Blank component.
474
+ * Render a disabled placeholder when a value is empty.
257
475
  *
258
- * If value is undefined or null, return text, otherwise return value.
476
+ * Empty values include `undefined`, `null`, empty strings, and empty arrays.
477
+ *
478
+ * @param {BlankProps} [options] - Placeholder text and value to render.
479
+ * @returns Rendered value or the configured placeholder text.
259
480
  *
260
481
  * @example
261
482
  * ```tsx
262
483
  * import { Blank } from '@faasjs/ant-design'
263
484
  *
264
- * <Blank value={undefined} text="Empty" />
485
+ * export function FieldPreview() {
486
+ * return <Blank value={undefined} text="Empty" />
487
+ * }
265
488
  * ```
266
489
  */
267
490
  declare function Blank(options?: BlankProps): JSX.Element;
268
-
269
- type ExtendFormTypeProps<T = any> = {
270
- children?: UnionFaasItemElement<T>;
271
- };
491
+ //#endregion
492
+ //#region src/FormItem/types.d.ts
493
+ type ExtendFormTypeProps<T = any> = BaseExtendTypeProps<T>;
272
494
  type ExtendTypes = {
273
- [type: string]: ExtendFormTypeProps;
495
+ [type: string]: ExtendFormTypeProps;
274
496
  };
275
497
  type InputTypeMap<T> = {
276
- string: InputProps | SelectProps<T> | RadioProps;
277
- 'string[]': InputProps | SelectProps<T> | RadioProps;
278
- number: InputNumberProps | SelectProps<T> | RadioProps;
279
- 'number[]': InputNumberProps | SelectProps<T> | RadioProps;
280
- boolean: SwitchProps;
281
- date: DatePickerProps;
282
- time: DatePickerProps;
283
- object: never;
284
- 'object[]': never;
498
+ string: InputProps | SelectProps<T> | RadioProps;
499
+ 'string[]': InputProps | SelectProps<T> | RadioProps;
500
+ number: InputNumberProps | SelectProps<T> | RadioProps;
501
+ 'number[]': InputNumberProps | SelectProps<T> | RadioProps;
502
+ boolean: SwitchProps;
503
+ date: DatePickerProps;
504
+ time: DatePickerProps;
505
+ object: never;
506
+ 'object[]': never;
285
507
  };
286
508
  interface FormItemProps<T = any> extends BaseItemProps, Omit<FormItemProps$1<T>, 'id' | 'children' | 'render'> {
287
- type?: FaasItemType;
288
- input?: InputTypeMap<T>[FaasItemType];
289
- maxCount?: number;
290
- object?: FormItemProps[];
291
- disabled?: boolean;
292
- required?: boolean;
293
- col?: number;
294
- children?: UnionFaasItemElement<T> | null;
295
- formChildren?: UnionFaasItemElement<T> | null;
296
- render?: UnionFaasItemRender<T> | null;
297
- formRender?: UnionFaasItemRender<T> | null;
298
- rules?: RuleObject[];
299
- label?: string | false;
300
- extendTypes?: ExtendTypes;
301
- /** trigger when current item's value changed */
302
- onValueChange?: (value: T, values: any, form: FormInstance) => void;
303
- /** trigger when any item's value changed */
304
- if?: (values: Record<string, any>) => boolean;
509
+ type?: FaasItemType;
510
+ input?: InputTypeMap<T>[FaasItemType];
511
+ maxCount?: number;
512
+ object?: FormItemProps[];
513
+ disabled?: boolean;
514
+ required?: boolean;
515
+ col?: number;
516
+ children?: UnionFaasItemElement<T> | null;
517
+ formChildren?: UnionFaasItemElement<T> | null;
518
+ render?: UnionFaasItemRender<T> | null;
519
+ formRender?: UnionFaasItemRender<T> | null;
520
+ rules?: RuleObject[];
521
+ label?: string | false;
522
+ extendTypes?: ExtendTypes;
523
+ onValueChange?: (value: T, values: any, form: FormInstance) => void;
524
+ if?: (values: Record<string, any>) => boolean;
305
525
  }
306
- /**
307
- * Extend custom form item types.
308
- *
309
- * @example
310
- * ```ts
311
- * import type { ExtendFormItemProps, FormProps } from '@faasjs/ant-design'
312
- *
313
- * // define custom type
314
- * interface ExtendTypes extends ExtendFormItemProps {
315
- * type: 'password'
316
- * }
317
- *
318
- * // extend form
319
- * function ExtendForm(props: FormProps<any, ExtendTypes>) {
320
- * return (
321
- * <Form
322
- * {...props}
323
- * extendTypes={{ password: { children: <Input.Password /> } }}
324
- * />
325
- * )
326
- * }
327
- *
328
- * // use custom type
329
- * <ExtendForm
330
- * items={[
331
- * {
332
- * id: 'test',
333
- * type: 'password',
334
- * },
335
- * ]}
336
- * />
337
- * ```
338
- */
339
526
  interface ExtendFormItemProps extends Omit<FormItemProps, 'type'> {
340
- type?: string;
527
+ type?: string;
341
528
  }
529
+ //#endregion
530
+ //#region src/Table/types.d.ts
342
531
  /**
343
- * FormItem
344
- *
345
- * - Based on [Ant Design Form.Item](https://ant.design/components/form#formitem).
346
- * - Can be used without [Form](https://faasjs.com/doc/ant-design/#form).
347
- *
348
- * @example
349
- * ```tsx
350
- * // use inline type
351
- * <FormItem type='string' id='name' />
532
+ * Column definition used by the FaasJS Ant Design {@link Table} component.
352
533
  *
353
- * // use custom type
354
- * <FormItem id='password'>
355
- * <Input.Password />
356
- * </>
357
- * ```
534
+ * @template T - Row record type rendered by the table.
358
535
  */
359
- declare function FormItem<T = any>(props: FormItemProps<T>): react_jsx_runtime.JSX.Element;
360
- declare namespace FormItem {
361
- var useStatus: () => {
362
- status?: antd_es_form_FormItem.ValidateStatus;
363
- errors: React.ReactNode[];
364
- warnings: React.ReactNode[];
365
- };
366
- }
367
-
368
536
  interface TableItemProps<T = any> extends FaasItemProps, Omit<TableColumnProps<T>, 'title' | 'children' | 'render'> {
369
- optionsType?: 'auto';
370
- children?: UnionFaasItemElement<T> | null;
371
- tableChildren?: UnionFaasItemElement<T> | null;
372
- render?: UnionFaasItemRender<T> | null;
373
- tableRender?: UnionFaasItemRender<T> | null;
374
- object?: TableItemProps<T>[];
537
+ /** Use built-in option inference for filters when supported. */
538
+ optionsType?: 'auto';
539
+ /** Generic custom element rendered when no table-specific child overrides it. */
540
+ children?: UnionFaasItemElement<T> | null;
541
+ /** Table-specific custom element. */
542
+ tableChildren?: UnionFaasItemElement<T> | null;
543
+ /** Generic custom render callback. */
544
+ render?: UnionFaasItemRender<T> | null;
545
+ /** Table-specific custom render callback. */
546
+ tableRender?: UnionFaasItemRender<T> | null;
547
+ /** Nested item definitions used by `object` and `object[]` item types. */
548
+ object?: TableItemProps<T>[];
375
549
  }
376
- type ExtendTableTypeProps<T = any> = {
377
- children?: UnionFaasItemElement<T>;
378
- render?: UnionFaasItemRender<T>;
379
- };
550
+ type ExtendTableTypeProps<T = any> = BaseExtendTypeProps<T>;
551
+ /**
552
+ * Shared fields for extending table item unions.
553
+ *
554
+ * @template T - Row record type rendered by the table.
555
+ */
380
556
  type ExtendTableItemProps<T = any> = BaseItemProps & Omit<TableColumnProps<T>, 'children'>;
557
+ /**
558
+ * Props for the FaasJS Ant Design {@link Table} component.
559
+ *
560
+ * @template T - Row record type rendered by the table.
561
+ * @template ExtendTypes - Additional item prop shape accepted by `items`.
562
+ */
381
563
  type TableProps<T = any, ExtendTypes = any> = {
382
- items: (TableItemProps | (ExtendTypes & ExtendTableItemProps))[];
383
- extendTypes?: {
384
- [key: string]: ExtendTableTypeProps;
385
- };
386
- faasData?: FaasDataWrapperProps<T>;
387
- onChange?: (pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<T> | SorterResult<T>[], extra: TableCurrentDataSource<T>) => {
388
- pagination: TablePaginationConfig;
389
- filters: Record<string, FilterValue | null>;
390
- sorter: SorterResult<T> | SorterResult<T>[];
391
- extra: TableCurrentDataSource<T>;
392
- };
564
+ /** Column definitions rendered by the table. */items: (TableItemProps | (ExtendTypes & ExtendTableItemProps))[]; /** Custom type renderers keyed by item type. */
565
+ extendTypes?: {
566
+ [key: string]: ExtendTableTypeProps;
567
+ }; /** Request config used to fetch table data before rendering. */
568
+ faasData?: FaasDataWrapperProps<any>; /** Change handler that can return rewritten pagination, filter, and sorter state. */
569
+ onChange?: (pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<T> | SorterResult<T>[], extra: TableCurrentDataSource<T>) => {
570
+ pagination: TablePaginationConfig;
571
+ filters: Record<string, FilterValue | null>;
572
+ sorter: SorterResult<T> | SorterResult<T>[];
573
+ extra: TableCurrentDataSource<T>;
574
+ };
393
575
  } & TableProps$1<T>;
576
+ /**
577
+ * Query params shape expected by table-backed FaasJS endpoints.
578
+ */
394
579
  type TableFaasDataParams = {
395
- filters?: Record<string, any[]>;
396
- pagination?: {
397
- current?: number;
398
- pageSize?: number;
399
- };
400
- sorter?: {
401
- field: string;
402
- order: 'ascend' | 'descend';
403
- } | {
404
- field: string;
405
- order?: 'ascend' | 'descend';
406
- }[];
407
- };
408
- type TableFaasDataResponse<T = any> = {
409
- rows: T[];
410
- pagination: {
411
- current: number;
412
- pageSize: number;
413
- total: number;
414
- };
580
+ /** Active filter values keyed by column field. */filters?: Record<string, any[]>; /** Pagination state sent to the endpoint. */
581
+ pagination?: {
582
+ /** Current page number. */current?: number; /** Requested page size. */
583
+ pageSize?: number;
584
+ }; /** Sorter state sent to the endpoint. */
585
+ sorter?: {
586
+ /** Column field being sorted. */field: string; /** Sort direction. */
587
+ order: 'ascend' | 'descend';
588
+ } | {
589
+ /** Column field being sorted. */field: string; /** Sort direction when active. */
590
+ order?: 'ascend' | 'descend';
591
+ }[];
415
592
  };
416
593
  /**
417
- * Table component with Ant Design & FaasJS
594
+ * Paginated response shape expected by {@link Table} when using `faasData`.
418
595
  *
419
- * - Based on [Ant Design Table](https://ant.design/components/table/).
420
- * - Support FaasJS injection.
421
- * - Auto generate filter dropdown (disable with `filterDropdown: false`).
422
- * - Auto generate sorter (disable with `sorter: false`).
596
+ * @template T - Row record type contained in `rows`.
423
597
  */
424
- declare function Table<T extends Record<string, any>, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): react_jsx_runtime.JSX.Element;
425
-
598
+ type TableFaasDataResponse<T = any> = {
599
+ /** Rows rendered by the table. */rows: T[]; /** Pagination state returned by the endpoint. */
600
+ pagination: {
601
+ /** Current page number. */current: number; /** Page size used for the result set. */
602
+ pageSize: number; /** Total number of available rows. */
603
+ total: number;
604
+ };
605
+ };
606
+ //#endregion
607
+ //#region src/data/types.d.ts
426
608
  type FaasItemType = 'string' | 'string[]' | 'number' | 'number[]' | 'boolean' | 'date' | 'time' | 'object' | 'object[]';
427
- /** FaasItemType's value type */
428
609
  type FaasItemTypeValue = {
429
- string: string;
430
- 'string[]': string[];
431
- number: number;
432
- 'number[]': number[];
433
- boolean: boolean;
434
- date: Dayjs;
435
- time: Dayjs;
436
- object: any;
437
- 'object[]': any[];
610
+ string: string;
611
+ 'string[]': string[];
612
+ number: number;
613
+ 'number[]': number[];
614
+ boolean: boolean;
615
+ date: Dayjs;
616
+ time: Dayjs;
617
+ object: any;
618
+ 'object[]': any[];
438
619
  };
439
620
  type BaseOption = string | number | {
440
- label: string;
441
- value?: any;
621
+ label: string;
622
+ value?: any;
442
623
  };
443
624
  interface BaseItemProps {
444
- id: string | number;
445
- title?: string;
446
- options?: BaseOption[];
625
+ id: string | number;
626
+ title?: string;
627
+ options?: BaseOption[];
447
628
  }
448
629
  interface FaasItemProps extends BaseItemProps {
449
- /**
450
- * Support string, string[], number, number[], boolean, date, time, object, object[]
451
- * @default 'string'
452
- */
453
- type?: FaasItemType;
630
+ type?: FaasItemType;
454
631
  }
632
+ type UnionScene = 'form' | 'description' | 'table';
633
+ type UnionFaasItemInjection<Value = any, Values = any> = {
634
+ scene?: UnionScene;
635
+ value?: Value;
636
+ values?: Values;
637
+ index?: number;
638
+ };
639
+ type UnionFaasItemRender<Value = any, Values = any> = (value: Value, values: Values, index: number, scene: UnionScene) => React.ReactNode;
640
+ type UnionFaasItemElement<Value = any, Values = any> = ReactElement<UnionFaasItemInjection<Value, Values>> | FC<UnionFaasItemInjection<Value, Values>>;
641
+ interface UnionFaasItemProps<Value = any, Values = any> extends FormItemProps, DescriptionItemProps, TableItemProps {
642
+ children?: UnionFaasItemElement<Value, Values> | null;
643
+ render?: UnionFaasItemRender<Value, Values> | null;
644
+ object?: UnionFaasItemProps<Value, Values>[];
645
+ }
646
+ type BaseExtendTypeProps<T = any> = {
647
+ children?: UnionFaasItemElement<T>;
648
+ render?: UnionFaasItemRender<T>;
649
+ };
650
+ //#endregion
651
+ //#region src/Description/types.d.ts
652
+ type ExtendDescriptionTypeProps<T = any> = BaseExtendTypeProps<T>;
653
+ type ExtendDescriptionItemProps = BaseItemProps;
654
+ interface DescriptionItemProps<T = any> extends FaasItemProps {
655
+ children?: UnionFaasItemElement<T> | null;
656
+ descriptionChildren?: UnionFaasItemElement<T> | null;
657
+ render?: UnionFaasItemRender<T> | null;
658
+ descriptionRender?: UnionFaasItemRender<T> | null;
659
+ if?: (values: Record<string, any>) => boolean;
660
+ object?: DescriptionItemProps<T>[];
661
+ }
662
+ interface DescriptionCommonProps<T = any, ExtendItemProps = any> extends Omit<DescriptionsProps, 'items'> {
663
+ renderTitle?(this: void, values: T): ReactNode;
664
+ items: (DescriptionItemProps | ExtendItemProps)[];
665
+ extendTypes?: {
666
+ [key: string]: ExtendDescriptionTypeProps;
667
+ };
668
+ }
669
+ interface DescriptionWithoutFaasProps<T = any, ExtendItemProps = any> extends DescriptionCommonProps<T, ExtendItemProps> {
670
+ dataSource?: T;
671
+ faasData?: never;
672
+ }
673
+ interface DescriptionWithFaasProps<Path extends FaasActionPaths = any, T = any, ExtendItemProps = any> extends DescriptionCommonProps<T, ExtendItemProps> {
674
+ dataSource?: never;
675
+ faasData?: FaasDataWrapperProps<Path>;
676
+ }
677
+ type DescriptionProps<T = any, ExtendItemProps = any> = DescriptionWithoutFaasProps<T, ExtendItemProps> | DescriptionWithFaasProps<any, T, ExtendItemProps>;
678
+ interface DescriptionItemContentProps<T = any> {
679
+ item: DescriptionItemProps;
680
+ value: T;
681
+ values?: any;
682
+ extendTypes?: {
683
+ [key: string]: ExtendDescriptionTypeProps;
684
+ };
685
+ }
686
+ //#endregion
687
+ //#region src/Description/index.d.ts
455
688
  /**
456
- * Converts an identifier string to a title case string.
689
+ * Render an Ant Design description list from a local data source.
457
690
  *
458
- * This function takes an identifier string with words separated by underscores,
459
- * capitalizes the first letter of each word, and joins them together without spaces.
691
+ * The component applies FaasJS item type normalization helpers to render item metadata with
692
+ * appropriate display formatting.
460
693
  *
461
- * @param id - The identifier string to convert.
462
- * @returns The converted title case string.
694
+ * @template T - Data record shape rendered by the component.
695
+ * @param {DescriptionWithoutFaasProps<T>} props - Description props including items and a local data source.
463
696
  *
464
697
  * @example
465
- * ```typescript
466
- * idToTitle('example_id'); // returns 'ExampleId'
698
+ * ```tsx
699
+ * import { Description } from '@faasjs/ant-design'
700
+ *
701
+ * export function Detail() {
702
+ * return (
703
+ * <Description
704
+ * title="Title"
705
+ * items={[
706
+ * { id: 'id', title: 'Title', type: 'string' },
707
+ * ]}
708
+ * dataSource={{ id: 'value' }}
709
+ * />
710
+ * )
711
+ * }
467
712
  * ```
468
713
  */
469
- declare function idToTitle(id: string | number): string;
470
- /**
471
- * convert string[] or number[] to { label, value }[]
472
- */
473
- declare function transferOptions(options: BaseOption[]): {
474
- label: string;
475
- value?: string | number;
476
- }[];
477
- declare function transferValue(type: FaasItemType, value: any): any;
478
- type UnionScene = 'form' | 'description' | 'table';
479
- type UnionFaasItemInjection<Value = any, Values = any> = {
480
- scene?: UnionScene;
481
- value?: Value;
482
- values?: Values;
483
- index?: number;
484
- };
714
+ declare function Description<T extends Record<string, any> = any>(props: DescriptionWithoutFaasProps<T>): JSX.Element;
485
715
  /**
486
- * A type representing a function that renders a React node for a given item in a list.
716
+ * Render an Ant Design description list with fetched FaasJS data.
717
+ *
718
+ * The component fetches data via `faasData` and applies FaasJS item type normalization helpers
719
+ * to render item metadata with appropriate display formatting.
720
+ *
721
+ * When `Path` is provided, the `action` and `params` in `faasData` are strongly typed from the
722
+ * {@link FaasActions} type augmentation.
487
723
  *
488
- * @param value - The value of the current item.
489
- * @param values - The entire list of values.
490
- * @param index - The index of the current item in the list.
491
- * @param scene {@link UnionScene} - The scene in which the rendering is taking place.
724
+ * @template Path - Action path type inferred from `faasData.action` for strong typing.
725
+ * @template T - Data record shape rendered by the component.
726
+ * @param {DescriptionWithFaasProps<Path, T>} props - Description props including items and FaasJS data config.
492
727
  *
493
728
  * @example
494
729
  * ```tsx
495
- * import { type UnionFaasItemRender, Form, Description, Table } from '@faasjs/ant-design'
496
- *
497
- * const nameReader: UnionFaasItemRender = (value, values, index, scene) => {
498
- * switch (scene) {
499
- * case 'form':
500
- * return <input />
501
- * case 'description':
502
- * case 'table':
503
- * return <span>{value}</span>
504
- * default:
505
- * return null
506
- * }
507
- * }
508
- *
509
- * const items = [
510
- * {
511
- * id: 'name',
512
- * render: nameReader,
513
- * }
514
- * ]
730
+ * import { Description } from '@faasjs/ant-design'
515
731
  *
516
- * function App() {
517
- * return <>
518
- * <Form items={items} /> // Will render an input
519
- * <Description items={items} dataSource={{ name: 'John' }} /> // Will render a span
520
- * <Table items={items} dataSource={[{ name: 'John' }]} /> // Will render a span
521
- * </>
732
+ * export function Detail() {
733
+ * return (
734
+ * <Description
735
+ * title="Title"
736
+ * items={[
737
+ * { id: 'id', title: 'Title', type: 'string' },
738
+ * ]}
739
+ * faasData={{
740
+ * action: 'user/get',
741
+ * params: { id: 1 },
742
+ * }}
743
+ * />
744
+ * )
522
745
  * }
523
746
  * ```
524
747
  */
525
- type UnionFaasItemRender<Value = any, Values = any> = (value: Value, values: Values, index: number, scene: UnionScene) => React.ReactNode;
748
+ declare function Description<Path extends FaasActionPaths, T extends Record<string, any> = any>(props: DescriptionWithFaasProps<Path, T>): JSX.Element;
526
749
  /**
527
- * Represents a React element that is used in the UnionFaasItem context.
750
+ * Render an Ant Design description list (catch-all overload for backward compatibility).
751
+ */
752
+ declare function Description<T extends Record<string, any> = any>(props: DescriptionProps<T>): JSX.Element;
753
+ declare namespace Description {
754
+ var displayName: string;
755
+ }
756
+ //#endregion
757
+ //#region src/Drawer/index.d.ts
758
+ /**
759
+ * Props accepted by the hook-managed drawer wrapper.
760
+ */
761
+ interface DrawerProps extends DrawerProps$1 {
762
+ /** Drawer body content managed by {@link useDrawer}. */
763
+ children?: JSX.Element | JSX.Element[];
764
+ }
765
+ /**
766
+ * State setter used to update hook-managed drawer props.
767
+ */
768
+ type setDrawerProps = Dispatch<SetStateAction<DrawerProps>>;
769
+ /**
770
+ * Create a hook-managed Ant Design drawer instance.
771
+ *
772
+ * The returned setter merges partial updates into the current drawer props instead of replacing the
773
+ * entire state object.
528
774
  *
529
- * This type can either be a React element with the specified injection types or `null`.
775
+ * @param {DrawerProps} [init] - Initial drawer props.
776
+ * @returns Hook-managed drawer element, current props, and a state-merging setter.
530
777
  *
531
778
  * @example
532
779
  * ```tsx
533
- * import { type UnionFaasItemElement, Form, Description, Table } from '@faasjs/ant-design'
534
- *
535
- * const NameComponent: UnionFaasItemElement = ({ scene, value }) => {
536
- * switch (scene) {
537
- * switch (scene) {
538
- * case 'form':
539
- * return <input />
540
- * case 'description':
541
- * case 'table':
542
- * return <span>{value}</span>
543
- * default:
544
- * return null
545
- * }
546
- * }
780
+ * import { useDrawer } from '@faasjs/ant-design'
781
+ * import { Button } from 'antd'
547
782
  *
548
- * const items = [
549
- * {
550
- * id: 'name',
551
- * children: NameComponent // both `NameComponent` and `<NameComponent />` is valid
552
- * }
553
- * ]
783
+ * function Example() {
784
+ * const { drawer, setDrawerProps } = useDrawer()
554
785
  *
555
- * function App() {
556
- * return <>
557
- * <Form items={items} /> // Will render an input
558
- * <Description items={items} dataSource={{ name: 'John' }} /> // Will render a span
559
- * <Table items={items} dataSource={[{ name: 'John' }]} /> // Will render a span
560
- * </>
786
+ * return (
787
+ * <>
788
+ * <Button onClick={() => setDrawerProps({ open: true, title: 'Details', children: <div>Content</div> })}>
789
+ * Open
790
+ * </Button>
791
+ * {drawer}
792
+ * </>
793
+ * )
561
794
  * }
562
795
  * ```
563
796
  */
564
- type UnionFaasItemElement<Value = any, Values = any> = ReactElement<UnionFaasItemInjection<Value, Values>> | FC<UnionFaasItemInjection<Value, Values>>;
797
+ declare function useDrawer(init?: DrawerProps): {
798
+ drawer: _$react_jsx_runtime0.JSX.Element;
799
+ drawerProps: DrawerProps;
800
+ setDrawerProps: setDrawerProps;
801
+ };
802
+ //#endregion
803
+ //#region src/data/render.d.ts
804
+ declare function renderDisplayValue(type: FaasItemType, value: any, options?: {
805
+ label: string;
806
+ value?: string | number;
807
+ }[]): JSX.Element | string | number | boolean | null;
808
+ //#endregion
809
+ //#region src/data/utils.d.ts
810
+ declare function idToTitle(id: string | number): string;
811
+ declare function transferOptions(options: BaseOption[]): {
812
+ label: string;
813
+ value?: string | number;
814
+ }[];
815
+ declare function transferValue(type: FaasItemType | null | undefined, value: any): any;
816
+ declare function cloneUnionFaasItemElement(element: UnionFaasItemElement, props: any): _$react.ReactElement<UnionFaasItemInjection<any, any>, string | _$react.JSXElementConstructor<any>>;
817
+ //#endregion
818
+ //#region src/FormItem/index.d.ts
565
819
  /**
566
- * Interface representing the properties of a UnionFaas item.
567
- *
568
- * The UnionFaas item can be used in a form, description, or table.
569
- *
570
- * ### Render Priority Order
571
- *
572
- * 1. **Null Rendering** (Notice: it also doesn't render column in table and description)
573
- * 1. Returns `null` if specific children or render props are null:
574
- * - `formChildren` / `descriptionChildren` / `tableChildren` / `formRender` / `descriptionRender` / `tableRender`
575
- * 2. Returns `null` if `children` or `render` prop is null
576
- * 2. **Children Rendering**
577
- * 1. First priority: Component-specific children
578
- * - `formChildren` for Form
579
- * - `descriptionChildren` for Description
580
- * - `tableChildren` for Table
581
- * 2. Second priority: Generic `children` prop
582
- * 3. **Custom Render Functions**
583
- * 1. First priority: Component-specific render functions
584
- * - `formRender` for Form
585
- * - `descriptionRender` for Description
586
- * - `tableRender` for Table
587
- * 2. Second priority: Generic `render` prop
588
- * 4. **Extended Types**
589
- * - Renders based on registered extended type handlers
590
- * 5. **Default Rendering**
591
- * - Renders primitive types (string, number, etc.)
592
- * - Uses default formatting based on data type
820
+ * Render a FaasJS-aware Ant Design form field or nested field group.
821
+ *
822
+ * The component derives default labels from `id`, applies required validation messages from the
823
+ * active theme, supports surface-specific union renderers, and can render nested `object` or
824
+ * `object[]` field structures.
825
+ *
826
+ * @template T - Value type rendered or edited by the form item.
827
+ * @param {FormItemProps<T>} props - Form item props including field metadata, rules, and custom renderers.
593
828
  *
594
829
  * @example
595
830
  * ```tsx
596
- * import { type UnionFaasItemProps, Form, Table, Description } from '@faasjs/ant-design'
597
- *
598
- * const item: UnionFaasItemProps[] = [
599
- * {
600
- * id: 'id',
601
- * formChildren: null, // Don't show in form, only in description and table
602
- * },
603
- * {
604
- * id: 'name',
605
- * required: true, // Required in form
606
- * },
607
- * {
608
- * id: 'age',
609
- * type: 'number', // Number type in form, description and table
610
- * options: ['< 18', '>= 18'], // Options in form and table
611
- * }
612
- * ]
831
+ * import { FormItem } from '@faasjs/ant-design'
832
+ * import { Input } from 'antd'
613
833
  *
614
- * const data = {
615
- * id: '1',
616
- * name: 'John',
617
- * age: '>= 18',
834
+ * export function AccountFields() {
835
+ * return (
836
+ * <>
837
+ * <FormItem id="name" type="string" />
838
+ * <FormItem id="password">
839
+ * <Input.Password />
840
+ * </FormItem>
841
+ * </>
842
+ * )
618
843
  * }
844
+ * ```
845
+ */
846
+ declare function FormItem<T = any>(props: FormItemProps<T>): _$react_jsx_runtime0.JSX.Element | null;
847
+ declare namespace FormItem {
848
+ var useStatus: () => {
849
+ status?: _$antd_es_form_FormItem0.ValidateStatus;
850
+ errors: React.ReactNode[];
851
+ warnings: React.ReactNode[];
852
+ };
853
+ }
854
+ //#endregion
855
+ //#region src/Form/types.d.ts
856
+ type FormSubmitProps = {
857
+ text?: string;
858
+ buttonProps?: ButtonProps;
859
+ };
860
+ type FormFaasProps<Values extends Record<string, any> = any, Path extends FaasActionPaths = any> = {
861
+ action: Path;
862
+ params?: FaasParams<Path> | ((values: Record<string, any>) => FaasParams<Path>);
863
+ transformValues?: (values: Values) => Record<string, any> | Promise<Record<string, any>>;
864
+ onSuccess?: (result: any, values: Record<string, any>) => void;
865
+ onError?: (error: any, values: Record<string, any>) => void;
866
+ onFinally?: () => void;
867
+ };
868
+ type FormCommonProps<Values extends Record<string, any>, ExtendItemProps extends ExtendFormItemProps = ExtendFormItemProps> = Omit<FormProps$1<Values>, 'onFinish' | 'children' | 'initialValues'> & {
869
+ items?: ((ExtendItemProps extends ExtendFormItemProps ? ExtendItemProps | FormItemProps : FormItemProps) | JSX.Element)[];
870
+ submit?: false | FormSubmitProps;
871
+ beforeItems?: JSX.Element | JSX.Element[];
872
+ footer?: JSX.Element | JSX.Element[];
873
+ extendTypes?: ExtendTypes;
874
+ children?: ReactNode;
875
+ initialValues?: Partial<Values>;
876
+ };
877
+ type FormWithoutFaasProps<Values extends Record<string, any> = any, ExtendItemProps extends ExtendFormItemProps = ExtendFormItemProps> = FormCommonProps<Values, ExtendItemProps> & {
878
+ faas?: never;
879
+ onFinish?: (values: Values) => void | Promise<void>;
880
+ };
881
+ type FormWithFaasProps<Path extends FaasActionPaths = any, Values extends Record<string, any> = any, ExtendItemProps extends ExtendFormItemProps = ExtendFormItemProps> = FormCommonProps<Values, ExtendItemProps> & {
882
+ faas?: FormFaasProps<Values, Path>;
883
+ onFinish?: never;
884
+ };
885
+ type FormProps<Values extends Record<string, any> = any, Path extends FaasActionPaths = any, ExtendItemProps extends ExtendFormItemProps = ExtendFormItemProps> = FormWithoutFaasProps<Values, ExtendItemProps> | FormWithFaasProps<Path, Values, ExtendItemProps>;
886
+ //#endregion
887
+ //#region src/Form/index.d.ts
888
+ /**
889
+ * Render a data-aware Ant Design form without the built-in FaasJS submit handler.
890
+ *
891
+ * The component normalizes `initialValues` with {@link transferValue}, renders item definitions
892
+ * through {@link FormItem}, and delegates submission to the custom `onFinish` handler.
893
+ *
894
+ * @template Values - Form values shape.
895
+ * @param {FormWithoutFaasProps<Values>} props - Form props including items, submit behavior, and a custom `onFinish` handler.
619
896
  *
620
- * function App() {
621
- * return <>
622
- * <Form items={item} /> // Use in form
623
- * <Description items={item} dataSource={data} /> // Use in description
624
- * <Table items={item} dataSource={[ data ]} /> // Use in table
625
- * </>
897
+ * @example
898
+ * ```tsx
899
+ * import { Form } from '@faasjs/ant-design'
900
+ *
901
+ * export function ProfileForm() {
902
+ * return (
903
+ * <Form
904
+ * items={[
905
+ * { id: 'name', required: true },
906
+ * { id: 'email', required: true },
907
+ * ]}
908
+ * onFinish={async (values) => {
909
+ * console.log(values)
910
+ * }}
911
+ * />
912
+ * )
626
913
  * }
627
914
  * ```
628
915
  */
629
- interface UnionFaasItemProps<Value = any, Values = any> extends FormItemProps, DescriptionItemProps, TableItemProps {
630
- children?: UnionFaasItemElement<Value, Values> | null;
631
- render?: UnionFaasItemRender<Value, Values> | null;
632
- object?: UnionFaasItemProps<Value, Values>[];
633
- }
916
+ declare function Form<Values extends Record<string, any> = any>(props: FormWithoutFaasProps<Values>): JSX.Element;
634
917
  /**
635
- * Clone a UnionFaasItemElement with the given props.
918
+ * Render a data-aware Ant Design form with the built-in FaasJS submit handler.
919
+ *
920
+ * The component normalizes `initialValues` with {@link transferValue}, renders item definitions
921
+ * through {@link FormItem}, and submits via the built-in FaasJS request flow configured by `faas`.
636
922
  *
637
- * This function takes a UnionFaasItemElement and props, and returns a cloned element.
638
- * If the provided element is a valid React element, it clones it with the new props.
639
- * Otherwise, it creates a new element from the provided element and props.
923
+ * When `Path` is provided, the `action` and `params` in `faas` are strongly typed from the
924
+ * {@link FaasActions} type augmentation.
640
925
  *
641
- * @param element - The UnionFaasItemElement to be cloned.
642
- * @param props - The props to be applied to the cloned element.
643
- * @returns The cloned element with the applied props.
926
+ * @template Path - Action path type inferred from `faas.action` for strong typing.
927
+ * @template Values - Form values shape.
928
+ * @param {FormWithFaasProps<Path, Values>} props - Form props including items, submit behavior, and FaasJS integration.
929
+ *
930
+ * @example
931
+ * ```tsx
932
+ * import { Form } from '@faasjs/ant-design'
933
+ *
934
+ * export function CreateUserForm() {
935
+ * return (
936
+ * <Form
937
+ * initialValues={{ role: 'user' }}
938
+ * items={[
939
+ * { id: 'name', required: true },
940
+ * { id: 'role', options: ['user', 'admin'] },
941
+ * ]}
942
+ * faas={{
943
+ * action: 'user/create',
944
+ * params: (values) => ({
945
+ * role: values.role || 'user',
946
+ * }),
947
+ * }}
948
+ * />
949
+ * )
950
+ * }
951
+ * ```
644
952
  */
645
- declare function cloneUnionFaasItemElement(element: UnionFaasItemElement, props: any): ReactElement<UnionFaasItemInjection<any, any>, string | react.JSXElementConstructor<any>>;
646
-
647
- interface ExtendDescriptionTypeProps<T = any> {
648
- children?: UnionFaasItemElement<T>;
649
- render?: UnionFaasItemRender<T>;
650
- }
651
- type ExtendDescriptionItemProps = BaseItemProps;
652
- interface DescriptionItemProps<T = any> extends FaasItemProps {
653
- children?: UnionFaasItemElement<T> | null;
654
- descriptionChildren?: UnionFaasItemElement<T> | null;
655
- render?: UnionFaasItemRender<T> | null;
656
- descriptionRender?: UnionFaasItemRender<T> | null;
657
- if?: (values: Record<string, any>) => boolean;
658
- object?: DescriptionItemProps<T>[];
659
- }
660
- interface DescriptionProps<T = any, ExtendItemProps = any> extends Omit<DescriptionsProps, 'items'> {
661
- renderTitle?(values: T): ReactNode;
662
- items: (DescriptionItemProps | ExtendItemProps)[];
663
- extendTypes?: {
664
- [key: string]: ExtendDescriptionTypeProps;
665
- };
666
- dataSource?: T;
667
- faasData?: FaasDataWrapperProps<T>;
953
+ declare function Form<Path extends FaasActionPaths, Values extends Record<string, any> = any>(props: FormWithFaasProps<Path, Values>): JSX.Element;
954
+ /**
955
+ * Render a data-aware Ant Design form (catch-all overload for backward compatibility).
956
+ */
957
+ declare function Form<Values extends Record<string, any> = any, Path extends FaasActionPaths = any>(props: FormProps<Values, Path>): JSX.Element;
958
+ declare namespace Form {
959
+ var useForm: typeof _$antd_es_form_Form0.useForm;
960
+ var useFormInstance: typeof _$antd_es_form_hooks_useFormInstance0.default;
961
+ var useWatch: typeof _$_rc_component_form0.useWatch;
962
+ var Item: typeof FormItem;
963
+ var List: _$react.FC<_$antd_es_form0.FormListProps>;
964
+ var ErrorList: _$react.FC<_$antd_es_form0.ErrorListProps>;
965
+ var Provider: _$react.FC<_$antd_es_form_context0.FormProviderProps>;
668
966
  }
669
- interface DescriptionItemContentProps<T = any> {
670
- item: DescriptionItemProps;
671
- value: T;
672
- values?: any;
673
- extendTypes?: {
674
- [key: string]: ExtendDescriptionTypeProps;
675
- };
967
+ //#endregion
968
+ //#region src/Link/index.d.ts
969
+ /**
970
+ * Props for the navigation-aware {@link Link} component.
971
+ */
972
+ interface LinkProps {
973
+ /** Target URL or route path. */
974
+ href: string;
975
+ /** Explicit link target. Absolute HTTP URLs default to `_blank`. */
976
+ target?: '_blank';
977
+ /** Text rendered when `children` is not provided. */
978
+ text?: string | number;
979
+ /** Custom link content rendered instead of `text`. */
980
+ children?: ReactNode;
981
+ /** Inline styles merged with the theme defaults. */
982
+ style?: CSSProperties;
983
+ /** Button mode config, or `true` to render with default Ant Design button props. */
984
+ button?: ButtonProps | boolean;
985
+ /** Whether the rendered link or button should take the full width. */
986
+ block?: boolean;
987
+ /** Whether plain-text links should enable the Typography copy action. */
988
+ copyable?: boolean;
989
+ /** Custom click handler that overrides the built-in navigation behavior. */
990
+ onClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
676
991
  }
677
992
  /**
678
- * Description component
993
+ * Render a navigation-aware link or button.
679
994
  *
680
- * - Based on [Ant Design Descriptions](https://ant.design/components/descriptions/).
995
+ * Internal links are pushed through React Router, while links with `_blank` targets are opened
996
+ * with `window.open`.
997
+ *
998
+ * @param {LinkProps} props - Link props controlling navigation target, rendering mode, and button behavior.
681
999
  *
682
1000
  * @example
683
1001
  * ```tsx
684
- * import { Description } from '@faasjs/ant-design'
1002
+ * import { Link } from '@faasjs/ant-design'
685
1003
  *
686
- * <Description
687
- * title="Title"
688
- * items={[
689
- * {
690
- * id: 'id',
691
- * title: 'Title',
692
- * type: 'string',
693
- * },
694
- * ]}
695
- * dataSource={{ id: 'value' }}
696
- * />
1004
+ * export function Navigation() {
1005
+ * return (
1006
+ * <>
1007
+ * <Link href="/">Home</Link>
1008
+ * <Link href="/users/new" button={{ type: 'primary' }}>
1009
+ * Create User
1010
+ * </Link>
1011
+ * </>
1012
+ * )
1013
+ * }
697
1014
  * ```
698
1015
  */
699
- declare function Description<T extends Record<string, any> = any>({ faasData, dataSource, renderTitle, extendTypes, ...props }: DescriptionProps<T>): react_jsx_runtime.JSX.Element;
700
- declare namespace Description {
701
- var displayName: string;
702
- }
703
-
704
- type FormSubmitProps = {
705
- /** Default: Submit */
706
- text?: string;
707
- /**
708
- * Submit to FaasJS server.
709
- *
710
- * If use onFinish, you should call submit manually.
711
- * ```ts
712
- * {
713
- * submit: {
714
- * to: {
715
- * action: 'action_name'
716
- * }
717
- * },
718
- * onFinish: (values, submit) => {
719
- * // do something before submit
720
- *
721
- * // submit
722
- * await submit({
723
- * ...values,
724
- * extraProps: 'some extra props'
725
- * })
726
- *
727
- * // do something after submit
728
- * }
729
- * }
730
- * ```
731
- */
732
- to?: {
733
- action: FaasAction | string;
734
- /** params will overwrite form values before submit */
735
- params?: Record<string, any>;
736
- then?: (result: any) => void;
737
- catch?: (error: any) => void;
738
- finally?: () => void;
739
- };
740
- };
741
- interface FormProps<Values extends Record<string, any> = any, ExtendItemProps extends ExtendFormItemProps = ExtendFormItemProps> extends Omit<FormProps$1<Values>, 'onFinish' | 'children' | 'initialValues'> {
742
- items?: ((ExtendItemProps extends ExtendFormItemProps ? ExtendItemProps | FormItemProps : FormItemProps) | JSX.Element)[];
743
- /** Default: { text: 'Submit' }, set false to disable it */
744
- submit?: false | FormSubmitProps;
745
- onFinish?: (values: Values, submit?: (values: any) => Promise<any>) => Promise<any>;
746
- beforeItems?: JSX.Element | JSX.Element[];
747
- footer?: JSX.Element | JSX.Element[];
748
- extendTypes?: ExtendTypes;
749
- children?: ReactNode;
750
- initialValues?: Partial<Values>;
1016
+ declare function Link(props: LinkProps): _$react_jsx_runtime0.JSX.Element;
1017
+ //#endregion
1018
+ //#region src/Modal/index.d.ts
1019
+ /**
1020
+ * Props accepted by the hook-managed modal wrapper.
1021
+ */
1022
+ interface ModalProps extends ModalProps$1 {
1023
+ /** Modal body content managed by {@link useModal}. */
1024
+ children?: JSX.Element | JSX.Element[] | string;
751
1025
  }
752
1026
  /**
753
- * Form component with Ant Design & FaasJS
1027
+ * State setter used to update hook-managed modal props.
1028
+ */
1029
+ type setModalProps = Dispatch<SetStateAction<ModalProps>>;
1030
+ /**
1031
+ * Create a hook-managed Ant Design modal instance.
1032
+ *
1033
+ * The returned setter merges partial updates into the current modal props instead of replacing the
1034
+ * entire state object.
754
1035
  *
755
- * - Based on [Ant Design Form](https://ant.design/components/form/).
1036
+ * @param {ModalProps} [init] - Initial modal props.
1037
+ * @returns Hook-managed modal element, current props, and a state-merging setter.
1038
+ *
1039
+ * @example
1040
+ * ```tsx
1041
+ * import { useModal } from '@faasjs/ant-design'
1042
+ * import { Button } from 'antd'
1043
+ *
1044
+ * function Example() {
1045
+ * const { modal, setModalProps } = useModal()
1046
+ *
1047
+ * return (
1048
+ * <>
1049
+ * <Button onClick={() => setModalProps({ open: true, title: 'Delete', children: 'Are you sure?' })}>
1050
+ * Open Modal
1051
+ * </Button>
1052
+ * {modal}
1053
+ * </>
1054
+ * )
1055
+ * }
1056
+ * ```
756
1057
  */
757
- declare function Form<Values = any>(props: FormProps<Values>): react_jsx_runtime.JSX.Element;
758
- declare namespace Form {
759
- var useForm: typeof antd_es_form_Form.useForm;
760
- var useFormInstance: typeof antd_es_form_hooks_useFormInstance.default;
761
- var useWatch: typeof _rc_component_form.useWatch;
762
- var Item: typeof FormItem;
763
- var List: react.FC<antd_es_form.FormListProps>;
764
- var ErrorList: react.FC<antd_es_form.ErrorListProps>;
765
- var Provider: react.FC<antd_es_form_context.FormProviderProps>;
766
- }
767
-
768
- interface LinkProps {
769
- href: string;
770
- target?: '_blank';
771
- text?: string | number;
772
- children?: ReactNode;
773
- style?: CSSProperties;
774
- button?: ButtonProps | boolean;
775
- block?: boolean;
776
- /** only use for text without button */
777
- copyable?: boolean;
778
- onClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
779
- }
1058
+ declare function useModal(init?: ModalProps): {
1059
+ modal: _$react_jsx_runtime0.JSX.Element;
1060
+ modalProps: ModalProps;
1061
+ setModalProps: setModalProps;
1062
+ };
1063
+ //#endregion
1064
+ //#region src/Routers/index.d.ts
780
1065
  /**
781
- * Link component with button
1066
+ * Default 404 route element that uses the configured localized title.
782
1067
  *
783
1068
  * @example
784
1069
  * ```tsx
785
- * // pure link
786
- * <Link href="/">Home</Link>
1070
+ * import { PageNotFound, Routes } from '@faasjs/ant-design'
787
1071
  *
788
- * // link with button
789
- * <Link href="/" button={{ type:'primary' }}>Home</Link>
1072
+ * export function AppRoutes() {
1073
+ * return (
1074
+ * <Routes
1075
+ * routes={[{ path: '/', element: <div>Home</div> }]}
1076
+ * notFound={<PageNotFound />}
1077
+ * />
1078
+ * )
1079
+ * }
790
1080
  * ```
791
1081
  */
792
- declare function Link(props: LinkProps): react_jsx_runtime.JSX.Element;
793
-
794
- declare function PageNotFound(): react_jsx_runtime.JSX.Element;
1082
+ declare function PageNotFound(): _$react_jsx_runtime0.JSX.Element;
1083
+ /**
1084
+ * Props for the lazy-loading {@link Routes} wrapper.
1085
+ */
795
1086
  interface RoutesProps {
796
- routes: (RouteProps & {
797
- page?: LazyExoticComponent<ComponentType<any>>;
798
- })[];
799
- fallback?: JSX.Element;
800
- notFound?: JSX.Element;
1087
+ /** Route records forwarded to React Router, with optional lazy `page` components. */
1088
+ routes: (RouteProps & {
1089
+ page?: LazyExoticComponent<ComponentType<any>>;
1090
+ })[];
1091
+ /** Fallback element rendered while lazy pages are loading. */
1092
+ fallback?: JSX.Element;
1093
+ /** Element rendered for the generated catch-all 404 route. */
1094
+ notFound?: JSX.Element;
801
1095
  }
802
1096
  /**
803
- * Routes with lazy loading and 404 page.
1097
+ * Render React Router routes with lazy-page support and a default 404 route.
1098
+ *
1099
+ * The wrapper adds a catch-all route automatically and uses an Ant Design `Skeleton` fallback when
1100
+ * `fallback` is not provided.
1101
+ *
1102
+ * @param {RoutesProps} props - Route definitions and optional fallback or 404 elements.
804
1103
  *
805
1104
  * @example
806
1105
  * ```tsx
807
1106
  * import { Routes, lazy } from '@faasjs/ant-design'
808
1107
  * import { BrowserRouter } from 'react-router-dom'
809
1108
  *
810
- * export function App () {
811
- * return <BrowserRouter>
812
- * <Routes routes={[
813
- * {
814
- * path: '/',
815
- * page: lazy(() => import('./pages/home'))
816
- * }
817
- * ]} />
818
- * </BrowserRouter>
1109
+ * export function App() {
1110
+ * return (
1111
+ * <BrowserRouter>
1112
+ * <Routes
1113
+ * routes={[
1114
+ * {
1115
+ * path: '/',
1116
+ * page: lazy(() => import('./pages/home')),
1117
+ * },
1118
+ * ]}
1119
+ * />
1120
+ * </BrowserRouter>
1121
+ * )
819
1122
  * }
820
1123
  * ```
821
1124
  */
822
- declare function Routes(props: RoutesProps): react_jsx_runtime.JSX.Element;
823
-
1125
+ declare function Routes(props: RoutesProps): _$react_jsx_runtime0.JSX.Element;
1126
+ //#endregion
1127
+ //#region src/Table/table.d.ts
1128
+ /**
1129
+ * Render an Ant Design table from FaasJS item metadata.
1130
+ *
1131
+ * The component can render local `dataSource` rows or resolve remote rows through `faasData`. It
1132
+ * also generates default filters and sorters for built-in item types unless you disable them with
1133
+ * the corresponding Ant Design column props.
1134
+ *
1135
+ * @template T - Row record type rendered by the table.
1136
+ * @template ExtendTypes - Additional item prop shape accepted by `items`.
1137
+ * @param {TableProps<T, ExtendTypes>} props - Table props including columns, data source, and optional Faas data config.
1138
+ * @throws {Error} When an entry in `extendTypes` omits both `children` and `render`.
1139
+ *
1140
+ * @example
1141
+ * ```tsx
1142
+ * import { Table } from '@faasjs/ant-design'
1143
+ *
1144
+ * const rows = [
1145
+ * { id: 1, name: 'Alice', active: true },
1146
+ * { id: 2, name: 'Bob', active: false },
1147
+ * ]
1148
+ *
1149
+ * export function UserTable() {
1150
+ * return (
1151
+ * <Table
1152
+ * rowKey="id"
1153
+ * dataSource={rows}
1154
+ * items={[
1155
+ * { id: 'name', title: 'Name' },
1156
+ * { id: 'active', type: 'boolean', title: 'Active' },
1157
+ * ]}
1158
+ * />
1159
+ * )
1160
+ * }
1161
+ * ```
1162
+ */
1163
+ declare function Table<T extends Record<string, any>, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): _$react_jsx_runtime0.JSX.Element;
1164
+ //#endregion
1165
+ //#region src/Tabs/index.d.ts
1166
+ /**
1167
+ * Tab item accepted by the FaasJS Ant Design {@link Tabs} wrapper.
1168
+ */
824
1169
  interface TabProps extends Partial<Tab> {
825
- id: string;
826
- title?: React.ReactNode;
827
- children: React.ReactNode;
1170
+ /** Stable tab identifier used as the default key and label. */
1171
+ id: string;
1172
+ /** Title used as the default Ant Design tab label. */
1173
+ title?: React.ReactNode;
1174
+ /** Tab panel content. */
1175
+ children: React.ReactNode;
828
1176
  }
1177
+ /**
1178
+ * Props for the FaasJS Ant Design {@link Tabs} component.
1179
+ */
829
1180
  interface TabsProps extends Omit<TabsProps$1, 'items'> {
830
- /** auto skip null tab */
831
- items: (TabProps | null | false)[];
1181
+ /** Tab definitions. `null` and `false` entries are skipped automatically. */
1182
+ items: (TabProps | null | false)[];
832
1183
  }
833
1184
  /**
834
- * Tabs component with Ant Design & FaasJS
1185
+ * Render an Ant Design tabs wrapper that accepts FaasJS-style tab definitions.
835
1186
  *
836
- * - Based on [Ant Design Tabs](https://ant.design/components/tabs/).
837
- * - Support auto skip null/false tab item.
838
- * - Support `id` as key and label.
1187
+ * Missing `key` and `label` values are derived from each tab's `id` and `title`.
1188
+ *
1189
+ * @param {TabsProps} props - Tabs props including tab items and Ant Design tab options.
839
1190
  *
840
1191
  * @example
841
1192
  * ```tsx
842
1193
  * import { Tabs } from '@faasjs/ant-design'
843
1194
  *
844
- * <Tabs
845
- * items={[
846
- * {
847
- * id: 'id',
848
- * children: 'content',
849
- * },
850
- * 1 === 0 && {
851
- * id: 'hidden',
852
- * children: 'content',
853
- * },
854
- * ]}
855
- * />
1195
+ * export function Page() {
1196
+ * return (
1197
+ * <Tabs
1198
+ * items={[
1199
+ * {
1200
+ * id: 'id',
1201
+ * children: 'content',
1202
+ * },
1203
+ * 1 === 0 && {
1204
+ * id: 'hidden',
1205
+ * children: 'content',
1206
+ * },
1207
+ * ]}
1208
+ * />
1209
+ * )
1210
+ * }
856
1211
  * ```
857
1212
  */
858
- declare function Tabs(props: TabsProps): react_jsx_runtime.JSX.Element;
859
-
1213
+ declare function Tabs(props: TabsProps): _$react_jsx_runtime0.JSX.Element;
1214
+ //#endregion
1215
+ //#region src/Title/index.d.ts
1216
+ /**
1217
+ * Props for the document-title helper component.
1218
+ */
860
1219
  interface TitleProps {
861
- title: string | string[];
862
- /** ` - ` as default */
863
- separator?: string;
864
- suffix?: string;
865
- /** return a h1 element */
866
- h1?: boolean | {
867
- className?: string;
868
- style?: React.CSSProperties;
869
- };
870
- /** return a pure text element */
871
- plain?: boolean;
872
- /** return children */
873
- children?: JSX.Element;
1220
+ /** Title text or title segments used to update `document.title`. */
1221
+ title: string | string[];
1222
+ /**
1223
+ * Separator used when joining title segments.
1224
+ *
1225
+ * @default ' - '
1226
+ */
1227
+ separator?: string;
1228
+ /** Suffix appended to the generated document title. */
1229
+ suffix?: string;
1230
+ /** Whether to render an `h1`, or the props used to style that `h1`. */
1231
+ h1?: boolean | {
1232
+ className?: string;
1233
+ style?: React.CSSProperties;
1234
+ };
1235
+ /** Whether to render plain text instead of returning `null`. */
1236
+ plain?: boolean;
1237
+ /** Existing element cloned with a `title` prop. */
1238
+ children?: JSX.Element;
874
1239
  }
875
1240
  /**
876
- * Title is used to change the title of the page
1241
+ * Update `document.title` and optionally render the title inline.
1242
+ *
1243
+ * The component returns `null` by default and is often used only for its side effect.
877
1244
  *
878
- * Return null by default.
1245
+ * @param {TitleProps} props - Title props controlling document title updates and optional inline rendering.
879
1246
  *
1247
+ * @example
880
1248
  * ```tsx
881
- * // return null
882
- * <Title title='hi' /> // => change the document.title to 'hi'
883
- * <Title title={['a', 'b']} /> // => change the document.title to 'a - b'
1249
+ * import { Title } from '@faasjs/ant-design'
884
1250
  *
885
- * // return h1
886
- * <Title title='hi' h1 /> // => <h1>hi</h1>
887
- * <Title title={['a', 'b']} h1 /> // => <h1>a</h1>
1251
+ * export function DetailPage() {
1252
+ * return (
1253
+ * <>
1254
+ * <Title title={['Orders', 'Detail']} h1 />
1255
+ * <div>...</div>
1256
+ * </>
1257
+ * )
1258
+ * }
1259
+ * ```
1260
+ */
1261
+ declare function Title(props: TitleProps): JSX.Element | null;
1262
+ //#endregion
1263
+ //#region src/useApp/index.d.ts
1264
+ /**
1265
+ * Shared app services exposed by {@link AppContext} and {@link useApp}.
1266
+ */
1267
+ interface useAppProps {
1268
+ /** Ant Design message API instance created by the root `App` component. */
1269
+ message: MessageInstance;
1270
+ /** Ant Design notification API instance created by the root `App` component. */
1271
+ notification: NotificationInstance;
1272
+ /** Current props of the hook-managed modal element. */
1273
+ modalProps: ModalProps;
1274
+ /** Setter that merges updates into the hook-managed modal props. */
1275
+ setModalProps: setModalProps;
1276
+ /** Current props of the hook-managed drawer element. */
1277
+ drawerProps: DrawerProps;
1278
+ /** Setter that merges updates into the hook-managed drawer props. */
1279
+ setDrawerProps: setDrawerProps;
1280
+ }
1281
+ /**
1282
+ * Shared context storing message, notification, modal, and drawer helpers.
888
1283
  *
889
- * // return children
890
- * <Title title='hi'><CustomTitle /></Title> // => <CustomTitle />
1284
+ * @example
1285
+ * ```ts
1286
+ * const { message } = AppContext.use()
891
1287
  * ```
892
1288
  */
893
- declare function Title(props: TitleProps): JSX.Element;
894
-
1289
+ declare const AppContext: any;
1290
+ /**
1291
+ * Read app-level services exposed by the root `App` component.
1292
+ *
1293
+ * @template NewT - Narrowed app context shape to read from `AppContext`.
1294
+ * @param {void} this - Explicit void receiver that keeps the hook unbound.
1295
+ * @returns Read-only app context value.
1296
+ *
1297
+ * @example
1298
+ * ```tsx
1299
+ * import { App, useApp } from '@faasjs/ant-design'
1300
+ * import { Button } from 'antd'
1301
+ *
1302
+ * function Page() {
1303
+ * const { message, setModalProps } = useApp()
1304
+ *
1305
+ * return (
1306
+ * <Button
1307
+ * onClick={() => {
1308
+ * message.success('Saved')
1309
+ * setModalProps({ open: true, title: 'Done', children: 'Profile updated.' })
1310
+ * }}
1311
+ * >
1312
+ * Save
1313
+ * </Button>
1314
+ * )
1315
+ * }
1316
+ *
1317
+ * export function Root() {
1318
+ * return (
1319
+ * <App>
1320
+ * <Page />
1321
+ * </App>
1322
+ * )
1323
+ * }
1324
+ * ```
1325
+ */
1326
+ declare function useApp<NewT extends useAppProps = useAppProps>(this: void): Readonly<NewT>;
1327
+ //#endregion
1328
+ //#region src/useThemeToken/index.d.ts
895
1329
  /**
896
- * Hook to retrieve the theme token from the Ant Design theme configuration.
1330
+ * Read the current Ant Design theme token.
1331
+ *
1332
+ * @returns Ant Design global token object for the active theme.
897
1333
  *
898
- * This function uses the `theme.useToken` method to get the current theme configuration
899
- * and returns the `token` property from the configuration.
1334
+ * @example
1335
+ * ```tsx
1336
+ * import { useThemeToken } from '@faasjs/ant-design'
1337
+ *
1338
+ * function PrimarySwatch() {
1339
+ * const { colorPrimary } = useThemeToken()
900
1340
  *
901
- * @returns {GlobalToken} The theme token from the Ant Design theme configuration.
1341
+ * return <div style={{ width: 24, height: 24, background: colorPrimary }} />
1342
+ * }
1343
+ * ```
902
1344
  */
903
1345
  declare function useThemeToken(): GlobalToken;
904
-
905
- export { App, type AppProps, type BaseItemProps, type BaseOption, Blank, type BlankProps, ConfigContext, ConfigProvider, type ConfigProviderProps, Description, type DescriptionItemContentProps, type DescriptionItemProps, type DescriptionProps, type DrawerProps, ErrorBoundary, type ExtendDescriptionItemProps, type ExtendDescriptionTypeProps, type ExtendFormItemProps, type ExtendFormTypeProps, type ExtendTableItemProps, type ExtendTableTypeProps, type ExtendTypes, type FaasDataInjection, FaasDataWrapper, type FaasDataWrapperProps, type FaasItemProps, type FaasItemType, type FaasItemTypeValue, Form, FormItem, type FormItemProps, type FormProps, type FormSubmitProps, Link, type LinkProps, Loading, type LoadingProps, type ModalProps, PageNotFound, Routes, type RoutesProps, type TabProps, Table, type TableFaasDataParams, type TableFaasDataResponse, type TableItemProps, type TableProps, Tabs, type TabsProps, Title, type TitleProps, type UnionFaasItemElement, type UnionFaasItemInjection, type UnionFaasItemProps, type UnionFaasItemRender, type UnionScene, cloneUnionFaasItemElement, idToTitle, type setDrawerProps, type setModalProps, transferOptions, transferValue, useApp, type useAppProps, useConfigContext, useDrawer, useModal, useThemeToken, withFaasData };
1346
+ //#endregion
1347
+ export { App, AppContext, AppProps, BaseExtendTypeProps, BaseItemProps, BaseOption, Blank, BlankProps, ConfigContext, ConfigProvider, ConfigProviderProps, Description, type DescriptionCommonProps, type DescriptionItemContentProps, type DescriptionItemProps, type DescriptionProps, type DescriptionWithFaasProps, type DescriptionWithoutFaasProps, Drawer, DrawerProps, ErrorBoundary, type ErrorBoundaryProps, type ExtendDescriptionItemProps, type ExtendDescriptionTypeProps, type ExtendFormItemProps, type ExtendFormTypeProps, type ExtendTableItemProps, type ExtendTableTypeProps, type ExtendTypes, type FaasDataInjection, FaasDataWrapper, FaasDataWrapperProps, type FaasDataWrapperRef, FaasItemProps, FaasItemType, FaasItemTypeValue, FaasReactClient, type FaasReactClientOptions, Form, type FormFaasProps, FormItem, type FormItemProps, type FormProps, type FormSubmitProps, type FormWithFaasProps, type FormWithoutFaasProps, Link, LinkProps, Loading, LoadingProps, Modal, ModalProps, PageNotFound, ResolvedTheme, Routes, RoutesProps, TabProps, Table, type TableFaasDataParams, type TableFaasDataResponse, type TableItemProps, type TableProps, Tabs, TabsProps, Title, TitleProps, UnionFaasItemElement, UnionFaasItemInjection, UnionFaasItemProps, UnionFaasItemRender, UnionScene, cloneUnionFaasItemElement, createOnErrorHandler, faas, idToTitle, lazy, renderDisplayValue, setDrawerProps, setModalProps, transferOptions, transferValue, useApp, useAppProps, useConfigContext, useDrawer, useFaas, useModal, useThemeToken, withFaasData };