survey-js-ui 3.0.0 → 3.0.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.
- package/README.md +222 -75
- package/fesm/survey-js-ui.mjs +2 -2
- package/package.json +17 -10
- package/survey-js-ui.js +2 -2
- package/survey-js-ui.min.js +2 -2
package/README.md
CHANGED
|
@@ -1,75 +1,222 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
[](https://dev.azure.com/SurveyJS/V2%20Libraries/_build/latest?definitionId=130&repoName=surveyjs%2Fsurvey-library&branchName=master)
|
|
8
|
+
[](https://github.com/surveyjs/survey-library/blob/master/LICENSE)
|
|
9
|
+
[](https://playwright.dev)
|
|
10
|
+
[](https://github.com/surveyjs/survey-library/issues)
|
|
11
|
+
[](https://github.com/surveyjs/survey-library/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aclosed+)
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
<div align="justify">
|
|
15
|
+
|
|
16
|
+
SurveyJS JavaScript Form Library is a free and open-source UI component library for rendering dynamic, JSON-driven forms and surveys in applications built with HTML, CSS, and JavaScript, without a frontend framework.
|
|
17
|
+
|
|
18
|
+
The `survey-js-ui` package provides the plain JavaScript renderer for SurveyJS Form Library. It works together with the framework-independent [`survey-core`](https://github.com/surveyjs/survey-library/tree/master/packages/survey-core) package, which provides the form model and handles form structure, validation, conditional logic, calculations, navigation, localization, and other core behavior. Installing `survey-js-ui` brings `survey-core` with it. Rendering is powered internally by [Preact](https://preactjs.com/). jQuery applications are supported through the `Survey()` plugin this package registers.
|
|
19
|
+
|
|
20
|
+
Use SurveyJS JavaScript Form Library to build multi-step forms, surveys, quizzes, assessments, calculator forms, and other data-entry tools. Form definitions and submitted responses can be processed by your own backend and stored in the database or service of your choice.
|
|
21
|
+
|
|
22
|
+
You can create form definitions manually, generate them with AI, or build them visually with [SurveyJS Creator](https://surveyjs.io/survey-creator/documentation/overview), an embeddable drag-and-drop form builder.
|
|
23
|
+
|
|
24
|
+
> Use this package when your framework has no dedicated SurveyJS renderer: older Angular versions (v8–v11), Vue 2, and frameworks not yet officially supported, such as [Svelte](https://svelte.dev). `renderSurvey` mounts a survey into any DOM element, so it can be driven from any component model. For React, Angular v12+, and Vue 3, prefer the [dedicated renderers](#related-packages).
|
|
25
|
+
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
npm install survey-js-ui
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Or load it from a CDN, together with `survey-core` and its style sheet:
|
|
35
|
+
|
|
36
|
+
```html
|
|
37
|
+
<link href="https://unpkg.com/survey-core/survey-core.min.css" type="text/css" rel="stylesheet">
|
|
38
|
+
<script type="text/javascript" src="https://unpkg.com/survey-core/survey.core.min.js"></script>
|
|
39
|
+
<script type="text/javascript" src="https://unpkg.com/survey-js-ui/survey-js-ui.min.js"></script>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
With a bundler — `survey-js-ui` re-exports `Model`, so a single import is enough:
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
import { Model, renderSurvey } from "survey-js-ui";
|
|
48
|
+
import "survey-core/survey-core.css";
|
|
49
|
+
|
|
50
|
+
const surveyJson = {
|
|
51
|
+
elements: [
|
|
52
|
+
{ name: "firstName", title: "Enter your first name:", type: "text" },
|
|
53
|
+
{ name: "satisfaction", title: "How satisfied are you?", type: "rating" }
|
|
54
|
+
]
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const survey = new Model(surveyJson);
|
|
58
|
+
survey.onComplete.add((sender) => {
|
|
59
|
+
console.log(JSON.stringify(sender.data, null, 2));
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
renderSurvey(survey, document.getElementById("surveyContainer"));
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
With the CDN script tags above, the library is exposed as the `Survey` global and importing it adds a `render` method to the model:
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<div id="surveyContainer"></div>
|
|
69
|
+
<script>
|
|
70
|
+
const survey = new Survey.Model(surveyJson);
|
|
71
|
+
survey.render(document.getElementById("surveyContainer"));
|
|
72
|
+
</script>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
If your application uses jQuery, render a survey with the `Survey()` plugin:
|
|
76
|
+
|
|
77
|
+
```js
|
|
78
|
+
$("#surveyContainer").Survey({ model: survey });
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
`survey-core/survey-core.css` applies the Default theme. For other predefined themes and CSS-variable customization, refer to [Themes & Styles](https://surveyjs.io/form-library/documentation/manage-default-themes-and-styles).
|
|
82
|
+
|
|
83
|
+
## Theme Adapters
|
|
84
|
+
|
|
85
|
+
A theme adapter maps an existing design system's CSS variables onto SurveyJS design tokens, so an embedded survey inherits the look of the host application. Adapters ship with `survey-core` as plain CSS — load one after the base style sheet:
|
|
86
|
+
|
|
87
|
+
```html
|
|
88
|
+
<link href="https://unpkg.com/survey-core/survey-core.min.css" type="text/css" rel="stylesheet">
|
|
89
|
+
<link href="https://unpkg.com/survey-core/themes/adapters/bootstrap-default.css" type="text/css" rel="stylesheet">
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Adapters are available for [Bootstrap](https://getbootstrap.com) (plus Bootswatch variants), [Material UI](https://mui.com), and [shadcn/ui](https://ui.shadcn.com), with matching icon sets (`survey-core/themes/adapters/icons/lucide`, `.../icons/mui`). See [Theme Adapters](https://surveyjs.io/themes/theme-adapters).
|
|
93
|
+
|
|
94
|
+
## Key Features
|
|
95
|
+
|
|
96
|
+
### Dynamic Forms and Surveys
|
|
97
|
+
|
|
98
|
+
- Render dynamic JSON-driven forms and surveys in plain JavaScript applications
|
|
99
|
+
- Multi-step forms, quizzes, assessments, calculator forms, and survey pop-ups
|
|
100
|
+
- Conditional visibility, branching, calculations, and expression-based logic
|
|
101
|
+
- Input validation, [save-and-resume workflows](https://surveyjs.io/form-library/examples/save-and-restore-user-responses-to-complete-survey/vanillajs), and dynamic content
|
|
102
|
+
|
|
103
|
+
### Form Controls
|
|
104
|
+
|
|
105
|
+
- 20+ built-in question and input types
|
|
106
|
+
- Dynamic panels and repeating question groups
|
|
107
|
+
- [Custom question types](https://surveyjs.io/form-library/documentation/customize-question-types/question-customization-options) and reusable components
|
|
108
|
+
- Electronic signature, image capture, file upload, matrices, and other advanced controls
|
|
109
|
+
|
|
110
|
+
### Plain JavaScript Integration
|
|
111
|
+
|
|
112
|
+
- Plain JavaScript renderer for SurveyJS Form Library
|
|
113
|
+
- TypeScript support
|
|
114
|
+
- Framework-independent form model through `survey-core`
|
|
115
|
+
- Client-side rendering without a required SurveyJS backend
|
|
116
|
+
- jQuery integration through the `Survey()` plugin
|
|
117
|
+
- Can be mounted into any DOM element with `renderSurvey`
|
|
118
|
+
|
|
119
|
+
### Data and Backend Integration
|
|
120
|
+
|
|
121
|
+
- [Connect to any server, API, or database](https://surveyjs.io/documentation/backend-integration)
|
|
122
|
+
- Store form definitions and submitted responses in your own infrastructure
|
|
123
|
+
- [Load choices from web services](https://surveyjs.io/form-library/examples/dropdown-menu-load-data-from-restful-service/vanillajs)
|
|
124
|
+
- Integrate third-party components and services
|
|
125
|
+
- [Backend integration examples for PHP, ASP.NET Core, and Node.js](https://surveyjs.io/backend-integration/examples)
|
|
126
|
+
|
|
127
|
+
### Appearance and Localization
|
|
128
|
+
|
|
129
|
+
- Built-in themes and custom branding
|
|
130
|
+
- [Theme Adapters for Bootstrap, Material UI, and shadcn/ui](https://surveyjs.io/themes/theme-adapters)
|
|
131
|
+
- Multi-language forms and right-to-left language support
|
|
132
|
+
- Community-supported UI localization
|
|
133
|
+
|
|
134
|
+
## Related packages
|
|
135
|
+
|
|
136
|
+
| Package | Purpose |
|
|
137
|
+
| --- | --- |
|
|
138
|
+
| [`survey-core`](https://www.npmjs.com/package/survey-core) | Platform-independent survey model (installed automatically) |
|
|
139
|
+
| [`survey-react-ui`](https://www.npmjs.com/package/survey-react-ui) | React renderer |
|
|
140
|
+
| [`survey-angular-ui`](https://www.npmjs.com/package/survey-angular-ui) | Angular renderer |
|
|
141
|
+
| [`survey-vue3-ui`](https://www.npmjs.com/package/survey-vue3-ui) | Vue 3 renderer |
|
|
142
|
+
|
|
143
|
+
## Documentation
|
|
144
|
+
|
|
145
|
+
- [Website](https://surveyjs.io/)
|
|
146
|
+
- [Documentation](https://surveyjs.io/form-library/documentation/overview)
|
|
147
|
+
- [Get Started with Plain JavaScript](https://surveyjs.io/form-library/documentation/get-started-html-css-javascript)
|
|
148
|
+
- [Form Library Demos for Plain JavaScript](https://surveyjs.io/form-library/examples/nps-question/vanillajs)
|
|
149
|
+
- [Release Notes](https://surveyjs.io/stay-updated/release-notes)
|
|
150
|
+
- [Roadmap](https://surveyjs.io/stay-updated/roadmap)
|
|
151
|
+
- [What's New](https://surveyjs.io/stay-updated/major-updates/2025-2026)
|
|
152
|
+
|
|
153
|
+
For AI coding agents: [https://surveyjs.io/llms.txt](https://surveyjs.io/llms.txt) indexes the documentation. Any documentation page is also available as raw Markdown — append `.md` to its URL, for example [https://surveyjs.io/form-library/documentation/get-started-html-css-javascript.md](https://surveyjs.io/form-library/documentation/get-started-html-css-javascript.md).
|
|
154
|
+
|
|
155
|
+
## SurveyJS Ecosystem
|
|
156
|
+
|
|
157
|
+
| Product | Purpose | License |
|
|
158
|
+
| --- | --- | --- |
|
|
159
|
+
| [Form Library](https://surveyjs.io/form-library) | Render dynamic forms from JSON (this package) | MIT |
|
|
160
|
+
| [Survey Creator](https://surveyjs.io/survey-creator) | Drag-and-drop form builder UI | Commercial |
|
|
161
|
+
| [Dashboard](https://surveyjs.io/dashboard) | Visualize and analyze collected results | Commercial |
|
|
162
|
+
| [PDF Generator](https://surveyjs.io/pdf-generator) | Render forms and responses as PDF | Commercial |
|
|
163
|
+
| [AI Form Response Extractor](https://surveyjs.io/documentation/combine-paper-and-online-survey-form-data) | Extract responses from paper forms, PDFs, and images into a SurveyJS schema (`ai-form-response-extractor`) | MIT |
|
|
164
|
+
|
|
165
|
+
## Build from Source
|
|
166
|
+
|
|
167
|
+
Requires Node.js 20 or later — CI builds on Node 20.x and 22.x. This monorepo does **not** use npm workspaces: each package installs independently, but a root install is still required for the shared tooling (linting, Playwright).
|
|
168
|
+
|
|
169
|
+
1. **Clone the repo and install shared dependencies**
|
|
170
|
+
|
|
171
|
+
```sh
|
|
172
|
+
git clone https://github.com/surveyjs/survey-library.git
|
|
173
|
+
cd survey-library
|
|
174
|
+
npm install
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
2. **Build `survey-core` first**
|
|
178
|
+
|
|
179
|
+
This package resolves `survey-core` from `../survey-core/build`, so the model must be built before this library can be built or tested. Follow [Build from sources](https://github.com/surveyjs/survey-library/blob/master/packages/survey-core/README.md#build-from-sources) in the `survey-core` README.
|
|
180
|
+
|
|
181
|
+
3. **Install dependencies and build this library**
|
|
182
|
+
|
|
183
|
+
```sh
|
|
184
|
+
cd packages/survey-js-ui
|
|
185
|
+
npm install
|
|
186
|
+
npm run build
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Build output goes to the `build` directory. Use `npm run watch:dev` while developing.
|
|
190
|
+
|
|
191
|
+
4. **Run a test application**
|
|
192
|
+
|
|
193
|
+
```sh
|
|
194
|
+
npm run start
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
This serves the package directory at http://localhost:8080/.
|
|
198
|
+
|
|
199
|
+
5. **Run unit tests**
|
|
200
|
+
|
|
201
|
+
Unit tests use [Vitest](https://vitest.dev/) in a jsdom environment. The markup snapshot tests are generated into `tests/shards` by `gen-shards.js` before each run, so `npm run test` is the entry point rather than a bare `vitest`.
|
|
202
|
+
|
|
203
|
+
```sh
|
|
204
|
+
npm run test # whole suite
|
|
205
|
+
npm run test:watch # watch mode
|
|
206
|
+
npx vitest run -t "test name" # tests matching a substring
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
6. **Run end-to-end tests**
|
|
210
|
+
|
|
211
|
+
E2E, visual-regression, and accessibility tests are Playwright suites. Do not start an HTTP server yourself — the Playwright config starts its own.
|
|
212
|
+
|
|
213
|
+
```sh
|
|
214
|
+
npm run e2e:ci # e2e
|
|
215
|
+
npm run e2e:ci -- --grep "TestName" # a single test
|
|
216
|
+
npm run scr:ci # visual regression
|
|
217
|
+
npm run accessibility-tests:ci # accessibility
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Licensing
|
|
221
|
+
|
|
222
|
+
SurveyJS Form Library is distributed under the [MIT license](https://github.com/surveyjs/survey-library/blob/master/LICENSE).
|
package/fesm/survey-js-ui.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - Survey JavaScript library v3.0.
|
|
2
|
+
* surveyjs - Survey JavaScript library v3.0.1
|
|
3
3
|
* Copyright (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
|
|
4
4
|
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
|
5
5
|
*/
|
|
@@ -6263,7 +6263,7 @@ SurveyModel.prototype["render"] = function (element = null) {
|
|
|
6263
6263
|
}
|
|
6264
6264
|
};
|
|
6265
6265
|
const preact = React;
|
|
6266
|
-
checkLibraryVersion(`${"3.0.
|
|
6266
|
+
checkLibraryVersion(`${"3.0.1"}`, "survey-js-ui");
|
|
6267
6267
|
|
|
6268
6268
|
export { CharacterCounterComponent, O as Children, x$3 as Component, ComponentsContainer, k$3 as Fragment, Header, HeaderCell, HeaderMobile, List, ListItemContent, ListItemGroup, LoadingIndicatorComponent, LogoImage, MatrixRow, NotifierComponent, Popup, PopupModal, PopupSurvey, N as PureComponent, QuestionErrorComponent, RatingDropdownItem, RatingItem, RatingItemSmiley, RatingItemStar, ReactElementFactory, ReactQuestionFactory, ReactSurveyElement, ReactSurveyElementsWrapper, Scroll, Skeleton, SliderLabelItem, Cn as StrictMode, Survey, SurveyActionBar, SurveyElementBase, SurveyElementErrors, SurveyFileChooseButton, SurveyFileItem, SurveyFilePreview, SurveyFlowPanel, SurveyHeader, SurveyLocStringEditor, SurveyLocStringViewer, SurveyNavigationBase, SurveyPage, SurveyPanel, SurveyProgress, SurveyProgressButtons, SurveyProgressToc, SurveyQuestion, SurveyQuestionAndErrorsCell, SurveyQuestionBoolean, SurveyQuestionBooleanCheckbox, SurveyQuestionBooleanRadio, SurveyQuestionBooleanSwitch, SurveyQuestionButtonGroup, SurveyQuestionButtonGroupDropdown, SurveyQuestionCheckbox, SurveyQuestionCheckboxItem, SurveyQuestionComment, SurveyQuestionCommentItem, SurveyQuestionComposite, SurveyQuestionCustom, SurveyQuestionDropdown, SurveyQuestionDropdownBase, SurveyQuestionDropdownSelect, SurveyQuestionElementBase, SurveyQuestionEmpty, SurveyQuestionExpression, SurveyQuestionFile, SurveyQuestionHtml, SurveyQuestionImage, SurveyQuestionImageMap, SurveyQuestionImagePicker, SurveyQuestionMatrix, SurveyQuestionMatrixCell, SurveyQuestionMatrixDropdown, SurveyQuestionMatrixDropdownBase, SurveyQuestionMatrixDropdownCell, SurveyQuestionMatrixDynamic, SurveyQuestionMatrixDynamicDragDropIcon, SurveyQuestionMatrixRow, SurveyQuestionMultipleText, SurveyQuestionOptionItem, SurveyQuestionPanelDynamic, SurveyQuestionPanelDynamicProgressText, SurveyQuestionRadioItem, SurveyQuestionRadiogroup, SurveyQuestionRanking, SurveyQuestionRankingItem, SurveyQuestionRankingItemContent, SurveyQuestionRating, SurveyQuestionRatingDropdown, SurveyQuestionSignaturePad, SurveyQuestionSlider, SurveyQuestionTagbox, SurveyQuestionTagboxItem, SurveyQuestionText, SurveyRow, SurveyTimerPanel, SurveyWindow, P as Suspense, B as SuspenseList, SvgBundleComponent, SvgIcon, TagboxFilterString, TitleActions, TitleElement, attachKey2click, _n as cloneElement, Q$2 as createContext, _$1 as createElement, dn as createFactory, $ as createPortal, b$1 as createRef, Sn as findDOMNode, En as flushSync, D as forwardRef, tn as hydrate, pn as isFragment, yn as isMemo, mn as isValidElement, z as lazy, M as memo, preact, nn as render, renderPopupSurvey, renderSurvey, R as startTransition, bn as unmountComponentAtNode, gn as unstable_batchedUpdates, q$2 as useCallback, x$2 as useContext, P$2 as useDebugValue, w as useDeferredValue, y as useEffect, g$2 as useId, F$2 as useImperativeHandle, I as useInsertionEffect, _ as useLayoutEffect, T$2 as useMemo, h as useReducer, A$2 as useRef, d as useState, C as useSyncExternalStore, k as useTransition, vn as version };
|
|
6269
6269
|
//# sourceMappingURL=survey-js-ui.mjs.map
|
package/package.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "survey-js-ui",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"description": "A free MIT-licensed UI component that renders dynamic, interactive JSON-based forms and surveys in apps built with HTML, CSS, and JavaScript. You can use it to collect responses from users and send them to your own database.",
|
|
6
5
|
"homepage": "https://surveyjs.io/",
|
|
7
6
|
"author": "DevSoft Baltic OU <info@devsoftbaltic.com>",
|
|
7
|
+
"description": "UI component that renders dynamic, JSON-based forms and surveys in HTML/CSS/JavaScript apps, with jQuery support. You can use it to collect responses from users and send them to your own database.",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"vanilla",
|
|
10
10
|
"vanilla-js",
|
|
11
|
+
"jquery",
|
|
12
|
+
"html",
|
|
11
13
|
"survey",
|
|
12
14
|
"form",
|
|
13
15
|
"surveyjs",
|
|
14
16
|
"survey-library",
|
|
15
|
-
"form-component",
|
|
16
17
|
"form-rendering",
|
|
17
18
|
"survey-renderer",
|
|
18
19
|
"dynamic-form",
|
|
19
20
|
"interactive-form",
|
|
20
21
|
"form-library",
|
|
21
|
-
"form-management",
|
|
22
22
|
"questionnaire",
|
|
23
23
|
"data-collection",
|
|
24
24
|
"data-validation",
|
|
@@ -27,12 +27,19 @@
|
|
|
27
27
|
"ui-component",
|
|
28
28
|
"json",
|
|
29
29
|
"json-schema",
|
|
30
|
-
"schema-form",
|
|
31
|
-
"survey-renderer",
|
|
32
|
-
"client-side",
|
|
33
|
-
"frontend",
|
|
34
30
|
"javascript",
|
|
35
|
-
"typescript"
|
|
31
|
+
"typescript",
|
|
32
|
+
"schema-form",
|
|
33
|
+
"conditional-logic",
|
|
34
|
+
"quiz",
|
|
35
|
+
"poll",
|
|
36
|
+
"localization",
|
|
37
|
+
"css",
|
|
38
|
+
"shadcn",
|
|
39
|
+
"mui",
|
|
40
|
+
"material-ui",
|
|
41
|
+
"bootstrap",
|
|
42
|
+
"bootswatch"
|
|
36
43
|
],
|
|
37
44
|
"files": [
|
|
38
45
|
"**/*"
|
|
@@ -53,7 +60,7 @@
|
|
|
53
60
|
},
|
|
54
61
|
"dependencies": {},
|
|
55
62
|
"peerDependencies": {
|
|
56
|
-
"survey-core": "3.0.
|
|
63
|
+
"survey-core": "3.0.1",
|
|
57
64
|
"@types/react-dom": "*",
|
|
58
65
|
"@types/react": "*"
|
|
59
66
|
}
|
package/survey-js-ui.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - Survey JavaScript library v3.0.
|
|
2
|
+
* surveyjs - Survey JavaScript library v3.0.1
|
|
3
3
|
* Copyright (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
|
|
4
4
|
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
|
5
5
|
*/
|
|
@@ -6264,7 +6264,7 @@
|
|
|
6264
6264
|
}
|
|
6265
6265
|
};
|
|
6266
6266
|
const preact = React;
|
|
6267
|
-
surveyCore.checkLibraryVersion(`${"3.0.
|
|
6267
|
+
surveyCore.checkLibraryVersion(`${"3.0.1"}`, "survey-js-ui");
|
|
6268
6268
|
|
|
6269
6269
|
Object.defineProperty(exports, 'Model', {
|
|
6270
6270
|
enumerable: true,
|