@harshshahcg/survey-render 1.0.2 → 1.0.3
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 +16 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,7 +30,10 @@ Install the package, then import the main component and types from the package n
|
|
|
30
30
|
```tsx
|
|
31
31
|
// Default: component + types (use your actual package name if different)
|
|
32
32
|
import { SurveyRenderer } from "@harshshahcg/survey-render";
|
|
33
|
-
import type {
|
|
33
|
+
import type {
|
|
34
|
+
SurveyConfig,
|
|
35
|
+
SurveySubmitPayload,
|
|
36
|
+
} from "@harshshahcg/survey-render";
|
|
34
37
|
```
|
|
35
38
|
|
|
36
39
|
**Other useful imports:**
|
|
@@ -76,7 +79,10 @@ Minimal runnable example: one text question, one single-select, one date. Copy i
|
|
|
76
79
|
```tsx
|
|
77
80
|
import React, { useState } from "react";
|
|
78
81
|
import { SurveyRenderer } from "@harshshahcg/survey-render";
|
|
79
|
-
import type {
|
|
82
|
+
import type {
|
|
83
|
+
SurveyConfig,
|
|
84
|
+
SurveySubmitPayload,
|
|
85
|
+
} from "@harshshahcg/survey-render";
|
|
80
86
|
|
|
81
87
|
// 1. Define survey config (can also load from JSON/API)
|
|
82
88
|
const sampleConfig: SurveyConfig = {
|
|
@@ -130,7 +136,9 @@ export default function App() {
|
|
|
130
136
|
try {
|
|
131
137
|
console.log("Submitted:", payload);
|
|
132
138
|
// await yourApi.submitSurvey(payload);
|
|
133
|
-
alert(
|
|
139
|
+
alert(
|
|
140
|
+
"Thank you! Responses: " + JSON.stringify(payload.responses, null, 2),
|
|
141
|
+
);
|
|
134
142
|
} finally {
|
|
135
143
|
setSubmitting(false);
|
|
136
144
|
}
|
|
@@ -189,7 +197,10 @@ export default function App() {
|
|
|
189
197
|
|
|
190
198
|
```tsx
|
|
191
199
|
import { SurveyRenderer } from "@harshshahcg/survey-render";
|
|
192
|
-
import type {
|
|
200
|
+
import type {
|
|
201
|
+
SurveyConfig,
|
|
202
|
+
SurveySubmitPayload,
|
|
203
|
+
} from "@harshshahcg/survey-render";
|
|
193
204
|
|
|
194
205
|
const config: SurveyConfig = {
|
|
195
206
|
surveyId: "my-survey",
|
|
@@ -209,7 +220,7 @@ const config: SurveyConfig = {
|
|
|
209
220
|
],
|
|
210
221
|
};
|
|
211
222
|
|
|
212
|
-
<SurveyRenderer data={config} onSubmit={(p) => console.log(p)}
|
|
223
|
+
<SurveyRenderer data={config} onSubmit={(p) => console.log(p)} />;
|
|
213
224
|
```
|
|
214
225
|
|
|
215
226
|
## Survey config shape
|