You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// This example is meant to test default styling without additional parameters
23
+
constcontact_info={
24
+
title: "jsPsych Survey Plugin example",
25
+
pages: [{
26
+
title: "Page 1 title: Personal Details",
27
+
name: "PersonalDetails",
28
+
elements: [{
29
+
type: "text",
30
+
name: "FirstName",
31
+
title: "First name:",
32
+
isRequired: true,
33
+
autocomplete: 'given-name'
34
+
},
35
+
{
36
+
type: "text",
37
+
name: "LastName",
38
+
title: "Last name:",
39
+
isRequired: true,
40
+
startWithNewLine: false,
41
+
autocomplete: 'family-name'
42
+
},
43
+
{
44
+
type: "panel",
45
+
name: "Contacts",
46
+
state: "collapsed",
47
+
title: "Contact (optional)",
48
+
elements: [{
49
+
type: "text",
50
+
inputType: 'tel',
51
+
name: "Phone",
52
+
title: "Phone number:",
53
+
defaultValue: "(123) 456-7890",
54
+
autocomplete: 'tel'
55
+
},{
56
+
type: "text",
57
+
name: "GitHub",
58
+
title: "GitHub username:"
59
+
},
60
+
{
61
+
type: "text",
62
+
inputType: 'email',
63
+
name: "email",
64
+
title: "Email:",
65
+
autocomplete: 'email'
66
+
}]
67
+
}]
68
+
},
69
+
{
70
+
title: "Page 2 title: Location",
71
+
name: "Location",
72
+
description: "Here are some questions with the 'description' shown below the question. The titles are hidden by setting the 'title' string to a space character. (You can also set the survey's 'questionTitleLocation' to' 'hidden', but that applies to the whole survey.)",
73
+
elements: [
74
+
{
75
+
type: "text",
76
+
name: "State",
77
+
title: " ",
78
+
width: "20%",
79
+
minWidth: "128px",
80
+
startWithNewLine: false,
81
+
description: "Enter a state or region",
82
+
autocomplete: "off"
83
+
},
84
+
{
85
+
type: "dropdown",
86
+
name: "Country",
87
+
title: " ",
88
+
startWithNewLine: false,
89
+
width: "60%",
90
+
minWidth: "256px",
91
+
description: "Select a country (start typing to search, press Enter to select)",
92
+
choicesByUrl: {
93
+
url: "https://surveyjs.io/api/CountriesExample"
94
+
},
95
+
placeholder: "",
96
+
allowClear: false
97
+
},
98
+
{
99
+
type: "tagbox",
100
+
choicesByUrl: {
101
+
url: "https://surveyjs.io/api/CountriesExample"
102
+
},
103
+
name: "all-countries",
104
+
title: "Which countries have you been to?",
105
+
description: "Multi-select dropdown - please select all that apply. Try selecting lots of countries to see how the input area grows."
Copy file name to clipboardExpand all lines: packages/plugin-survey/src/index.ts
+12-36Lines changed: 12 additions & 36 deletions
Original file line number
Diff line number
Diff line change
@@ -44,6 +44,14 @@ const info = <const>{
44
44
type: ParameterType.FUNCTION,
45
45
default: null,
46
46
},
47
+
/**
48
+
* The minimum width of the survey container. This is applied as a CSS `min-width` property to the survey container element.
49
+
* Note that the width of the survey can also be controlled using SurveyJS parameters within the `survey_json` object (e.g., `widthMode`, `width`, `fitToContainer`).
50
+
*/
51
+
min_width: {
52
+
type: ParameterType.STRING,
53
+
default: "min(100vw, 800px)",
54
+
},
47
55
},
48
56
data: {
49
57
/** An object containing the response to each question. The object will have a separate key (identifier) for each question. If the `name` parameter is defined for the question (recommended), then the response object will use the value of `name` as the key for each question. If any questions do not have a name parameter, their keys will named automatically, with the first unnamed question recorded as `question1`, the second as `question2`, and so on. The response type will depend on the question type. This will be encoded as a JSON string when data is saved using the `.json()` or `.csv()` functions. */
@@ -61,31 +69,6 @@ const info = <const>{
61
69
62
70
typeInfo=typeofinfo;
63
71
64
-
// Define the mapping between custom jsPsych class names (jspsych-*) and class names provided by SurveyJS.
65
-
// See here for full list: https://github.com/surveyjs/survey-library/blob/master/src/defaultCss/defaultV2Css.ts.
66
-
// To modify the survey plugin CSS:
67
-
// (1) search for the CSS selector that you want to modify,
68
-
// (2) look it up and get the associated ID (note that some of these are nested)
69
-
// (3) if the ID isn't already listed as a key here, add it and use a new jspsych class name as the value
70
-
// (4) in survey.scss, use the jspsych class name as the selector and add/modify the rule
71
-
72
-
constjsPsychSurveyCssClassMap={
73
-
body: "jspsych-body",
74
-
bodyContainer: "jspsych-body-container",
75
-
question: {
76
-
content: "jspsych-question-content",
77
-
mainRoot: "jspsych-question-root",
78
-
},
79
-
page: {
80
-
root: "jspsych-page",
81
-
},
82
-
footer: "jspsych-footer",
83
-
navigation: {
84
-
complete: "jspsych-nav-complete",
85
-
},
86
-
rowMultiple: "jspsych-row-multiple",
87
-
};
88
-
89
72
/**
90
73
* SurveyJS version: 2.2.0
91
74
*
@@ -151,9 +134,11 @@ class SurveyPlugin implements JsPsychPlugin<Info> {
0 commit comments