@mieweb/forms-editor 1.0.0 → 1.0.2

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/README.md CHANGED
@@ -1,46 +1,14 @@
1
1
  # @mieweb/forms-editor
2
2
 
3
- Embeddable questionnaire editor with FHIR export and conditional logic.
3
+ Visual questionnaire builder with three editing modes: Build, Code, and Preview.
4
4
 
5
- ## 🎨 Version 1.0 - UI/UX Refinement
6
-
7
- The editor now features a complete visual overhaul with modern blue theme:
8
- - All field components use consistent blue color palette
9
- - Enhanced focus states and hover interactions
10
- - Improved field selection and editing experience
11
- - Better visual hierarchy with updated FieldWrapper
12
- - Mobile-responsive with polished interactions
13
-
14
- See the [main CHANGELOG](../../CHANGELOG.md) for complete details.
5
+ ## Installation
15
6
 
16
7
  ```bash
17
- npm install @mieweb/forms-editor react react-dom
8
+ npm install @mieweb/forms-editor
18
9
  ```
19
10
 
20
- ## 🆕 New Features
21
-
22
- ### YAML & JSON Import
23
- Import questionnaires from YAML or JSON with automatic format detection:
24
- - Drag and drop `.json`, `.yaml`, or `.yml` files
25
- - Auto-detects MIE Forms vs SurveyJS schemas
26
- - Preserves metadata (title, description, etc.)
27
-
28
- ### Auto-Parsing on Initialization
29
- Pass YAML strings, JSON strings, or objects directly:
30
- ```jsx
31
- // YAML string
32
- const yamlData = `
33
- schemaType: mieforms-v1.0
34
- fields:
35
- - id: name
36
- fieldType: text
37
- question: Name?
38
- `;
39
-
40
- <QuestionnaireEditor initialFormData={yamlData} />
41
-
42
- // Or JSON string, or parsed object - all work!
43
- ```
11
+ **Requirements:** React 18+ and React DOM 18+
44
12
 
45
13
  ## Quick Start
46
14
 
@@ -50,13 +18,7 @@ import { QuestionnaireEditor } from '@mieweb/forms-editor';
50
18
  function App() {
51
19
  const [formData, setFormData] = React.useState({
52
20
  schemaType: 'mieforms-v1.0',
53
- title: 'Patient Intake',
54
- fields: [
55
- { id: 'section-1', fieldType: 'section', title: 'Section 1', fields: [] },
56
- { id: 'name', fieldType: 'text', question: 'Your Name', required: true },
57
- { id: 'gender', fieldType: 'radio', question: 'Gender',
58
- options: [{ value: 'Male' }, { value: 'Female' }], selected: null },
59
- ]
21
+ fields: []
60
22
  });
61
23
 
62
24
  return (
@@ -68,91 +30,17 @@ function App() {
68
30
  }
69
31
  ```
70
32
 
71
- ## Props
72
-
73
- - `initialFormData` - Form data object or YAML/JSON string (supports auto-parsing)
74
- - `schemaType` - Optional: `'mieforms'` or `'surveyjs'` (auto-detected if not provided)
75
- - `onChange` - Callback when form data changes (receives complete form object with metadata)
76
- - `startInPreview` - Start in preview mode (default: false)
77
- - `hideUnsupportedFields` - Hide unsupported field types (default: false)
78
- - `showHeader` - Show editor header (default: true)
79
- - `className` - Additional CSS classes
80
-
81
- ## 🔄 Breaking Changes (v0.1.1)
33
+ ## Documentation
82
34
 
83
- ### Prop Rename
84
- ```jsx
85
- // ❌ Before
86
- <QuestionnaireEditor initialFields={fields} />
35
+ **[Full Documentation](<link>/docs/editor/overview)**
87
36
 
88
- // After
89
- <QuestionnaireEditor initialFormData={formData} />
90
- ```
37
+ For detailed information, see:
38
+ - [Quick Start Guide](<link>/docs/getting-started/quickstart-editor)
39
+ - [Props Reference](<link>/docs/editor/props)
40
+ - [Editor Modes](<link>/docs/editor/modes)
41
+ - [Field Editing](<link>/docs/editor/field-editing)
42
+ - [Import/Export](<link>/docs/editor/importing)
91
43
 
92
- ### onChange Callback
93
- Now receives complete form data object instead of just fields array:
94
- ```jsx
95
- // ❌ Before
96
- onChange={(fields) => console.log(fields)}
44
+ ## License
97
45
 
98
- // ✅ After
99
- onChange={(formData) => {
100
- console.log(formData);
101
- // { schemaType: 'mieforms-v1.0', title: '...', fields: [...] }
102
- }}
103
- ```
104
-
105
- ### Schema Type Required
106
- Form data must include `schemaType` field:
107
- ```jsx
108
- const formData = {
109
- schemaType: 'mieforms-v1.0', // Required!
110
- fields: [...]
111
- };
112
- ```
113
-
114
- ## Features
115
-
116
- ### Field Types
117
- - `text` - Single-line text input
118
- - `longtext` - Multi-line text area
119
- - `multitext` - Multiple labeled text inputs
120
- - `boolean` - Yes/No button selection
121
- - `radio` - Radio buttons
122
- - `check` - Checkboxes
123
- - `dropdown` - Dropdown selection
124
- - `section` - Field container
125
- - `unsupported` - Placeholder (can be hidden with `hideUnsupportedFields` prop)
126
-
127
- ### Conditional Logic
128
- Show/hide fields based on answers via the Logic panel.
129
-
130
- ### Import/Export
131
- - JSON, YAML formats with auto-detection
132
- - SurveyJS schema import with conversion report
133
- - FHIR export (via forms-engine)
134
-
135
- ### Mobile Support
136
- Responsive with swipeable modal editing.
137
-
138
- ## Field Structure
139
-
140
- ```javascript
141
- {
142
- id: 'unique-id',
143
- fieldType: 'text', // 'longtext', 'multitext', 'boolean', 'radio', 'check', 'dropdown', 'section'
144
- question: 'What is your name?',
145
- answer: '',
146
- required: false,
147
- enableWhen: {
148
- logic: 'AND', // or 'OR'
149
- conditions: [
150
- {
151
- targetId: 'other-field-id',
152
- operator: 'equals', // 'contains', 'includes'
153
- value: 'expected-value'
154
- }
155
- ]
156
- }
157
- }
158
- ```
46
+ MIT