@btst/plugin-form-builder 0.0.0-stage → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +17 -0
- package/dist/api/getters.cjs +154 -0
- package/dist/api/getters.mjs +145 -0
- package/dist/api/index.cjs +25 -0
- package/dist/api/index.d.cts +119 -0
- package/dist/api/index.d.mts +119 -0
- package/dist/api/index.d.ts +119 -0
- package/dist/api/index.mjs +6 -0
- package/dist/api/lifecycle-migrations.cjs +15 -0
- package/dist/api/lifecycle-migrations.mjs +13 -0
- package/dist/api/operations.cjs +1093 -0
- package/dist/api/operations.mjs +1082 -0
- package/dist/api/plugin.cjs +201 -0
- package/dist/api/plugin.mjs +192 -0
- package/dist/api/query-key-defs.cjs +43 -0
- package/dist/api/query-key-defs.mjs +39 -0
- package/dist/client/components/forms/form-renderer.cjs +193 -0
- package/dist/client/components/forms/form-renderer.mjs +191 -0
- package/dist/client/components/index.cjs +29 -0
- package/dist/client/components/index.d.cts +97 -0
- package/dist/client/components/index.d.mts +97 -0
- package/dist/client/components/index.d.ts +97 -0
- package/dist/client/components/index.mjs +18 -0
- package/dist/client/components/loading/form-builder-skeleton.cjs +32 -0
- package/dist/client/components/loading/form-builder-skeleton.mjs +30 -0
- package/dist/client/components/loading/form-list-skeleton.cjs +21 -0
- package/dist/client/components/loading/form-list-skeleton.mjs +19 -0
- package/dist/client/components/loading/submissions-skeleton.cjs +34 -0
- package/dist/client/components/loading/submissions-skeleton.mjs +32 -0
- package/dist/client/components/pages/404-page.cjs +28 -0
- package/dist/client/components/pages/404-page.mjs +26 -0
- package/dist/client/components/pages/form-builder-page.cjs +77 -0
- package/dist/client/components/pages/form-builder-page.internal.cjs +217 -0
- package/dist/client/components/pages/form-builder-page.internal.mjs +215 -0
- package/dist/client/components/pages/form-builder-page.mjs +75 -0
- package/dist/client/components/pages/form-list-page.cjs +44 -0
- package/dist/client/components/pages/form-list-page.internal.cjs +282 -0
- package/dist/client/components/pages/form-list-page.internal.mjs +280 -0
- package/dist/client/components/pages/form-list-page.mjs +42 -0
- package/dist/client/components/pages/submissions-page.cjs +64 -0
- package/dist/client/components/pages/submissions-page.internal.cjs +255 -0
- package/dist/client/components/pages/submissions-page.internal.mjs +253 -0
- package/dist/client/components/pages/submissions-page.mjs +62 -0
- package/dist/client/components/shared/default-error.cjs +17 -0
- package/dist/client/components/shared/default-error.mjs +15 -0
- package/dist/client/components/shared/empty-state.cjs +16 -0
- package/dist/client/components/shared/empty-state.mjs +14 -0
- package/dist/client/components/shared/page-wrapper.cjs +29 -0
- package/dist/client/components/shared/page-wrapper.mjs +27 -0
- package/dist/client/components/shared/pagination.cjs +49 -0
- package/dist/client/components/shared/pagination.mjs +47 -0
- package/dist/client/constants.cjs +5 -0
- package/dist/client/constants.mjs +3 -0
- package/dist/client/hooks/form-builder-hooks.cjs +203 -0
- package/dist/client/hooks/form-builder-hooks.mjs +186 -0
- package/dist/client/hooks/form-builder-resource.cjs +13 -0
- package/dist/client/hooks/form-builder-resource.mjs +11 -0
- package/dist/client/hooks/index.cjs +22 -0
- package/dist/client/hooks/index.d.cts +378 -0
- package/dist/client/hooks/index.d.mts +378 -0
- package/dist/client/hooks/index.d.ts +378 -0
- package/dist/client/hooks/index.mjs +1 -0
- package/dist/client/index.cjs +13 -0
- package/dist/client/index.d.cts +410 -0
- package/dist/client/index.d.mts +410 -0
- package/dist/client/index.d.ts +410 -0
- package/dist/client/index.mjs +2 -0
- package/dist/client/plugin.cjs +311 -0
- package/dist/client/plugin.mjs +309 -0
- package/dist/client.css +3 -0
- package/dist/db.cjs +99 -0
- package/dist/db.mjs +97 -0
- package/dist/permissions.cjs +95 -0
- package/dist/permissions.d.cts +94 -0
- package/dist/permissions.d.mts +94 -0
- package/dist/permissions.d.ts +94 -0
- package/dist/permissions.mjs +93 -0
- package/dist/query-keys.cjs +140 -0
- package/dist/query-keys.d.cts +392 -0
- package/dist/query-keys.d.mts +392 -0
- package/dist/query-keys.d.ts +392 -0
- package/dist/query-keys.mjs +137 -0
- package/dist/schemas.cjs +91 -0
- package/dist/schemas.mjs +82 -0
- package/dist/shared/plugin-form-builder.BZYGyFgT.d.mts +351 -0
- package/dist/shared/plugin-form-builder.Bbl9NufB.d.cts +408 -0
- package/dist/shared/plugin-form-builder.CSP5HR2O.d.ts +408 -0
- package/dist/shared/plugin-form-builder.Cmk083dA.d.cts +351 -0
- package/dist/shared/plugin-form-builder.D258Qpb8.d.ts +351 -0
- package/dist/shared/plugin-form-builder.DWrQ3lRX.d.cts +118 -0
- package/dist/shared/plugin-form-builder.DWrQ3lRX.d.mts +118 -0
- package/dist/shared/plugin-form-builder.DWrQ3lRX.d.ts +118 -0
- package/dist/shared/plugin-form-builder.lp98rFNl.d.mts +408 -0
- package/dist/style.css +6 -0
- package/dist/types.cjs +2 -0
- package/dist/types.d.cts +6 -0
- package/dist/types.d.mts +6 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.mjs +1 -0
- package/dist/ui/src/components/accordion.cjs +81 -0
- package/dist/ui/src/components/accordion.mjs +62 -0
- package/dist/ui/src/components/alert-dialog.cjs +157 -0
- package/dist/ui/src/components/alert-dialog.mjs +132 -0
- package/dist/ui/src/components/auto-form/common/label.cjs +18 -0
- package/dist/ui/src/components/auto-form/common/label.mjs +16 -0
- package/dist/ui/src/components/auto-form/common/tooltip.cjs +9 -0
- package/dist/ui/src/components/auto-form/common/tooltip.mjs +7 -0
- package/dist/ui/src/components/auto-form/config.cjs +40 -0
- package/dist/ui/src/components/auto-form/config.mjs +37 -0
- package/dist/ui/src/components/auto-form/dependencies.cjs +48 -0
- package/dist/ui/src/components/auto-form/dependencies.mjs +46 -0
- package/dist/ui/src/components/auto-form/fields/array.cjs +266 -0
- package/dist/ui/src/components/auto-form/fields/array.mjs +264 -0
- package/dist/ui/src/components/auto-form/fields/checkbox.cjs +38 -0
- package/dist/ui/src/components/auto-form/fields/checkbox.mjs +36 -0
- package/dist/ui/src/components/auto-form/fields/date.cjs +67 -0
- package/dist/ui/src/components/auto-form/fields/date.mjs +65 -0
- package/dist/ui/src/components/auto-form/fields/enum.cjs +73 -0
- package/dist/ui/src/components/auto-form/fields/enum.mjs +71 -0
- package/dist/ui/src/components/auto-form/fields/input.cjs +32 -0
- package/dist/ui/src/components/auto-form/fields/input.mjs +30 -0
- package/dist/ui/src/components/auto-form/fields/number.cjs +31 -0
- package/dist/ui/src/components/auto-form/fields/number.mjs +29 -0
- package/dist/ui/src/components/auto-form/fields/object.cjs +233 -0
- package/dist/ui/src/components/auto-form/fields/object.mjs +217 -0
- package/dist/ui/src/components/auto-form/fields/radio-group.cjs +67 -0
- package/dist/ui/src/components/auto-form/fields/radio-group.mjs +65 -0
- package/dist/ui/src/components/auto-form/fields/switch.cjs +38 -0
- package/dist/ui/src/components/auto-form/fields/switch.mjs +36 -0
- package/dist/ui/src/components/auto-form/fields/textarea.cjs +31 -0
- package/dist/ui/src/components/auto-form/fields/textarea.mjs +29 -0
- package/dist/ui/src/components/auto-form/helpers.cjs +270 -0
- package/dist/ui/src/components/auto-form/helpers.mjs +259 -0
- package/dist/ui/src/components/auto-form/index.cjs +92 -0
- package/dist/ui/src/components/auto-form/index.mjs +86 -0
- package/dist/ui/src/components/auto-form/stepped-auto-form.cjs +374 -0
- package/dist/ui/src/components/auto-form/stepped-auto-form.mjs +368 -0
- package/dist/ui/src/components/auto-form/types.cjs +11 -0
- package/dist/ui/src/components/auto-form/types.mjs +9 -0
- package/dist/ui/src/components/button.cjs +56 -0
- package/dist/ui/src/components/button.mjs +53 -0
- package/dist/ui/src/components/calendar.cjs +207 -0
- package/dist/ui/src/components/calendar.mjs +190 -0
- package/dist/ui/src/components/checkbox.cjs +48 -0
- package/dist/ui/src/components/checkbox.mjs +32 -0
- package/dist/ui/src/components/date-picker.cjs +41 -0
- package/dist/ui/src/components/date-picker.mjs +39 -0
- package/dist/ui/src/components/dialog.cjs +141 -0
- package/dist/ui/src/components/dialog.mjs +118 -0
- package/dist/ui/src/components/dropdown-menu.cjs +81 -0
- package/dist/ui/src/components/dropdown-menu.mjs +62 -0
- package/dist/ui/src/components/form-builder/canvas.cjs +111 -0
- package/dist/ui/src/components/form-builder/canvas.mjs +109 -0
- package/dist/ui/src/components/form-builder/components/index.cjs +571 -0
- package/dist/ui/src/components/form-builder/components/index.mjs +554 -0
- package/dist/ui/src/components/form-builder/edit-field-dialog.cjs +131 -0
- package/dist/ui/src/components/form-builder/edit-field-dialog.mjs +129 -0
- package/dist/ui/src/components/form-builder/form-preview.cjs +73 -0
- package/dist/ui/src/components/form-builder/form-preview.mjs +71 -0
- package/dist/ui/src/components/form-builder/index.cjs +350 -0
- package/dist/ui/src/components/form-builder/index.mjs +344 -0
- package/dist/ui/src/components/form-builder/nested-field-editor-dialog.cjs +263 -0
- package/dist/ui/src/components/form-builder/nested-field-editor-dialog.mjs +261 -0
- package/dist/ui/src/components/form-builder/palette.cjs +52 -0
- package/dist/ui/src/components/form-builder/palette.mjs +49 -0
- package/dist/ui/src/components/form-builder/schema-utils.cjs +128 -0
- package/dist/ui/src/components/form-builder/schema-utils.mjs +122 -0
- package/dist/ui/src/components/form-builder/sortable-field.cjs +151 -0
- package/dist/ui/src/components/form-builder/sortable-field.mjs +148 -0
- package/dist/ui/src/components/form-builder/step-tabs.cjs +180 -0
- package/dist/ui/src/components/form-builder/step-tabs.mjs +178 -0
- package/dist/ui/src/components/form-builder/types.cjs +7 -0
- package/dist/ui/src/components/form-builder/types.mjs +5 -0
- package/dist/ui/src/components/form-builder/validation-schemas.cjs +67 -0
- package/dist/ui/src/components/form-builder/validation-schemas.mjs +56 -0
- package/dist/ui/src/components/form.cjs +120 -0
- package/dist/ui/src/components/form.mjs +98 -0
- package/dist/ui/src/components/input.cjs +23 -0
- package/dist/ui/src/components/input.mjs +21 -0
- package/dist/ui/src/components/label.cjs +39 -0
- package/dist/ui/src/components/label.mjs +23 -0
- package/dist/ui/src/components/page-layout.cjs +25 -0
- package/dist/ui/src/components/page-layout.mjs +23 -0
- package/dist/ui/src/components/page-wrapper.cjs +20 -0
- package/dist/ui/src/components/page-wrapper.mjs +18 -0
- package/dist/ui/src/components/popover.cjs +60 -0
- package/dist/ui/src/components/popover.mjs +42 -0
- package/dist/ui/src/components/radio-group.cjs +62 -0
- package/dist/ui/src/components/radio-group.mjs +45 -0
- package/dist/ui/src/components/select.cjs +161 -0
- package/dist/ui/src/components/select.mjs +139 -0
- package/dist/ui/src/components/separator.cjs +43 -0
- package/dist/ui/src/components/separator.mjs +27 -0
- package/dist/ui/src/components/skeleton.cjs +17 -0
- package/dist/ui/src/components/skeleton.mjs +15 -0
- package/dist/ui/src/components/stack-attribution.cjs +24 -0
- package/dist/ui/src/components/stack-attribution.mjs +22 -0
- package/dist/ui/src/components/switch.cjs +48 -0
- package/dist/ui/src/components/switch.mjs +32 -0
- package/dist/ui/src/components/table.cjs +89 -0
- package/dist/ui/src/components/table.mjs +82 -0
- package/dist/ui/src/components/tabs.cjs +84 -0
- package/dist/ui/src/components/tabs.mjs +65 -0
- package/dist/ui/src/components/textarea.cjs +20 -0
- package/dist/ui/src/components/textarea.mjs +18 -0
- package/dist/ui/src/lib/schema-converter.cjs +133 -0
- package/dist/ui/src/lib/schema-converter.mjs +127 -0
- package/dist/ui/src/lib/utils.cjs +10 -0
- package/dist/ui/src/lib/utils.mjs +8 -0
- package/dist/utils.cjs +41 -0
- package/dist/utils.mjs +32 -0
- package/package.json +175 -3
- package/README.md +0 -3
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
import * as _btst_stack_client from '@btst/stack/client';
|
|
2
|
+
import * as _btst_yar from '@btst/yar';
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
import { ComponentType } from 'react';
|
|
5
|
+
import { A as AutoFormInputComponentProps, F as FormListPageComponent } from '../shared/plugin-form-builder.DWrQ3lRX.mjs';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import 'react-hook-form';
|
|
8
|
+
|
|
9
|
+
declare const FORM_BUILDER_LOCALIZATION: {
|
|
10
|
+
FORM_BUILDER_RENDERER_LOAD_FAILED: string;
|
|
11
|
+
FORM_BUILDER_RENDERER_UNEXPECTED_ERROR: string;
|
|
12
|
+
FORM_BUILDER_RENDERER_SUBMITTED_TITLE: string;
|
|
13
|
+
FORM_BUILDER_RENDERER_NOT_FOUND: string;
|
|
14
|
+
FORM_BUILDER_RENDERER_INACTIVE: string;
|
|
15
|
+
FORM_BUILDER_RENDERER_SCHEMA_ERROR: string;
|
|
16
|
+
FORM_BUILDER_RENDERER_THANK_YOU: string;
|
|
17
|
+
FORM_BUILDER_SUBMISSIONS_TITLE: string;
|
|
18
|
+
FORM_BUILDER_SUBMISSIONS_SUBTITLE: string;
|
|
19
|
+
FORM_BUILDER_SUBMISSIONS_EMPTY: string;
|
|
20
|
+
FORM_BUILDER_SUBMISSIONS_EMPTY_DESCRIPTION: string;
|
|
21
|
+
FORM_BUILDER_SUBMISSIONS_COLUMN_ID: string;
|
|
22
|
+
FORM_BUILDER_SUBMISSIONS_COLUMN_DATA: string;
|
|
23
|
+
FORM_BUILDER_SUBMISSIONS_COLUMN_SUBMITTED_AT: string;
|
|
24
|
+
FORM_BUILDER_SUBMISSIONS_COLUMN_IP_ADDRESS: string;
|
|
25
|
+
FORM_BUILDER_SUBMISSIONS_COLUMN_ACTIONS: string;
|
|
26
|
+
FORM_BUILDER_SUBMISSIONS_ACTION_VIEW: string;
|
|
27
|
+
FORM_BUILDER_SUBMISSIONS_ACTION_DELETE: string;
|
|
28
|
+
FORM_BUILDER_SUBMISSIONS_DELETE_TITLE: string;
|
|
29
|
+
FORM_BUILDER_SUBMISSIONS_DELETE_CONFIRM: string;
|
|
30
|
+
FORM_BUILDER_SUBMISSIONS_BACK_TO_FORM: string;
|
|
31
|
+
FORM_BUILDER_SUBMISSIONS_DETAILS_TITLE: string;
|
|
32
|
+
FORM_BUILDER_SUBMISSIONS_FIELD_ID: string;
|
|
33
|
+
FORM_BUILDER_SUBMISSIONS_FIELD_SUBMITTED: string;
|
|
34
|
+
FORM_BUILDER_SUBMISSIONS_FIELD_IP: string;
|
|
35
|
+
FORM_BUILDER_SUBMISSIONS_FIELD_USER_AGENT: string;
|
|
36
|
+
FORM_BUILDER_SUBMISSIONS_FIELD_DATA: string;
|
|
37
|
+
FORM_BUILDER_EDITOR_TITLE_NEW: string;
|
|
38
|
+
FORM_BUILDER_EDITOR_TITLE_EDIT: string;
|
|
39
|
+
FORM_BUILDER_EDITOR_SLUG_AUTO: string;
|
|
40
|
+
FORM_BUILDER_EDITOR_SLUG_MANUAL: string;
|
|
41
|
+
FORM_BUILDER_EDITOR_DELETE_CONFIRM: string;
|
|
42
|
+
FORM_BUILDER_EDITOR_UNSAVED_CHANGES: string;
|
|
43
|
+
FORM_BUILDER_EDITOR_NAME_PLACEHOLDER: string;
|
|
44
|
+
FORM_BUILDER_EDITOR_SLUG_PLACEHOLDER: string;
|
|
45
|
+
FORM_BUILDER_EDITOR_DESCRIPTION_PLACEHOLDER: string;
|
|
46
|
+
FORM_BUILDER_EDITOR_SUCCESS_MESSAGE_LABEL: string;
|
|
47
|
+
FORM_BUILDER_EDITOR_SUCCESS_MESSAGE_PLACEHOLDER: string;
|
|
48
|
+
FORM_BUILDER_EDITOR_REDIRECT_URL_LABEL: string;
|
|
49
|
+
FORM_BUILDER_EDITOR_REDIRECT_URL_PLACEHOLDER: string;
|
|
50
|
+
FORM_BUILDER_LIST_TITLE: string;
|
|
51
|
+
FORM_BUILDER_LIST_SUBTITLE: string;
|
|
52
|
+
FORM_BUILDER_LIST_EMPTY: string;
|
|
53
|
+
FORM_BUILDER_LIST_EMPTY_DESCRIPTION: string;
|
|
54
|
+
FORM_BUILDER_LIST_COLUMN_NAME: string;
|
|
55
|
+
FORM_BUILDER_LIST_COLUMN_SLUG: string;
|
|
56
|
+
FORM_BUILDER_LIST_COLUMN_STATUS: string;
|
|
57
|
+
FORM_BUILDER_LIST_COLUMN_CREATED: string;
|
|
58
|
+
FORM_BUILDER_LIST_COLUMN_ACTIONS: string;
|
|
59
|
+
FORM_BUILDER_LIST_ACTION_EDIT: string;
|
|
60
|
+
FORM_BUILDER_LIST_ACTION_DELETE: string;
|
|
61
|
+
FORM_BUILDER_LIST_ACTION_SUBMISSIONS: string;
|
|
62
|
+
FORM_BUILDER_LIST_DELETE_TITLE: string;
|
|
63
|
+
FORM_BUILDER_LIST_SEARCH_PLACEHOLDER: string;
|
|
64
|
+
FORM_BUILDER_LIST_SEARCH_EMPTY: string;
|
|
65
|
+
FORM_BUILDER_LIST_SEARCH_EMPTY_DESCRIPTION: string;
|
|
66
|
+
FORM_BUILDER_LIST_PAGINATION_SHOWING: string;
|
|
67
|
+
FORM_BUILDER_LIST_PAGINATION_PREVIOUS: string;
|
|
68
|
+
FORM_BUILDER_LIST_PAGINATION_NEXT: string;
|
|
69
|
+
FORM_BUILDER_TOAST_CREATE_SUCCESS: string;
|
|
70
|
+
FORM_BUILDER_TOAST_UPDATE_SUCCESS: string;
|
|
71
|
+
FORM_BUILDER_TOAST_DELETE_SUCCESS: string;
|
|
72
|
+
FORM_BUILDER_TOAST_SUBMIT_SUCCESS: string;
|
|
73
|
+
FORM_BUILDER_TOAST_ERROR: string;
|
|
74
|
+
FORM_BUILDER_TOAST_VALIDATION_ERROR: string;
|
|
75
|
+
FORM_BUILDER_TOAST_DUPLICATE_SLUG: string;
|
|
76
|
+
FORM_BUILDER_TOAST_SUBMISSION_DELETED: string;
|
|
77
|
+
FORM_BUILDER_TOAST_NAME_REQUIRED: string;
|
|
78
|
+
FORM_BUILDER_TOAST_SLUG_REQUIRED: string;
|
|
79
|
+
FORM_BUILDER_TOAST_SCHEMA_REQUIRED: string;
|
|
80
|
+
FORM_BUILDER_BUTTON_SAVE: string;
|
|
81
|
+
FORM_BUILDER_BUTTON_CANCEL: string;
|
|
82
|
+
FORM_BUILDER_BUTTON_DELETE: string;
|
|
83
|
+
FORM_BUILDER_BUTTON_CREATE: string;
|
|
84
|
+
FORM_BUILDER_BUTTON_BACK: string;
|
|
85
|
+
FORM_BUILDER_BUTTON_NEW_FORM: string;
|
|
86
|
+
FORM_BUILDER_BUTTON_SUBMIT: string;
|
|
87
|
+
FORM_BUILDER_LABEL_NAME: string;
|
|
88
|
+
FORM_BUILDER_LABEL_SLUG: string;
|
|
89
|
+
FORM_BUILDER_LABEL_SLUG_DESCRIPTION: string;
|
|
90
|
+
FORM_BUILDER_LABEL_DESCRIPTION: string;
|
|
91
|
+
FORM_BUILDER_LABEL_STATUS: string;
|
|
92
|
+
FORM_BUILDER_LABEL_CREATED_AT: string;
|
|
93
|
+
FORM_BUILDER_LABEL_UPDATED_AT: string;
|
|
94
|
+
FORM_BUILDER_LABEL_ACTIONS: string;
|
|
95
|
+
FORM_BUILDER_STATUS_LOADING: string;
|
|
96
|
+
FORM_BUILDER_STATUS_SAVING: string;
|
|
97
|
+
FORM_BUILDER_STATUS_DELETING: string;
|
|
98
|
+
FORM_BUILDER_STATUS_ACTIVE: string;
|
|
99
|
+
FORM_BUILDER_STATUS_INACTIVE: string;
|
|
100
|
+
FORM_BUILDER_STATUS_ARCHIVED: string;
|
|
101
|
+
FORM_BUILDER_ERROR_GENERIC: string;
|
|
102
|
+
FORM_BUILDER_ERROR_NOT_FOUND: string;
|
|
103
|
+
FORM_BUILDER_ERROR_VALIDATION: string;
|
|
104
|
+
FORM_BUILDER_404_TITLE: string;
|
|
105
|
+
FORM_BUILDER_404_DESCRIPTION: string;
|
|
106
|
+
FORM_BUILDER_404_BACK: string;
|
|
107
|
+
FORM_BUILDER_ATTRIBUTION: string;
|
|
108
|
+
};
|
|
109
|
+
type FormBuilderLocalization = typeof FORM_BUILDER_LOCALIZATION;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Context passed to lifecycle hooks
|
|
113
|
+
*/
|
|
114
|
+
interface RouteContext {
|
|
115
|
+
/** Current route path */
|
|
116
|
+
path: string;
|
|
117
|
+
/** Route parameters (e.g., { id: "123" }) */
|
|
118
|
+
params?: Record<string, string>;
|
|
119
|
+
/** Whether rendering on server (true) or client (false) */
|
|
120
|
+
isSSR: boolean;
|
|
121
|
+
/** Additional context properties */
|
|
122
|
+
[key: string]: unknown;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Overridable components and functions for the Form Builder plugin
|
|
126
|
+
*
|
|
127
|
+
* External consumers can provide their own implementations to customize
|
|
128
|
+
* plugin-specific components and behavior.
|
|
129
|
+
*/
|
|
130
|
+
interface FormBuilderPluginOverrides {
|
|
131
|
+
/**
|
|
132
|
+
* Custom field components for AutoForm fields.
|
|
133
|
+
*
|
|
134
|
+
* These map field type names to React components. Use these to:
|
|
135
|
+
* - Override built-in field types (checkbox, date, select, radio, switch, textarea, file, number, fallback)
|
|
136
|
+
* - Add custom field types for your forms
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```tsx
|
|
140
|
+
* fieldComponents: {
|
|
141
|
+
* // Override the file type with custom S3 upload
|
|
142
|
+
* file: ({ field, label, isRequired }) => (
|
|
143
|
+
* <MyS3Upload
|
|
144
|
+
* value={field.value}
|
|
145
|
+
* onChange={field.onChange}
|
|
146
|
+
* label={label}
|
|
147
|
+
* required={isRequired}
|
|
148
|
+
* />
|
|
149
|
+
* ),
|
|
150
|
+
* // Add a custom rich text editor
|
|
151
|
+
* richText: ({ field, label }) => (
|
|
152
|
+
* <MyRichTextEditor value={field.value} onChange={field.onChange} />
|
|
153
|
+
* ),
|
|
154
|
+
* }
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
fieldComponents?: Record<string, ComponentType<AutoFormInputComponentProps>>;
|
|
158
|
+
/**
|
|
159
|
+
* Optional class names merged onto specific UI elements.
|
|
160
|
+
* Use these for targeted styling without replacing whole components.
|
|
161
|
+
*/
|
|
162
|
+
classNames?: {
|
|
163
|
+
/** Page container shared by every Form Builder page */
|
|
164
|
+
container?: string;
|
|
165
|
+
/** Wrapper around the forms or submissions table */
|
|
166
|
+
table?: string;
|
|
167
|
+
/** Each body row in the forms or submissions table */
|
|
168
|
+
tableRow?: string;
|
|
169
|
+
/** Pagination footer under the forms or submissions list */
|
|
170
|
+
pagination?: string;
|
|
171
|
+
/** Root of `FormRenderer`, including loading, error, and success states */
|
|
172
|
+
form?: string;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Localization object for the Form Builder plugin
|
|
176
|
+
*/
|
|
177
|
+
localization?: Partial<FormBuilderLocalization>;
|
|
178
|
+
/**
|
|
179
|
+
* Whether to show the attribution
|
|
180
|
+
*/
|
|
181
|
+
showAttribution?: boolean;
|
|
182
|
+
/**
|
|
183
|
+
* Called when a route is rendered
|
|
184
|
+
* @param routeName - Name of the route (e.g., 'formList', 'formBuilder', 'submissions')
|
|
185
|
+
* @param context - Route context with path, params, etc.
|
|
186
|
+
*/
|
|
187
|
+
onRouteRender?: (routeName: string, context: RouteContext) => void | Promise<void>;
|
|
188
|
+
/**
|
|
189
|
+
* Called when a route encounters an error
|
|
190
|
+
* @param routeName - Name of the route
|
|
191
|
+
* @param error - The error that occurred
|
|
192
|
+
* @param context - Route context
|
|
193
|
+
*/
|
|
194
|
+
onRouteError?: (routeName: string, error: Error, context: RouteContext) => void | Promise<void>;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Context passed to loader hooks
|
|
199
|
+
*/
|
|
200
|
+
interface LoaderContext {
|
|
201
|
+
/** Current route path */
|
|
202
|
+
path: string;
|
|
203
|
+
/** Route parameters (e.g., { id: "123" }) */
|
|
204
|
+
params?: Record<string, string>;
|
|
205
|
+
/** Whether rendering on server (true) or client (false) */
|
|
206
|
+
isSSR: boolean;
|
|
207
|
+
/** Base URL for API calls */
|
|
208
|
+
apiBaseURL: string;
|
|
209
|
+
/** Path where the API is mounted */
|
|
210
|
+
apiBasePath: string;
|
|
211
|
+
/** Optional headers for the request */
|
|
212
|
+
headers?: Headers;
|
|
213
|
+
/** Additional context properties */
|
|
214
|
+
[key: string]: unknown;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Hooks for Form Builder client plugin
|
|
218
|
+
* All hooks are optional and allow consumers to customize behavior
|
|
219
|
+
*/
|
|
220
|
+
interface FormBuilderClientHooks {
|
|
221
|
+
/**
|
|
222
|
+
* Called before loading the form list page. Throw an error to cancel loading.
|
|
223
|
+
* @param context - Loader context with path, params, etc.
|
|
224
|
+
*/
|
|
225
|
+
beforeLoadFormList?: (context: LoaderContext) => Promise<void> | void;
|
|
226
|
+
/**
|
|
227
|
+
* Called after the form list is loaded.
|
|
228
|
+
* @param context - Loader context
|
|
229
|
+
*/
|
|
230
|
+
afterLoadFormList?: (context: LoaderContext) => Promise<void> | void;
|
|
231
|
+
/**
|
|
232
|
+
* Called before loading the form builder page. Throw an error to cancel loading.
|
|
233
|
+
* @param id - The form ID (undefined for new forms)
|
|
234
|
+
* @param context - Loader context
|
|
235
|
+
*/
|
|
236
|
+
beforeLoadFormBuilder?: (id: string | undefined, context: LoaderContext) => Promise<void> | void;
|
|
237
|
+
/**
|
|
238
|
+
* Called after the form builder is loaded.
|
|
239
|
+
* @param id - The form ID (undefined for new forms)
|
|
240
|
+
* @param context - Loader context
|
|
241
|
+
*/
|
|
242
|
+
afterLoadFormBuilder?: (id: string | undefined, context: LoaderContext) => Promise<void> | void;
|
|
243
|
+
/**
|
|
244
|
+
* Called before loading the submissions page. Throw an error to cancel loading.
|
|
245
|
+
* @param formId - The form ID
|
|
246
|
+
* @param context - Loader context
|
|
247
|
+
*/
|
|
248
|
+
beforeLoadSubmissions?: (formId: string, context: LoaderContext) => Promise<void> | void;
|
|
249
|
+
/**
|
|
250
|
+
* Called after the submissions page is loaded.
|
|
251
|
+
* @param formId - The form ID
|
|
252
|
+
* @param context - Loader context
|
|
253
|
+
*/
|
|
254
|
+
afterLoadSubmissions?: (formId: string, context: LoaderContext) => Promise<void> | void;
|
|
255
|
+
/**
|
|
256
|
+
* Called when a loading error occurs.
|
|
257
|
+
* Use this to report loader failures. Router error handling remains authoritative.
|
|
258
|
+
* @param error - The error that occurred
|
|
259
|
+
* @param context - Loader context
|
|
260
|
+
*/
|
|
261
|
+
onErrorLoad?: (error: Error, context: LoaderContext) => Promise<void> | void;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Configuration for Form Builder client plugin
|
|
265
|
+
*/
|
|
266
|
+
interface FormBuilderClientConfig {
|
|
267
|
+
/** Optional hooks for route loading, redirects, and telemetry. */
|
|
268
|
+
hooks?: FormBuilderClientHooks;
|
|
269
|
+
/**
|
|
270
|
+
* Optional page component overrides.
|
|
271
|
+
* Replace any plugin page with a custom React component.
|
|
272
|
+
* The built-in component is used as the fallback when not provided.
|
|
273
|
+
*/
|
|
274
|
+
pageComponents?: {
|
|
275
|
+
/** Replaces the form list page */
|
|
276
|
+
formList?: ComponentType;
|
|
277
|
+
/** Replaces the new form page */
|
|
278
|
+
newForm?: ComponentType;
|
|
279
|
+
/** Replaces the form editor page */
|
|
280
|
+
editForm?: ComponentType<{
|
|
281
|
+
params: {
|
|
282
|
+
id: string;
|
|
283
|
+
};
|
|
284
|
+
}>;
|
|
285
|
+
/** Replaces the form submissions page */
|
|
286
|
+
submissions?: ComponentType<{
|
|
287
|
+
params: {
|
|
288
|
+
id: string;
|
|
289
|
+
};
|
|
290
|
+
}>;
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
declare const formBuilderClientPlugin: (config?: FormBuilderClientConfig) => _btst_stack_client.ClientPluginDefinition<FormBuilderPluginOverrides, {
|
|
294
|
+
formList: _btst_yar.DefinedRoute<"/forms", {
|
|
295
|
+
readonly page: react.LazyExoticComponent<typeof FormListPageComponent>;
|
|
296
|
+
readonly loader: () => Promise<void>;
|
|
297
|
+
readonly meta: () => ({
|
|
298
|
+
title: string;
|
|
299
|
+
name?: undefined;
|
|
300
|
+
content?: undefined;
|
|
301
|
+
} | {
|
|
302
|
+
name: string;
|
|
303
|
+
content: string;
|
|
304
|
+
title?: undefined;
|
|
305
|
+
})[];
|
|
306
|
+
}, _btst_yar.RouteMeta>;
|
|
307
|
+
newForm: _btst_yar.DefinedRoute<"/forms/new", {
|
|
308
|
+
readonly page: () => react.JSX.Element;
|
|
309
|
+
readonly loader: () => Promise<void>;
|
|
310
|
+
readonly meta: () => ({
|
|
311
|
+
title: string;
|
|
312
|
+
name?: undefined;
|
|
313
|
+
content?: undefined;
|
|
314
|
+
} | {
|
|
315
|
+
name: string;
|
|
316
|
+
content: string;
|
|
317
|
+
title?: undefined;
|
|
318
|
+
})[];
|
|
319
|
+
}, _btst_yar.RouteMeta>;
|
|
320
|
+
editForm: _btst_yar.DefinedRoute<"/forms/:id/edit", {
|
|
321
|
+
readonly page: ({ params }: _btst_yar.RouteContext<"/forms/:id/edit", _btst_yar.RouteOptions>) => react.JSX.Element;
|
|
322
|
+
readonly loader: ({ params }: _btst_yar.RouteContext<"/forms/:id/edit", _btst_yar.RouteOptions>) => Promise<void>;
|
|
323
|
+
readonly meta: ({ params }: _btst_yar.RouteContext<"/forms/:id/edit", _btst_yar.RouteOptions>) => ({
|
|
324
|
+
title: string;
|
|
325
|
+
name?: undefined;
|
|
326
|
+
content?: undefined;
|
|
327
|
+
} | {
|
|
328
|
+
name: string;
|
|
329
|
+
content: string;
|
|
330
|
+
title?: undefined;
|
|
331
|
+
})[];
|
|
332
|
+
}, _btst_yar.RouteMeta>;
|
|
333
|
+
submissions: _btst_yar.DefinedRoute<"/forms/:id/submissions", {
|
|
334
|
+
readonly page: ({ params }: _btst_yar.RouteContext<"/forms/:id/submissions", _btst_yar.RouteOptions>) => react.JSX.Element;
|
|
335
|
+
readonly loader: ({ params }: _btst_yar.RouteContext<"/forms/:id/submissions", _btst_yar.RouteOptions>) => Promise<void>;
|
|
336
|
+
readonly meta: ({ params }: _btst_yar.RouteContext<"/forms/:id/submissions", _btst_yar.RouteOptions>) => ({
|
|
337
|
+
title: string;
|
|
338
|
+
name?: undefined;
|
|
339
|
+
content?: undefined;
|
|
340
|
+
} | {
|
|
341
|
+
name: string;
|
|
342
|
+
content: string;
|
|
343
|
+
title?: undefined;
|
|
344
|
+
})[];
|
|
345
|
+
}, _btst_yar.RouteMeta>;
|
|
346
|
+
}, "formBuilder", Readonly<Record<string, never>>, never>;
|
|
347
|
+
|
|
348
|
+
interface FormStep {
|
|
349
|
+
id: string;
|
|
350
|
+
title: string;
|
|
351
|
+
}
|
|
352
|
+
interface FormSchemaMetadata {
|
|
353
|
+
/** Multi-step form step definitions */
|
|
354
|
+
steps?: FormStep[];
|
|
355
|
+
/** Map of field names to their step indices */
|
|
356
|
+
stepGroupMap?: Record<string, number>;
|
|
357
|
+
}
|
|
358
|
+
interface JsonSchemaProperty {
|
|
359
|
+
type?: string;
|
|
360
|
+
format?: string;
|
|
361
|
+
formatMinimum?: string;
|
|
362
|
+
formatMaximum?: string;
|
|
363
|
+
stepGroup?: number;
|
|
364
|
+
properties?: Record<string, JsonSchemaProperty>;
|
|
365
|
+
[key: string]: unknown;
|
|
366
|
+
}
|
|
367
|
+
interface FormJsonSchema {
|
|
368
|
+
type?: string;
|
|
369
|
+
properties?: Record<string, JsonSchemaProperty>;
|
|
370
|
+
required?: string[];
|
|
371
|
+
steps?: FormStep[];
|
|
372
|
+
stepGroupMap?: Record<string, number>;
|
|
373
|
+
[key: string]: unknown;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Convert a Zod schema to JSON Schema with proper handling for:
|
|
377
|
+
* - z.date() → { type: "string", format: "date-time" }
|
|
378
|
+
* - Date min/max constraints → formatMinimum/formatMaximum
|
|
379
|
+
* - Steps metadata (if provided via schema.meta() or explicit metadata param)
|
|
380
|
+
*
|
|
381
|
+
* @param schema - The Zod schema to convert
|
|
382
|
+
* @param metadata - Optional explicit metadata to include (overrides schema meta)
|
|
383
|
+
*/
|
|
384
|
+
declare function zodToFormSchema<T extends z.ZodType>(schema: T, metadata?: FormSchemaMetadata): FormJsonSchema;
|
|
385
|
+
/**
|
|
386
|
+
* Convert JSON Schema to Zod schema with proper handling for:
|
|
387
|
+
* - { type: "string", format: "date-time" } → date field (with constraints)
|
|
388
|
+
* - Steps metadata re-attachment (preserved via .meta())
|
|
389
|
+
* - Step group mapping
|
|
390
|
+
*
|
|
391
|
+
* @param jsonSchema - The JSON Schema to convert
|
|
392
|
+
* @returns A Zod schema ready for validation, with all metadata preserved
|
|
393
|
+
*/
|
|
394
|
+
declare function formSchemaToZod(jsonSchema: FormJsonSchema): z.ZodType;
|
|
395
|
+
/**
|
|
396
|
+
* Check if a JSON Schema has multi-step configuration.
|
|
397
|
+
*/
|
|
398
|
+
declare function hasSteps(jsonSchema: FormJsonSchema): boolean;
|
|
399
|
+
/**
|
|
400
|
+
* Get steps from a JSON Schema.
|
|
401
|
+
*/
|
|
402
|
+
declare function getSteps(jsonSchema: FormJsonSchema): FormStep[];
|
|
403
|
+
/**
|
|
404
|
+
* Get the step group map from a JSON Schema.
|
|
405
|
+
* Returns a map of field names to step indices.
|
|
406
|
+
*/
|
|
407
|
+
declare function getStepGroupMap(jsonSchema: FormJsonSchema): Record<string, number>;
|
|
408
|
+
|
|
409
|
+
export { AutoFormInputComponentProps, formBuilderClientPlugin, formSchemaToZod, getStepGroupMap, getSteps, hasSteps, zodToFormSchema };
|
|
410
|
+
export type { FormBuilderClientConfig, FormBuilderClientHooks, FormBuilderLocalization, FormBuilderPluginOverrides, FormSchemaMetadata, FormStep, LoaderContext, RouteContext };
|