@entrypulse/builder 1.0.5 → 1.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.
- package/dist/assets/index-BNZVkOcl.css +2 -0
- package/dist/assets/index-xKAcicXf.js +242 -0
- package/dist/index.html +15 -0
- package/package.json +3 -1
- package/dist/entry-pulse.css +0 -1
- package/dist/entry-pulse.js +0 -29653
- package/dist/entry-pulse.js.map +0 -1
- package/dist/entry-pulse.umd.cjs +0 -209
- package/dist/entry-pulse.umd.cjs.map +0 -1
- package/dist/index.d.ts +0 -1645
package/dist/index.d.ts
DELETED
|
@@ -1,1645 +0,0 @@
|
|
|
1
|
-
import { ComponentType } from 'react';
|
|
2
|
-
import { default as default_2 } from 'react';
|
|
3
|
-
import { LucideIcon } from 'lucide-react';
|
|
4
|
-
import { StoreApi } from 'zustand';
|
|
5
|
-
import { UseBoundStore } from 'zustand';
|
|
6
|
-
import { WritableDraft } from 'immer';
|
|
7
|
-
|
|
8
|
-
export declare const AffixInput: default_2.FC<AffixInputProps>;
|
|
9
|
-
|
|
10
|
-
declare interface AffixInputProps {
|
|
11
|
-
prefix?: string;
|
|
12
|
-
suffix?: string;
|
|
13
|
-
children: default_2.ReactNode;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* All built-in element definitions
|
|
18
|
-
*/
|
|
19
|
-
export declare const builtInElements: ElementDefinition[];
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Built-in sidebar tab IDs that can be referenced or extended
|
|
23
|
-
*/
|
|
24
|
-
export declare type BuiltinSidebarTabId = "fields" | "pages";
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Built-in action IDs that can be overridden
|
|
28
|
-
*/
|
|
29
|
-
export declare type BuiltinToolbarActionId = "undo" | "redo" | "export" | "import" | "reset" | "design-mode" | "preview-mode";
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Renders a form element on the canvas (builder preview mode)
|
|
33
|
-
*
|
|
34
|
-
* This component:
|
|
35
|
-
* 1. Looks up the element definition in the registry
|
|
36
|
-
* 2. Creates the render context with all settings
|
|
37
|
-
* 3. Calls the element's renderOnCanvas function
|
|
38
|
-
* 4. Falls back to a default view if element is not found
|
|
39
|
-
*/
|
|
40
|
-
export declare const CanvasElementRenderer: default_2.FC<CanvasElementRendererProps>;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Props for the unified canvas element renderer
|
|
44
|
-
*/
|
|
45
|
-
export declare interface CanvasElementRendererProps {
|
|
46
|
-
element: FormElement;
|
|
47
|
-
isSelected?: boolean;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Wrapper for canvas preview elements
|
|
52
|
-
* Adds disabled styling and prevents interaction
|
|
53
|
-
*/
|
|
54
|
-
export declare const CanvasPreviewWrapper: default_2.FC<CanvasPreviewWrapperProps>;
|
|
55
|
-
|
|
56
|
-
declare interface CanvasPreviewWrapperProps {
|
|
57
|
-
children: default_2.ReactNode;
|
|
58
|
-
className?: string;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
declare type ContactElementType = "email" | "phone" | "url" | "location";
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Helper function to create a sidebar tab with sensible defaults
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* ```tsx
|
|
68
|
-
* const aiChatTab = createSidebarTab({
|
|
69
|
-
* id: 'ai-chat',
|
|
70
|
-
* label: 'AI Chat',
|
|
71
|
-
* icon: Bot,
|
|
72
|
-
* content: AIChatPanel,
|
|
73
|
-
* });
|
|
74
|
-
*
|
|
75
|
-
* <EntryPulse sidebarTabs={[aiChatTab]} />
|
|
76
|
-
* ```
|
|
77
|
-
*/
|
|
78
|
-
export declare function createSidebarTab(config: Omit<SidebarTab, "order" | "disabled" | "hidden"> & Partial<Pick<SidebarTab, "order" | "disabled" | "hidden">>): SidebarTab;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Helper function to create multiple sidebar tabs
|
|
82
|
-
*
|
|
83
|
-
* @example
|
|
84
|
-
* ```tsx
|
|
85
|
-
* const tabs = createSidebarTabs([
|
|
86
|
-
* { id: 'templates', icon: LayoutTemplate, label: 'Templates', content: TemplatesPanel },
|
|
87
|
-
* { id: 'ai-chat', icon: Bot, label: 'AI Chat', content: AIChatPanel },
|
|
88
|
-
* ]);
|
|
89
|
-
*
|
|
90
|
-
* <EntryPulse sidebarTabs={tabs} />
|
|
91
|
-
* ```
|
|
92
|
-
*/
|
|
93
|
-
export declare function createSidebarTabs(configs: Array<Omit<SidebarTab, "order" | "disabled" | "hidden"> & Partial<Pick<SidebarTab, "order" | "disabled" | "hidden">>>): SidebarTab[];
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Helper function to create a toolbar action with sensible defaults
|
|
97
|
-
*
|
|
98
|
-
* @example
|
|
99
|
-
* ```tsx
|
|
100
|
-
* const saveAction = createToolbarAction({
|
|
101
|
-
* id: 'save',
|
|
102
|
-
* icon: Save,
|
|
103
|
-
* label: 'Save Form',
|
|
104
|
-
* position: 'right',
|
|
105
|
-
* onClick: (ctx) => {
|
|
106
|
-
* saveToServer(ctx.schema);
|
|
107
|
-
* }
|
|
108
|
-
* });
|
|
109
|
-
* ```
|
|
110
|
-
*/
|
|
111
|
-
export declare function createToolbarAction(config: Omit<ToolbarAction, "order" | "variant" | "disabled" | "hidden"> & Partial<Pick<ToolbarAction, "order" | "variant" | "disabled" | "hidden">>): ToolbarAction;
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Helper function to create multiple toolbar actions
|
|
115
|
-
*
|
|
116
|
-
* @example
|
|
117
|
-
* ```tsx
|
|
118
|
-
* const actions = createToolbarActions([
|
|
119
|
-
* { id: 'save', icon: Save, label: 'Save', position: 'right', onClick: handleSave },
|
|
120
|
-
* { id: 'publish', icon: Globe, label: 'Publish', position: 'right', onClick: handlePublish },
|
|
121
|
-
* ]);
|
|
122
|
-
* ```
|
|
123
|
-
*/
|
|
124
|
-
export declare function createToolbarActions(configs: Array<Omit<ToolbarAction, "order" | "variant" | "disabled" | "hidden"> & Partial<Pick<ToolbarAction, "order" | "variant" | "disabled" | "hidden">>>): ToolbarAction[];
|
|
125
|
-
|
|
126
|
-
declare type DateTimeElementType = "date" | "time" | "dateTime" | "multipleDates" | "dateRange";
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Default values generator function type
|
|
130
|
-
*/
|
|
131
|
-
export declare type DefaultValuesGenerator = () => {
|
|
132
|
-
properties?: Partial<ElementProperties>;
|
|
133
|
-
layout?: Partial<ElementLayout>;
|
|
134
|
-
validation?: Partial<ElementValidation>;
|
|
135
|
-
config?: Partial<ElementConfig>;
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
declare interface DescriptionProps {
|
|
139
|
-
description?: string;
|
|
140
|
-
className?: string;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
declare type DisplayFieldElementType = "paragraph" | "image" | "link";
|
|
144
|
-
|
|
145
|
-
export declare interface ElementAttributes {
|
|
146
|
-
name: string;
|
|
147
|
-
dataType?: "string" | "number" | "boolean" | "array" | "object" | "date";
|
|
148
|
-
defaultValue?: any;
|
|
149
|
-
customAttributes?: Record<string, any>;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
declare type ElementCategory = "field" | "page";
|
|
153
|
-
|
|
154
|
-
export declare interface ElementConfig {
|
|
155
|
-
options?: ElementOption[];
|
|
156
|
-
allowOther?: boolean;
|
|
157
|
-
otherLabel?: string;
|
|
158
|
-
rows?: number;
|
|
159
|
-
autoResize?: boolean;
|
|
160
|
-
minRows?: number;
|
|
161
|
-
maxRows?: number;
|
|
162
|
-
toolbar?: string[];
|
|
163
|
-
height?: number;
|
|
164
|
-
allowImages?: boolean;
|
|
165
|
-
allowLinks?: boolean;
|
|
166
|
-
step?: number;
|
|
167
|
-
decimals?: number;
|
|
168
|
-
thousandsSeparator?: boolean;
|
|
169
|
-
currencySymbol?: string;
|
|
170
|
-
min?: number;
|
|
171
|
-
max?: number;
|
|
172
|
-
showValue?: boolean;
|
|
173
|
-
showMarks?: boolean;
|
|
174
|
-
marks?: {
|
|
175
|
-
value: number;
|
|
176
|
-
label: string;
|
|
177
|
-
}[];
|
|
178
|
-
minRange?: number;
|
|
179
|
-
maxRange?: number;
|
|
180
|
-
defaultCountry?: string;
|
|
181
|
-
allowedCountries?: string[];
|
|
182
|
-
format?: string;
|
|
183
|
-
enableGeolocation?: boolean;
|
|
184
|
-
showMap?: boolean;
|
|
185
|
-
mapProvider?: "google" | "openstreetmap";
|
|
186
|
-
showStrengthMeter?: boolean;
|
|
187
|
-
minStrength?: "weak" | "medium" | "strong";
|
|
188
|
-
showToggle?: boolean;
|
|
189
|
-
strokeWidth?: number;
|
|
190
|
-
strokeColor?: string;
|
|
191
|
-
backgroundColor?: string;
|
|
192
|
-
canvasWidth?: number;
|
|
193
|
-
canvasHeight?: number;
|
|
194
|
-
provider?: "recaptcha" | "hcaptcha" | "turnstile";
|
|
195
|
-
siteKey?: string;
|
|
196
|
-
theme?: "light" | "dark";
|
|
197
|
-
maxTags?: number;
|
|
198
|
-
allowCustomTags?: boolean;
|
|
199
|
-
suggestions?: string[];
|
|
200
|
-
checkedLabel?: string;
|
|
201
|
-
uncheckedLabel?: string;
|
|
202
|
-
onLabel?: string;
|
|
203
|
-
offLabel?: string;
|
|
204
|
-
matrixRows?: MatrixRow[];
|
|
205
|
-
matrixColumns?: MatrixColumn[];
|
|
206
|
-
allowMultiplePerRow?: boolean;
|
|
207
|
-
accept?: string;
|
|
208
|
-
maxSize?: number;
|
|
209
|
-
multiple?: boolean;
|
|
210
|
-
maxFiles?: number;
|
|
211
|
-
aspectRatio?: string;
|
|
212
|
-
allowCrop?: boolean;
|
|
213
|
-
minWidth?: number;
|
|
214
|
-
minHeight?: number;
|
|
215
|
-
maxWidth?: number;
|
|
216
|
-
maxHeight?: number;
|
|
217
|
-
minDate?: string;
|
|
218
|
-
maxDate?: string;
|
|
219
|
-
minTime?: string;
|
|
220
|
-
maxTime?: string;
|
|
221
|
-
disabledDates?: string[];
|
|
222
|
-
disabledDays?: number[];
|
|
223
|
-
showCalendar?: boolean;
|
|
224
|
-
timeFormat?: "12h" | "24h";
|
|
225
|
-
timeInterval?: number;
|
|
226
|
-
minDays?: number;
|
|
227
|
-
maxDays?: number;
|
|
228
|
-
buttonText?: string;
|
|
229
|
-
buttonStyle?: "primary" | "secondary" | "outline" | "ghost";
|
|
230
|
-
buttonSize?: "small" | "medium" | "large";
|
|
231
|
-
showIcon?: boolean;
|
|
232
|
-
iconPosition?: "left" | "right";
|
|
233
|
-
loadingText?: string;
|
|
234
|
-
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
235
|
-
alignment?: "left" | "center" | "right";
|
|
236
|
-
style?: "solid" | "dashed" | "dotted";
|
|
237
|
-
thickness?: number;
|
|
238
|
-
color?: string;
|
|
239
|
-
spacerHeight?: number;
|
|
240
|
-
collapsed?: boolean;
|
|
241
|
-
collapsible?: boolean;
|
|
242
|
-
showBorder?: boolean;
|
|
243
|
-
padding?: number;
|
|
244
|
-
gridColumns?: number;
|
|
245
|
-
gridGap?: number;
|
|
246
|
-
responsiveColumns?: {
|
|
247
|
-
sm?: number;
|
|
248
|
-
md?: number;
|
|
249
|
-
lg?: number;
|
|
250
|
-
};
|
|
251
|
-
tableColumns?: {
|
|
252
|
-
id: string;
|
|
253
|
-
header: string;
|
|
254
|
-
width?: string;
|
|
255
|
-
align?: "left" | "center" | "right";
|
|
256
|
-
}[];
|
|
257
|
-
showHeader?: boolean;
|
|
258
|
-
striped?: boolean;
|
|
259
|
-
bordered?: boolean;
|
|
260
|
-
minItems?: number;
|
|
261
|
-
maxItems?: number;
|
|
262
|
-
addButtonText?: string;
|
|
263
|
-
removeButtonText?: string;
|
|
264
|
-
itemLabel?: string;
|
|
265
|
-
showItemNumber?: boolean;
|
|
266
|
-
showProgressBar?: boolean;
|
|
267
|
-
showStepNumbers?: boolean;
|
|
268
|
-
allowSkip?: boolean;
|
|
269
|
-
validateOnNext?: boolean;
|
|
270
|
-
activeStepId?: string;
|
|
271
|
-
steps?: WizardStep[];
|
|
272
|
-
textAlign?: "left" | "center" | "right" | "justify";
|
|
273
|
-
fontSize?: "small" | "medium" | "large";
|
|
274
|
-
fontWeight?: "normal" | "medium" | "bold";
|
|
275
|
-
imageWidth?: string;
|
|
276
|
-
imageHeight?: string;
|
|
277
|
-
objectFit?: "contain" | "cover" | "fill" | "none";
|
|
278
|
-
borderRadius?: number;
|
|
279
|
-
linkText?: string;
|
|
280
|
-
linkStyle?: "text" | "button";
|
|
281
|
-
[key: string]: any;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Complete element definition interface
|
|
286
|
-
*
|
|
287
|
-
* This is the main interface that all elements must implement.
|
|
288
|
-
* Custom elements should register using this interface.
|
|
289
|
-
*/
|
|
290
|
-
export declare interface ElementDefinition {
|
|
291
|
-
/** Unique element type identifier */
|
|
292
|
-
type: ElementType | string;
|
|
293
|
-
/** Element structure: 'field' for data collection, 'page' for layout */
|
|
294
|
-
structure: ElementStructure;
|
|
295
|
-
/** Element type category */
|
|
296
|
-
typeCategory: ElementTypeCategory;
|
|
297
|
-
/** Display label shown in the element palette */
|
|
298
|
-
label: string;
|
|
299
|
-
/** Short description of the element */
|
|
300
|
-
description: string;
|
|
301
|
-
/** Icon (emoji or icon component) */
|
|
302
|
-
icon: string | default_2.ComponentType<{
|
|
303
|
-
className?: string;
|
|
304
|
-
}>;
|
|
305
|
-
/** Category for sidebar organization */
|
|
306
|
-
category: ElementCategory;
|
|
307
|
-
/** Sub-category for further organization */
|
|
308
|
-
subCategory?: FieldSubCategory | PageSubCategory | string;
|
|
309
|
-
/**
|
|
310
|
-
* Render the element on the canvas (builder preview)
|
|
311
|
-
* This shows a preview of how the element will look
|
|
312
|
-
*/
|
|
313
|
-
renderOnCanvas: (context: ElementRenderContext) => default_2.ReactNode;
|
|
314
|
-
/**
|
|
315
|
-
* Render the element in the actual form (runtime)
|
|
316
|
-
* This is the fully functional element with value handling
|
|
317
|
-
*/
|
|
318
|
-
render: (context: ElementRenderContext) => default_2.ReactNode;
|
|
319
|
-
/**
|
|
320
|
-
* Custom settings panel component (optional)
|
|
321
|
-
* If not provided, default settings panels will be used
|
|
322
|
-
*/
|
|
323
|
-
renderSettings?: (props: ElementSettingsProps) => default_2.ReactNode;
|
|
324
|
-
/**
|
|
325
|
-
* Generate default values for a new element
|
|
326
|
-
*/
|
|
327
|
-
getDefaultValues: DefaultValuesGenerator;
|
|
328
|
-
/**
|
|
329
|
-
* Whether this element can contain other elements
|
|
330
|
-
*/
|
|
331
|
-
isContainer?: boolean;
|
|
332
|
-
/**
|
|
333
|
-
* Validate the element's configuration
|
|
334
|
-
*/
|
|
335
|
-
validateConfig?: (element: FormElement) => string[];
|
|
336
|
-
/**
|
|
337
|
-
* Data type for form submission
|
|
338
|
-
*/
|
|
339
|
-
dataType?: "string" | "number" | "boolean" | "array" | "object" | "date" | "file";
|
|
340
|
-
/**
|
|
341
|
-
* Whether this element supports validation rules
|
|
342
|
-
*/
|
|
343
|
-
supportsValidation?: boolean;
|
|
344
|
-
/**
|
|
345
|
-
* Whether this element supports options (for choice elements)
|
|
346
|
-
*/
|
|
347
|
-
supportsOptions?: boolean;
|
|
348
|
-
/**
|
|
349
|
-
* Whether this element supports matrix configuration
|
|
350
|
-
*/
|
|
351
|
-
supportsMatrix?: boolean;
|
|
352
|
-
/**
|
|
353
|
-
* Declarative settings schema for dynamic property panel rendering.
|
|
354
|
-
* If provided (and renderSettings is not), the PropertyPanel will
|
|
355
|
-
* automatically render fields based on this schema.
|
|
356
|
-
*/
|
|
357
|
-
settingsSchema?: ElementSettingsSchema;
|
|
358
|
-
/**
|
|
359
|
-
* Custom keywords for search in element palette
|
|
360
|
-
*/
|
|
361
|
-
searchKeywords?: string[];
|
|
362
|
-
/**
|
|
363
|
-
* Version of the element definition (for migrations)
|
|
364
|
-
*/
|
|
365
|
-
version?: string;
|
|
366
|
-
/**
|
|
367
|
-
* Author information for custom elements
|
|
368
|
-
*/
|
|
369
|
-
author?: string;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
export declare const ElementDescription: default_2.FC<DescriptionProps>;
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* Element group definition for sidebar organization
|
|
376
|
-
*/
|
|
377
|
-
export declare interface ElementGroup {
|
|
378
|
-
/** Group identifier */
|
|
379
|
-
id: string;
|
|
380
|
-
/** Display label */
|
|
381
|
-
label: string;
|
|
382
|
-
/** Elements in this group */
|
|
383
|
-
elements: ElementDefinition[];
|
|
384
|
-
/** Sort order */
|
|
385
|
-
order?: number;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
export declare const ElementLabel: default_2.FC<LabelProps>;
|
|
389
|
-
|
|
390
|
-
export declare interface ElementLayout {
|
|
391
|
-
shrinkElement?: boolean;
|
|
392
|
-
labelPosition?: "left" | "top" | "hidden";
|
|
393
|
-
size?: "default" | "small" | "medium" | "large" | "full";
|
|
394
|
-
width?: string;
|
|
395
|
-
className?: string;
|
|
396
|
-
columns?: number;
|
|
397
|
-
gap?: number;
|
|
398
|
-
height?: number;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
export declare interface ElementLogic {
|
|
402
|
-
showWhen?: QueryBuilderRule;
|
|
403
|
-
hideWhen?: QueryBuilderRule;
|
|
404
|
-
requireWhen?: QueryBuilderRule;
|
|
405
|
-
disableWhen?: QueryBuilderRule;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
export declare interface ElementOption {
|
|
409
|
-
label: string;
|
|
410
|
-
value: string;
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
export declare interface ElementProperties {
|
|
414
|
-
label?: string;
|
|
415
|
-
description?: string;
|
|
416
|
-
placeholder?: string;
|
|
417
|
-
prefix?: string;
|
|
418
|
-
suffix?: string;
|
|
419
|
-
disabled?: boolean;
|
|
420
|
-
readonly?: boolean;
|
|
421
|
-
useExpressionValue?: boolean;
|
|
422
|
-
expressionFormula?: string;
|
|
423
|
-
content?: string;
|
|
424
|
-
src?: string;
|
|
425
|
-
alt?: string;
|
|
426
|
-
href?: string;
|
|
427
|
-
target?: "_blank" | "_self" | "_parent" | "_top";
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
declare class ElementRegistry implements IElementRegistry {
|
|
431
|
-
private elements;
|
|
432
|
-
private customGroups;
|
|
433
|
-
/**
|
|
434
|
-
* Register a new element definition
|
|
435
|
-
*/
|
|
436
|
-
register(definition: ElementDefinition, options?: RegisterElementOptions): void;
|
|
437
|
-
/**
|
|
438
|
-
* Get element definition by type
|
|
439
|
-
*/
|
|
440
|
-
get(type: ElementType | string): ElementDefinition | undefined;
|
|
441
|
-
/**
|
|
442
|
-
* Check if element type is registered
|
|
443
|
-
*/
|
|
444
|
-
has(type: ElementType | string): boolean;
|
|
445
|
-
/**
|
|
446
|
-
* Get all registered elements
|
|
447
|
-
*/
|
|
448
|
-
getAll(): ElementDefinition[];
|
|
449
|
-
/**
|
|
450
|
-
* Get elements by category (field or page)
|
|
451
|
-
*/
|
|
452
|
-
getByCategory(category: ElementCategory): ElementDefinition[];
|
|
453
|
-
/**
|
|
454
|
-
* Get elements by structure (field or page)
|
|
455
|
-
*/
|
|
456
|
-
getByStructure(structure: ElementStructure): ElementDefinition[];
|
|
457
|
-
/**
|
|
458
|
-
* Get elements by type category
|
|
459
|
-
*/
|
|
460
|
-
getByTypeCategory(typeCategory: ElementTypeCategory): ElementDefinition[];
|
|
461
|
-
/**
|
|
462
|
-
* Get elements grouped for sidebar display
|
|
463
|
-
*/
|
|
464
|
-
getGroups(): ElementGroup[];
|
|
465
|
-
/**
|
|
466
|
-
* Unregister an element
|
|
467
|
-
*/
|
|
468
|
-
unregister(type: ElementType | string): boolean;
|
|
469
|
-
/**
|
|
470
|
-
* Clear all registered elements
|
|
471
|
-
*/
|
|
472
|
-
clear(): void;
|
|
473
|
-
/**
|
|
474
|
-
* Get icon for element type
|
|
475
|
-
*/
|
|
476
|
-
getIcon(type: ElementType | string): string | React.ComponentType<{
|
|
477
|
-
className?: string;
|
|
478
|
-
}> | undefined;
|
|
479
|
-
/**
|
|
480
|
-
* Get label for element type
|
|
481
|
-
*/
|
|
482
|
-
getLabel(type: ElementType | string): string | undefined;
|
|
483
|
-
/**
|
|
484
|
-
* Check if element is a container
|
|
485
|
-
*/
|
|
486
|
-
isContainer(type: ElementType | string): boolean;
|
|
487
|
-
/**
|
|
488
|
-
* Check if element supports validation
|
|
489
|
-
*/
|
|
490
|
-
supportsValidation(type: ElementType | string): boolean;
|
|
491
|
-
/**
|
|
492
|
-
* Check if element supports options
|
|
493
|
-
*/
|
|
494
|
-
supportsOptions(type: ElementType | string): boolean;
|
|
495
|
-
/**
|
|
496
|
-
* Get default values for element type
|
|
497
|
-
*/
|
|
498
|
-
getDefaultValues(type: ElementType | string): {
|
|
499
|
-
properties?: Partial<ElementProperties>;
|
|
500
|
-
layout?: Partial<ElementLayout>;
|
|
501
|
-
validation?: Partial<ElementValidation>;
|
|
502
|
-
config?: Partial<ElementConfig>;
|
|
503
|
-
};
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
/**
|
|
507
|
-
* Global element registry instance
|
|
508
|
-
*/
|
|
509
|
-
export declare const elementRegistry: ElementRegistry;
|
|
510
|
-
|
|
511
|
-
/**
|
|
512
|
-
* Context passed to element renderers containing all settings
|
|
513
|
-
*/
|
|
514
|
-
export declare interface ElementRenderContext {
|
|
515
|
-
/** The form element data */
|
|
516
|
-
element: FormElement;
|
|
517
|
-
/** Element properties (label, description, placeholder, etc.) */
|
|
518
|
-
properties: ElementProperties;
|
|
519
|
-
/** Layout configuration */
|
|
520
|
-
layout: ElementLayout;
|
|
521
|
-
/** Validation rules */
|
|
522
|
-
validation?: ElementValidation;
|
|
523
|
-
/** Conditional logic rules */
|
|
524
|
-
logic?: ElementLogic;
|
|
525
|
-
/** Element-specific configuration */
|
|
526
|
-
config?: ElementConfig;
|
|
527
|
-
/** Whether the element is selected in the builder */
|
|
528
|
-
isSelected?: boolean;
|
|
529
|
-
/** Whether we're in builder/canvas mode or preview/render mode */
|
|
530
|
-
mode: "canvas" | "render";
|
|
531
|
-
/** Current value (for render mode) */
|
|
532
|
-
value?: any;
|
|
533
|
-
/** Change handler (for render mode) */
|
|
534
|
-
onChange?: (value: any) => void;
|
|
535
|
-
/** Error messages (for render mode) */
|
|
536
|
-
errors?: string[];
|
|
537
|
-
/** All form values (for conditional logic) */
|
|
538
|
-
formValues?: Record<string, any>;
|
|
539
|
-
/** Read-only mode */
|
|
540
|
-
readOnly?: boolean;
|
|
541
|
-
/** Disabled state */
|
|
542
|
-
disabled?: boolean;
|
|
543
|
-
/** All form elements (for container rendering) */
|
|
544
|
-
allElements?: FormElement[];
|
|
545
|
-
/**
|
|
546
|
-
* Render children elements (for container elements)
|
|
547
|
-
* This is provided by the form renderer to handle nested elements
|
|
548
|
-
*/
|
|
549
|
-
renderChildren?: (containerId: string, namePrefix?: string) => default_2.ReactNode;
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
/**
|
|
553
|
-
* Props for settings panel components
|
|
554
|
-
*/
|
|
555
|
-
export declare interface ElementSettingsProps {
|
|
556
|
-
/** The form element being edited */
|
|
557
|
-
element: FormElement;
|
|
558
|
-
/** Callback to update element properties */
|
|
559
|
-
onUpdate: (updates: Partial<FormElement>) => void;
|
|
560
|
-
/** Current tab in settings panel */
|
|
561
|
-
activeTab?: "properties" | "layout" | "validation" | "logic";
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
/**
|
|
565
|
-
* Declarative schema that drives the dynamic property panel.
|
|
566
|
-
*
|
|
567
|
-
* When an `ElementDefinition` provides this (via `settingsSchema`),
|
|
568
|
-
* the PropertyPanel will automatically render the described fields
|
|
569
|
-
* instead of relying on the hardcoded per-type switch statements.
|
|
570
|
-
*/
|
|
571
|
-
declare interface ElementSettingsSchema {
|
|
572
|
-
/** Custom title and icon for the config section */
|
|
573
|
-
configSection?: {
|
|
574
|
-
title: string;
|
|
575
|
-
icon?: string;
|
|
576
|
-
};
|
|
577
|
-
/** Ordered list of fields to render in the config section */
|
|
578
|
-
fields: SettingField[];
|
|
579
|
-
/**
|
|
580
|
-
* Control which standard sections appear in the property panel.
|
|
581
|
-
* Omitted keys default to the existing static behaviour.
|
|
582
|
-
*/
|
|
583
|
-
showSections?: {
|
|
584
|
-
properties?: boolean;
|
|
585
|
-
layout?: boolean;
|
|
586
|
-
validation?: boolean;
|
|
587
|
-
attributes?: boolean;
|
|
588
|
-
logic?: boolean;
|
|
589
|
-
options?: boolean;
|
|
590
|
-
matrix?: boolean;
|
|
591
|
-
};
|
|
592
|
-
/**
|
|
593
|
-
* Fine-grained control over the built-in Properties section.
|
|
594
|
-
* Only takes effect when showSections.properties is not false.
|
|
595
|
-
*/
|
|
596
|
-
properties?: {
|
|
597
|
-
showLabel?: boolean;
|
|
598
|
-
showPlaceholder?: boolean;
|
|
599
|
-
showDescription?: boolean;
|
|
600
|
-
showPrefix?: boolean;
|
|
601
|
-
showSuffix?: boolean;
|
|
602
|
-
};
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
/**
|
|
606
|
-
* Element structure defines whether the element is a field (collects data)
|
|
607
|
-
* or a page element (layout/structural)
|
|
608
|
-
*/
|
|
609
|
-
export declare type ElementStructure = "field" | "page";
|
|
610
|
-
|
|
611
|
-
export declare type ElementType = FieldElementType | PageElementType;
|
|
612
|
-
|
|
613
|
-
/**
|
|
614
|
-
* Standard element type categories
|
|
615
|
-
*/
|
|
616
|
-
export declare type ElementTypeCategory = "Text" | "Numeric" | "Contact" | "Security" | "Selection" | "Matrix" | "DateTime" | "FileUpload" | "Display" | "Heading" | "Layout" | "Repeatable" | "Special" | "Payment" | "Pricing" | "Product" | "Custom";
|
|
617
|
-
|
|
618
|
-
export declare interface ElementValidation {
|
|
619
|
-
required?: boolean;
|
|
620
|
-
minLength?: number;
|
|
621
|
-
maxLength?: number;
|
|
622
|
-
min?: number;
|
|
623
|
-
max?: number;
|
|
624
|
-
pattern?: string;
|
|
625
|
-
customRules?: ValidationRule[];
|
|
626
|
-
errorMessage?: string;
|
|
627
|
-
minFiles?: number;
|
|
628
|
-
maxFiles?: number;
|
|
629
|
-
minDates?: number;
|
|
630
|
-
maxDates?: number;
|
|
631
|
-
minSelections?: number;
|
|
632
|
-
maxSelections?: number;
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
export declare const EmptyState: default_2.FC<EmptyStateProps>;
|
|
636
|
-
|
|
637
|
-
declare interface EmptyStateProps {
|
|
638
|
-
icon?: string;
|
|
639
|
-
message: string;
|
|
640
|
-
subMessage?: string;
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
/**
|
|
644
|
-
* EntryPulse - The main form builder component
|
|
645
|
-
*
|
|
646
|
-
* @example
|
|
647
|
-
* Basic usage:
|
|
648
|
-
* ```tsx
|
|
649
|
-
* <EntryPulse />
|
|
650
|
-
* ```
|
|
651
|
-
*
|
|
652
|
-
* @example
|
|
653
|
-
* With custom toolbar actions:
|
|
654
|
-
* ```tsx
|
|
655
|
-
* import { createToolbarAction } from 'entry-pulse';
|
|
656
|
-
* import { Save } from 'lucide-react';
|
|
657
|
-
*
|
|
658
|
-
* const saveAction = createToolbarAction({
|
|
659
|
-
* id: 'save',
|
|
660
|
-
* icon: Save,
|
|
661
|
-
* label: 'Save Form',
|
|
662
|
-
* position: 'right',
|
|
663
|
-
* onClick: (ctx) => {
|
|
664
|
-
* saveToServer(ctx.schema);
|
|
665
|
-
* }
|
|
666
|
-
* });
|
|
667
|
-
*
|
|
668
|
-
* <EntryPulse toolbarActions={[saveAction]} />
|
|
669
|
-
* ```
|
|
670
|
-
*
|
|
671
|
-
* @example
|
|
672
|
-
* With full toolbar configuration:
|
|
673
|
-
* ```tsx
|
|
674
|
-
* <EntryPulse
|
|
675
|
-
* toolbarConfig={{
|
|
676
|
-
* actions: [saveAction, publishAction],
|
|
677
|
-
* hideBuiltinActions: ['reset'],
|
|
678
|
-
* showImportExport: false,
|
|
679
|
-
* }}
|
|
680
|
-
* />
|
|
681
|
-
* ```
|
|
682
|
-
*/
|
|
683
|
-
declare const EntryPulse: default_2.FC<EntryPulseProps>;
|
|
684
|
-
export { EntryPulse }
|
|
685
|
-
export default EntryPulse;
|
|
686
|
-
|
|
687
|
-
/**
|
|
688
|
-
* Props for the EntryPulse component
|
|
689
|
-
*/
|
|
690
|
-
export declare interface EntryPulseProps {
|
|
691
|
-
/**
|
|
692
|
-
* Initial schema to load into the form builder
|
|
693
|
-
*/
|
|
694
|
-
initialSchema?: FormSchema;
|
|
695
|
-
/**
|
|
696
|
-
* Callback when the schema changes
|
|
697
|
-
*/
|
|
698
|
-
onSchemaChange?: (schema: FormSchema) => void;
|
|
699
|
-
/**
|
|
700
|
-
* Custom toolbar actions to add to the toolbar
|
|
701
|
-
*/
|
|
702
|
-
toolbarActions?: ToolbarAction[];
|
|
703
|
-
/**
|
|
704
|
-
* Full toolbar configuration for advanced customization
|
|
705
|
-
*/
|
|
706
|
-
toolbarConfig?: ToolbarConfig;
|
|
707
|
-
/**
|
|
708
|
-
* Custom sidebar tabs to add to the element sidebar
|
|
709
|
-
*/
|
|
710
|
-
sidebarTabs?: SidebarTab[];
|
|
711
|
-
/**
|
|
712
|
-
* Full sidebar configuration for advanced customization
|
|
713
|
-
*/
|
|
714
|
-
sidebarConfig?: SidebarConfig;
|
|
715
|
-
/**
|
|
716
|
-
* Callback when form is submitted in preview mode
|
|
717
|
-
*/
|
|
718
|
-
onPreviewSubmit?: (data: FormSubmissionData) => void;
|
|
719
|
-
/**
|
|
720
|
-
* Format of the submitted data (default: "keyValue")
|
|
721
|
-
* - "keyValue": Returns a flat object with field names as keys
|
|
722
|
-
* - "array": Returns an array of objects with id, value, type, and category
|
|
723
|
-
*/
|
|
724
|
-
submissionFormat?: SubmissionFormat;
|
|
725
|
-
/**
|
|
726
|
-
* Whether to show the element sidebar (default: true)
|
|
727
|
-
*/
|
|
728
|
-
showElementSidebar?: boolean;
|
|
729
|
-
/**
|
|
730
|
-
* Whether to show the property panel (default: true)
|
|
731
|
-
*/
|
|
732
|
-
showPropertyPanel?: boolean;
|
|
733
|
-
/**
|
|
734
|
-
* Custom class name for the container
|
|
735
|
-
*/
|
|
736
|
-
className?: string;
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
export declare const ErrorMessages: default_2.FC<ErrorMessagesProps>;
|
|
740
|
-
|
|
741
|
-
declare interface ErrorMessagesProps {
|
|
742
|
-
errors?: string[];
|
|
743
|
-
className?: string;
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
/**
|
|
747
|
-
* Extract common render context values
|
|
748
|
-
*/
|
|
749
|
-
export declare function extractContextValues(context: ElementRenderContext): {
|
|
750
|
-
label: string | undefined;
|
|
751
|
-
description: string | undefined;
|
|
752
|
-
placeholder: string | undefined;
|
|
753
|
-
prefix: string | undefined;
|
|
754
|
-
suffix: string | undefined;
|
|
755
|
-
required: boolean;
|
|
756
|
-
labelPosition: "left" | "top" | "hidden";
|
|
757
|
-
isCanvas: boolean;
|
|
758
|
-
isDisabled: boolean;
|
|
759
|
-
value: any;
|
|
760
|
-
onChange: ((value: any) => void) | undefined;
|
|
761
|
-
errors: string[] | undefined;
|
|
762
|
-
config: ElementConfig | undefined;
|
|
763
|
-
element: FormElement;
|
|
764
|
-
};
|
|
765
|
-
|
|
766
|
-
declare type FieldElementType = TextInputElementType | NumericElementType | ContactElementType | SecurityElementType | SelectionElementType | MatrixElementType | DateTimeElementType | FileUploadElementType | DisplayFieldElementType;
|
|
767
|
-
|
|
768
|
-
declare type FieldSubCategory = "textInput" | "numeric" | "contact" | "security" | "selection" | "matrix" | "dateTime" | "fileUpload" | "display";
|
|
769
|
-
|
|
770
|
-
/**
|
|
771
|
-
* Wrapper component for form fields
|
|
772
|
-
* Handles label, description, and error display
|
|
773
|
-
*/
|
|
774
|
-
export declare const FieldWrapper: default_2.FC<RenderHelperProps>;
|
|
775
|
-
|
|
776
|
-
declare type FileUploadElementType = "fileUpload" | "imageUpload" | "multiFileUpload" | "multiImageUpload";
|
|
777
|
-
|
|
778
|
-
/**
|
|
779
|
-
* Filter out non-field elements from submitted data
|
|
780
|
-
* This removes layout elements like dividers, paragraphs, etc.
|
|
781
|
-
*/
|
|
782
|
-
export declare function filterFieldData(data: Record<string, any>, elements: FormElement[]): Record<string, any>;
|
|
783
|
-
|
|
784
|
-
declare interface FormBuilderActions {
|
|
785
|
-
addElement: (type: ElementType, insertIndex?: number) => void;
|
|
786
|
-
addElementToContainer: (type: ElementType, containerId: string, stepId?: string) => void;
|
|
787
|
-
updateElement: (id: string, updates: Partial<FormElement>) => void;
|
|
788
|
-
deleteElement: (id: string) => void;
|
|
789
|
-
duplicateElement: (id: string) => void;
|
|
790
|
-
moveElement: (id: string, newIndex: number) => void;
|
|
791
|
-
reorderElements: (fromIndex: number, toIndex: number) => void;
|
|
792
|
-
selectElement: (id: string | null) => void;
|
|
793
|
-
hasWizard: () => boolean;
|
|
794
|
-
addWizardStep: (wizardId: string, step: WizardStep) => void;
|
|
795
|
-
updateWizardStep: (wizardId: string, stepId: string, updates: Partial<WizardStep>) => void;
|
|
796
|
-
removeWizardStep: (wizardId: string, stepId: string) => void;
|
|
797
|
-
setActiveWizardStep: (wizardId: string, stepId: string) => void;
|
|
798
|
-
getContainerChildren: (containerId: string, stepId?: string) => FormElement[];
|
|
799
|
-
undo: () => void;
|
|
800
|
-
redo: () => void;
|
|
801
|
-
canUndo: () => boolean;
|
|
802
|
-
canRedo: () => boolean;
|
|
803
|
-
setMode: (mode: string) => void;
|
|
804
|
-
loadSchema: (schema: FormSchema) => void;
|
|
805
|
-
exportSchema: () => FormSchema;
|
|
806
|
-
resetForm: () => void;
|
|
807
|
-
updateFormTitle: (title: string) => void;
|
|
808
|
-
updateFormDescription: (description: string) => void;
|
|
809
|
-
setHoveredElementId: (id: string | null) => void;
|
|
810
|
-
setDraggedElementType: (type: ElementType | null) => void;
|
|
811
|
-
validateSchema: () => ValidationResult;
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
declare interface FormBuilderState {
|
|
815
|
-
schema: FormSchema;
|
|
816
|
-
selectedElementId: string | null;
|
|
817
|
-
mode: string;
|
|
818
|
-
history: FormSchema[];
|
|
819
|
-
historyIndex: number;
|
|
820
|
-
hoveredElementId: string | null;
|
|
821
|
-
draggedElementType: ElementType | null;
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
declare type FormBuilderStore = FormBuilderState & FormBuilderActions;
|
|
825
|
-
|
|
826
|
-
export declare interface FormElement {
|
|
827
|
-
id: string;
|
|
828
|
-
type: ElementType;
|
|
829
|
-
parentId?: string;
|
|
830
|
-
order: number;
|
|
831
|
-
properties: ElementProperties;
|
|
832
|
-
layout: ElementLayout;
|
|
833
|
-
validation?: ElementValidation;
|
|
834
|
-
logic?: ElementLogic;
|
|
835
|
-
attributes: ElementAttributes;
|
|
836
|
-
config?: ElementConfig;
|
|
837
|
-
children?: string[];
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
/**
|
|
841
|
-
* Renders a form element in the actual form (runtime mode)
|
|
842
|
-
*
|
|
843
|
-
* This component handles:
|
|
844
|
-
* - Value management
|
|
845
|
-
* - Change callbacks
|
|
846
|
-
* - Validation errors display
|
|
847
|
-
* - Read-only and disabled states
|
|
848
|
-
*/
|
|
849
|
-
export declare const FormElementRenderer: default_2.FC<FormElementRendererProps_2>;
|
|
850
|
-
|
|
851
|
-
/**
|
|
852
|
-
* Props for the form renderer (runtime)
|
|
853
|
-
*/
|
|
854
|
-
export declare interface FormElementRendererProps {
|
|
855
|
-
element: FormElement;
|
|
856
|
-
value?: any;
|
|
857
|
-
onChange?: (value: any) => void;
|
|
858
|
-
errors?: string[];
|
|
859
|
-
formValues?: Record<string, any>;
|
|
860
|
-
readOnly?: boolean;
|
|
861
|
-
disabled?: boolean;
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
declare interface FormElementRendererProps_2 {
|
|
865
|
-
element: FormElement;
|
|
866
|
-
value?: any;
|
|
867
|
-
onChange?: (value: any) => void;
|
|
868
|
-
errors?: string[];
|
|
869
|
-
formValues?: Record<string, any>;
|
|
870
|
-
readOnly?: boolean;
|
|
871
|
-
disabled?: boolean;
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
export declare interface FormMetadata {
|
|
875
|
-
createdAt: string;
|
|
876
|
-
updatedAt: string;
|
|
877
|
-
author?: string;
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
export declare const FormPreview: default_2.FC<FormPreviewProps>;
|
|
881
|
-
|
|
882
|
-
declare interface FormPreviewProps {
|
|
883
|
-
schema: FormSchema;
|
|
884
|
-
onSubmit?: (data: FormSubmissionData) => void;
|
|
885
|
-
initialValues?: Record<string, any>;
|
|
886
|
-
/**
|
|
887
|
-
* Format of the submitted data (default: "keyValue")
|
|
888
|
-
* - "keyValue": Returns a flat object with field names as keys
|
|
889
|
-
* - "array": Returns an array of objects with id, value, type, and category
|
|
890
|
-
*/
|
|
891
|
-
submissionFormat?: SubmissionFormat;
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
export declare interface FormSchema {
|
|
895
|
-
id: string;
|
|
896
|
-
version: string;
|
|
897
|
-
title: string;
|
|
898
|
-
description?: string;
|
|
899
|
-
metadata?: FormMetadata;
|
|
900
|
-
settings?: FormSettings;
|
|
901
|
-
elements: FormElement[];
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
export declare interface FormSettings {
|
|
905
|
-
showProgressBar?: boolean;
|
|
906
|
-
allowSaveDraft?: boolean;
|
|
907
|
-
submitButtonText?: string;
|
|
908
|
-
successMessage?: string;
|
|
909
|
-
errorMessage?: string;
|
|
910
|
-
redirectUrl?: string;
|
|
911
|
-
submitAction?: "message" | "redirect" | "custom";
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
export declare type FormSubmissionData = Record<string, any> | SubmissionDataItem[];
|
|
915
|
-
|
|
916
|
-
/**
|
|
917
|
-
* Create button class names
|
|
918
|
-
*/
|
|
919
|
-
export declare function getButtonClassName(options?: {
|
|
920
|
-
variant?: 'primary' | 'secondary' | 'outline' | 'ghost';
|
|
921
|
-
size?: 'small' | 'medium' | 'large';
|
|
922
|
-
disabled?: boolean;
|
|
923
|
-
}): string;
|
|
924
|
-
|
|
925
|
-
/**
|
|
926
|
-
* Create canvas preview input class names (always disabled look)
|
|
927
|
-
*/
|
|
928
|
-
export declare function getCanvasInputClassName(size?: 'small' | 'medium' | 'large'): string;
|
|
929
|
-
|
|
930
|
-
/**
|
|
931
|
-
* Get element definition
|
|
932
|
-
*/
|
|
933
|
-
export declare function getElementDefinition(type: ElementType | string): ElementDefinition | undefined;
|
|
934
|
-
|
|
935
|
-
/**
|
|
936
|
-
* Get the icon for an element type
|
|
937
|
-
*/
|
|
938
|
-
export declare function getElementIcon(type: string): string | default_2.ComponentType<{
|
|
939
|
-
className?: string;
|
|
940
|
-
}> | undefined;
|
|
941
|
-
|
|
942
|
-
/**
|
|
943
|
-
* Get the label for an element type
|
|
944
|
-
*/
|
|
945
|
-
export declare function getElementLabel(type: string): string;
|
|
946
|
-
|
|
947
|
-
/**
|
|
948
|
-
* Create standard input class names
|
|
949
|
-
*/
|
|
950
|
-
export declare function getInputClassName(options?: {
|
|
951
|
-
hasError?: boolean;
|
|
952
|
-
disabled?: boolean;
|
|
953
|
-
size?: 'small' | 'medium' | 'large';
|
|
954
|
-
hasLeftIcon?: boolean;
|
|
955
|
-
hasRightIcon?: boolean;
|
|
956
|
-
hasPrefix?: boolean;
|
|
957
|
-
hasSuffix?: boolean;
|
|
958
|
-
}): string;
|
|
959
|
-
|
|
960
|
-
/**
|
|
961
|
-
* Get a mode definition by id.
|
|
962
|
-
*/
|
|
963
|
-
export declare function getModeDefinition(id: string): ModeDefinition | undefined;
|
|
964
|
-
|
|
965
|
-
/**
|
|
966
|
-
* Check if element type exists
|
|
967
|
-
*/
|
|
968
|
-
export declare function hasElement(type: ElementType | string): boolean;
|
|
969
|
-
|
|
970
|
-
/**
|
|
971
|
-
* Check if a mode is registered.
|
|
972
|
-
*/
|
|
973
|
-
export declare function hasMode(id: string): boolean;
|
|
974
|
-
|
|
975
|
-
declare type HeadingElementType = "formHeading" | "sectionHeading" | "subheading";
|
|
976
|
-
|
|
977
|
-
export declare const IconInput: default_2.FC<IconInputProps>;
|
|
978
|
-
|
|
979
|
-
declare interface IconInputProps {
|
|
980
|
-
icon: string;
|
|
981
|
-
children: default_2.ReactNode;
|
|
982
|
-
iconPosition?: 'left' | 'right';
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
/**
|
|
986
|
-
* Element registry interface
|
|
987
|
-
*/
|
|
988
|
-
export declare interface IElementRegistry {
|
|
989
|
-
/** Register a new element */
|
|
990
|
-
register(definition: ElementDefinition, options?: RegisterElementOptions): void;
|
|
991
|
-
/** Get element definition by type */
|
|
992
|
-
get(type: ElementType | string): ElementDefinition | undefined;
|
|
993
|
-
/** Check if element type is registered */
|
|
994
|
-
has(type: ElementType | string): boolean;
|
|
995
|
-
/** Get all registered elements */
|
|
996
|
-
getAll(): ElementDefinition[];
|
|
997
|
-
/** Get elements by category */
|
|
998
|
-
getByCategory(category: ElementCategory): ElementDefinition[];
|
|
999
|
-
/** Get elements by structure */
|
|
1000
|
-
getByStructure(structure: ElementStructure): ElementDefinition[];
|
|
1001
|
-
/** Get elements by type category */
|
|
1002
|
-
getByTypeCategory(typeCategory: ElementTypeCategory): ElementDefinition[];
|
|
1003
|
-
/** Get element groups for sidebar */
|
|
1004
|
-
getGroups(): ElementGroup[];
|
|
1005
|
-
/** Unregister an element */
|
|
1006
|
-
unregister(type: ElementType | string): boolean;
|
|
1007
|
-
/** Clear all registered elements */
|
|
1008
|
-
clear(): void;
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
/**
|
|
1012
|
-
* Interface for the mode registry.
|
|
1013
|
-
*/
|
|
1014
|
-
export declare interface IModeRegistry {
|
|
1015
|
-
/** Register a new mode definition */
|
|
1016
|
-
register(definition: ModeDefinition): void;
|
|
1017
|
-
/** Get a mode definition by id */
|
|
1018
|
-
get(id: string): ModeDefinition | undefined;
|
|
1019
|
-
/** Check if a mode is registered */
|
|
1020
|
-
has(id: string): boolean;
|
|
1021
|
-
/** Get all registered modes sorted by order */
|
|
1022
|
-
getAll(): ModeDefinition[];
|
|
1023
|
-
/** Get all visible modes (not hidden) sorted by order */
|
|
1024
|
-
getVisible(): ModeDefinition[];
|
|
1025
|
-
/** Unregister a mode */
|
|
1026
|
-
unregister(id: string): boolean;
|
|
1027
|
-
/** Clear all registered modes */
|
|
1028
|
-
clear(): void;
|
|
1029
|
-
}
|
|
1030
|
-
|
|
1031
|
-
/**
|
|
1032
|
-
* Wrapper for input elements with configurable label position
|
|
1033
|
-
*/
|
|
1034
|
-
export declare const InputWrapper: default_2.FC<InputWrapperProps>;
|
|
1035
|
-
|
|
1036
|
-
/**
|
|
1037
|
-
* Input wrapper props for consistent styling
|
|
1038
|
-
*/
|
|
1039
|
-
export declare interface InputWrapperProps extends RenderHelperProps {
|
|
1040
|
-
labelPosition?: "left" | "top" | "hidden";
|
|
1041
|
-
className?: string;
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
/**
|
|
1045
|
-
* Helper to check if an action is disabled based on context
|
|
1046
|
-
*/
|
|
1047
|
-
export declare function isActionDisabled(action: ToolbarAction, context: ToolbarActionContext): boolean;
|
|
1048
|
-
|
|
1049
|
-
/**
|
|
1050
|
-
* Helper to check if an action is hidden based on context
|
|
1051
|
-
*/
|
|
1052
|
-
export declare function isActionHidden(action: ToolbarAction, context: ToolbarActionContext): boolean;
|
|
1053
|
-
|
|
1054
|
-
/**
|
|
1055
|
-
* Check if an element type is registered
|
|
1056
|
-
*/
|
|
1057
|
-
export declare function isElementRegistered(type: string): boolean;
|
|
1058
|
-
|
|
1059
|
-
/**
|
|
1060
|
-
* Helper to check if a sidebar tab is disabled based on context
|
|
1061
|
-
*/
|
|
1062
|
-
export declare function isSidebarTabDisabled(tab: SidebarTab, context: SidebarTabContext): boolean;
|
|
1063
|
-
|
|
1064
|
-
/**
|
|
1065
|
-
* Helper to check if a sidebar tab is hidden based on context
|
|
1066
|
-
*/
|
|
1067
|
-
export declare function isSidebarTabHidden(tab: SidebarTab, context: SidebarTabContext): boolean;
|
|
1068
|
-
|
|
1069
|
-
declare interface LabelProps {
|
|
1070
|
-
label?: string;
|
|
1071
|
-
required?: boolean;
|
|
1072
|
-
htmlFor?: string;
|
|
1073
|
-
className?: string;
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
declare type LayoutElementType = "divider" | "spacer" | "group" | "grid" | "table";
|
|
1077
|
-
|
|
1078
|
-
declare interface MatrixColumn {
|
|
1079
|
-
id: string;
|
|
1080
|
-
label: string;
|
|
1081
|
-
type?: "text" | "number" | "dropdown";
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
declare type MatrixElementType = "singleChoiceMatrix" | "multipleChoiceMatrix" | "matrixTable";
|
|
1085
|
-
|
|
1086
|
-
declare interface MatrixRow {
|
|
1087
|
-
id: string;
|
|
1088
|
-
label: string;
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
/**
|
|
1092
|
-
* Pre-built child components that modes can compose into their layout.
|
|
1093
|
-
*
|
|
1094
|
-
* These are provided by the form builder so that custom modes can
|
|
1095
|
-
* reuse the standard UI building blocks without reimplementing them.
|
|
1096
|
-
*/
|
|
1097
|
-
export declare interface ModeContentChildren {
|
|
1098
|
-
/** The element sidebar component (left panel) */
|
|
1099
|
-
ElementSidebar?: default_2.ReactNode;
|
|
1100
|
-
/** The canvas component (center area) */
|
|
1101
|
-
Canvas?: default_2.ReactNode;
|
|
1102
|
-
/** The property panel component (right panel) */
|
|
1103
|
-
PropertyPanel?: default_2.ReactNode;
|
|
1104
|
-
}
|
|
1105
|
-
|
|
1106
|
-
/**
|
|
1107
|
-
* Context provided to mode render functions and lifecycle hooks.
|
|
1108
|
-
* Gives modes access to the form builder's state and actions.
|
|
1109
|
-
*/
|
|
1110
|
-
export declare interface ModeContext {
|
|
1111
|
-
/** Current form schema */
|
|
1112
|
-
schema: FormSchema;
|
|
1113
|
-
/** Current active mode id */
|
|
1114
|
-
currentMode: string;
|
|
1115
|
-
/** Switch to a different mode */
|
|
1116
|
-
setMode: (mode: string) => void;
|
|
1117
|
-
/** Submission format preference */
|
|
1118
|
-
submissionFormat: SubmissionFormat;
|
|
1119
|
-
/** Callback when form is submitted (preview-like modes) */
|
|
1120
|
-
onSubmit?: (data: FormSubmissionData) => void;
|
|
1121
|
-
/** Whether the element sidebar is visible */
|
|
1122
|
-
showElementSidebar: boolean;
|
|
1123
|
-
/** Whether the property panel is visible */
|
|
1124
|
-
showPropertyPanel: boolean;
|
|
1125
|
-
/** Load a new schema */
|
|
1126
|
-
loadSchema: (schema: FormSchema) => void;
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
|
-
/**
|
|
1130
|
-
* Definition of a registered mode.
|
|
1131
|
-
*
|
|
1132
|
-
* Each mode represents a distinct view in the form builder (e.g., design canvas,
|
|
1133
|
-
* live preview, code export). The mode's `renderContent` function is responsible
|
|
1134
|
-
* for rendering the full main content area when that mode is active.
|
|
1135
|
-
*/
|
|
1136
|
-
export declare interface ModeDefinition {
|
|
1137
|
-
/** Unique identifier for this mode (e.g., "design", "preview") */
|
|
1138
|
-
id: string;
|
|
1139
|
-
/** Display label shown in tooltips and UI */
|
|
1140
|
-
label: string;
|
|
1141
|
-
/** Icon component (lucide-react icon or custom component) */
|
|
1142
|
-
icon: ComponentType<{
|
|
1143
|
-
className?: string;
|
|
1144
|
-
}>;
|
|
1145
|
-
/**
|
|
1146
|
-
* Render the main content area for this mode.
|
|
1147
|
-
*
|
|
1148
|
-
* Called by EntryPulse when this mode is active. The mode is
|
|
1149
|
-
* responsible for rendering its own full content layout.
|
|
1150
|
-
*
|
|
1151
|
-
* @param context - Provides schema, callbacks, and builder state
|
|
1152
|
-
* @param children - Pre-built child components the mode can compose
|
|
1153
|
-
* (sidebar, canvas, property panel, etc.)
|
|
1154
|
-
*/
|
|
1155
|
-
renderContent: (context: ModeContext, children?: ModeContentChildren) => default_2.ReactNode;
|
|
1156
|
-
/**
|
|
1157
|
-
* Sort order in the mode toggle group (lower = leftmost).
|
|
1158
|
-
* Built-in modes use: design=0, preview=10.
|
|
1159
|
-
* Defaults to 50 for custom modes.
|
|
1160
|
-
*/
|
|
1161
|
-
order?: number;
|
|
1162
|
-
/**
|
|
1163
|
-
* Keyboard shortcut key (e.g., "d" for design, "p" for preview).
|
|
1164
|
-
* Will be triggered with Ctrl/Cmd modifier.
|
|
1165
|
-
*/
|
|
1166
|
-
keyboardShortcut?: string;
|
|
1167
|
-
/**
|
|
1168
|
-
* Whether this mode is hidden from the toolbar mode toggle.
|
|
1169
|
-
* Hidden modes can still be activated programmatically via setMode().
|
|
1170
|
-
*/
|
|
1171
|
-
hidden?: boolean;
|
|
1172
|
-
/**
|
|
1173
|
-
* Whether this mode is disabled (shown greyed out, not clickable).
|
|
1174
|
-
* Can be a static boolean or a function that checks the context.
|
|
1175
|
-
*/
|
|
1176
|
-
disabled?: boolean | ((context: ModeContext) => boolean);
|
|
1177
|
-
/**
|
|
1178
|
-
* Tooltip description for the mode button (optional, overrides label).
|
|
1179
|
-
*/
|
|
1180
|
-
description?: string;
|
|
1181
|
-
/**
|
|
1182
|
-
* Version of the mode definition (for future migrations).
|
|
1183
|
-
*/
|
|
1184
|
-
version?: string;
|
|
1185
|
-
}
|
|
1186
|
-
|
|
1187
|
-
declare class ModeRegistry implements IModeRegistry {
|
|
1188
|
-
private modes;
|
|
1189
|
-
/**
|
|
1190
|
-
* Register a new mode definition.
|
|
1191
|
-
*
|
|
1192
|
-
* @throws if required fields are missing
|
|
1193
|
-
* @warns if the id is already taken (unless override was intended)
|
|
1194
|
-
*/
|
|
1195
|
-
register(definition: ModeDefinition): void;
|
|
1196
|
-
/**
|
|
1197
|
-
* Get a mode definition by id.
|
|
1198
|
-
*/
|
|
1199
|
-
get(id: string): ModeDefinition | undefined;
|
|
1200
|
-
/**
|
|
1201
|
-
* Check if a mode is registered.
|
|
1202
|
-
*/
|
|
1203
|
-
has(id: string): boolean;
|
|
1204
|
-
/**
|
|
1205
|
-
* Get all registered modes sorted by order (ascending).
|
|
1206
|
-
*/
|
|
1207
|
-
getAll(): ModeDefinition[];
|
|
1208
|
-
/**
|
|
1209
|
-
* Get all visible modes (not hidden) sorted by order.
|
|
1210
|
-
* These are the modes that should appear in the toolbar toggle.
|
|
1211
|
-
*/
|
|
1212
|
-
getVisible(): ModeDefinition[];
|
|
1213
|
-
/**
|
|
1214
|
-
* Unregister a mode by id.
|
|
1215
|
-
*/
|
|
1216
|
-
unregister(id: string): boolean;
|
|
1217
|
-
/**
|
|
1218
|
-
* Clear all registered modes.
|
|
1219
|
-
*/
|
|
1220
|
-
clear(): void;
|
|
1221
|
-
}
|
|
1222
|
-
|
|
1223
|
-
/**
|
|
1224
|
-
* Global mode registry instance.
|
|
1225
|
-
*/
|
|
1226
|
-
export declare const modeRegistry: ModeRegistry;
|
|
1227
|
-
|
|
1228
|
-
declare type NumericElementType = "number" | "slider" | "rangeSlider";
|
|
1229
|
-
|
|
1230
|
-
declare type PageElementType = HeadingElementType | LayoutElementType | RepeatableElementType | SpecialPageElementType;
|
|
1231
|
-
|
|
1232
|
-
declare type PageSubCategory = "heading" | "layout" | "repeatable" | "special";
|
|
1233
|
-
|
|
1234
|
-
declare interface QueryBuilderRule {
|
|
1235
|
-
combinator: "and" | "or";
|
|
1236
|
-
rules: Array<{
|
|
1237
|
-
field: string;
|
|
1238
|
-
operator: string;
|
|
1239
|
-
value: any;
|
|
1240
|
-
}>;
|
|
1241
|
-
}
|
|
1242
|
-
|
|
1243
|
-
/**
|
|
1244
|
-
* Register all built-in elements with the registry
|
|
1245
|
-
*/
|
|
1246
|
-
export declare function registerBuiltInElements(): void;
|
|
1247
|
-
|
|
1248
|
-
/**
|
|
1249
|
-
* Register all built-in modes.
|
|
1250
|
-
*
|
|
1251
|
-
* Called once during application bootstrap. Safe to call multiple
|
|
1252
|
-
* times – duplicate registrations are silently ignored by the
|
|
1253
|
-
* registry.
|
|
1254
|
-
*/
|
|
1255
|
-
export declare function registerBuiltinModes(): void;
|
|
1256
|
-
|
|
1257
|
-
/**
|
|
1258
|
-
* Register a custom element
|
|
1259
|
-
*
|
|
1260
|
-
* @example
|
|
1261
|
-
* ```tsx
|
|
1262
|
-
* registerElement({
|
|
1263
|
-
* type: 'myCustomInput',
|
|
1264
|
-
* structure: 'field',
|
|
1265
|
-
* typeCategory: 'Custom',
|
|
1266
|
-
* label: 'My Custom Input',
|
|
1267
|
-
* description: 'A custom input element',
|
|
1268
|
-
* icon: '🎨',
|
|
1269
|
-
* category: 'field',
|
|
1270
|
-
* subCategory: 'textInput',
|
|
1271
|
-
* renderOnCanvas: (ctx) => <div>Preview: {ctx.properties.label}</div>,
|
|
1272
|
-
* render: (ctx) => <input type="text" value={ctx.value} onChange={e => ctx.onChange?.(e.target.value)} />,
|
|
1273
|
-
* getDefaultValues: () => ({
|
|
1274
|
-
* properties: { label: 'My Custom Input' },
|
|
1275
|
-
* layout: { labelPosition: 'top' },
|
|
1276
|
-
* }),
|
|
1277
|
-
* });
|
|
1278
|
-
* ```
|
|
1279
|
-
*/
|
|
1280
|
-
export declare function registerElement(definition: ElementDefinition, options?: RegisterElementOptions): void;
|
|
1281
|
-
|
|
1282
|
-
/**
|
|
1283
|
-
* Options for registering an element
|
|
1284
|
-
*/
|
|
1285
|
-
export declare interface RegisterElementOptions {
|
|
1286
|
-
/** Override existing element with same type */
|
|
1287
|
-
override?: boolean;
|
|
1288
|
-
/** Group name for custom elements */
|
|
1289
|
-
group?: string;
|
|
1290
|
-
}
|
|
1291
|
-
|
|
1292
|
-
/**
|
|
1293
|
-
* Register multiple elements at once
|
|
1294
|
-
*/
|
|
1295
|
-
export declare function registerElements(definitions: ElementDefinition[], options?: RegisterElementOptions): void;
|
|
1296
|
-
|
|
1297
|
-
/**
|
|
1298
|
-
* Register a custom mode.
|
|
1299
|
-
*
|
|
1300
|
-
* @example
|
|
1301
|
-
* ```tsx
|
|
1302
|
-
* import { registerMode } from 'entry-pulse';
|
|
1303
|
-
* import { Code } from 'lucide-react';
|
|
1304
|
-
*
|
|
1305
|
-
* registerMode({
|
|
1306
|
-
* id: 'export',
|
|
1307
|
-
* label: 'Export Code',
|
|
1308
|
-
* icon: Code,
|
|
1309
|
-
* order: 20,
|
|
1310
|
-
* keyboardShortcut: 'e',
|
|
1311
|
-
* renderContent: (ctx, children) => (
|
|
1312
|
-
* <div className="flex-1 flex">
|
|
1313
|
-
* {children?.Canvas}
|
|
1314
|
-
* <ExportPanel schema={ctx.schema} />
|
|
1315
|
-
* </div>
|
|
1316
|
-
* ),
|
|
1317
|
-
* });
|
|
1318
|
-
* ```
|
|
1319
|
-
*/
|
|
1320
|
-
export declare function registerMode(definition: ModeDefinition): void;
|
|
1321
|
-
|
|
1322
|
-
/**
|
|
1323
|
-
* Register multiple modes at once.
|
|
1324
|
-
*/
|
|
1325
|
-
export declare function registerModes(definitions: ModeDefinition[]): void;
|
|
1326
|
-
|
|
1327
|
-
/**
|
|
1328
|
-
* Render an element for a form using the registry
|
|
1329
|
-
*/
|
|
1330
|
-
export declare function renderElement(element: FormElement, value?: any, onChange?: (value: any) => void, errors?: string[], formValues?: Record<string, any>): default_2.ReactNode;
|
|
1331
|
-
|
|
1332
|
-
/**
|
|
1333
|
-
* Render an element for the canvas using the registry
|
|
1334
|
-
*/
|
|
1335
|
-
export declare function renderElementOnCanvas(element: FormElement, isSelected?: boolean): default_2.ReactNode;
|
|
1336
|
-
|
|
1337
|
-
/**
|
|
1338
|
-
* Common render helper props
|
|
1339
|
-
*/
|
|
1340
|
-
export declare interface RenderHelperProps {
|
|
1341
|
-
label?: string;
|
|
1342
|
-
description?: string;
|
|
1343
|
-
required?: boolean;
|
|
1344
|
-
errors?: string[];
|
|
1345
|
-
children: default_2.ReactNode;
|
|
1346
|
-
}
|
|
1347
|
-
|
|
1348
|
-
declare type RepeatableElementType = "repeatElement" | "repeatGroup";
|
|
1349
|
-
|
|
1350
|
-
declare type SecurityElementType = "password" | "signature" | "captcha";
|
|
1351
|
-
|
|
1352
|
-
declare type SelectionElementType = "singleChoice" | "multipleChoice" | "dropdown" | "tags" | "decisionBox" | "toggleSwitch";
|
|
1353
|
-
|
|
1354
|
-
/**
|
|
1355
|
-
* A single setting field definition for the property panel.
|
|
1356
|
-
*
|
|
1357
|
-
* Describes how a single property/config value should be rendered
|
|
1358
|
-
* and edited in the settings sidebar.
|
|
1359
|
-
*/
|
|
1360
|
-
declare interface SettingField {
|
|
1361
|
-
/** Unique key within the target section (properties, config, layout, validation) */
|
|
1362
|
-
key: string;
|
|
1363
|
-
/** Display label shown in the UI */
|
|
1364
|
-
label: string;
|
|
1365
|
-
/** Input type to render */
|
|
1366
|
-
type: SettingFieldType;
|
|
1367
|
-
/**
|
|
1368
|
-
* Which section of the element this field belongs to.
|
|
1369
|
-
* - "properties" → element.properties[key]
|
|
1370
|
-
* - "config" → element.config[key]
|
|
1371
|
-
* - "layout" → element.layout[key]
|
|
1372
|
-
* - "validation" → element.validation[key]
|
|
1373
|
-
*/
|
|
1374
|
-
section: "properties" | "config" | "layout" | "validation";
|
|
1375
|
-
/** Placeholder text for the input */
|
|
1376
|
-
placeholder?: string;
|
|
1377
|
-
/** Help text displayed below the field */
|
|
1378
|
-
description?: string;
|
|
1379
|
-
/** Options for select fields */
|
|
1380
|
-
options?: {
|
|
1381
|
-
value: string | number;
|
|
1382
|
-
label: string;
|
|
1383
|
-
}[];
|
|
1384
|
-
/** Minimum value for number fields */
|
|
1385
|
-
min?: number;
|
|
1386
|
-
/** Maximum value for number fields */
|
|
1387
|
-
max?: number;
|
|
1388
|
-
/** Default value when the field is empty */
|
|
1389
|
-
defaultValue?: any;
|
|
1390
|
-
/** Only render this field when another field matches a value */
|
|
1391
|
-
showWhen?: {
|
|
1392
|
-
/** Key of the condition field (looked up in the same section unless dotted) */
|
|
1393
|
-
field: string;
|
|
1394
|
-
/** Value the condition field must equal */
|
|
1395
|
-
value: any;
|
|
1396
|
-
};
|
|
1397
|
-
/** Column span within a 2-column grid (1 = half, 2 = full). Defaults to 2 */
|
|
1398
|
-
colSpan?: 1 | 2;
|
|
1399
|
-
/** Rows for textarea fields */
|
|
1400
|
-
rows?: number;
|
|
1401
|
-
}
|
|
1402
|
-
|
|
1403
|
-
/**
|
|
1404
|
-
* Field types supported by the dynamic settings renderer
|
|
1405
|
-
*/
|
|
1406
|
-
declare type SettingFieldType = "text" | "textarea" | "number" | "checkbox" | "select" | "color" | "url";
|
|
1407
|
-
|
|
1408
|
-
/**
|
|
1409
|
-
* Configuration options for the sidebar
|
|
1410
|
-
*/
|
|
1411
|
-
export declare interface SidebarConfig {
|
|
1412
|
-
/** Custom tabs to add to the sidebar */
|
|
1413
|
-
tabs?: SidebarTab[];
|
|
1414
|
-
/** Built-in tabs to hide */
|
|
1415
|
-
hideBuiltinTabs?: BuiltinSidebarTabId[];
|
|
1416
|
-
}
|
|
1417
|
-
|
|
1418
|
-
/**
|
|
1419
|
-
* Configuration for a sidebar tab
|
|
1420
|
-
*/
|
|
1421
|
-
export declare interface SidebarTab {
|
|
1422
|
-
/** Unique identifier for the tab (used as TabsTrigger value) */
|
|
1423
|
-
id: string;
|
|
1424
|
-
/** Label shown on the tab trigger */
|
|
1425
|
-
label: string;
|
|
1426
|
-
/** Optional icon displayed next to the label */
|
|
1427
|
-
icon?: LucideIcon | ComponentType<{
|
|
1428
|
-
className?: string;
|
|
1429
|
-
}>;
|
|
1430
|
-
/** Order relative to built-in tabs (lower = earlier). Built-in tabs: fields=0, pages=1. Default: 99 */
|
|
1431
|
-
order?: number;
|
|
1432
|
-
/** Content component rendered when the tab is active. Receives SidebarTabContext. */
|
|
1433
|
-
content: ComponentType<SidebarTabContentProps>;
|
|
1434
|
-
/** Whether the tab is disabled */
|
|
1435
|
-
disabled?: boolean | ((context: SidebarTabContext) => boolean);
|
|
1436
|
-
/** Whether the tab should be hidden */
|
|
1437
|
-
hidden?: boolean | ((context: SidebarTabContext) => boolean);
|
|
1438
|
-
}
|
|
1439
|
-
|
|
1440
|
-
/**
|
|
1441
|
-
* Props passed to a sidebar tab's content component
|
|
1442
|
-
*/
|
|
1443
|
-
export declare interface SidebarTabContentProps extends SidebarTabContext {
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
|
-
/**
|
|
1447
|
-
* Context provided to sidebar tab content components
|
|
1448
|
-
* Gives access to form state and actions for building interactive sidebar panels
|
|
1449
|
-
*/
|
|
1450
|
-
export declare interface SidebarTabContext {
|
|
1451
|
-
/** Current form schema */
|
|
1452
|
-
schema: FormSchema;
|
|
1453
|
-
/** Current mode id (e.g. "design", "preview", or any custom mode) */
|
|
1454
|
-
mode: string;
|
|
1455
|
-
/** Available actions to manipulate form state */
|
|
1456
|
-
actions: {
|
|
1457
|
-
/** Add a new element to the form */
|
|
1458
|
-
addElement: (type: ElementType, insertIndex?: number) => void;
|
|
1459
|
-
/** Load a complete schema (replaces current form) */
|
|
1460
|
-
loadSchema: (schema: FormSchema) => void;
|
|
1461
|
-
/** Export current schema */
|
|
1462
|
-
exportSchema: () => FormSchema;
|
|
1463
|
-
/** Reset form to empty state */
|
|
1464
|
-
resetForm: () => void;
|
|
1465
|
-
/** Update form title */
|
|
1466
|
-
updateFormTitle: (title: string) => void;
|
|
1467
|
-
/** Update form description */
|
|
1468
|
-
updateFormDescription: (description: string) => void;
|
|
1469
|
-
/** Update a specific element by ID */
|
|
1470
|
-
updateElement: (id: string, updates: Partial<FormElement>) => void;
|
|
1471
|
-
/** Delete an element by ID */
|
|
1472
|
-
deleteElement: (id: string) => void;
|
|
1473
|
-
/** Select an element (opens property panel) */
|
|
1474
|
-
selectElement: (id: string | null) => void;
|
|
1475
|
-
/** Switch to a different mode */
|
|
1476
|
-
setMode: (mode: string) => void;
|
|
1477
|
-
};
|
|
1478
|
-
}
|
|
1479
|
-
|
|
1480
|
-
declare type SpecialPageElementType = "pages" | "submit";
|
|
1481
|
-
|
|
1482
|
-
export declare interface SubmissionDataItem {
|
|
1483
|
-
id: string;
|
|
1484
|
-
value: any;
|
|
1485
|
-
type: string;
|
|
1486
|
-
category: string;
|
|
1487
|
-
}
|
|
1488
|
-
|
|
1489
|
-
export declare type SubmissionFormat = "keyValue" | "array";
|
|
1490
|
-
|
|
1491
|
-
declare type TextInputElementType = "shortText" | "longText" | "multiLineInput" | "textEditor";
|
|
1492
|
-
|
|
1493
|
-
/**
|
|
1494
|
-
* Configuration for a toolbar action
|
|
1495
|
-
*/
|
|
1496
|
-
export declare interface ToolbarAction {
|
|
1497
|
-
/** Unique identifier for the action */
|
|
1498
|
-
id: string;
|
|
1499
|
-
/** Icon component to display (lucide-react icon or custom component) */
|
|
1500
|
-
icon: LucideIcon | ComponentType<{
|
|
1501
|
-
className?: string;
|
|
1502
|
-
}>;
|
|
1503
|
-
/** Label shown in tooltip */
|
|
1504
|
-
label: string;
|
|
1505
|
-
/** Position in the toolbar */
|
|
1506
|
-
position: ToolbarActionPosition;
|
|
1507
|
-
/** Order within the position group (lower = earlier, default: 0) */
|
|
1508
|
-
order?: number;
|
|
1509
|
-
/** Click handler with access to form context */
|
|
1510
|
-
onClick: (context: ToolbarActionContext) => void | Promise<void>;
|
|
1511
|
-
/** Whether the action is disabled */
|
|
1512
|
-
disabled?: boolean | ((context: ToolbarActionContext) => boolean);
|
|
1513
|
-
/** Visual variant of the button */
|
|
1514
|
-
variant?: ToolbarActionVariant;
|
|
1515
|
-
/** Whether the action should be hidden */
|
|
1516
|
-
hidden?: boolean | ((context: ToolbarActionContext) => boolean);
|
|
1517
|
-
/**
|
|
1518
|
-
* If specified, this action will replace the built-in action with this ID.
|
|
1519
|
-
* The built-in action will be completely replaced.
|
|
1520
|
-
*/
|
|
1521
|
-
override?: BuiltinToolbarActionId;
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1524
|
-
/**
|
|
1525
|
-
* Context provided to toolbar actions with access to form state and actions
|
|
1526
|
-
*/
|
|
1527
|
-
export declare interface ToolbarActionContext {
|
|
1528
|
-
/** Current form schema */
|
|
1529
|
-
schema: FormSchema;
|
|
1530
|
-
/** Current mode id (e.g. "design", "preview", or any custom mode) */
|
|
1531
|
-
mode: string;
|
|
1532
|
-
/** Whether undo is available */
|
|
1533
|
-
canUndo: boolean;
|
|
1534
|
-
/** Whether redo is available */
|
|
1535
|
-
canRedo: boolean;
|
|
1536
|
-
/** Available actions to manipulate form state */
|
|
1537
|
-
actions: {
|
|
1538
|
-
/** Undo last action */
|
|
1539
|
-
undo: () => void;
|
|
1540
|
-
/** Redo last undone action */
|
|
1541
|
-
redo: () => void;
|
|
1542
|
-
/** Load a schema into the form builder */
|
|
1543
|
-
loadSchema: (schema: FormSchema) => void;
|
|
1544
|
-
/** Export current schema */
|
|
1545
|
-
exportSchema: () => FormSchema;
|
|
1546
|
-
/** Switch to a different mode */
|
|
1547
|
-
setMode: (mode: string) => void;
|
|
1548
|
-
/** Reset form to empty state */
|
|
1549
|
-
resetForm: () => void;
|
|
1550
|
-
};
|
|
1551
|
-
}
|
|
1552
|
-
|
|
1553
|
-
/**
|
|
1554
|
-
* Position of the action in the toolbar
|
|
1555
|
-
*/
|
|
1556
|
-
export declare type ToolbarActionPosition = "left" | "center" | "right";
|
|
1557
|
-
|
|
1558
|
-
/**
|
|
1559
|
-
* Visual variant of the toolbar button
|
|
1560
|
-
*/
|
|
1561
|
-
export declare type ToolbarActionVariant = "default" | "ghost" | "destructive";
|
|
1562
|
-
|
|
1563
|
-
/**
|
|
1564
|
-
* Configuration options for the toolbar
|
|
1565
|
-
*/
|
|
1566
|
-
export declare interface ToolbarConfig {
|
|
1567
|
-
/** Custom actions to add to the toolbar */
|
|
1568
|
-
actions?: ToolbarAction[];
|
|
1569
|
-
/** Built-in actions to hide */
|
|
1570
|
-
hideBuiltinActions?: BuiltinToolbarActionId[];
|
|
1571
|
-
/** Whether to show the mode toggle (design/preview) */
|
|
1572
|
-
showModeToggle?: boolean;
|
|
1573
|
-
/** Whether to show undo/redo buttons */
|
|
1574
|
-
showUndoRedo?: boolean;
|
|
1575
|
-
/** Whether to show import/export buttons */
|
|
1576
|
-
showImportExport?: boolean;
|
|
1577
|
-
/** Whether to show reset button */
|
|
1578
|
-
showReset?: boolean;
|
|
1579
|
-
}
|
|
1580
|
-
|
|
1581
|
-
/**
|
|
1582
|
-
* Transform form submission data based on the specified format
|
|
1583
|
-
*/
|
|
1584
|
-
export declare function transformSubmissionData(data: Record<string, any>, elements: FormElement[], format?: SubmissionFormat): FormSubmissionData;
|
|
1585
|
-
|
|
1586
|
-
/**
|
|
1587
|
-
* Transform flat key-value form data to array format with metadata
|
|
1588
|
-
*/
|
|
1589
|
-
export declare function transformToArrayFormat(data: Record<string, any>, elements: FormElement[]): SubmissionDataItem[];
|
|
1590
|
-
|
|
1591
|
-
/**
|
|
1592
|
-
* Unregister a custom element
|
|
1593
|
-
*/
|
|
1594
|
-
export declare function unregisterElement(type: ElementType | string): boolean;
|
|
1595
|
-
|
|
1596
|
-
/**
|
|
1597
|
-
* Unregister a mode by id.
|
|
1598
|
-
*/
|
|
1599
|
-
export declare function unregisterMode(id: string): boolean;
|
|
1600
|
-
|
|
1601
|
-
export declare const useFormStore: UseBoundStore<Omit<StoreApi<FormBuilderStore>, "setState"> & {
|
|
1602
|
-
setState(nextStateOrUpdater: FormBuilderStore | Partial<FormBuilderStore> | ((state: WritableDraft<FormBuilderStore>) => void), shouldReplace?: false): void;
|
|
1603
|
-
setState(nextStateOrUpdater: FormBuilderStore | ((state: WritableDraft<FormBuilderStore>) => void), shouldReplace: true): void;
|
|
1604
|
-
}>;
|
|
1605
|
-
|
|
1606
|
-
export declare interface ValidationError {
|
|
1607
|
-
type: "error" | "warning";
|
|
1608
|
-
elementId?: string;
|
|
1609
|
-
message: string;
|
|
1610
|
-
}
|
|
1611
|
-
|
|
1612
|
-
export declare interface ValidationResult {
|
|
1613
|
-
valid: boolean;
|
|
1614
|
-
errors: ValidationError[];
|
|
1615
|
-
}
|
|
1616
|
-
|
|
1617
|
-
declare interface ValidationRule {
|
|
1618
|
-
id: string;
|
|
1619
|
-
type: "min" | "max" | "pattern" | "custom" | "email" | "url" | "phone" | "equalTo" | "notEqualTo";
|
|
1620
|
-
value: any;
|
|
1621
|
-
message: string;
|
|
1622
|
-
}
|
|
1623
|
-
|
|
1624
|
-
export declare const WizardForm: default_2.FC<WizardFormProps>;
|
|
1625
|
-
|
|
1626
|
-
declare interface WizardFormProps {
|
|
1627
|
-
schema: FormSchema;
|
|
1628
|
-
onSubmit?: (data: FormSubmissionData) => void;
|
|
1629
|
-
initialValues?: Record<string, any>;
|
|
1630
|
-
onPageChange?: (pageIndex: number) => void;
|
|
1631
|
-
/**
|
|
1632
|
-
* Format of the submitted data (default: "keyValue")
|
|
1633
|
-
* - "keyValue": Returns a flat object with field names as keys
|
|
1634
|
-
* - "array": Returns an array of objects with id, value, type, and category
|
|
1635
|
-
*/
|
|
1636
|
-
submissionFormat?: SubmissionFormat;
|
|
1637
|
-
}
|
|
1638
|
-
|
|
1639
|
-
export declare interface WizardStep {
|
|
1640
|
-
id: string;
|
|
1641
|
-
label: string;
|
|
1642
|
-
description?: string;
|
|
1643
|
-
}
|
|
1644
|
-
|
|
1645
|
-
export { }
|