@btst/plugin-form-builder 1.0.0 → 1.2.0-beta.1

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 (84) hide show
  1. package/dist/api/index.cjs +1 -0
  2. package/dist/api/index.d.cts +1 -1
  3. package/dist/api/index.d.mts +1 -1
  4. package/dist/api/index.d.ts +1 -1
  5. package/dist/api/index.mjs +1 -1
  6. package/dist/api/operations.cjs +64 -4
  7. package/dist/api/operations.mjs +64 -5
  8. package/dist/api/plugin.cjs +8 -0
  9. package/dist/api/plugin.mjs +8 -0
  10. package/dist/api/submissions-csv.cjs +69 -0
  11. package/dist/api/submissions-csv.mjs +64 -0
  12. package/dist/client/components/forms/form-renderer.cjs +31 -2
  13. package/dist/client/components/forms/form-renderer.mjs +31 -2
  14. package/dist/client/components/forms/media-file-field.cjs +48 -0
  15. package/dist/client/components/forms/media-file-field.mjs +46 -0
  16. package/dist/client/components/index.d.cts +4 -2
  17. package/dist/client/components/index.d.mts +4 -2
  18. package/dist/client/components/index.d.ts +4 -2
  19. package/dist/client/components/pages/ai-schema.cjs +120 -0
  20. package/dist/client/components/pages/ai-schema.mjs +118 -0
  21. package/dist/client/components/pages/form-builder-page.internal.cjs +40 -1
  22. package/dist/client/components/pages/form-builder-page.internal.mjs +41 -2
  23. package/dist/client/components/pages/form-list-page.internal.cjs +1 -0
  24. package/dist/client/components/pages/form-list-page.internal.mjs +1 -0
  25. package/dist/client/components/pages/submissions-page.internal.cjs +40 -0
  26. package/dist/client/components/pages/submissions-page.internal.mjs +41 -1
  27. package/dist/client/components/shared/pagination.cjs +19 -0
  28. package/dist/client/components/shared/pagination.mjs +20 -1
  29. package/dist/client/hooks/form-builder-hooks.cjs +4 -0
  30. package/dist/client/hooks/form-builder-hooks.mjs +4 -1
  31. package/dist/client/hooks/index.cjs +1 -0
  32. package/dist/client/hooks/index.d.cts +7 -2
  33. package/dist/client/hooks/index.d.mts +7 -2
  34. package/dist/client/hooks/index.d.ts +7 -2
  35. package/dist/client/hooks/index.mjs +1 -1
  36. package/dist/client/index.d.cts +42 -3
  37. package/dist/client/index.d.mts +42 -3
  38. package/dist/client/index.d.ts +42 -3
  39. package/dist/permissions.cjs +8 -0
  40. package/dist/permissions.d.cts +6 -0
  41. package/dist/permissions.d.mts +6 -0
  42. package/dist/permissions.d.ts +6 -0
  43. package/dist/permissions.mjs +8 -0
  44. package/dist/query-keys.cjs +7 -0
  45. package/dist/query-keys.d.cts +29 -1
  46. package/dist/query-keys.d.mts +29 -1
  47. package/dist/query-keys.d.ts +29 -1
  48. package/dist/query-keys.mjs +7 -0
  49. package/dist/shared/{plugin-form-builder.CSP5HR2O.d.ts → plugin-form-builder.65tLgfcd.d.ts} +46 -29
  50. package/dist/shared/{plugin-form-builder.Bbl9NufB.d.cts → plugin-form-builder.DXdOj9vM.d.cts} +46 -29
  51. package/dist/shared/{plugin-form-builder.lp98rFNl.d.mts → plugin-form-builder.PWs25HN1.d.mts} +46 -29
  52. package/dist/shared/{plugin-form-builder.DWrQ3lRX.d.ts → plugin-form-builder.sdjcoJcH.d.cts} +15 -1
  53. package/dist/shared/{plugin-form-builder.DWrQ3lRX.d.cts → plugin-form-builder.sdjcoJcH.d.mts} +15 -1
  54. package/dist/shared/{plugin-form-builder.DWrQ3lRX.d.mts → plugin-form-builder.sdjcoJcH.d.ts} +15 -1
  55. package/dist/ui/src/components/auto-form/config.cjs +2 -0
  56. package/dist/ui/src/components/auto-form/config.mjs +2 -0
  57. package/dist/ui/src/components/auto-form/fields/file.cjs +68 -0
  58. package/dist/ui/src/components/auto-form/fields/file.mjs +63 -0
  59. package/dist/ui/src/components/auto-form/fields/object.cjs +9 -2
  60. package/dist/ui/src/components/auto-form/fields/object.mjs +9 -2
  61. package/dist/ui/src/components/auto-form/helpers.cjs +9 -0
  62. package/dist/ui/src/components/auto-form/helpers.mjs +9 -0
  63. package/dist/ui/src/components/auto-form/index.cjs +29 -4
  64. package/dist/ui/src/components/auto-form/index.mjs +31 -6
  65. package/dist/ui/src/components/auto-form/stepped-auto-form.cjs +34 -29
  66. package/dist/ui/src/components/auto-form/stepped-auto-form.mjs +35 -30
  67. package/dist/ui/src/components/form-builder/canvas.cjs +9 -0
  68. package/dist/ui/src/components/form-builder/canvas.mjs +9 -0
  69. package/dist/ui/src/components/form-builder/components/index.cjs +12 -0
  70. package/dist/ui/src/components/form-builder/components/index.mjs +12 -1
  71. package/dist/ui/src/components/form-builder/condition-editor.cjs +73 -0
  72. package/dist/ui/src/components/form-builder/condition-editor.mjs +71 -0
  73. package/dist/ui/src/components/form-builder/edit-field-dialog.cjs +6 -2
  74. package/dist/ui/src/components/form-builder/edit-field-dialog.mjs +6 -2
  75. package/dist/ui/src/components/form-builder/index.cjs +6 -1
  76. package/dist/ui/src/components/form-builder/index.mjs +6 -1
  77. package/dist/ui/src/components/form-builder/schema-utils.cjs +2 -0
  78. package/dist/ui/src/components/form-builder/schema-utils.mjs +2 -0
  79. package/dist/ui/src/components/form.mjs +1 -1
  80. package/dist/ui/src/lib/form-visibility.cjs +20 -0
  81. package/dist/ui/src/lib/form-visibility.mjs +18 -0
  82. package/dist/ui/src/lib/schema-converter.cjs +101 -0
  83. package/dist/ui/src/lib/schema-converter.mjs +100 -1
  84. package/package.json +4 -4
@@ -2,11 +2,30 @@
2
2
  'use strict';
3
3
 
4
4
  const jsxRuntime = require('react/jsx-runtime');
5
+ const context = require('@btst/stack/context');
6
+ const constants = require('../../constants.cjs');
5
7
  const button = require('../../../ui/src/components/button.cjs');
6
8
  const lucideReact = require('lucide-react');
7
9
  const utils = require('../../../utils.cjs');
8
10
 
9
11
  function Pagination({
12
+ page,
13
+ ...props
14
+ }) {
15
+ if (!page) return /* @__PURE__ */ jsxRuntime.jsx(DefaultPagination, { ...props });
16
+ return /* @__PURE__ */ jsxRuntime.jsx(ScopedPagination, { page, ...props });
17
+ }
18
+ function ScopedPagination({
19
+ page,
20
+ ...props
21
+ }) {
22
+ const { pageOverrides } = context.usePluginOverrides(
23
+ constants.FORM_BUILDER_PLUGIN_ID
24
+ );
25
+ const Controls = (page ? pageOverrides?.[page]?.Pagination : void 0) ?? DefaultPagination;
26
+ return /* @__PURE__ */ jsxRuntime.jsx(Controls, { ...props });
27
+ }
28
+ function DefaultPagination({
10
29
  total,
11
30
  showing,
12
31
  hasMore,
@@ -1,10 +1,29 @@
1
1
  'use client';
2
- import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { usePluginOverrides } from '@btst/stack/context';
4
+ import { FORM_BUILDER_PLUGIN_ID } from '../../constants.mjs';
3
5
  import { Button } from '../../../ui/src/components/button.mjs';
4
6
  import { ChevronRight } from 'lucide-react';
5
7
  import { cn } from '../../../utils.mjs';
6
8
 
7
9
  function Pagination({
10
+ page,
11
+ ...props
12
+ }) {
13
+ if (!page) return /* @__PURE__ */ jsx(DefaultPagination, { ...props });
14
+ return /* @__PURE__ */ jsx(ScopedPagination, { page, ...props });
15
+ }
16
+ function ScopedPagination({
17
+ page,
18
+ ...props
19
+ }) {
20
+ const { pageOverrides } = usePluginOverrides(
21
+ FORM_BUILDER_PLUGIN_ID
22
+ );
23
+ const Controls = (page ? pageOverrides?.[page]?.Pagination : void 0) ?? DefaultPagination;
24
+ return /* @__PURE__ */ jsx(Controls, { ...props });
25
+ }
26
+ function DefaultPagination({
8
27
  total,
9
28
  showing,
10
29
  hasMore,
@@ -184,10 +184,14 @@ function useDeleteSubmission(formId) {
184
184
  mutateAsync: (subId) => mutation.mutateAsync({ formId, subId })
185
185
  };
186
186
  }
187
+ function useExportSubmissions() {
188
+ return formBuilderResource.formBuilder.formSubmissions.export.use();
189
+ }
187
190
 
188
191
  exports.useCreateForm = useCreateForm;
189
192
  exports.useDeleteForm = useDeleteForm;
190
193
  exports.useDeleteSubmission = useDeleteSubmission;
194
+ exports.useExportSubmissions = useExportSubmissions;
191
195
  exports.useFormBuilderForm = useFormBuilderForm;
192
196
  exports.useFormById = useFormById;
193
197
  exports.useFormBySlug = useFormBySlug;
@@ -182,5 +182,8 @@ function useDeleteSubmission(formId) {
182
182
  mutateAsync: (subId) => mutation.mutateAsync({ formId, subId })
183
183
  };
184
184
  }
185
+ function useExportSubmissions() {
186
+ return formBuilder.formSubmissions.export.use();
187
+ }
185
188
 
186
- export { useCreateForm, useDeleteForm, useDeleteSubmission, useFormBuilderForm, useFormById, useFormBySlug, useForms, useSubmission, useSubmissions, useSubmitForm, useSuspenseFormById, useSuspenseFormBySlug, useSuspenseFormForUpdate, useSuspenseForms, useSuspenseSubmissions, useUpdateForm };
189
+ export { useCreateForm, useDeleteForm, useDeleteSubmission, useExportSubmissions, useFormBuilderForm, useFormById, useFormBySlug, useForms, useSubmission, useSubmissions, useSubmitForm, useSuspenseFormById, useSuspenseFormBySlug, useSuspenseFormForUpdate, useSuspenseForms, useSuspenseSubmissions, useUpdateForm };
@@ -7,6 +7,7 @@ const formBuilderHooks = require('./form-builder-hooks.cjs');
7
7
  exports.useCreateForm = formBuilderHooks.useCreateForm;
8
8
  exports.useDeleteForm = formBuilderHooks.useDeleteForm;
9
9
  exports.useDeleteSubmission = formBuilderHooks.useDeleteSubmission;
10
+ exports.useExportSubmissions = formBuilderHooks.useExportSubmissions;
10
11
  exports.useFormBuilderForm = formBuilderHooks.useFormBuilderForm;
11
12
  exports.useFormById = formBuilderHooks.useFormById;
12
13
  exports.useFormBySlug = formBuilderHooks.useFormBySlug;
@@ -11,7 +11,7 @@ import '@btst/stack/context';
11
11
  import '../../permissions.cjs';
12
12
  import 'zod';
13
13
  import '@btst/stack/plugins/client';
14
- import '../../shared/plugin-form-builder.Bbl9NufB.cjs';
14
+ import '../../shared/plugin-form-builder.DXdOj9vM.cjs';
15
15
  import '@btst/db';
16
16
  import 'zod/v4/core';
17
17
  import 'better-call';
@@ -373,6 +373,11 @@ declare function useDeleteSubmission(formId: string): {
373
373
  isPaused: boolean;
374
374
  submittedAt: number;
375
375
  };
376
+ /** Export all submissions after the server checks the export permission. */
377
+ declare function useExportSubmissions(): _tanstack_react_query.UseMutationResult<{
378
+ csv: string;
379
+ filename: string;
380
+ }, Error, string>;
376
381
 
377
- export { CreateFormInput, SerializedFormSubmissionSummary, UpdateFormInput, useCreateForm, useDeleteForm, useDeleteSubmission, useFormBuilderForm, useFormById, useFormBySlug, useForms, useSubmission, useSubmissions, useSubmitForm, useSuspenseFormById, useSuspenseFormBySlug, useSuspenseFormForUpdate, useSuspenseForms, useSuspenseSubmissions, useUpdateForm };
382
+ export { CreateFormInput, SerializedFormSubmissionSummary, UpdateFormInput, useCreateForm, useDeleteForm, useDeleteSubmission, useExportSubmissions, useFormBuilderForm, useFormById, useFormBySlug, useForms, useSubmission, useSubmissions, useSubmitForm, useSuspenseFormById, useSuspenseFormBySlug, useSuspenseFormForUpdate, useSuspenseForms, useSuspenseSubmissions, useUpdateForm };
378
383
  export type { UseFormsOptions, UseFormsResult, UseSubmissionOptions, UseSubmissionsOptions, UseSubmissionsResult };
@@ -11,7 +11,7 @@ import '@btst/stack/context';
11
11
  import '../../permissions.mjs';
12
12
  import 'zod';
13
13
  import '@btst/stack/plugins/client';
14
- import '../../shared/plugin-form-builder.lp98rFNl.mjs';
14
+ import '../../shared/plugin-form-builder.PWs25HN1.mjs';
15
15
  import '@btst/db';
16
16
  import 'zod/v4/core';
17
17
  import 'better-call';
@@ -373,6 +373,11 @@ declare function useDeleteSubmission(formId: string): {
373
373
  isPaused: boolean;
374
374
  submittedAt: number;
375
375
  };
376
+ /** Export all submissions after the server checks the export permission. */
377
+ declare function useExportSubmissions(): _tanstack_react_query.UseMutationResult<{
378
+ csv: string;
379
+ filename: string;
380
+ }, Error, string>;
376
381
 
377
- export { CreateFormInput, SerializedFormSubmissionSummary, UpdateFormInput, useCreateForm, useDeleteForm, useDeleteSubmission, useFormBuilderForm, useFormById, useFormBySlug, useForms, useSubmission, useSubmissions, useSubmitForm, useSuspenseFormById, useSuspenseFormBySlug, useSuspenseFormForUpdate, useSuspenseForms, useSuspenseSubmissions, useUpdateForm };
382
+ export { CreateFormInput, SerializedFormSubmissionSummary, UpdateFormInput, useCreateForm, useDeleteForm, useDeleteSubmission, useExportSubmissions, useFormBuilderForm, useFormById, useFormBySlug, useForms, useSubmission, useSubmissions, useSubmitForm, useSuspenseFormById, useSuspenseFormBySlug, useSuspenseFormForUpdate, useSuspenseForms, useSuspenseSubmissions, useUpdateForm };
378
383
  export type { UseFormsOptions, UseFormsResult, UseSubmissionOptions, UseSubmissionsOptions, UseSubmissionsResult };
@@ -11,7 +11,7 @@ import '@btst/stack/context';
11
11
  import '../../permissions.js';
12
12
  import 'zod';
13
13
  import '@btst/stack/plugins/client';
14
- import '../../shared/plugin-form-builder.CSP5HR2O.js';
14
+ import '../../shared/plugin-form-builder.65tLgfcd.js';
15
15
  import '@btst/db';
16
16
  import 'zod/v4/core';
17
17
  import 'better-call';
@@ -373,6 +373,11 @@ declare function useDeleteSubmission(formId: string): {
373
373
  isPaused: boolean;
374
374
  submittedAt: number;
375
375
  };
376
+ /** Export all submissions after the server checks the export permission. */
377
+ declare function useExportSubmissions(): _tanstack_react_query.UseMutationResult<{
378
+ csv: string;
379
+ filename: string;
380
+ }, Error, string>;
376
381
 
377
- export { CreateFormInput, SerializedFormSubmissionSummary, UpdateFormInput, useCreateForm, useDeleteForm, useDeleteSubmission, useFormBuilderForm, useFormById, useFormBySlug, useForms, useSubmission, useSubmissions, useSubmitForm, useSuspenseFormById, useSuspenseFormBySlug, useSuspenseFormForUpdate, useSuspenseForms, useSuspenseSubmissions, useUpdateForm };
382
+ export { CreateFormInput, SerializedFormSubmissionSummary, UpdateFormInput, useCreateForm, useDeleteForm, useDeleteSubmission, useExportSubmissions, useFormBuilderForm, useFormById, useFormBySlug, useForms, useSubmission, useSubmissions, useSubmitForm, useSuspenseFormById, useSuspenseFormBySlug, useSuspenseFormForUpdate, useSuspenseForms, useSuspenseSubmissions, useUpdateForm };
378
383
  export type { UseFormsOptions, UseFormsResult, UseSubmissionOptions, UseSubmissionsOptions, UseSubmissionsResult };
@@ -1 +1 @@
1
- export { useCreateForm, useDeleteForm, useDeleteSubmission, useFormBuilderForm, useFormById, useFormBySlug, useForms, useSubmission, useSubmissions, useSubmitForm, useSuspenseFormById, useSuspenseFormBySlug, useSuspenseFormForUpdate, useSuspenseForms, useSuspenseSubmissions, useUpdateForm } from './form-builder-hooks.mjs';
1
+ export { useCreateForm, useDeleteForm, useDeleteSubmission, useExportSubmissions, useFormBuilderForm, useFormById, useFormBySlug, useForms, useSubmission, useSubmissions, useSubmitForm, useSuspenseFormById, useSuspenseFormBySlug, useSuspenseFormForUpdate, useSuspenseForms, useSuspenseSubmissions, useUpdateForm } from './form-builder-hooks.mjs';
@@ -1,11 +1,28 @@
1
+ 'use client';
1
2
  import * as _btst_stack_client from '@btst/stack/client';
2
3
  import * as _btst_yar from '@btst/yar';
3
4
  import * as react from 'react';
4
5
  import { ComponentType } from 'react';
5
- import { A as AutoFormInputComponentProps, F as FormListPageComponent } from '../shared/plugin-form-builder.DWrQ3lRX.cjs';
6
+ import { A as AutoFormInputComponentProps, F as FormListPageComponent, S as ShowIfCondition } from '../shared/plugin-form-builder.sdjcoJcH.cjs';
6
7
  import { z } from 'zod';
7
8
  import 'react-hook-form';
8
9
 
10
+ /** Pagination data, labels, and load action supplied by a built-in list. */
11
+ interface PaginationProps {
12
+ total: number;
13
+ showing: number;
14
+ hasMore: boolean;
15
+ isLoadingMore: boolean;
16
+ onLoadMore: () => void;
17
+ className?: string;
18
+ labels?: {
19
+ showing?: string;
20
+ previous?: string;
21
+ next?: string;
22
+ loading?: string;
23
+ };
24
+ }
25
+
9
26
  declare const FORM_BUILDER_LOCALIZATION: {
10
27
  FORM_BUILDER_RENDERER_LOAD_FAILED: string;
11
28
  FORM_BUILDER_RENDERER_UNEXPECTED_ERROR: string;
@@ -128,6 +145,23 @@ interface RouteContext {
128
145
  * plugin-specific components and behavior.
129
146
  */
130
147
  interface FormBuilderPluginOverrides {
148
+ /** Pagination presentation for the built-in forms and submissions lists. */
149
+ pageOverrides?: Partial<Record<"formList" | "submissions", {
150
+ Pagination?: ComponentType<PaginationProps>;
151
+ }>>;
152
+ /** Upload standalone form files. Takes precedence over the legacy onUpload override. */
153
+ uploadFile?: (file: File) => Promise<string>;
154
+ /** Select an existing file URL instead of the default native upload input. */
155
+ imagePicker?: ComponentType<{
156
+ onSelect: (url: string) => void;
157
+ }>;
158
+ /** Replace the file input. Takes precedence over imagePicker; can select any supported file. */
159
+ imageInputField?: ComponentType<{
160
+ value: string;
161
+ onChange: (url: string) => void;
162
+ }>;
163
+ /** Upload standalone form files and return their URL string. */
164
+ onUpload?: (file: File) => Promise<string>;
131
165
  /**
132
166
  * Custom field components for AutoForm fields.
133
167
  *
@@ -348,6 +382,8 @@ declare const formBuilderClientPlugin: (config?: FormBuilderClientConfig) => _bt
348
382
  interface FormStep {
349
383
  id: string;
350
384
  title: string;
385
+ /** Display this step only when its condition matches. */
386
+ showIf?: ShowIfCondition;
351
387
  }
352
388
  interface FormSchemaMetadata {
353
389
  /** Multi-step form step definitions */
@@ -361,6 +397,9 @@ interface JsonSchemaProperty {
361
397
  formatMinimum?: string;
362
398
  formatMaximum?: string;
363
399
  stepGroup?: number;
400
+ showIf?: ShowIfCondition;
401
+ items?: JsonSchemaProperty;
402
+ required?: string[];
364
403
  properties?: Record<string, JsonSchemaProperty>;
365
404
  [key: string]: unknown;
366
405
  }
@@ -406,5 +445,5 @@ declare function getSteps(jsonSchema: FormJsonSchema): FormStep[];
406
445
  */
407
446
  declare function getStepGroupMap(jsonSchema: FormJsonSchema): Record<string, number>;
408
447
 
409
- export { AutoFormInputComponentProps, formBuilderClientPlugin, formSchemaToZod, getStepGroupMap, getSteps, hasSteps, zodToFormSchema };
410
- export type { FormBuilderClientConfig, FormBuilderClientHooks, FormBuilderLocalization, FormBuilderPluginOverrides, FormSchemaMetadata, FormStep, LoaderContext, RouteContext };
448
+ export { AutoFormInputComponentProps, ShowIfCondition, formBuilderClientPlugin, formSchemaToZod, getStepGroupMap, getSteps, hasSteps, zodToFormSchema };
449
+ export type { FormBuilderClientConfig, FormBuilderClientHooks, FormBuilderLocalization, FormBuilderPluginOverrides, FormSchemaMetadata, FormStep, LoaderContext, PaginationProps, RouteContext };
@@ -1,11 +1,28 @@
1
+ 'use client';
1
2
  import * as _btst_stack_client from '@btst/stack/client';
2
3
  import * as _btst_yar from '@btst/yar';
3
4
  import * as react from 'react';
4
5
  import { ComponentType } from 'react';
5
- import { A as AutoFormInputComponentProps, F as FormListPageComponent } from '../shared/plugin-form-builder.DWrQ3lRX.mjs';
6
+ import { A as AutoFormInputComponentProps, F as FormListPageComponent, S as ShowIfCondition } from '../shared/plugin-form-builder.sdjcoJcH.mjs';
6
7
  import { z } from 'zod';
7
8
  import 'react-hook-form';
8
9
 
10
+ /** Pagination data, labels, and load action supplied by a built-in list. */
11
+ interface PaginationProps {
12
+ total: number;
13
+ showing: number;
14
+ hasMore: boolean;
15
+ isLoadingMore: boolean;
16
+ onLoadMore: () => void;
17
+ className?: string;
18
+ labels?: {
19
+ showing?: string;
20
+ previous?: string;
21
+ next?: string;
22
+ loading?: string;
23
+ };
24
+ }
25
+
9
26
  declare const FORM_BUILDER_LOCALIZATION: {
10
27
  FORM_BUILDER_RENDERER_LOAD_FAILED: string;
11
28
  FORM_BUILDER_RENDERER_UNEXPECTED_ERROR: string;
@@ -128,6 +145,23 @@ interface RouteContext {
128
145
  * plugin-specific components and behavior.
129
146
  */
130
147
  interface FormBuilderPluginOverrides {
148
+ /** Pagination presentation for the built-in forms and submissions lists. */
149
+ pageOverrides?: Partial<Record<"formList" | "submissions", {
150
+ Pagination?: ComponentType<PaginationProps>;
151
+ }>>;
152
+ /** Upload standalone form files. Takes precedence over the legacy onUpload override. */
153
+ uploadFile?: (file: File) => Promise<string>;
154
+ /** Select an existing file URL instead of the default native upload input. */
155
+ imagePicker?: ComponentType<{
156
+ onSelect: (url: string) => void;
157
+ }>;
158
+ /** Replace the file input. Takes precedence over imagePicker; can select any supported file. */
159
+ imageInputField?: ComponentType<{
160
+ value: string;
161
+ onChange: (url: string) => void;
162
+ }>;
163
+ /** Upload standalone form files and return their URL string. */
164
+ onUpload?: (file: File) => Promise<string>;
131
165
  /**
132
166
  * Custom field components for AutoForm fields.
133
167
  *
@@ -348,6 +382,8 @@ declare const formBuilderClientPlugin: (config?: FormBuilderClientConfig) => _bt
348
382
  interface FormStep {
349
383
  id: string;
350
384
  title: string;
385
+ /** Display this step only when its condition matches. */
386
+ showIf?: ShowIfCondition;
351
387
  }
352
388
  interface FormSchemaMetadata {
353
389
  /** Multi-step form step definitions */
@@ -361,6 +397,9 @@ interface JsonSchemaProperty {
361
397
  formatMinimum?: string;
362
398
  formatMaximum?: string;
363
399
  stepGroup?: number;
400
+ showIf?: ShowIfCondition;
401
+ items?: JsonSchemaProperty;
402
+ required?: string[];
364
403
  properties?: Record<string, JsonSchemaProperty>;
365
404
  [key: string]: unknown;
366
405
  }
@@ -406,5 +445,5 @@ declare function getSteps(jsonSchema: FormJsonSchema): FormStep[];
406
445
  */
407
446
  declare function getStepGroupMap(jsonSchema: FormJsonSchema): Record<string, number>;
408
447
 
409
- export { AutoFormInputComponentProps, formBuilderClientPlugin, formSchemaToZod, getStepGroupMap, getSteps, hasSteps, zodToFormSchema };
410
- export type { FormBuilderClientConfig, FormBuilderClientHooks, FormBuilderLocalization, FormBuilderPluginOverrides, FormSchemaMetadata, FormStep, LoaderContext, RouteContext };
448
+ export { AutoFormInputComponentProps, ShowIfCondition, formBuilderClientPlugin, formSchemaToZod, getStepGroupMap, getSteps, hasSteps, zodToFormSchema };
449
+ export type { FormBuilderClientConfig, FormBuilderClientHooks, FormBuilderLocalization, FormBuilderPluginOverrides, FormSchemaMetadata, FormStep, LoaderContext, PaginationProps, RouteContext };
@@ -1,11 +1,28 @@
1
+ 'use client';
1
2
  import * as _btst_stack_client from '@btst/stack/client';
2
3
  import * as _btst_yar from '@btst/yar';
3
4
  import * as react from 'react';
4
5
  import { ComponentType } from 'react';
5
- import { A as AutoFormInputComponentProps, F as FormListPageComponent } from '../shared/plugin-form-builder.DWrQ3lRX.js';
6
+ import { A as AutoFormInputComponentProps, F as FormListPageComponent, S as ShowIfCondition } from '../shared/plugin-form-builder.sdjcoJcH.js';
6
7
  import { z } from 'zod';
7
8
  import 'react-hook-form';
8
9
 
10
+ /** Pagination data, labels, and load action supplied by a built-in list. */
11
+ interface PaginationProps {
12
+ total: number;
13
+ showing: number;
14
+ hasMore: boolean;
15
+ isLoadingMore: boolean;
16
+ onLoadMore: () => void;
17
+ className?: string;
18
+ labels?: {
19
+ showing?: string;
20
+ previous?: string;
21
+ next?: string;
22
+ loading?: string;
23
+ };
24
+ }
25
+
9
26
  declare const FORM_BUILDER_LOCALIZATION: {
10
27
  FORM_BUILDER_RENDERER_LOAD_FAILED: string;
11
28
  FORM_BUILDER_RENDERER_UNEXPECTED_ERROR: string;
@@ -128,6 +145,23 @@ interface RouteContext {
128
145
  * plugin-specific components and behavior.
129
146
  */
130
147
  interface FormBuilderPluginOverrides {
148
+ /** Pagination presentation for the built-in forms and submissions lists. */
149
+ pageOverrides?: Partial<Record<"formList" | "submissions", {
150
+ Pagination?: ComponentType<PaginationProps>;
151
+ }>>;
152
+ /** Upload standalone form files. Takes precedence over the legacy onUpload override. */
153
+ uploadFile?: (file: File) => Promise<string>;
154
+ /** Select an existing file URL instead of the default native upload input. */
155
+ imagePicker?: ComponentType<{
156
+ onSelect: (url: string) => void;
157
+ }>;
158
+ /** Replace the file input. Takes precedence over imagePicker; can select any supported file. */
159
+ imageInputField?: ComponentType<{
160
+ value: string;
161
+ onChange: (url: string) => void;
162
+ }>;
163
+ /** Upload standalone form files and return their URL string. */
164
+ onUpload?: (file: File) => Promise<string>;
131
165
  /**
132
166
  * Custom field components for AutoForm fields.
133
167
  *
@@ -348,6 +382,8 @@ declare const formBuilderClientPlugin: (config?: FormBuilderClientConfig) => _bt
348
382
  interface FormStep {
349
383
  id: string;
350
384
  title: string;
385
+ /** Display this step only when its condition matches. */
386
+ showIf?: ShowIfCondition;
351
387
  }
352
388
  interface FormSchemaMetadata {
353
389
  /** Multi-step form step definitions */
@@ -361,6 +397,9 @@ interface JsonSchemaProperty {
361
397
  formatMinimum?: string;
362
398
  formatMaximum?: string;
363
399
  stepGroup?: number;
400
+ showIf?: ShowIfCondition;
401
+ items?: JsonSchemaProperty;
402
+ required?: string[];
364
403
  properties?: Record<string, JsonSchemaProperty>;
365
404
  [key: string]: unknown;
366
405
  }
@@ -406,5 +445,5 @@ declare function getSteps(jsonSchema: FormJsonSchema): FormStep[];
406
445
  */
407
446
  declare function getStepGroupMap(jsonSchema: FormJsonSchema): Record<string, number>;
408
447
 
409
- export { AutoFormInputComponentProps, formBuilderClientPlugin, formSchemaToZod, getStepGroupMap, getSteps, hasSteps, zodToFormSchema };
410
- export type { FormBuilderClientConfig, FormBuilderClientHooks, FormBuilderLocalization, FormBuilderPluginOverrides, FormSchemaMetadata, FormStep, LoaderContext, RouteContext };
448
+ export { AutoFormInputComponentProps, ShowIfCondition, formBuilderClientPlugin, formSchemaToZod, getStepGroupMap, getSteps, hasSteps, zodToFormSchema };
449
+ export type { FormBuilderClientConfig, FormBuilderClientHooks, FormBuilderLocalization, FormBuilderPluginOverrides, FormSchemaMetadata, FormStep, LoaderContext, PaginationProps, RouteContext };
@@ -50,6 +50,14 @@ const formBuilderPermissions = authorization.definePermissions("forms", {
50
50
  )
51
51
  },
52
52
  submission: {
53
+ /** Export all submission payloads for a server-resolved form. */
54
+ export: authorization.permission(
55
+ z.z.object({
56
+ formId: z.z.string(),
57
+ formExists: z.z.boolean(),
58
+ ownerId: z.z.string().optional()
59
+ })
60
+ ),
53
61
  /** Submit to a public, server-resolved form. */
54
62
  create: authorization.permission(
55
63
  z.z.object({
@@ -54,6 +54,12 @@ declare const formBuilderPermissions: _btst_stack_authorization.PermissionCatalo
54
54
  }, z.core.$strip>>;
55
55
  };
56
56
  readonly submission: {
57
+ /** Export all submission payloads for a server-resolved form. */
58
+ readonly export: _btst_stack_authorization.PermissionSeed<z.ZodObject<{
59
+ formId: z.ZodString;
60
+ formExists: z.ZodBoolean;
61
+ ownerId: z.ZodOptional<z.ZodString>;
62
+ }, z.core.$strip>>;
57
63
  /** Submit to a public, server-resolved form. */
58
64
  readonly create: _btst_stack_authorization.PermissionSeed<z.ZodObject<{
59
65
  slug: z.ZodString;
@@ -54,6 +54,12 @@ declare const formBuilderPermissions: _btst_stack_authorization.PermissionCatalo
54
54
  }, z.core.$strip>>;
55
55
  };
56
56
  readonly submission: {
57
+ /** Export all submission payloads for a server-resolved form. */
58
+ readonly export: _btst_stack_authorization.PermissionSeed<z.ZodObject<{
59
+ formId: z.ZodString;
60
+ formExists: z.ZodBoolean;
61
+ ownerId: z.ZodOptional<z.ZodString>;
62
+ }, z.core.$strip>>;
57
63
  /** Submit to a public, server-resolved form. */
58
64
  readonly create: _btst_stack_authorization.PermissionSeed<z.ZodObject<{
59
65
  slug: z.ZodString;
@@ -54,6 +54,12 @@ declare const formBuilderPermissions: _btst_stack_authorization.PermissionCatalo
54
54
  }, z.core.$strip>>;
55
55
  };
56
56
  readonly submission: {
57
+ /** Export all submission payloads for a server-resolved form. */
58
+ readonly export: _btst_stack_authorization.PermissionSeed<z.ZodObject<{
59
+ formId: z.ZodString;
60
+ formExists: z.ZodBoolean;
61
+ ownerId: z.ZodOptional<z.ZodString>;
62
+ }, z.core.$strip>>;
57
63
  /** Submit to a public, server-resolved form. */
58
64
  readonly create: _btst_stack_authorization.PermissionSeed<z.ZodObject<{
59
65
  slug: z.ZodString;
@@ -48,6 +48,14 @@ const formBuilderPermissions = definePermissions("forms", {
48
48
  )
49
49
  },
50
50
  submission: {
51
+ /** Export all submission payloads for a server-resolved form. */
52
+ export: permission(
53
+ z.object({
54
+ formId: z.string(),
55
+ formExists: z.boolean(),
56
+ ownerId: z.string().optional()
57
+ })
58
+ ),
51
59
  /** Submit to a public, server-resolved form. */
52
60
  create: permission(
53
61
  z.object({
@@ -120,6 +120,13 @@ const formBuilderResources = {
120
120
  }
121
121
  },
122
122
  mutations: {
123
+ export: {
124
+ path: "@post/forms/:formId/submissions/export",
125
+ method: "POST",
126
+ input: (formId) => ({ params: { formId } }),
127
+ select: (data) => data,
128
+ refresh: false
129
+ },
123
130
  delete: {
124
131
  path: "@delete/forms/:formId/submissions/:subId",
125
132
  method: "DELETE",
@@ -1,6 +1,6 @@
1
1
  import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import { createApiClient } from '@btst/stack/plugins/client';
3
- import { j as FormsListDiscriminator, k as SubmissionsListDiscriminator } from './shared/plugin-form-builder.Bbl9NufB.cjs';
3
+ import { j as FormsListDiscriminator, k as SubmissionsListDiscriminator } from './shared/plugin-form-builder.DXdOj9vM.cjs';
4
4
  import { FormBuilderApiRouter } from './api/index.cjs';
5
5
  import { PaginatedForms, SerializedForm, SerializedFormSubmission, PaginatedFormSubmissions, SerializedFormSubmissionWithData } from './types.cjs';
6
6
  import { StackIdentity } from '@btst/stack/context';
@@ -203,6 +203,20 @@ declare const formBuilderResources: {
203
203
  };
204
204
  };
205
205
  mutations: {
206
+ export: {
207
+ path: string;
208
+ method: "POST";
209
+ input: (formId: string) => {
210
+ params: {
211
+ formId: string;
212
+ };
213
+ };
214
+ select: (data: any) => {
215
+ csv: string;
216
+ filename: string;
217
+ };
218
+ refresh: false;
219
+ };
206
220
  delete: {
207
221
  path: string;
208
222
  method: "DELETE";
@@ -367,6 +381,20 @@ declare function createFormBuilderQueryKeys(client: ReturnType<typeof createApiC
367
381
  };
368
382
  };
369
383
  mutations: {
384
+ export: {
385
+ path: string;
386
+ method: "POST";
387
+ input: (formId: string) => {
388
+ params: {
389
+ formId: string;
390
+ };
391
+ };
392
+ select: (data: any) => {
393
+ csv: string;
394
+ filename: string;
395
+ };
396
+ refresh: false;
397
+ };
370
398
  delete: {
371
399
  path: string;
372
400
  method: "DELETE";
@@ -1,6 +1,6 @@
1
1
  import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import { createApiClient } from '@btst/stack/plugins/client';
3
- import { j as FormsListDiscriminator, k as SubmissionsListDiscriminator } from './shared/plugin-form-builder.lp98rFNl.mjs';
3
+ import { j as FormsListDiscriminator, k as SubmissionsListDiscriminator } from './shared/plugin-form-builder.PWs25HN1.mjs';
4
4
  import { FormBuilderApiRouter } from './api/index.mjs';
5
5
  import { PaginatedForms, SerializedForm, SerializedFormSubmission, PaginatedFormSubmissions, SerializedFormSubmissionWithData } from './types.mjs';
6
6
  import { StackIdentity } from '@btst/stack/context';
@@ -203,6 +203,20 @@ declare const formBuilderResources: {
203
203
  };
204
204
  };
205
205
  mutations: {
206
+ export: {
207
+ path: string;
208
+ method: "POST";
209
+ input: (formId: string) => {
210
+ params: {
211
+ formId: string;
212
+ };
213
+ };
214
+ select: (data: any) => {
215
+ csv: string;
216
+ filename: string;
217
+ };
218
+ refresh: false;
219
+ };
206
220
  delete: {
207
221
  path: string;
208
222
  method: "DELETE";
@@ -367,6 +381,20 @@ declare function createFormBuilderQueryKeys(client: ReturnType<typeof createApiC
367
381
  };
368
382
  };
369
383
  mutations: {
384
+ export: {
385
+ path: string;
386
+ method: "POST";
387
+ input: (formId: string) => {
388
+ params: {
389
+ formId: string;
390
+ };
391
+ };
392
+ select: (data: any) => {
393
+ csv: string;
394
+ filename: string;
395
+ };
396
+ refresh: false;
397
+ };
370
398
  delete: {
371
399
  path: string;
372
400
  method: "DELETE";
@@ -1,6 +1,6 @@
1
1
  import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import { createApiClient } from '@btst/stack/plugins/client';
3
- import { j as FormsListDiscriminator, k as SubmissionsListDiscriminator } from './shared/plugin-form-builder.CSP5HR2O.js';
3
+ import { j as FormsListDiscriminator, k as SubmissionsListDiscriminator } from './shared/plugin-form-builder.65tLgfcd.js';
4
4
  import { FormBuilderApiRouter } from './api/index.js';
5
5
  import { PaginatedForms, SerializedForm, SerializedFormSubmission, PaginatedFormSubmissions, SerializedFormSubmissionWithData } from './types.js';
6
6
  import { StackIdentity } from '@btst/stack/context';
@@ -203,6 +203,20 @@ declare const formBuilderResources: {
203
203
  };
204
204
  };
205
205
  mutations: {
206
+ export: {
207
+ path: string;
208
+ method: "POST";
209
+ input: (formId: string) => {
210
+ params: {
211
+ formId: string;
212
+ };
213
+ };
214
+ select: (data: any) => {
215
+ csv: string;
216
+ filename: string;
217
+ };
218
+ refresh: false;
219
+ };
206
220
  delete: {
207
221
  path: string;
208
222
  method: "DELETE";
@@ -367,6 +381,20 @@ declare function createFormBuilderQueryKeys(client: ReturnType<typeof createApiC
367
381
  };
368
382
  };
369
383
  mutations: {
384
+ export: {
385
+ path: string;
386
+ method: "POST";
387
+ input: (formId: string) => {
388
+ params: {
389
+ formId: string;
390
+ };
391
+ };
392
+ select: (data: any) => {
393
+ csv: string;
394
+ filename: string;
395
+ };
396
+ refresh: false;
397
+ };
370
398
  delete: {
371
399
  path: string;
372
400
  method: "DELETE";