@zeroman.yang/react-auto-components 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +260 -0
  3. package/dist/adapters/xlsx.d.ts +7 -0
  4. package/dist/components/AutoChat/VirtualChatMessages.d.ts +16 -0
  5. package/dist/components/AutoChat/index.d.ts +4 -0
  6. package/dist/components/AutoChat/types.d.ts +89 -0
  7. package/dist/components/AutoChat/useChatScroll.d.ts +10 -0
  8. package/dist/components/AutoDialog/index.d.ts +46 -0
  9. package/dist/components/AutoForm/AutoForm.d.ts +2 -0
  10. package/dist/components/AutoForm/ChoiceField.d.ts +16 -0
  11. package/dist/components/AutoForm/FormField.d.ts +8 -0
  12. package/dist/components/AutoForm/index.d.ts +2 -0
  13. package/dist/components/AutoForm/types.d.ts +28 -0
  14. package/dist/components/AutoMenu/index.d.ts +35 -0
  15. package/dist/components/AutoSearchPanel/index.d.ts +21 -0
  16. package/dist/components/AutoTable/AutoTable.d.ts +2 -0
  17. package/dist/components/AutoTable/FilterEditor.d.ts +7 -0
  18. package/dist/components/AutoTable/SettingsPanel.d.ts +7 -0
  19. package/dist/components/AutoTable/TableHeader.d.ts +18 -0
  20. package/dist/components/AutoTable/export.d.ts +11 -0
  21. package/dist/components/AutoTable/features.d.ts +9 -0
  22. package/dist/components/AutoTable/index.d.ts +4 -0
  23. package/dist/components/AutoTable/settings.d.ts +34 -0
  24. package/dist/components/AutoTable/types.d.ts +107 -0
  25. package/dist/components/AutoTable/useTableData.d.ts +9 -0
  26. package/dist/components/AutoTable/useTableSettings.d.ts +7 -0
  27. package/dist/components/AutoTabs/index.d.ts +29 -0
  28. package/dist/core/AutoConfigProvider.d.ts +34 -0
  29. package/dist/core/config.d.ts +10 -0
  30. package/dist/core/i18n.d.ts +2 -0
  31. package/dist/core/query.d.ts +24 -0
  32. package/dist/core/types.d.ts +93 -0
  33. package/dist/index.d.ts +11 -0
  34. package/dist/index.js +3246 -0
  35. package/dist/internal/Popover.d.ts +16 -0
  36. package/dist/style.css +2 -0
  37. package/dist/xlsx.js +9 -0
  38. package/docs/auto-chat.md +89 -0
  39. package/docs/i18n/de/README.md +203 -0
  40. package/docs/i18n/de/auto-chat.md +82 -0
  41. package/docs/i18n/de/migration.md +71 -0
  42. package/docs/i18n/es/README.md +203 -0
  43. package/docs/i18n/es/auto-chat.md +82 -0
  44. package/docs/i18n/es/migration.md +71 -0
  45. package/docs/i18n/fr/README.md +203 -0
  46. package/docs/i18n/fr/auto-chat.md +82 -0
  47. package/docs/i18n/fr/migration.md +71 -0
  48. package/docs/i18n/ja/README.md +203 -0
  49. package/docs/i18n/ja/auto-chat.md +82 -0
  50. package/docs/i18n/ja/migration.md +71 -0
  51. package/docs/i18n/ko/README.md +203 -0
  52. package/docs/i18n/ko/auto-chat.md +82 -0
  53. package/docs/i18n/ko/migration.md +71 -0
  54. package/docs/i18n/pt-BR/README.md +203 -0
  55. package/docs/i18n/pt-BR/auto-chat.md +82 -0
  56. package/docs/i18n/pt-BR/migration.md +71 -0
  57. package/docs/i18n/ru/README.md +203 -0
  58. package/docs/i18n/ru/auto-chat.md +82 -0
  59. package/docs/i18n/ru/migration.md +71 -0
  60. package/docs/i18n/zh-CN/README.md +217 -0
  61. package/docs/i18n/zh-CN/auto-chat.md +82 -0
  62. package/docs/i18n/zh-CN/migration.md +71 -0
  63. package/docs/i18n/zh-TW/README.md +217 -0
  64. package/docs/i18n/zh-TW/auto-chat.md +82 -0
  65. package/docs/i18n/zh-TW/migration.md +71 -0
  66. package/docs/migration.md +71 -0
  67. package/package.json +111 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Zeroman
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,260 @@
1
+ # React Auto Components
2
+
3
+ **English** | [简体中文](docs/i18n/zh-CN/README.md) | [繁體中文](docs/i18n/zh-TW/README.md) | [日本語](docs/i18n/ja/README.md) | [한국어](docs/i18n/ko/README.md) | [Español](docs/i18n/es/README.md) | [Français](docs/i18n/fr/README.md) | [Deutsch](docs/i18n/de/README.md) | [Português (Brasil)](docs/i18n/pt-BR/README.md) | [Русский](docs/i18n/ru/README.md)
4
+
5
+ A standalone, schema-driven component library for React 19, covering forms, tables, and chat. Built with TypeScript, TanStack Table 9 / Form / Virtual, Radix, and Floating UI, without Ant Design, Element Plus, or MUI. Library builds use React Compiler.
6
+
7
+ [![Auto Studio Demo Preview](docs/assets/demo.png)](https://zeroman.github.io/react-auto-components/)
8
+
9
+ <p align="center">
10
+ <a href="https://zeroman.github.io/react-auto-components/"><strong>🚀 Live Demo (GitHub Pages)</strong></a> · <a href="#demo-and-test-project">Run Locally</a> · <a href="#components">Components</a>
11
+ </p>
12
+
13
+ ## Project status
14
+
15
+ The current version is 0.1.0 and APIs may still change. React 19 is required. The package provides ESM and TypeScript declarations. Existing components default to Chinese; AutoChat defaults to English. Built-in text can be translated through AutoConfigProvider.config.t.
16
+
17
+ Install with `pnpm add @zeroman.yang/react-auto-components` (npm and yarn work the same way). React 19 and react-dom 19 are peer dependencies. Import the stylesheet once: `import "@zeroman.yang/react-auto-components/style.css"`.
18
+
19
+ - [Live Demo (GitHub Pages)](https://zeroman.github.io/react-auto-components/)
20
+ - [Contributing](https://github.com/Zeroman/react-auto-components/blob/main/.github/CONTRIBUTING.md)
21
+ - [Changelog](https://github.com/Zeroman/react-auto-components/blob/main/docs/CHANGELOG.md)
22
+ - [Account setup and publishing](https://github.com/Zeroman/react-auto-components/blob/main/docs/publishing.md)
23
+ - [MIT license](LICENSE)
24
+
25
+ ## Demo and test project
26
+
27
+ Try the **[Online Demo](https://zeroman.github.io/react-auto-components/)** directly in your browser.
28
+
29
+ To run or develop the test project locally (requires Node.js >= 22.12 and pnpm 12.5):
30
+
31
+ ```sh
32
+ pnpm install --frozen-lockfile
33
+ pnpm prepare:test-project
34
+ pnpm --dir test-project dev
35
+ ```
36
+
37
+ Open http://127.0.0.1:4173. The test project includes pages for all seven components, local/server-side/10,000-row/tree tables, CRUD, failed-submission retries, drafts, nested tabs, and dynamic row heights.
38
+
39
+ The demo automatically detects the browser language, with English as the fallback. Choose a language from the header or Global settings; the selection is remembered across reloads. Select Auto to follow the browser again. Ten languages are supported. Pages fill the viewport, with tables and long panels scrolling inside their own areas.
40
+
41
+ Every example page includes a **View code** button that opens its real source file in a dialog, with file tabs, one-click copy, and a GitHub link.
42
+
43
+ `test-project` has its own package.json and lockfile. It installs the actual output of `pnpm pack`, with no source aliases. Run `pnpm prepare:test-project` again after changing the library; the script uses content-hashed filenames to avoid stale tarball caches.
44
+
45
+ ### Automated demo workflow
46
+
47
+ The demo build and screenshot capture process is automated and reusable:
48
+
49
+ ```sh
50
+ pnpm demo:update # Full update: rebuilds library, updates test-project, builds demo-dist, and refreshes screenshot
51
+ pnpm demo:build # Compiles static demo files to demo-dist for GitHub Pages
52
+ pnpm demo:screenshot # Takes fresh high-resolution screenshot using headless Chromium to docs/assets/demo.png
53
+ ```
54
+
55
+ Pushes to `main` branch automatically build and publish static files to GitHub Pages via GitHub Actions.
56
+
57
+ ## Usage
58
+
59
+ ```tsx
60
+ import { useState } from "react";
61
+ import {
62
+ AutoConfigProvider,
63
+ AutoDialogProvider,
64
+ AutoTable,
65
+ type AutoColumn,
66
+ type Field,
67
+ } from "@zeroman.yang/react-auto-components";
68
+ import "@zeroman.yang/react-auto-components/style.css";
69
+
70
+ type Person = { id: number; name: string; enabled: boolean };
71
+ const columns: AutoColumn<Person>[] = [
72
+ { key: "name", label: "Name", sortable: true },
73
+ {
74
+ key: "enabled",
75
+ label: "Enabled",
76
+ options: [
77
+ { label: "Yes", value: true },
78
+ { label: "No", value: false },
79
+ ],
80
+ },
81
+ ];
82
+ const fields: Field<Person>[] = [
83
+ { name: "name", label: "Name", required: true },
84
+ { name: "enabled", label: "Enabled", type: "switch", defaultValue: true },
85
+ ];
86
+ export function App() {
87
+ const [rows, setRows] = useState<Person[]>([]);
88
+ return (
89
+ <AutoConfigProvider config={{ namespace: "my-app" }}>
90
+ <AutoDialogProvider>
91
+ <AutoTable<Person>
92
+ id="people"
93
+ rowKey="id"
94
+ data={rows}
95
+ columns={columns}
96
+ formFields={fields}
97
+ searchFields={fields}
98
+ onAdd={(value) =>
99
+ setRows((old) => [...old, { ...value, id: Date.now() }])
100
+ }
101
+ onEdit={(row, value) =>
102
+ setRows((old) =>
103
+ old.map((item) =>
104
+ item.id === row.id ? { ...row, ...value } : item,
105
+ ),
106
+ )
107
+ }
108
+ onDelete={(selected) =>
109
+ setRows((old) =>
110
+ old.filter((item) => !selected.some((row) => row.id === item.id)),
111
+ )
112
+ }
113
+ />
114
+ </AutoDialogProvider>
115
+ </AutoConfigProvider>
116
+ );
117
+ }
118
+ ```
119
+
120
+ Fields, columns, and refs use generics: invalid field names or default values produce compile-time errors. The provider supports namespaces, permissions, field-label translation, custom fields, notifications, and persistence adapters. Built-in labels, validation messages, and accessibility text use AutoConfigProvider.config.t; explicit component labels take precedence.
121
+
122
+ The t callback receives a message key and a fallback. Preserve numbered placeholders such as {0} and {1} in translated built-in messages; the components substitute their values after translation.
123
+
124
+ ## Components
125
+
126
+ | Component | Capabilities |
127
+ | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
128
+ | AutoForm | Native field types, virtualized options, cascading selection, upload adapters, custom rendering, dependent fields, conditional visibility, async validation, controlled state, input preservation after failures |
129
+ | AutoSearchPanel | Basic/advanced conditions, manual/instant search, reset, sort tags, a shared query AST, and RSQL serialization |
130
+ | AutoTable | Local/remote data, multi-column sorting, column filters, pagination, stable selection, virtualization, tree/detail expansion, summaries, merged cells, CRUD, context menus, and copy |
131
+ | AutoDialog | Declarative/imperative APIs, isolated providers, drafts, close guards, focus management, dragging, fullscreen, and async submission |
132
+ | AutoTabs | Horizontal/vertical layouts, nesting, permissions, disabled tabs, preserved panel state, and refresh |
133
+ | AutoMenu | Sidebar navigation with icons, descriptions, badges, nested groups, permissions, and a collapsible icon rail |
134
+ | AutoChat | Caller-owned message rendering, optional virtualization, streaming follow, anchored history loading, send/stop composer, and custom actions |
135
+
136
+ Table layout, sorting, filtering, and export each support named presets and independent versions. Persistence defaults to localStorage; remote adapters can be injected. JSON/CSV export is built in. XLSX uses an optional, separate adapter:
137
+
138
+ ```tsx
139
+ import { exportXlsx } from "@zeroman.yang/react-auto-components/xlsx";
140
+ // <AutoTable ... exportXlsx={exportXlsx} />
141
+ ```
142
+
143
+ ExcelJS loads dynamically when the adapter is first used and is excluded from the library's main entry. Applications that only use CSV/JSON can omit optional dependencies during installation.
144
+
145
+ ## Verification
146
+
147
+ ```sh
148
+ pnpm typecheck
149
+ pnpm test
150
+ pnpm build
151
+ pnpm prepare:test-project
152
+ pnpm --dir test-project build
153
+ pnpm exec playwright install chromium # First run only
154
+ pnpm test:e2e
155
+ ```
156
+
157
+ Unit tests cover fields, async validation, queries, dialogs, virtualization, tables, configuration migrations, and exports. Playwright tests interactions through the packaged public entry points. Desktop/mobile screenshots are written to `test-project/test-results`.
158
+
159
+ ## Behavior and conventions
160
+
161
+ - This is a React-native API, not a property-by-property or method-by-method compatibility layer for Vue. See the [migration guide](docs/migration.md).
162
+ - Application code owns the data. CRUD callbacks persist changes; throwing on failure preserves edits. After success, the component refreshes remote data. Local data must be updated by the caller.
163
+ - A table's `id` must be unique within its namespace, and `rowKey` must be unique across all pages and tree nodes. In server-side mode, provide `columns` explicitly; the data source returns the total count.
164
+ - When `query` / `value` is controlled, the parent must handle callbacks and update it. These props can be omitted for uncontrolled use.
165
+ - Merged cells use a non-virtualized semantic table, suitable for paginated data, to avoid rowSpan misalignment across virtual windows.
166
+ - Server-side summaries for all filtered rows are supplied through `summaryValues`. Missing summaries display `—` instead of presenting the current page's total as an overall total. Set `summaryScope="page"` to calculate the current page explicitly.
167
+ - Submission pauses while uploads are in progress. Resetting, replacing field values, or unmounting cancels old uploads; late results cannot overwrite newer values.
168
+ - Remote exports of all filtered results request data one page at a time. Large applications can implement their own server-side export.
169
+ - Import browser styles explicitly from `style.css`. JavaScript modules can be imported in Node without `window`.
170
+
171
+ ## Fill the remaining height with AutoTable
172
+
173
+ `height={440}` continues to set a fixed height for the data scroll area. With `height="auto"`, the entire table fills the height allocated by its parent layout. Search, toolbar, and pagination take their natural heights; the data area uses the remaining space and scrolls independently:
174
+
175
+ ```tsx
176
+ <div
177
+ style={{
178
+ height: "100dvh",
179
+ display: "flex",
180
+ flexDirection: "column",
181
+ gap: 12,
182
+ }}
183
+ >
184
+ <header>Page title and description</header>
185
+ <AutoTable<Person>
186
+ id="people"
187
+ rowKey="id"
188
+ data={rows}
189
+ columns={columns}
190
+ height="auto"
191
+ />
192
+ <footer>Page footer</footer>
193
+ </div>
194
+ ```
195
+
196
+ The parent must have a definite height. Use `flex: 1; min-height: 0` in nested flex containers to pass down the remaining space, or `grid-template-rows: auto minmax(0, 1fr) auto` for grid layouts. No JavaScript calculation of viewport height minus toolbar height is needed: layout handles added/removed search fields, wrapped toolbars, and parent resizing, and the virtual list follows the scroll area's actual dimensions.
197
+
198
+ This does not size the table according to the number of rows. Empty and small datasets still fill the available space. The parent must at least accommodate the search area, toolbar, and pagination themselves.
199
+
200
+ The test project demonstrates this in the **AutoTable → Remaining height** tab while preserving the sidebar and page header. The legacy URL `http://127.0.0.1:4173/?demo=auto-height` selects that tab directly. Browser tests: `test-project/tests/auto-height.spec.ts`.
201
+
202
+ ## Global form layout
203
+
204
+ Use `AutoConfigProvider.config.form` to configure regular forms, search panels, table search areas, and dialog forms consistently. Labels can appear above or to the left of controls, with independent left/right text alignment. Defaults are top labels and comfortable spacing.
205
+
206
+ ```tsx
207
+ <AutoConfigProvider
208
+ config={{
209
+ form: {
210
+ labelPosition: "left", // 'top': above; 'left': to the left of the control
211
+ labelAlign: "right", // Right-aligned text; the label stays left of the control
212
+ labelWidth: 80,
213
+ density: "compact", // 'comfortable': more spacing
214
+ },
215
+ }}
216
+ >
217
+ <App />
218
+ </AutoConfigProvider>
219
+ ```
220
+
221
+ Nested providers merge layout settings property by property. Explicit component props override the enclosing provider. For example, retain top labels in one form while using inline labels globally:
222
+
223
+ ```tsx
224
+ <AutoForm fields={fields} labelPosition="top" density="comfortable" />
225
+ <AutoTable id="people" rowKey="id" data={rows} columns={columns}
226
+ searchFields={searchFields}
227
+ searchLayout={{ labelWidth: 100, columns: 3 }} />
228
+ ```
229
+
230
+ `labelWidth` defaults to `"auto"` and also accepts a pixel number or CSS width such as `"6em"`. In automatic mode, each search label fits its text; regular forms and dialog forms share a width based on visible labels to align controls. Long labels occupy at most 45% of the field width and wrap beyond that, preserving room for controls. Explicit fixed widths are not subject to this automatic limit. Compact search areas place action buttons on the same row when space allows and wrap on narrow screens. Label associations remain intact, errors and descriptions align with controls, and long labels can wrap.
231
+
232
+ In the demo, open **Global settings** from the sidebar or the top-right gear to change layout, density, label width, and theme. Changes take effect immediately without clearing current inputs. The form page supports **Follow global** or local overrides. The demo explicitly enables compact inline layout through its provider.
233
+
234
+ ## Global size and density
235
+
236
+ `AutoConfigProvider` supports `size: "small" | "medium" | "large"` and `density: "compact" | "comfortable"`. Explicit component props take precedence over component-category settings, which take precedence over global values:
237
+
238
+ ```tsx
239
+ <AutoConfigProvider
240
+ config={{
241
+ size: "medium",
242
+ density: "compact",
243
+ form: { labelPosition: "left", labelAlign: "right" },
244
+ table: { density: "compact" },
245
+ tabs: { density: "compact" },
246
+ }}
247
+ >
248
+ <AutoForm fields={fields} size="small" />
249
+ </AutoConfigProvider>
250
+ ```
251
+
252
+ Table density also supports `normal`. The table settings panel defaults to following global settings. Selecting compact, normal, or comfortable spacing overrides the global density and is saved with the layout preset; the component's `density` prop has the highest priority. Local sizes on nested components apply independently.
253
+
254
+ Forms support `resetLabel`, `extraActions`, and `onReset`; search panels support `searchLabel`, `resetLabel`, and `extraActions`; dialogs support `cancelLabel` and `extraActions`. `AutoTabs` items can define a `badge`, and `AutoTable.empty` customizes empty-state content.
255
+
256
+ ### AutoChat
257
+
258
+ AutoChat provides a lightweight conversation layout with streaming follow, history loading and a composer. Supply React content or renderMessage for message rendering; no extra runtime dependencies are required.
259
+
260
+ [AutoChat API](docs/auto-chat.md)
@@ -0,0 +1,7 @@
1
+ export declare function exportXlsx(data: {
2
+ headers: string[];
3
+ rows: unknown[][];
4
+ }, options: {
5
+ fileName: string;
6
+ sheetName?: string;
7
+ }): Promise<import("exceljs").Buffer>;
@@ -0,0 +1,16 @@
1
+ import { type Ref, type ReactNode, type RefObject } from "react";
2
+ import type { AutoChatMessage } from "./types";
3
+ export interface VirtualChatHandle {
4
+ scrollToIndex(index: number): void;
5
+ }
6
+ export declare function VirtualChatMessages<T extends AutoChatMessage>({ messages, viewport, content, following, autoFollow, estimate, overscan, renderRow, ref, }: {
7
+ messages: readonly T[];
8
+ viewport: RefObject<HTMLDivElement | null>;
9
+ content: RefObject<HTMLDivElement | null>;
10
+ following: RefObject<boolean>;
11
+ autoFollow: boolean;
12
+ estimate: number;
13
+ overscan: number;
14
+ renderRow: (message: T, index: number) => ReactNode;
15
+ ref?: Ref<VirtualChatHandle>;
16
+ }): import("react").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import type { AutoChatMessage, AutoChatProps } from "./types";
2
+ import "./chat.css";
3
+ export type * from "./types";
4
+ export declare function AutoChat<T extends AutoChatMessage>(props: AutoChatProps<T>): import("react").JSX.Element;
@@ -0,0 +1,89 @@
1
+ import type { CSSProperties, Key, ReactNode, Ref } from "react";
2
+ import type { ComponentDensity, ComponentSize } from "../../core/types";
3
+ export type AutoChatRole = "user" | "assistant" | "system" | "tool" | "error";
4
+ export type AutoChatMessageLayout = "role" | "left" | "right" | "full";
5
+ /** Normalize application messages at the boundary; no transport protocol is assumed. */
6
+ export interface AutoChatMessage {
7
+ /** Stable and unique within a conversation, including during streaming. */
8
+ id: string;
9
+ role: AutoChatRole;
10
+ content?: ReactNode;
11
+ author?: ReactNode;
12
+ avatar?: ReactNode;
13
+ meta?: ReactNode;
14
+ streaming?: boolean;
15
+ }
16
+ export interface AutoChatHandle {
17
+ scrollToBottom(): void;
18
+ scrollToMessage(id: string): boolean;
19
+ focusComposer(): void;
20
+ getScrollElement(): HTMLDivElement | null;
21
+ }
22
+ export interface AutoChatLabels {
23
+ conversation: string;
24
+ empty: string;
25
+ placeholder: string;
26
+ composer: string;
27
+ send: string;
28
+ stop: string;
29
+ sending: string;
30
+ generating: string;
31
+ latest: string;
32
+ loadOlder: string;
33
+ loading: string;
34
+ sendError: string;
35
+ loadError: string;
36
+ user: string;
37
+ assistant: string;
38
+ system: string;
39
+ tool: string;
40
+ error: string;
41
+ }
42
+ export interface AutoChatProps<T extends AutoChatMessage = AutoChatMessage> {
43
+ messages: readonly T[];
44
+ /** Own Markdown, code, tool output and attachment rendering in the host. */
45
+ renderMessage?: (message: T, context: {
46
+ index: number;
47
+ }) => ReactNode;
48
+ renderActions?: (message: T, context: {
49
+ index: number;
50
+ }) => ReactNode;
51
+ header?: ReactNode;
52
+ footer?: ReactNode;
53
+ empty?: ReactNode;
54
+ /** Changing this key resets draft, pending UI and scroll state. */
55
+ conversationKey?: Key;
56
+ height?: CSSProperties["height"];
57
+ className?: string;
58
+ style?: CSSProperties;
59
+ size?: ComponentSize;
60
+ density?: ComponentDensity;
61
+ /** Role-based alignment (default), all left/right, or full-width messages. */
62
+ messageLayout?: AutoChatMessageLayout;
63
+ labels?: Partial<AutoChatLabels>;
64
+ /** Follow appended/resized content only while the reader is at the bottom. */
65
+ autoFollow?: boolean;
66
+ /** Reuse TanStack Virtual for large histories with measured message heights. */
67
+ virtual?: boolean;
68
+ estimatedMessageHeight?: number;
69
+ overscan?: number;
70
+ /** Hide the built-in composer, for read-only history or an external editor. */
71
+ composer?: boolean;
72
+ value?: string;
73
+ defaultValue?: string;
74
+ onValueChange?: (value: string) => void;
75
+ /** Resolving accepts the draft; rejecting keeps it and shows a local error. */
76
+ onSend?: (text: string) => void | Promise<void>;
77
+ onSendError?: (error: unknown) => void;
78
+ onStop?: () => void;
79
+ generating?: boolean;
80
+ disabled?: boolean;
81
+ /** Enter sends; Shift+Enter inserts a newline. IME composition never sends. */
82
+ sendOnEnter?: boolean;
83
+ composerExtra?: ReactNode;
84
+ hasMore?: boolean;
85
+ loadingOlder?: boolean;
86
+ onLoadOlder?: () => void | Promise<void>;
87
+ onLoadError?: (error: unknown) => void;
88
+ ref?: Ref<AutoChatHandle>;
89
+ }
@@ -0,0 +1,10 @@
1
+ /** DOM anchoring also handles images and custom renderers resizing after commit. */
2
+ export declare function useChatScroll(autoFollow: boolean, virtual?: boolean): {
3
+ viewport: import("react").RefObject<HTMLDivElement | null>;
4
+ content: import("react").RefObject<HTMLDivElement | null>;
5
+ following: import("react").RefObject<boolean>;
6
+ showLatest: boolean;
7
+ scrollToBottom: () => void;
8
+ onScroll: () => void;
9
+ pause: () => void;
10
+ };
@@ -0,0 +1,46 @@
1
+ import { type ReactNode } from "react";
2
+ import type { ComponentSize, Field } from "../../core/types";
3
+ export type CloseReason = "cancel" | "close" | "submit";
4
+ export interface DialogOptions<T extends object> {
5
+ title: string;
6
+ description?: string;
7
+ content?: ReactNode;
8
+ fields?: readonly Field<T>[];
9
+ defaultValue?: Partial<T>;
10
+ draftKey?: string;
11
+ onSubmit?: (values: T) => void | Promise<void>;
12
+ beforeClose?: (reason: CloseReason) => boolean | Promise<boolean>;
13
+ onClose?: (reason: CloseReason) => void;
14
+ size?: ComponentSize;
15
+ footer?: (actions: {
16
+ submit: () => void;
17
+ cancel: () => void;
18
+ busy: boolean;
19
+ }) => ReactNode;
20
+ header?: ReactNode;
21
+ width?: number;
22
+ fullscreen?: boolean;
23
+ draggable?: boolean;
24
+ showReset?: boolean;
25
+ hideFooter?: boolean;
26
+ confirmLabel?: string;
27
+ cancelLabel?: string;
28
+ extraActions?: ReactNode;
29
+ }
30
+ export interface DialogHandle {
31
+ id: string;
32
+ close: () => Promise<boolean>;
33
+ }
34
+ interface DialogService {
35
+ open<T extends object>(options: DialogOptions<T>): DialogHandle;
36
+ close(id: string): Promise<boolean>;
37
+ }
38
+ export declare function AutoDialogProvider({ children }: {
39
+ children: ReactNode;
40
+ }): import("react").JSX.Element;
41
+ export declare function useAutoDialog(): DialogService;
42
+ export declare function AutoDialog<T extends object>({ open, onOpenChange, ...options }: DialogOptions<T> & {
43
+ open: boolean;
44
+ onOpenChange: (open: boolean) => void;
45
+ }): import("react").JSX.Element | null;
46
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { AutoFormProps } from "./types";
2
+ export declare function AutoForm<T extends object>({ fields, value, defaultValue, onChange, onSubmit, disabled, readOnly, columns, labelPosition: ownLabelPosition, labelAlign: ownLabelAlign, labelWidth: ownLabelWidth, density: ownDensity, size: ownSize, actions, submitLabel, resetLabel, extraActions, onReset, children, className, style, ref, }: AutoFormProps<T>): import("react").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import type { Option } from "../../core/types";
2
+ export declare function VirtualSelect({ id, value, options, onChange, disabled, multiple, }: {
3
+ id: string;
4
+ value: unknown;
5
+ options: readonly Option[];
6
+ onChange: (value: unknown) => void;
7
+ disabled: boolean;
8
+ multiple?: boolean;
9
+ }): import("react").JSX.Element;
10
+ export declare function Cascader({ id, value, options, onChange, disabled, }: {
11
+ id: string;
12
+ value: unknown;
13
+ options: readonly Option[];
14
+ onChange: (value: unknown) => void;
15
+ disabled: boolean;
16
+ }): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import type { AnyField, FieldContext } from "../../core/types";
2
+ export declare function FormField<T extends object>({ field, context, readOnly, resetEpoch, onUploadPending, }: {
3
+ field: AnyField<T>;
4
+ context: FieldContext<T>;
5
+ readOnly?: boolean;
6
+ resetEpoch?: number;
7
+ onUploadPending?: (id: string, pending: boolean) => void;
8
+ }): string | number | bigint | boolean | import("react").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | Iterable<import("react").ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
@@ -0,0 +1,2 @@
1
+ export { AutoForm } from "./AutoForm";
2
+ export type { AutoFormProps, AutoFormHandle } from "./types";
@@ -0,0 +1,28 @@
1
+ import type { CSSProperties, ReactNode, Ref } from "react";
2
+ import type { Field, FieldName, AutoFormLayout } from "../../core/types";
3
+ export interface AutoFormHandle<T extends object> {
4
+ validate(): Promise<boolean>;
5
+ reset(values?: T): void;
6
+ getValues(): T;
7
+ setValue<K extends FieldName<T>>(name: K, value: T[K]): void;
8
+ focus(name: FieldName<T>): void;
9
+ }
10
+ export interface AutoFormProps<T extends object> extends AutoFormLayout {
11
+ fields: readonly Field<T>[];
12
+ value?: T;
13
+ defaultValue?: Partial<T>;
14
+ onChange?: (value: T) => void;
15
+ onSubmit?: (value: T) => void | Promise<void>;
16
+ onReset?: () => void;
17
+ disabled?: boolean;
18
+ readOnly?: boolean;
19
+ columns?: number;
20
+ actions?: boolean;
21
+ submitLabel?: string;
22
+ resetLabel?: string;
23
+ extraActions?: ReactNode;
24
+ children?: ReactNode;
25
+ className?: string;
26
+ style?: CSSProperties;
27
+ ref?: Ref<AutoFormHandle<T>>;
28
+ }
@@ -0,0 +1,35 @@
1
+ import { type CSSProperties, type ReactNode } from "react";
2
+ import type { Access, ComponentDensity, ComponentSize } from "../../core/types";
3
+ export interface AutoMenuItem extends Access {
4
+ /** Stable and unique across the entire menu. */
5
+ id: string;
6
+ label: string;
7
+ icon?: ReactNode;
8
+ /** Secondary line rendered under the label. */
9
+ description?: ReactNode;
10
+ badge?: ReactNode;
11
+ hidden?: boolean | (() => boolean);
12
+ /** Disables this entry and its descendants. */
13
+ disabled?: boolean;
14
+ /** Sub-menu entries; clicking a parent toggles its expansion. */
15
+ children?: readonly AutoMenuItem[];
16
+ }
17
+ export interface AutoMenuProps {
18
+ items: readonly AutoMenuItem[];
19
+ value?: string;
20
+ defaultValue?: string;
21
+ onChange?: (id: string, item: AutoMenuItem, path: readonly string[]) => void;
22
+ /** Group label above the items; also used as the nav aria-label. */
23
+ label?: string;
24
+ header?: ReactNode;
25
+ footer?: ReactNode;
26
+ collapsible?: boolean;
27
+ collapsed?: boolean;
28
+ defaultCollapsed?: boolean;
29
+ onCollapsedChange?: (collapsed: boolean) => void;
30
+ size?: ComponentSize;
31
+ density?: ComponentDensity;
32
+ className?: string;
33
+ style?: CSSProperties;
34
+ }
35
+ export declare function AutoMenu({ items, value, defaultValue, onChange, label, header, footer, collapsible, collapsed, defaultCollapsed, onCollapsedChange, size: ownSize, density: ownDensity, className, style, }: AutoMenuProps): import("react").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { type QueryNode } from "../../core/query";
2
+ import type { Field, AutoFormLayout } from "../../core/types";
3
+ export interface AutoSearchPanelProps<T extends object> extends AutoFormLayout {
4
+ fields: readonly Field<T>[];
5
+ value?: T;
6
+ defaultValue?: Partial<T>;
7
+ onChange?: (values: T) => void;
8
+ onSearch: (query: QueryNode, values: T) => void;
9
+ mode?: "manual" | "instant";
10
+ columns?: number;
11
+ disabled?: boolean;
12
+ searchLabel?: string;
13
+ resetLabel?: string;
14
+ extraActions?: React.ReactNode;
15
+ sortTags?: readonly {
16
+ id: string;
17
+ label: string;
18
+ onRemove: () => void;
19
+ }[];
20
+ }
21
+ export declare function AutoSearchPanel<T extends object>({ fields, value, defaultValue, onChange, onSearch, mode, columns, labelPosition, labelAlign, labelWidth, density: ownDensity, size: ownSize, disabled, searchLabel, resetLabel, extraActions, sortTags, }: AutoSearchPanelProps<T>): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { AutoTableProps } from "./types";
2
+ export declare function AutoTable<T extends object>(props: AutoTableProps<T>): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import type { AutoColumn } from "./types";
2
+ import type { QueryNode } from "../../core/query";
3
+ export declare function FilterEditor<T extends object>({ columns, value, onChange, }: {
4
+ columns: readonly AutoColumn<T>[];
5
+ value: QueryNode;
6
+ onChange: (value: QueryNode) => void;
7
+ }): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { type TableSettings } from "./settings";
2
+ import type { AutoColumn } from "./types";
3
+ export declare function SettingsPanel<T extends object>({ value, columns, onChange, }: {
4
+ value: TableSettings;
5
+ columns: readonly AutoColumn<T>[];
6
+ onChange: (v: TableSettings) => void;
7
+ }): import("react").JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { type CSSProperties } from "react";
2
+ import type { AutoColumn, TableSort } from "./types";
3
+ import type { QueryNode } from "../../core/query";
4
+ export declare function updateColumnFilter(query: QueryNode, field: string, values: unknown[]): QueryNode;
5
+ export declare function TableHeader<T extends object>({ columns, rows, sort, filter, onSort, onFilter, onResize, style, hasActions, allSelected, indeterminate, onSelectAll, }: {
6
+ columns: readonly AutoColumn<T>[];
7
+ rows: readonly T[];
8
+ sort: TableSort[];
9
+ filter: QueryNode;
10
+ onSort: (sort: TableSort[]) => void;
11
+ onFilter: (query: QueryNode) => void;
12
+ onResize: (key: string, width: number) => void;
13
+ style: (column: AutoColumn<T>) => CSSProperties;
14
+ hasActions: boolean;
15
+ allSelected: boolean;
16
+ indeterminate?: boolean;
17
+ onSelectAll: (value: boolean) => void;
18
+ }): import("react").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import type { AutoColumn } from "./types";
2
+ export interface ExportData {
3
+ headers: string[];
4
+ rows: unknown[][];
5
+ }
6
+ export declare function formatted<T extends object>(column: AutoColumn<T>, row: T): string | number;
7
+ export declare function collectExport<T extends object>(rows: readonly T[], columns: readonly AutoColumn<T>[], names?: readonly string[]): ExportData;
8
+ export declare function toCsv(data: ExportData): string;
9
+ export declare function toJson(data: ExportData): string;
10
+ export declare function download(data: BlobPart, fileName: string, type: string): void;
11
+ export declare function fetchExportRows<T extends object>(source: import("./types").DataSource<T>, query: import("./types").TableQuery, signal: AbortSignal): Promise<T[]>;
@@ -0,0 +1,9 @@
1
+ export declare const features: {
2
+ rowSortingFeature: import("@tanstack/react-table").TableFeature;
3
+ rowPaginationFeature: import("@tanstack/react-table").TableFeature;
4
+ rowSelectionFeature: import("@tanstack/react-table").TableFeature;
5
+ rowExpandingFeature: import("@tanstack/react-table").TableFeature;
6
+ sortedRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
7
+ expandedRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
8
+ paginatedRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
9
+ };