@faasjs/ant-design 8.0.0-beta.2 → 8.0.0-beta.21

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