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

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