@nextlyhq/plugin-form-builder 0.0.2-alpha.35 → 0.0.2-alpha.37

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.
@@ -1,6 +1,6 @@
1
1
  import { ComponentPath } from '@nextlyhq/plugin-sdk/admin';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import { i as FormField, b as FormSettings, s as FormNotification, p as FormFieldType } from '../types-C-DcuYGF.js';
3
+ import { q as FormField, s as FormFieldTypeId, A as AnyFormField, b as FormSettings, v as FormNotification } from '../types-r8uBeB0u.js';
4
4
  import { FormFieldCatalogType, FieldTypeCatalogEntry } from 'nextly/field-catalog';
5
5
  import { ReactNode } from 'react';
6
6
  import 'nextly';
@@ -73,31 +73,39 @@ interface FieldCardsProps {
73
73
  * added.
74
74
  */
75
75
  enabledTypes: readonly FormFieldCatalogType[] | null;
76
+ /**
77
+ * Type ids the host disabled (`config.fields[type] === false`). Applied to
78
+ * plugin field types too, so the host exclude layer is not bypassed for
79
+ * contributed types.
80
+ */
81
+ disabledFieldTypes?: ReadonlySet<string>;
76
82
  /** Creates a field of the given type and returns it (context helper). */
77
- onAddField: (type: FormFieldCatalogType) => void;
83
+ onAddField: (type: FormFieldTypeId) => void;
78
84
  }
79
- declare function FieldCards({ enabledTypes, onAddField }: FieldCardsProps): react_jsx_runtime.JSX.Element;
85
+ declare function FieldCards({ enabledTypes, disabledFieldTypes, onAddField, }: FieldCardsProps): react_jsx_runtime.JSX.Element;
80
86
 
81
87
  interface AddFieldDialogProps {
82
88
  open: boolean;
83
89
  onOpenChange: (open: boolean) => void;
84
90
  /**
85
- * The form surface's catalog, already filtered by the host's excludes;
86
- * `null` while the host configuration is still loading.
91
+ * The form surface's catalog — built-ins already filtered by the host's
92
+ * excludes plus any plugin field types that opted into the forms surface;
93
+ * `null` while the host configuration is still loading. `type` is the open
94
+ * `FormFieldTypeId` so a plugin entry shares this shape with the built-ins.
87
95
  */
88
- entries: readonly FieldTypeCatalogEntry<FormFieldCatalogType>[] | null;
96
+ entries: readonly FieldTypeCatalogEntry<FormFieldTypeId>[] | null;
89
97
  /** Called with the chosen type; the parent creates and selects the field. */
90
- onAdd: (type: FormFieldCatalogType) => void;
98
+ onAdd: (type: FormFieldTypeId) => void;
91
99
  }
92
100
  declare function AddFieldDialog({ open, onOpenChange, entries, onAdd, }: AddFieldDialogProps): react_jsx_runtime.JSX.Element;
93
101
 
94
102
  interface FieldEditorProps {
95
- /** The field being edited */
96
- field: FormField;
103
+ /** The field being edited (built-in or plugin-contributed). */
104
+ field: AnyFormField;
97
105
  /** All fields in the form (for conditional logic references) */
98
- allFields: FormField[];
106
+ allFields: AnyFormField[];
99
107
  /** Callback when field is updated */
100
- onUpdate: (updates: Partial<FormField>) => void;
108
+ onUpdate: (updates: Partial<AnyFormField>) => void;
101
109
  }
102
110
  /**
103
111
  * FieldEditor - Field properties configuration panel
@@ -121,8 +129,8 @@ interface FieldEditorProps {
121
129
  declare function FieldEditor({ field, allFields, onUpdate }: FieldEditorProps): react_jsx_runtime.JSX.Element;
122
130
 
123
131
  interface FormPreviewProps {
124
- /** Array of form fields to preview */
125
- fields: FormField[];
132
+ /** Array of form fields to preview (built-in or plugin-contributed). */
133
+ fields: AnyFormField[];
126
134
  /** Form metadata */
127
135
  formData?: {
128
136
  name?: string;
@@ -134,7 +142,7 @@ declare function FormPreview({ fields, formData }: FormPreviewProps): react_jsx_
134
142
 
135
143
  interface FormBuilderState {
136
144
  /** Form fields array */
137
- fields: FormField[];
145
+ fields: AnyFormField[];
138
146
  /** Currently selected field ID (name) */
139
147
  selectedFieldId: string | null;
140
148
  /** Active tab: builder, preview, settings, or notifications */
@@ -156,11 +164,11 @@ interface FormBuilderState {
156
164
  }
157
165
  interface FormBuilderActions {
158
166
  /** Set all fields */
159
- setFields: (fields: FormField[]) => void;
167
+ setFields: (fields: AnyFormField[]) => void;
160
168
  /** Add a new field */
161
- addField: (field: FormField, index?: number) => void;
169
+ addField: (field: AnyFormField, index?: number) => void;
162
170
  /** Update a field by name */
163
- updateField: (fieldName: string, updates: Partial<FormField>) => void;
171
+ updateField: (fieldName: string, updates: Partial<AnyFormField>) => void;
164
172
  /** Delete a field by name */
165
173
  deleteField: (fieldName: string) => void;
166
174
  /** Move a field from one index to another */
@@ -198,7 +206,7 @@ interface FormBuilderProviderProps {
198
206
  slug?: string;
199
207
  description?: string;
200
208
  status?: "draft" | "published" | "closed";
201
- fields?: FormField[];
209
+ fields?: AnyFormField[];
202
210
  settings?: Partial<FormSettings>;
203
211
  notifications?: FormNotification[];
204
212
  };
@@ -215,16 +223,17 @@ declare function createNotification(): FormNotification;
215
223
  * Names key submission data, so they should read like keys a developer
216
224
  * would have chosen, not timestamps.
217
225
  */
218
- declare function generateFieldName(type: FormFieldType, existingNames?: readonly string[]): string;
226
+ declare function generateFieldName(type: FormFieldTypeId, existingNames?: readonly string[]): string;
219
227
  /**
220
228
  * Generate a human-readable label from field type, using the shared catalog
221
- * so a new field's default label matches what the picker called the type.
229
+ * so a new field's default label matches what the picker called the type. A
230
+ * plugin type not in the built-in catalog falls back to a title-cased id.
222
231
  */
223
- declare function generateFieldLabel(type: FormFieldType): string;
232
+ declare function generateFieldLabel(type: FormFieldTypeId): string;
224
233
  /**
225
234
  * Create a new field from a field type with default values.
226
235
  */
227
- declare function createFieldFromType(type: FormFieldType, existingNames?: readonly string[]): FormField;
236
+ declare function createFieldFromType(type: FormFieldTypeId, existingNames?: readonly string[]): AnyFormField;
228
237
  /**
229
238
  * FormBuilderProvider - Provides form builder state to child components
230
239
  *