@squaredr/fieldcraft-pro 1.8.0 → 1.9.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.
@@ -1,177 +1,21 @@
1
- import * as react from 'react';
2
- import { ReactNode } from 'react';
3
- import { b as FormBuilderProps, d as FormBuilderTheme, f as QuestionTypeInfo, S as SelectedItem, D as DragItem } from '../types-bFHsZT1n.mjs';
4
- export { B as BuilderState, a as DropTarget, F as FormBuilderPreviewProps, M as MutationAction, P as PaletteCategory, e as PropertyPanelTab, Q as QuestionTypeCategory } from '../types-bFHsZT1n.mjs';
5
- import * as react_jsx_runtime from 'react/jsx-runtime';
6
- import { FormEngineSchema, Option, Question, Section } from '@squaredr/fieldcraft-core';
7
- import { ClassValue } from 'clsx';
8
- import * as _dnd_kit_core from '@dnd-kit/core';
9
- import { DragStartEvent, DragEndEvent } from '@dnd-kit/core';
1
+ export { B as BuilderStateHook, D as DEFAULT_PALETTE, a as DEFAULT_SCHEMA, F as FormBuilder, b as FormBuilderThemeProvider, Q as QUESTION_TYPE_INFO, U as UndoRedoState, c as addOption, d as addQuestion, e as addSection, f as cn, g as duplicateQuestion, h as duplicateSection, i as findQuestion, j as findSection, k as generateId, l as generateOptionId, m as generateQuestionId, n as generateSectionId, o as moveOption, p as moveQuestion, q as moveSection, r as removeOption, s as removeQuestion, t as removeSection, u as updateOption, v as updateQuestion, w as updateSection, x as useBuilderState, y as useBuilderTheme, z as useDragDrop, A as useUndoRedo } from '../default-schema-Bwq8FATF.mjs';
2
+ import { F as FormBuilderTheme } from '../types-BQOeI3LX.mjs';
3
+ export { B as BuilderState, D as DragItem, a as DropTarget, b as FormBuilderPreviewProps, c as FormBuilderProps, M as MutationAction, P as PaletteCategory, d as PropertyPanelTab, Q as QuestionTypeCategory, e as QuestionTypeInfo, S as SelectedItem } from '../types-BQOeI3LX.mjs';
4
+ import 'react';
5
+ import '@squaredr/fieldcraft-core';
6
+ import 'clsx';
7
+ import '@dnd-kit/core';
10
8
  import '@squaredr/fieldcraft-react';
11
9
 
12
- declare const FormBuilder: react.ComponentType<FormBuilderProps>;
13
-
14
- declare function useBuilderTheme(): FormBuilderTheme;
15
- type FormBuilderThemeProviderProps = {
16
- theme?: FormBuilderTheme;
17
- children: ReactNode;
18
- };
19
- declare function FormBuilderThemeProvider({ theme, children }: FormBuilderThemeProviderProps): react_jsx_runtime.JSX.Element;
20
-
21
- /**
22
- * Metadata for all question types available in the Pro palette.
23
- * Icons are lucide-react component names (imported dynamically via ICON_MAP).
24
- *
25
- * 44 field types — general-purpose form building.
26
- * Telehealth-specific fields (15) are in @squaredr/fieldcraft-pro-telehealth.
27
- */
28
- declare const QUESTION_TYPE_INFO: Record<string, QuestionTypeInfo>;
29
- /**
30
- * Default palette layout with categories (44 Pro field types).
31
- * Telehealth fields can be appended via FormBuilder's `palette` prop.
32
- */
33
- declare const DEFAULT_PALETTE: ({
34
- category: "text";
35
- label: string;
36
- types: string[];
37
- } | {
38
- category: "numeric";
39
- label: string;
40
- types: string[];
41
- } | {
42
- category: "selection";
43
- label: string;
44
- types: string[];
45
- } | {
46
- category: "datetime";
47
- label: string;
48
- types: string[];
49
- } | {
50
- category: "media";
51
- label: string;
52
- types: string[];
53
- } | {
54
- category: "content";
55
- label: string;
56
- types: string[];
57
- } | {
58
- category: "structural";
59
- label: string;
60
- types: string[];
61
- } | {
62
- category: "advanced";
63
- label: string;
64
- types: string[];
65
- })[];
66
-
67
- /**
68
- * Generate unique IDs for sections, questions, and options.
69
- * Format: {prefix}_{timestamp}_{random}
70
- */
71
- declare function generateId(prefix: string): string;
72
- declare function generateSectionId(): string;
73
- declare function generateQuestionId(): string;
74
- declare function generateOptionId(): string;
75
-
76
- /**
77
- * Pure functions for mutating FormEngineSchema.
78
- * All functions return a new schema object (immutable updates).
79
- */
80
-
81
- declare function addSection(schema: FormEngineSchema, section: Section, index: number): FormEngineSchema;
82
- declare function removeSection(schema: FormEngineSchema, sectionId: string): FormEngineSchema;
83
- declare function updateSection(schema: FormEngineSchema, sectionId: string, updates: Partial<Section>): FormEngineSchema;
84
- declare function moveSection(schema: FormEngineSchema, sectionId: string, newIndex: number): FormEngineSchema;
85
- declare function duplicateSection(schema: FormEngineSchema, sectionId: string): FormEngineSchema;
86
- declare function addQuestion(schema: FormEngineSchema, sectionId: string, question: Question, index: number): FormEngineSchema;
87
- declare function removeQuestion(schema: FormEngineSchema, sectionId: string, questionId: string): FormEngineSchema;
88
- declare function updateQuestion(schema: FormEngineSchema, sectionId: string, questionId: string, updates: Partial<Question>): FormEngineSchema;
89
- declare function moveQuestion(schema: FormEngineSchema, sectionId: string, questionId: string, targetSectionId: string, newIndex: number): FormEngineSchema;
90
- declare function duplicateQuestion(schema: FormEngineSchema, sectionId: string, questionId: string): FormEngineSchema;
91
- declare function addOption(schema: FormEngineSchema, sectionId: string, questionId: string, option: Option, index: number): FormEngineSchema;
92
- declare function removeOption(schema: FormEngineSchema, sectionId: string, questionId: string, optionIndex: number): FormEngineSchema;
93
- declare function updateOption(schema: FormEngineSchema, sectionId: string, questionId: string, optionIndex: number, updates: Partial<Option>): FormEngineSchema;
94
- declare function moveOption(schema: FormEngineSchema, sectionId: string, questionId: string, oldIndex: number, newIndex: number): FormEngineSchema;
95
- declare function findQuestion(schema: FormEngineSchema, sectionId: string, questionId: string): {
96
- section: Section;
97
- question: Question;
98
- questionIndex: number;
99
- } | null;
100
- declare function findSection(schema: FormEngineSchema, sectionId: string): {
101
- section: Section;
102
- sectionIndex: number;
103
- } | null;
104
-
105
- declare function cn(...inputs: ClassValue[]): string;
106
-
107
10
  /**
108
- * Master state hook for the FormBuilder.
109
- * Combines schema state, selection, and undo/redo.
110
- *
111
- * All mutation callbacks use a ref to read the latest schema,
112
- * avoiding stale closures when multiple mutations fire in the
113
- * same render tick.
11
+ * Drafting Teal dark theme preset.
12
+ * Matches fieldcraft.squaredr.tech dark mode.
114
13
  */
115
- declare function useBuilderState(initialSchema: FormEngineSchema): {
116
- schema: FormEngineSchema;
117
- selectedItem: SelectedItem | null;
118
- isDirty: boolean;
119
- updateSchema: (newSchema: FormEngineSchema) => void;
120
- addSection: (section: Section, index: number) => void;
121
- removeSection: (sectionId: string) => void;
122
- updateSection: (sectionId: string, updates: Partial<Section>) => void;
123
- moveSection: (sectionId: string, newIndex: number) => void;
124
- duplicateSection: (sectionId: string) => void;
125
- addQuestion: (sectionId: string, question: Question, index: number) => void;
126
- removeQuestion: (sectionId: string, questionId: string) => void;
127
- updateQuestion: (sectionId: string, questionId: string, updates: Partial<Question>) => void;
128
- moveQuestion: (sectionId: string, questionId: string, targetSectionId: string, newIndex: number) => void;
129
- duplicateQuestion: (sectionId: string, questionId: string) => void;
130
- selectQuestion: (sectionId: string, questionId: string) => void;
131
- selectSection: (sectionId: string) => void;
132
- clearSelection: () => void;
133
- canUndo: boolean;
134
- canRedo: boolean;
135
- undo: () => void;
136
- redo: () => void;
137
- resetSchema: (newSchema: FormEngineSchema) => void;
138
- markClean: () => void;
139
- };
140
- type BuilderStateHook = ReturnType<typeof useBuilderState>;
141
-
142
- type UndoRedoState = {
143
- canUndo: boolean;
144
- canRedo: boolean;
145
- undo: () => void;
146
- redo: () => void;
147
- push: (schema: FormEngineSchema) => void;
148
- clear: () => void;
149
- };
150
- /**
151
- * Hook for undo/redo functionality.
152
- * Maintains a history stack of schemas with max 50 entries.
153
- * Uses state for the index so canUndo/canRedo trigger re-renders.
154
- * The history array is kept in a ref since its identity doesn't
155
- * need to cause re-renders — only the index matters.
156
- */
157
- declare function useUndoRedo(currentSchema: FormEngineSchema, setSchema: (schema: FormEngineSchema) => void): UndoRedoState;
158
-
159
- /**
160
- * Hook to wire up @dnd-kit drag-and-drop.
161
- * Returns DndContext props and handlers.
162
- */
163
- declare function useDragDrop(builderState: BuilderStateHook): {
164
- sensors: _dnd_kit_core.SensorDescriptor<_dnd_kit_core.SensorOptions>[];
165
- handleDragStart: (event: DragStartEvent) => void;
166
- handleDragEnd: (event: DragEndEvent) => void;
167
- handleDragCancel: () => void;
168
- activeDragItem: DragItem | null;
169
- };
170
-
14
+ declare const squaredrDarkPreset: FormBuilderTheme;
171
15
  /**
172
- * Default empty schema for new forms.
173
- * Contains one section with one question to get started.
16
+ * Drafting Teal light theme preset (default).
17
+ * Matches fieldcraft.squaredr.tech light mode.
174
18
  */
175
- declare const DEFAULT_SCHEMA: FormEngineSchema;
19
+ declare const cleanPreset: FormBuilderTheme;
176
20
 
177
- export { type BuilderStateHook, DEFAULT_PALETTE, DEFAULT_SCHEMA, DragItem, FormBuilder, FormBuilderProps, FormBuilderTheme, FormBuilderThemeProvider, QUESTION_TYPE_INFO, QuestionTypeInfo, SelectedItem, type UndoRedoState, addOption, addQuestion, addSection, cn, duplicateQuestion, duplicateSection, findQuestion, findSection, generateId, generateOptionId, generateQuestionId, generateSectionId, moveOption, moveQuestion, moveSection, removeOption, removeQuestion, removeSection, updateOption, updateQuestion, updateSection, useBuilderState, useBuilderTheme, useDragDrop, useUndoRedo };
21
+ export { FormBuilderTheme, cleanPreset, squaredrDarkPreset };
@@ -1,177 +1,21 @@
1
- import * as react from 'react';
2
- import { ReactNode } from 'react';
3
- import { b as FormBuilderProps, d as FormBuilderTheme, f as QuestionTypeInfo, S as SelectedItem, D as DragItem } from '../types-bFHsZT1n.js';
4
- export { B as BuilderState, a as DropTarget, F as FormBuilderPreviewProps, M as MutationAction, P as PaletteCategory, e as PropertyPanelTab, Q as QuestionTypeCategory } from '../types-bFHsZT1n.js';
5
- import * as react_jsx_runtime from 'react/jsx-runtime';
6
- import { FormEngineSchema, Option, Question, Section } from '@squaredr/fieldcraft-core';
7
- import { ClassValue } from 'clsx';
8
- import * as _dnd_kit_core from '@dnd-kit/core';
9
- import { DragStartEvent, DragEndEvent } from '@dnd-kit/core';
1
+ export { B as BuilderStateHook, D as DEFAULT_PALETTE, a as DEFAULT_SCHEMA, F as FormBuilder, b as FormBuilderThemeProvider, Q as QUESTION_TYPE_INFO, U as UndoRedoState, c as addOption, d as addQuestion, e as addSection, f as cn, g as duplicateQuestion, h as duplicateSection, i as findQuestion, j as findSection, k as generateId, l as generateOptionId, m as generateQuestionId, n as generateSectionId, o as moveOption, p as moveQuestion, q as moveSection, r as removeOption, s as removeQuestion, t as removeSection, u as updateOption, v as updateQuestion, w as updateSection, x as useBuilderState, y as useBuilderTheme, z as useDragDrop, A as useUndoRedo } from '../default-schema-BGxf9Jrg.js';
2
+ import { F as FormBuilderTheme } from '../types-BQOeI3LX.js';
3
+ export { B as BuilderState, D as DragItem, a as DropTarget, b as FormBuilderPreviewProps, c as FormBuilderProps, M as MutationAction, P as PaletteCategory, d as PropertyPanelTab, Q as QuestionTypeCategory, e as QuestionTypeInfo, S as SelectedItem } from '../types-BQOeI3LX.js';
4
+ import 'react';
5
+ import '@squaredr/fieldcraft-core';
6
+ import 'clsx';
7
+ import '@dnd-kit/core';
10
8
  import '@squaredr/fieldcraft-react';
11
9
 
12
- declare const FormBuilder: react.ComponentType<FormBuilderProps>;
13
-
14
- declare function useBuilderTheme(): FormBuilderTheme;
15
- type FormBuilderThemeProviderProps = {
16
- theme?: FormBuilderTheme;
17
- children: ReactNode;
18
- };
19
- declare function FormBuilderThemeProvider({ theme, children }: FormBuilderThemeProviderProps): react_jsx_runtime.JSX.Element;
20
-
21
- /**
22
- * Metadata for all question types available in the Pro palette.
23
- * Icons are lucide-react component names (imported dynamically via ICON_MAP).
24
- *
25
- * 44 field types — general-purpose form building.
26
- * Telehealth-specific fields (15) are in @squaredr/fieldcraft-pro-telehealth.
27
- */
28
- declare const QUESTION_TYPE_INFO: Record<string, QuestionTypeInfo>;
29
- /**
30
- * Default palette layout with categories (44 Pro field types).
31
- * Telehealth fields can be appended via FormBuilder's `palette` prop.
32
- */
33
- declare const DEFAULT_PALETTE: ({
34
- category: "text";
35
- label: string;
36
- types: string[];
37
- } | {
38
- category: "numeric";
39
- label: string;
40
- types: string[];
41
- } | {
42
- category: "selection";
43
- label: string;
44
- types: string[];
45
- } | {
46
- category: "datetime";
47
- label: string;
48
- types: string[];
49
- } | {
50
- category: "media";
51
- label: string;
52
- types: string[];
53
- } | {
54
- category: "content";
55
- label: string;
56
- types: string[];
57
- } | {
58
- category: "structural";
59
- label: string;
60
- types: string[];
61
- } | {
62
- category: "advanced";
63
- label: string;
64
- types: string[];
65
- })[];
66
-
67
- /**
68
- * Generate unique IDs for sections, questions, and options.
69
- * Format: {prefix}_{timestamp}_{random}
70
- */
71
- declare function generateId(prefix: string): string;
72
- declare function generateSectionId(): string;
73
- declare function generateQuestionId(): string;
74
- declare function generateOptionId(): string;
75
-
76
- /**
77
- * Pure functions for mutating FormEngineSchema.
78
- * All functions return a new schema object (immutable updates).
79
- */
80
-
81
- declare function addSection(schema: FormEngineSchema, section: Section, index: number): FormEngineSchema;
82
- declare function removeSection(schema: FormEngineSchema, sectionId: string): FormEngineSchema;
83
- declare function updateSection(schema: FormEngineSchema, sectionId: string, updates: Partial<Section>): FormEngineSchema;
84
- declare function moveSection(schema: FormEngineSchema, sectionId: string, newIndex: number): FormEngineSchema;
85
- declare function duplicateSection(schema: FormEngineSchema, sectionId: string): FormEngineSchema;
86
- declare function addQuestion(schema: FormEngineSchema, sectionId: string, question: Question, index: number): FormEngineSchema;
87
- declare function removeQuestion(schema: FormEngineSchema, sectionId: string, questionId: string): FormEngineSchema;
88
- declare function updateQuestion(schema: FormEngineSchema, sectionId: string, questionId: string, updates: Partial<Question>): FormEngineSchema;
89
- declare function moveQuestion(schema: FormEngineSchema, sectionId: string, questionId: string, targetSectionId: string, newIndex: number): FormEngineSchema;
90
- declare function duplicateQuestion(schema: FormEngineSchema, sectionId: string, questionId: string): FormEngineSchema;
91
- declare function addOption(schema: FormEngineSchema, sectionId: string, questionId: string, option: Option, index: number): FormEngineSchema;
92
- declare function removeOption(schema: FormEngineSchema, sectionId: string, questionId: string, optionIndex: number): FormEngineSchema;
93
- declare function updateOption(schema: FormEngineSchema, sectionId: string, questionId: string, optionIndex: number, updates: Partial<Option>): FormEngineSchema;
94
- declare function moveOption(schema: FormEngineSchema, sectionId: string, questionId: string, oldIndex: number, newIndex: number): FormEngineSchema;
95
- declare function findQuestion(schema: FormEngineSchema, sectionId: string, questionId: string): {
96
- section: Section;
97
- question: Question;
98
- questionIndex: number;
99
- } | null;
100
- declare function findSection(schema: FormEngineSchema, sectionId: string): {
101
- section: Section;
102
- sectionIndex: number;
103
- } | null;
104
-
105
- declare function cn(...inputs: ClassValue[]): string;
106
-
107
10
  /**
108
- * Master state hook for the FormBuilder.
109
- * Combines schema state, selection, and undo/redo.
110
- *
111
- * All mutation callbacks use a ref to read the latest schema,
112
- * avoiding stale closures when multiple mutations fire in the
113
- * same render tick.
11
+ * Drafting Teal dark theme preset.
12
+ * Matches fieldcraft.squaredr.tech dark mode.
114
13
  */
115
- declare function useBuilderState(initialSchema: FormEngineSchema): {
116
- schema: FormEngineSchema;
117
- selectedItem: SelectedItem | null;
118
- isDirty: boolean;
119
- updateSchema: (newSchema: FormEngineSchema) => void;
120
- addSection: (section: Section, index: number) => void;
121
- removeSection: (sectionId: string) => void;
122
- updateSection: (sectionId: string, updates: Partial<Section>) => void;
123
- moveSection: (sectionId: string, newIndex: number) => void;
124
- duplicateSection: (sectionId: string) => void;
125
- addQuestion: (sectionId: string, question: Question, index: number) => void;
126
- removeQuestion: (sectionId: string, questionId: string) => void;
127
- updateQuestion: (sectionId: string, questionId: string, updates: Partial<Question>) => void;
128
- moveQuestion: (sectionId: string, questionId: string, targetSectionId: string, newIndex: number) => void;
129
- duplicateQuestion: (sectionId: string, questionId: string) => void;
130
- selectQuestion: (sectionId: string, questionId: string) => void;
131
- selectSection: (sectionId: string) => void;
132
- clearSelection: () => void;
133
- canUndo: boolean;
134
- canRedo: boolean;
135
- undo: () => void;
136
- redo: () => void;
137
- resetSchema: (newSchema: FormEngineSchema) => void;
138
- markClean: () => void;
139
- };
140
- type BuilderStateHook = ReturnType<typeof useBuilderState>;
141
-
142
- type UndoRedoState = {
143
- canUndo: boolean;
144
- canRedo: boolean;
145
- undo: () => void;
146
- redo: () => void;
147
- push: (schema: FormEngineSchema) => void;
148
- clear: () => void;
149
- };
150
- /**
151
- * Hook for undo/redo functionality.
152
- * Maintains a history stack of schemas with max 50 entries.
153
- * Uses state for the index so canUndo/canRedo trigger re-renders.
154
- * The history array is kept in a ref since its identity doesn't
155
- * need to cause re-renders — only the index matters.
156
- */
157
- declare function useUndoRedo(currentSchema: FormEngineSchema, setSchema: (schema: FormEngineSchema) => void): UndoRedoState;
158
-
159
- /**
160
- * Hook to wire up @dnd-kit drag-and-drop.
161
- * Returns DndContext props and handlers.
162
- */
163
- declare function useDragDrop(builderState: BuilderStateHook): {
164
- sensors: _dnd_kit_core.SensorDescriptor<_dnd_kit_core.SensorOptions>[];
165
- handleDragStart: (event: DragStartEvent) => void;
166
- handleDragEnd: (event: DragEndEvent) => void;
167
- handleDragCancel: () => void;
168
- activeDragItem: DragItem | null;
169
- };
170
-
14
+ declare const squaredrDarkPreset: FormBuilderTheme;
171
15
  /**
172
- * Default empty schema for new forms.
173
- * Contains one section with one question to get started.
16
+ * Drafting Teal light theme preset (default).
17
+ * Matches fieldcraft.squaredr.tech light mode.
174
18
  */
175
- declare const DEFAULT_SCHEMA: FormEngineSchema;
19
+ declare const cleanPreset: FormBuilderTheme;
176
20
 
177
- export { type BuilderStateHook, DEFAULT_PALETTE, DEFAULT_SCHEMA, DragItem, FormBuilder, FormBuilderProps, FormBuilderTheme, FormBuilderThemeProvider, QUESTION_TYPE_INFO, QuestionTypeInfo, SelectedItem, type UndoRedoState, addOption, addQuestion, addSection, cn, duplicateQuestion, duplicateSection, findQuestion, findSection, generateId, generateOptionId, generateQuestionId, generateSectionId, moveOption, moveQuestion, moveSection, removeOption, removeQuestion, removeSection, updateOption, updateQuestion, updateSection, useBuilderState, useBuilderTheme, useDragDrop, useUndoRedo };
21
+ export { FormBuilderTheme, cleanPreset, squaredrDarkPreset };