@micromag/screen-survey 0.4.71 → 0.4.76
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/es/index.d.ts +2 -2
- package/es/index.js +370 -413
- package/package.json +20 -19
package/es/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ForwardedRef } from 'react';
|
|
3
|
-
import { TextElement, Answer, BoxStyle, TextStyle, Color, Header, Footer, BackgroundElement, Transitions } from '@micromag/core';
|
|
3
|
+
import { TextElement, Answer, BoxStyle, TextStyle, Color, Header, Footer, BackgroundElement, Transitions, MediaElement } from '@micromag/core';
|
|
4
4
|
|
|
5
5
|
interface SurveyScreenProps {
|
|
6
6
|
id?: string | null;
|
|
@@ -28,7 +28,7 @@ interface SurveyScreenProps {
|
|
|
28
28
|
transitions?: Transitions | null;
|
|
29
29
|
resultTransitionDuration?: number;
|
|
30
30
|
type?: string | null;
|
|
31
|
-
mediaRef?: ForwardedRef<
|
|
31
|
+
mediaRef?: ForwardedRef<MediaElement> | null;
|
|
32
32
|
className?: string | null;
|
|
33
33
|
}
|
|
34
34
|
declare function SurveyScreen({ id, layout, question, answers, result, buttonsStyle, buttonsTextStyle, resultsStyle, spacing, header, footer, background, customAnswer, showCount, withoutPercentage, withoutBar, current, preload, transitions, resultTransitionDuration, type, mediaRef: customMediaRef, className, }: SurveyScreenProps): react_jsx_runtime.JSX.Element;
|
package/es/index.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { FormattedMessage, defineMessage } from 'react-intl';
|
|
2
|
-
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
3
|
-
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
|
-
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
5
|
-
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
6
2
|
import { faRedo } from '@fortawesome/free-solid-svg-icons/faRedo';
|
|
7
3
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
8
4
|
import classNames from 'classnames';
|
|
@@ -28,236 +24,200 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
28
24
|
|
|
29
25
|
var styles = {"container":"micromag-screen-survey-container","background":"micromag-screen-survey-background","content":"micromag-screen-survey-content","question":"micromag-screen-survey-question","answers":"micromag-screen-survey-answers","items":"micromag-screen-survey-items","header":"micromag-screen-survey-header","disabled":"micromag-screen-survey-disabled","footer":"micromag-screen-survey-footer","item":"micromag-screen-survey-item","placeholderAnswer":"micromag-screen-survey-placeholderAnswer","itemContent":"micromag-screen-survey-itemContent","resultBar":"micromag-screen-survey-resultBar","resultLabel":"micromag-screen-survey-resultLabel","resultText":"micromag-screen-survey-resultText","itemInner":"micromag-screen-survey-itemInner","button":"micromag-screen-survey-button","itemLabel":"micromag-screen-survey-itemLabel","itemText":"micromag-screen-survey-itemText","emptyQuestion":"micromag-screen-survey-emptyQuestion","emptyAnswer":"micromag-screen-survey-emptyAnswer","userAnswer":"micromag-screen-survey-userAnswer","input":"micromag-screen-survey-input","textInput":"micromag-screen-survey-textInput","confirm":"micromag-screen-survey-confirm","selected":"micromag-screen-survey-selected","submit":"micromag-screen-survey-submit","focused":"micromag-screen-survey-focused","filled":"micromag-screen-survey-filled","multiline":"micromag-screen-survey-multiline","icon":"micromag-screen-survey-icon","answered":"micromag-screen-survey-answered","withPercentage":"micromag-screen-survey-withPercentage","withBar":"micromag-screen-survey-withBar","inputFocused":"micromag-screen-survey-inputFocused","isPlaceholder":"micromag-screen-survey-isPlaceholder","layout":"micromag-screen-survey-layout","reset":"micromag-screen-survey-reset"};
|
|
30
26
|
|
|
31
|
-
function SurveyScreen(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
autoload: !isPlaceholder
|
|
111
|
-
}
|
|
112
|
-
}),
|
|
113
|
-
_useQuiz$quiz = _useQuiz.quiz,
|
|
114
|
-
allQuizAnswers = _useQuiz$quiz === void 0 ? [] : _useQuiz$quiz;
|
|
115
|
-
var quizAnswers = allQuizAnswers.filter(function (item) {
|
|
116
|
-
var _ref2 = item || {},
|
|
117
|
-
_ref2$choice = _ref2.choice,
|
|
118
|
-
choice = _ref2$choice === void 0 ? null : _ref2$choice;
|
|
119
|
-
var answersBody = (answers || []).map(function (answer) {
|
|
120
|
-
var _ref3 = answer || {},
|
|
121
|
-
_ref3$label = _ref3.label,
|
|
122
|
-
label = _ref3$label === void 0 ? null : _ref3$label;
|
|
123
|
-
var _ref4 = label || {},
|
|
124
|
-
_ref4$body = _ref4.body,
|
|
125
|
-
body = _ref4$body === void 0 ? null : _ref4$body;
|
|
27
|
+
function SurveyScreen({
|
|
28
|
+
id = null,
|
|
29
|
+
layout = 'middle',
|
|
30
|
+
question = null,
|
|
31
|
+
answers = null,
|
|
32
|
+
result = null,
|
|
33
|
+
buttonsStyle = null,
|
|
34
|
+
buttonsTextStyle = null,
|
|
35
|
+
resultsStyle = null,
|
|
36
|
+
spacing = 20,
|
|
37
|
+
header = null,
|
|
38
|
+
footer = null,
|
|
39
|
+
background = null,
|
|
40
|
+
customAnswer = false,
|
|
41
|
+
showCount = false,
|
|
42
|
+
withoutPercentage = false,
|
|
43
|
+
withoutBar = false,
|
|
44
|
+
current = true,
|
|
45
|
+
preload = true,
|
|
46
|
+
transitions = null,
|
|
47
|
+
resultTransitionDuration = 500,
|
|
48
|
+
type = null,
|
|
49
|
+
mediaRef: customMediaRef = null,
|
|
50
|
+
className = null
|
|
51
|
+
}) {
|
|
52
|
+
const screenId = id || 'screen-id';
|
|
53
|
+
const trackScreenEvent = useTrackScreenEvent(type);
|
|
54
|
+
const {
|
|
55
|
+
width,
|
|
56
|
+
height,
|
|
57
|
+
resolution
|
|
58
|
+
} = useScreenSize();
|
|
59
|
+
const {
|
|
60
|
+
create: submitQuiz
|
|
61
|
+
} = useQuizCreate({
|
|
62
|
+
screenId
|
|
63
|
+
});
|
|
64
|
+
const {
|
|
65
|
+
isView,
|
|
66
|
+
isPreview,
|
|
67
|
+
isPlaceholder,
|
|
68
|
+
isEdit,
|
|
69
|
+
isStatic,
|
|
70
|
+
isCapture
|
|
71
|
+
} = useScreenRenderContext();
|
|
72
|
+
const {
|
|
73
|
+
topHeight: viewerTopHeight,
|
|
74
|
+
bottomHeight: viewerBottomHeight,
|
|
75
|
+
bottomSidesWidth: viewerBottomSidesWidth
|
|
76
|
+
} = useViewerContext();
|
|
77
|
+
const {
|
|
78
|
+
open: openWebView
|
|
79
|
+
} = useViewerWebView();
|
|
80
|
+
const {
|
|
81
|
+
muted
|
|
82
|
+
} = usePlaybackContext();
|
|
83
|
+
const {
|
|
84
|
+
ref: mediaRef,
|
|
85
|
+
isCurrent: isCurrentMedia = false
|
|
86
|
+
} = usePlaybackMediaRef(current, true);
|
|
87
|
+
const {
|
|
88
|
+
quiz: allQuizAnswers = []
|
|
89
|
+
} = useQuiz({
|
|
90
|
+
screenId,
|
|
91
|
+
opts: {
|
|
92
|
+
autoload: !isPlaceholder
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
const quizAnswers = allQuizAnswers.filter(item => {
|
|
96
|
+
const {
|
|
97
|
+
choice = null
|
|
98
|
+
} = item || {};
|
|
99
|
+
const answersBody = (answers || []).map(answer => {
|
|
100
|
+
const {
|
|
101
|
+
label = null
|
|
102
|
+
} = answer || {};
|
|
103
|
+
const {
|
|
104
|
+
body = null
|
|
105
|
+
} = label || {};
|
|
126
106
|
return body;
|
|
127
|
-
}).filter(
|
|
128
|
-
|
|
129
|
-
});
|
|
130
|
-
var hasResult = answersBody.find(function (body) {
|
|
131
|
-
return body === choice;
|
|
132
|
-
});
|
|
107
|
+
}).filter(body_0 => body_0 !== null);
|
|
108
|
+
const hasResult = answersBody.find(body_1 => body_1 === choice);
|
|
133
109
|
if (hasResult) {
|
|
134
110
|
return true;
|
|
135
111
|
}
|
|
136
112
|
return false;
|
|
137
113
|
});
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
count =
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
return qa.choice === body;
|
|
179
|
-
}) || {},
|
|
180
|
-
_ref0$count = _ref0.count,
|
|
181
|
-
count = _ref0$count === void 0 ? 0 : _ref0$count;
|
|
182
|
-
var countWithUser = i === userAnswerIndex ? count + 1 : count;
|
|
183
|
-
if (body !== null) {
|
|
184
|
-
return _objectSpread(_objectSpread({}, answersTotal), {}, _defineProperty({}, body, {
|
|
185
|
-
percent: total > 0 ? countWithUser / total * 100 : 0,
|
|
186
|
-
count: countWithUser
|
|
187
|
-
}));
|
|
114
|
+
const hasQuestion = isTextFilled(question);
|
|
115
|
+
const hasDefaultResult = isTextFilled(result);
|
|
116
|
+
const {
|
|
117
|
+
active: allowCustomAnswer = false,
|
|
118
|
+
placeholder = null,
|
|
119
|
+
textStyle: customAnswerTextStyle = null,
|
|
120
|
+
boxStyle: customAnswerBoxStyle = null,
|
|
121
|
+
submit: customAnswerSubmit = null,
|
|
122
|
+
multiline: customAnswerMultiline = false
|
|
123
|
+
} = customAnswer || {};
|
|
124
|
+
const {
|
|
125
|
+
body: placeholderBody = null,
|
|
126
|
+
textStyle: placeholderTextStyle = null
|
|
127
|
+
} = placeholder || {};
|
|
128
|
+
const showInstantAnswer = isStatic || isCapture;
|
|
129
|
+
const [userAnswerIndex, setUserAnswerIndex] = useState(showInstantAnswer ? -1 : null);
|
|
130
|
+
const answered = userAnswerIndex !== null;
|
|
131
|
+
const quizAnswersComputed = useMemo(() => {
|
|
132
|
+
const total = answers !== null ? (quizAnswers || []).reduce((points, {
|
|
133
|
+
count = 0
|
|
134
|
+
}) => points + parseInt(count, 10), userAnswerIndex !== null && userAnswerIndex > -1 ? 1 : 0) : 0;
|
|
135
|
+
const computed = answers !== null ? (answers || []).reduce((answersTotal, ans, i) => {
|
|
136
|
+
const {
|
|
137
|
+
label: label_0 = {}
|
|
138
|
+
} = ans || {};
|
|
139
|
+
const {
|
|
140
|
+
body: body_2 = null
|
|
141
|
+
} = label_0 || {};
|
|
142
|
+
const {
|
|
143
|
+
count: count_0 = 0
|
|
144
|
+
} = quizAnswers.find(qa => qa.choice === body_2) || {};
|
|
145
|
+
const countWithUser = i === userAnswerIndex ? count_0 + 1 : count_0;
|
|
146
|
+
if (body_2 !== null) {
|
|
147
|
+
return {
|
|
148
|
+
...answersTotal,
|
|
149
|
+
[body_2]: {
|
|
150
|
+
percent: total > 0 ? countWithUser / total * 100 : 0,
|
|
151
|
+
count: countWithUser
|
|
152
|
+
}
|
|
153
|
+
};
|
|
188
154
|
}
|
|
189
155
|
return answersTotal;
|
|
190
156
|
}, {}) : {};
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
percent: evenlySplit[
|
|
198
|
-
}
|
|
199
|
-
}, {});
|
|
157
|
+
const quizAnswersPct = total > 0 ? Object.keys(computed).map(key => computed[key].percent || 0) : [];
|
|
158
|
+
const evenlySplit = getLargestRemainderRound(quizAnswersPct, 100);
|
|
159
|
+
return Object.keys(computed).reduce((acc, key_0, i_0) => ({
|
|
160
|
+
...acc,
|
|
161
|
+
[key_0]: {
|
|
162
|
+
...computed[key_0],
|
|
163
|
+
percent: evenlySplit[i_0]
|
|
164
|
+
}
|
|
165
|
+
}), {});
|
|
200
166
|
}, [answers, quizAnswers, userAnswerIndex]);
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
167
|
+
const isSplitted = layout === 'split';
|
|
168
|
+
const isMiddleLayout = layout === 'middle';
|
|
169
|
+
const verticalAlign = isSplitted ? null : layout;
|
|
170
|
+
const transitionPlaying = current;
|
|
171
|
+
const transitionDisabled = isStatic || isCapture || isPlaceholder || isPreview || isEdit;
|
|
172
|
+
const backgroundPlaying = current && (isView || isEdit) && (isCurrentMedia || !isView);
|
|
173
|
+
const mediaShouldLoad = current || preload;
|
|
174
|
+
const onAnswerClick = useCallback(answerIndex => {
|
|
209
175
|
if (userAnswerIndex === null) {
|
|
210
176
|
setUserAnswerIndex(answerIndex);
|
|
211
|
-
|
|
177
|
+
const answer_0 = answers !== null ? answers[answerIndex] : null;
|
|
212
178
|
submitQuiz({
|
|
213
|
-
choice:
|
|
179
|
+
choice: answer_0.label.body || answerIndex,
|
|
214
180
|
value: 1
|
|
215
181
|
});
|
|
216
|
-
trackScreenEvent('click_answer',
|
|
182
|
+
trackScreenEvent('click_answer', `Answer ${userAnswerIndex + 1}: ${answer_0.label.body}`, {
|
|
217
183
|
linkType: 'survey_answer',
|
|
218
|
-
answer:
|
|
219
|
-
answerIndex
|
|
184
|
+
answer: answer_0,
|
|
185
|
+
answerIndex,
|
|
220
186
|
answerType: 'button'
|
|
221
187
|
});
|
|
222
188
|
}
|
|
223
189
|
}, [userAnswerIndex, setUserAnswerIndex, trackScreenEvent, submitQuiz]);
|
|
224
|
-
useEffect(
|
|
190
|
+
useEffect(() => {
|
|
225
191
|
if (!current && isEdit && userAnswerIndex !== null) {
|
|
226
192
|
setUserAnswerIndex(null);
|
|
227
193
|
}
|
|
228
194
|
}, [isEdit, current, userAnswerIndex, setUserAnswerIndex]);
|
|
229
|
-
|
|
195
|
+
const onQuizReset = useCallback(() => {
|
|
230
196
|
setUserAnswerIndex(null);
|
|
231
197
|
}, [setUserAnswerIndex]);
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
var _useState5 = useState(false),
|
|
237
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
238
|
-
inputFocused = _useState6[0],
|
|
239
|
-
setInputFocused = _useState6[1];
|
|
240
|
-
var inputDisabled = isPreview || answered;
|
|
241
|
-
var onInputFocused = useCallback(function (e) {
|
|
198
|
+
const [textInput, setTextInput] = useState(null);
|
|
199
|
+
const [inputFocused, setInputFocused] = useState(false);
|
|
200
|
+
const inputDisabled = isPreview || answered;
|
|
201
|
+
const onInputFocused = useCallback(e => {
|
|
242
202
|
e.preventDefault();
|
|
243
203
|
e.stopPropagation();
|
|
244
204
|
setInputFocused(true);
|
|
245
205
|
}, [setInputFocused]);
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
206
|
+
const onInputBlurred = useCallback(e_0 => {
|
|
207
|
+
e_0.preventDefault();
|
|
208
|
+
e_0.stopPropagation();
|
|
249
209
|
setInputFocused(false);
|
|
250
210
|
}, [setInputFocused]);
|
|
251
|
-
|
|
252
|
-
|
|
211
|
+
const onTextInputChange = useCallback(e_1 => {
|
|
212
|
+
const value = DOMPurify.sanitize(e_1.currentTarget.value || '');
|
|
253
213
|
setTextInput(value !== '' ? value : null);
|
|
254
214
|
}, [setTextInput]);
|
|
255
|
-
|
|
215
|
+
const onTextInputClear = useCallback(() => {
|
|
256
216
|
setTextInput('');
|
|
257
217
|
}, [setTextInput]);
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
218
|
+
const onSubmitSuggestion = useCallback(e_2 => {
|
|
219
|
+
e_2.preventDefault();
|
|
220
|
+
e_2.stopPropagation();
|
|
261
221
|
if (textInput !== null && textInput !== '' && !answered) {
|
|
262
222
|
submitQuiz({
|
|
263
223
|
choice: textInput,
|
|
@@ -265,72 +225,63 @@ function SurveyScreen(_ref) {
|
|
|
265
225
|
});
|
|
266
226
|
setUserAnswerIndex('input');
|
|
267
227
|
setInputFocused(false);
|
|
268
|
-
trackScreenEvent('click_answer',
|
|
269
|
-
textInput
|
|
228
|
+
trackScreenEvent('click_answer', `Answer input: ${textInput}`, {
|
|
229
|
+
textInput,
|
|
270
230
|
answerIndex: null,
|
|
271
231
|
answerType: 'custom'
|
|
272
232
|
});
|
|
273
233
|
}
|
|
274
234
|
}, [textInput, submitQuiz, answered, setUserAnswerIndex, setInputFocused, trackScreenEvent]);
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
isView
|
|
279
|
-
current
|
|
280
|
-
openWebView
|
|
281
|
-
isPreview
|
|
235
|
+
const hasHeader = isHeaderFilled(header);
|
|
236
|
+
const hasFooter = isFooterFilled(footer);
|
|
237
|
+
const footerProps = getFooterProps(footer, {
|
|
238
|
+
isView,
|
|
239
|
+
current,
|
|
240
|
+
openWebView,
|
|
241
|
+
isPreview
|
|
282
242
|
});
|
|
283
|
-
|
|
284
|
-
headerRef
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
footerRef
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
var onScrolledBottom = useCallback(function (_ref1) {
|
|
297
|
-
var initial = _ref1.initial;
|
|
243
|
+
const {
|
|
244
|
+
ref: headerRef,
|
|
245
|
+
height: headerHeight = 0
|
|
246
|
+
} = useDimensionObserver();
|
|
247
|
+
const {
|
|
248
|
+
ref: footerRef,
|
|
249
|
+
height: footerHeight = 0
|
|
250
|
+
} = useDimensionObserver();
|
|
251
|
+
const scrollingDisabled = !isEdit && transitionDisabled || !current;
|
|
252
|
+
const [scrolledBottom, setScrolledBottom] = useState(false);
|
|
253
|
+
const onScrolledBottom = useCallback(({
|
|
254
|
+
initial
|
|
255
|
+
}) => {
|
|
298
256
|
if (initial) {
|
|
299
257
|
trackScreenEvent('scroll', 'Screen');
|
|
300
258
|
}
|
|
301
259
|
setScrolledBottom(true);
|
|
302
260
|
}, [trackScreenEvent]);
|
|
303
|
-
|
|
261
|
+
const onScrolledNotBottom = useCallback(() => {
|
|
304
262
|
setScrolledBottom(false);
|
|
305
263
|
}, [setScrolledBottom]);
|
|
306
|
-
|
|
307
|
-
var trigger = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
264
|
+
const onScrolledTrigger = useCallback((trigger = null) => {
|
|
308
265
|
if (trigger !== null) {
|
|
309
|
-
|
|
266
|
+
const scrollPercent = Math.round(trigger * 100);
|
|
310
267
|
trackScreenEvent('scroll', scrollPercent, {
|
|
311
|
-
scrollPercent
|
|
268
|
+
scrollPercent
|
|
312
269
|
});
|
|
313
270
|
}
|
|
314
271
|
}, [trackScreenEvent]);
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
var onScrollHeightChange = useCallback(function (_ref10) {
|
|
320
|
-
var _ref10$canScroll = _ref10.canScroll,
|
|
321
|
-
canScroll = _ref10$canScroll === void 0 ? false : _ref10$canScroll;
|
|
272
|
+
const [hasScroll, setHasScroll] = useState(false);
|
|
273
|
+
const onScrollHeightChange = useCallback(({
|
|
274
|
+
canScroll = false
|
|
275
|
+
}) => {
|
|
322
276
|
setHasScroll(canScroll);
|
|
323
277
|
}, [setHasScroll]);
|
|
324
278
|
|
|
325
279
|
// Question
|
|
326
|
-
|
|
280
|
+
const items = [/*#__PURE__*/jsx(ScreenElement, {
|
|
327
281
|
placeholder: "title",
|
|
328
282
|
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
329
283
|
id: "e1I+KU",
|
|
330
|
-
defaultMessage:
|
|
331
|
-
"type": 0,
|
|
332
|
-
"value": "Question"
|
|
333
|
-
}]
|
|
284
|
+
defaultMessage: "Question"
|
|
334
285
|
}),
|
|
335
286
|
emptyClassName: styles.emptyQuestion,
|
|
336
287
|
isEmpty: !hasQuestion,
|
|
@@ -338,79 +289,78 @@ function SurveyScreen(_ref) {
|
|
|
338
289
|
transitions: transitions,
|
|
339
290
|
playing: transitionPlaying,
|
|
340
291
|
disabled: transitionDisabled,
|
|
341
|
-
children: /*#__PURE__*/jsx(Heading,
|
|
292
|
+
children: /*#__PURE__*/jsx(Heading, {
|
|
293
|
+
...question,
|
|
342
294
|
className: styles.question
|
|
343
|
-
})
|
|
295
|
+
})
|
|
344
296
|
}) : null
|
|
345
297
|
}, "question")];
|
|
346
298
|
if (isSplitted || !isPlaceholder && hasFooter && isMiddleLayout) {
|
|
347
299
|
items.push(/*#__PURE__*/jsx(Spacer, {}, "spacer"));
|
|
348
300
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
var answer = answers !== null && userAnswerIndex !== null ? answers[userAnswerIndex] : null;
|
|
362
|
-
var _ref12 = answer || {},
|
|
363
|
-
_ref12$result = _ref12.result,
|
|
364
|
-
answerResult = _ref12$result === void 0 ? null : _ref12$result;
|
|
301
|
+
const finalTransitionDuration = useMemo(() => showInstantAnswer ? 0 : `${resultTransitionDuration}ms`, [showInstantAnswer, resultTransitionDuration]);
|
|
302
|
+
const {
|
|
303
|
+
barColor: resultsBarColor = null,
|
|
304
|
+
textColor: resultsTextColor = null,
|
|
305
|
+
percentageTextStyle: resultsPercentageTextStyle = null
|
|
306
|
+
} = resultsStyle || {};
|
|
307
|
+
const finalResult = useMemo(() => {
|
|
308
|
+
const defaultResult = hasDefaultResult ? result : null;
|
|
309
|
+
const answer_1 = answers !== null && userAnswerIndex !== null ? answers[userAnswerIndex] : null;
|
|
310
|
+
const {
|
|
311
|
+
result: answerResult = null
|
|
312
|
+
} = answer_1 || {};
|
|
365
313
|
return answerResult || defaultResult;
|
|
366
314
|
}, [hasDefaultResult, result, answers, userAnswerIndex]);
|
|
367
|
-
|
|
315
|
+
const showReset = isEdit && userAnswerIndex !== null;
|
|
368
316
|
items.push(/*#__PURE__*/jsx("div", {
|
|
369
317
|
className: styles.answers,
|
|
370
318
|
children: answers !== null || isPlaceholder ? /*#__PURE__*/jsx("div", {
|
|
371
319
|
className: styles.items,
|
|
372
|
-
children: (isPlaceholder ?
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
320
|
+
children: (isPlaceholder ? [...new Array(3)] : answers).map((answer_2, answerIndex_0) => {
|
|
321
|
+
const hasAnswer = answer_2 !== null;
|
|
322
|
+
const {
|
|
323
|
+
label: label_1 = null,
|
|
324
|
+
buttonStyle: answerButtonStyle = null,
|
|
325
|
+
textStyle: answerButtonTextStyle = null,
|
|
326
|
+
// for backwards compat, leave there
|
|
327
|
+
resultStyle: answerResultStyle = null
|
|
328
|
+
} = answer_2 || {};
|
|
329
|
+
const {
|
|
330
|
+
barColor: answerResultBarColor = null,
|
|
331
|
+
textColor: answerResultTextColor,
|
|
332
|
+
percentageTextStyle: answerResultPercentageTextStyle = null
|
|
333
|
+
} = answerResultStyle || {};
|
|
334
|
+
const {
|
|
335
|
+
body: body_3 = null
|
|
336
|
+
} = label_1 || {};
|
|
337
|
+
const {
|
|
338
|
+
percent = 0,
|
|
339
|
+
count: count_1 = 0
|
|
340
|
+
} = body_3 !== null ? quizAnswersComputed[body_3] || {} : {};
|
|
341
|
+
const {
|
|
342
|
+
textStyle = null
|
|
343
|
+
} = label_1 || {};
|
|
344
|
+
const {
|
|
345
|
+
color: labelColor = null
|
|
346
|
+
} = textStyle || {};
|
|
347
|
+
const hasAnswerLabel = isTextFilled(label_1);
|
|
348
|
+
const userAnswer = userAnswerIndex === answerIndex_0;
|
|
349
|
+
const buttonStyles = {
|
|
350
|
+
...buttonsStyle,
|
|
351
|
+
...answerButtonStyle,
|
|
352
|
+
...(answered ? {
|
|
353
|
+
textAlign: 'left'
|
|
354
|
+
} : null)
|
|
355
|
+
};
|
|
356
|
+
const {
|
|
357
|
+
borderRadius: answerResultBorderRadius = null
|
|
358
|
+
} = buttonStyles || {};
|
|
359
|
+
const finalBarBorderRadius = answerResultBorderRadius !== null && isNumber(answerResultBorderRadius) && answerResultBorderRadius > 2 ? answerResultBorderRadius - 2 : answerResultBorderRadius;
|
|
412
360
|
return /*#__PURE__*/jsx("div", {
|
|
413
|
-
className: classNames([styles.item,
|
|
361
|
+
className: classNames([styles.item, {
|
|
362
|
+
[styles.userAnswer]: userAnswer
|
|
363
|
+
}]),
|
|
414
364
|
children: /*#__PURE__*/jsx(ScreenElement, {
|
|
415
365
|
placeholder: "surveyAnswer",
|
|
416
366
|
placeholderProps: {
|
|
@@ -418,10 +368,7 @@ function SurveyScreen(_ref) {
|
|
|
418
368
|
},
|
|
419
369
|
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
420
370
|
id: "+Ok+7S",
|
|
421
|
-
defaultMessage:
|
|
422
|
-
"type": 0,
|
|
423
|
-
"value": "Answer"
|
|
424
|
-
}]
|
|
371
|
+
defaultMessage: "Answer"
|
|
425
372
|
}),
|
|
426
373
|
emptyClassName: styles.emptyAnswer,
|
|
427
374
|
isEmpty: !hasAnswerLabel,
|
|
@@ -435,57 +382,86 @@ function SurveyScreen(_ref) {
|
|
|
435
382
|
},
|
|
436
383
|
children: /*#__PURE__*/jsx(Button, {
|
|
437
384
|
className: styles.button,
|
|
438
|
-
onPointerUp:
|
|
439
|
-
if (
|
|
440
|
-
onAnswerClick(
|
|
385
|
+
onPointerUp: e_3 => {
|
|
386
|
+
if (e_3.pointerType !== 'mouse' || e_3.button === 0) {
|
|
387
|
+
onAnswerClick(answerIndex_0);
|
|
441
388
|
}
|
|
442
389
|
},
|
|
443
390
|
disabled: isPreview || userAnswerIndex !== null,
|
|
444
391
|
focusable: current && isView,
|
|
445
392
|
buttonStyle: buttonStyles,
|
|
446
|
-
textStyle:
|
|
393
|
+
textStyle: {
|
|
394
|
+
...buttonsTextStyle,
|
|
395
|
+
...textStyle,
|
|
396
|
+
...answerButtonTextStyle
|
|
397
|
+
},
|
|
447
398
|
children: /*#__PURE__*/jsxs("span", {
|
|
448
399
|
className: styles.itemLabel,
|
|
449
|
-
children: [/*#__PURE__*/jsx(Text,
|
|
450
|
-
|
|
400
|
+
children: [/*#__PURE__*/jsx(Text, {
|
|
401
|
+
...label_1,
|
|
402
|
+
textStyle: {
|
|
403
|
+
...buttonsTextStyle,
|
|
404
|
+
...textStyle,
|
|
405
|
+
...answerButtonTextStyle
|
|
406
|
+
},
|
|
451
407
|
inline: true,
|
|
452
408
|
className: styles.itemText
|
|
453
|
-
})
|
|
409
|
+
}), !withoutPercentage ? /*#__PURE__*/jsx("div", {
|
|
454
410
|
className: styles.resultLabel,
|
|
455
|
-
style:
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
411
|
+
style: {
|
|
412
|
+
...getStyleFromColor(answered ? answerResultTextColor || resultsTextColor || answerResultBarColor || resultsBarColor || labelColor : null, 'color'),
|
|
413
|
+
...(answered ? {
|
|
414
|
+
opacity: 1
|
|
415
|
+
} : {
|
|
416
|
+
opacity: 0
|
|
417
|
+
})
|
|
418
|
+
},
|
|
419
|
+
children: /*#__PURE__*/jsx(Text, {
|
|
420
|
+
...label_1,
|
|
421
|
+
textStyle: {
|
|
422
|
+
...buttonsTextStyle,
|
|
423
|
+
...textStyle,
|
|
424
|
+
...answerButtonTextStyle,
|
|
425
|
+
...resultsTextColor,
|
|
426
|
+
...resultsPercentageTextStyle,
|
|
427
|
+
...answerResultTextColor,
|
|
428
|
+
...answerResultPercentageTextStyle
|
|
429
|
+
},
|
|
462
430
|
inline: true,
|
|
463
431
|
className: styles.resultText,
|
|
464
|
-
body: showCount ?
|
|
465
|
-
})
|
|
432
|
+
body: showCount ? count_1 : `${percent}%`
|
|
433
|
+
})
|
|
466
434
|
}) : null, !withoutBar ? /*#__PURE__*/jsx("div", {
|
|
467
435
|
className: styles.resultBar,
|
|
468
|
-
style:
|
|
436
|
+
style: {
|
|
469
437
|
borderRadius: finalBarBorderRadius,
|
|
470
438
|
transitionDuration: finalTransitionDuration,
|
|
471
|
-
width: percent !== null ?
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
439
|
+
width: percent !== null ? `${percent}%` : '0%',
|
|
440
|
+
...getStyleFromColor(answerResultBarColor || resultsBarColor || labelColor, 'backgroundColor'),
|
|
441
|
+
...(answered ? {
|
|
442
|
+
opacity: 0.5
|
|
443
|
+
} : {
|
|
444
|
+
opacity: 0
|
|
445
|
+
})
|
|
446
|
+
}
|
|
477
447
|
}) : null]
|
|
478
448
|
})
|
|
479
449
|
})
|
|
480
450
|
})
|
|
481
451
|
}) : null
|
|
482
452
|
})
|
|
483
|
-
},
|
|
453
|
+
}, `answer-${answerIndex_0 + 1}`);
|
|
484
454
|
})
|
|
485
455
|
}) : null
|
|
486
456
|
}, "answers"));
|
|
487
457
|
return /*#__PURE__*/jsxs("div", {
|
|
488
|
-
className: classNames([styles.container, className,
|
|
458
|
+
className: classNames([styles.container, className, {
|
|
459
|
+
[styles.answered]: answered,
|
|
460
|
+
[styles.inputFocused]: inputFocused,
|
|
461
|
+
[styles.withPercentage]: !withoutPercentage,
|
|
462
|
+
[styles.withBar]: !withoutBar,
|
|
463
|
+
[styles.isPlaceholder]: isPlaceholder
|
|
464
|
+
}]),
|
|
489
465
|
children: [/*#__PURE__*/jsxs(Container, {
|
|
490
466
|
width: width,
|
|
491
467
|
height: height,
|
|
@@ -506,16 +482,20 @@ function SurveyScreen(_ref) {
|
|
|
506
482
|
}),
|
|
507
483
|
onClick: onQuizReset
|
|
508
484
|
}) : null, !isPlaceholder && hasHeader ? /*#__PURE__*/jsx("div", {
|
|
509
|
-
className: classNames([styles.header,
|
|
485
|
+
className: classNames([styles.header, {
|
|
486
|
+
[styles.disabled]: scrolledBottom && !scrollingDisabled && hasScroll
|
|
487
|
+
}]),
|
|
510
488
|
ref: headerRef,
|
|
511
489
|
style: {
|
|
512
490
|
paddingTop: spacing / 2,
|
|
513
491
|
paddingLeft: spacing,
|
|
514
492
|
paddingRight: spacing,
|
|
515
493
|
paddingBottom: spacing,
|
|
516
|
-
transform: !isPreview ?
|
|
494
|
+
transform: !isPreview ? `translate(0, ${viewerTopHeight}px)` : null
|
|
517
495
|
},
|
|
518
|
-
children: /*#__PURE__*/jsx(Header,
|
|
496
|
+
children: /*#__PURE__*/jsx(Header, {
|
|
497
|
+
...header
|
|
498
|
+
})
|
|
519
499
|
}) : null, /*#__PURE__*/jsxs(Layout, {
|
|
520
500
|
className: styles.layout,
|
|
521
501
|
verticalAlign: verticalAlign,
|
|
@@ -526,15 +506,33 @@ function SurveyScreen(_ref) {
|
|
|
526
506
|
paddingBottom: (current && !isPreview ? viewerBottomHeight : 0) + (footerHeight + spacing)
|
|
527
507
|
} : null,
|
|
528
508
|
children: [items, !isPlaceholder && allowCustomAnswer ? /*#__PURE__*/jsxs("form", {
|
|
529
|
-
className: classNames([styles.input,
|
|
509
|
+
className: classNames([styles.input, {
|
|
510
|
+
[styles.focused]: inputFocused,
|
|
511
|
+
[styles.filled]: textInput !== null && textInput !== '',
|
|
512
|
+
[styles.disabled]: inputDisabled,
|
|
513
|
+
[styles.selected]: userAnswerIndex === 'input',
|
|
514
|
+
[styles.multiline]: customAnswerMultiline
|
|
515
|
+
}]),
|
|
530
516
|
onSubmit: onSubmitSuggestion,
|
|
531
517
|
children: [/*#__PURE__*/jsx(TextInput, {
|
|
532
518
|
className: styles.textInput,
|
|
533
519
|
disabled: inputDisabled,
|
|
534
520
|
focusable: current && isView,
|
|
535
|
-
buttonStyle:
|
|
536
|
-
|
|
537
|
-
|
|
521
|
+
buttonStyle: {
|
|
522
|
+
...buttonsStyle,
|
|
523
|
+
...customAnswerBoxStyle
|
|
524
|
+
},
|
|
525
|
+
textStyle: {
|
|
526
|
+
...buttonsTextStyle,
|
|
527
|
+
...customAnswerTextStyle
|
|
528
|
+
// ...(answered ? { textAlign: 'left' } : null),
|
|
529
|
+
},
|
|
530
|
+
placeholderTextStyle: {
|
|
531
|
+
...buttonsTextStyle,
|
|
532
|
+
...customAnswerTextStyle,
|
|
533
|
+
...placeholderTextStyle
|
|
534
|
+
// ...(answered ? { textAlign: 'left' } : null),
|
|
535
|
+
},
|
|
538
536
|
value: textInput,
|
|
539
537
|
label: placeholderBody,
|
|
540
538
|
onChange: onTextInputChange,
|
|
@@ -542,7 +540,9 @@ function SurveyScreen(_ref) {
|
|
|
542
540
|
onBlur: onInputBlurred,
|
|
543
541
|
multiline: customAnswerMultiline
|
|
544
542
|
}), !answered ? /*#__PURE__*/jsx(Button, {
|
|
545
|
-
className: classNames([styles.confirm,
|
|
543
|
+
className: classNames([styles.confirm, {
|
|
544
|
+
[styles.disabled]: inputDisabled || textInput === null || textInput === ''
|
|
545
|
+
}]),
|
|
546
546
|
type: "button",
|
|
547
547
|
onClick: onTextInputClear,
|
|
548
548
|
disabled: inputDisabled || textInput === null || textInput === '',
|
|
@@ -550,34 +550,42 @@ function SurveyScreen(_ref) {
|
|
|
550
550
|
className: styles.icon
|
|
551
551
|
})
|
|
552
552
|
}) : null, !answered ? /*#__PURE__*/jsx(Button, {
|
|
553
|
-
className: classNames([styles.submit,
|
|
553
|
+
className: classNames([styles.submit, {
|
|
554
|
+
[styles.disabled]: inputDisabled || textInput === null || textInput === ''
|
|
555
|
+
}]),
|
|
554
556
|
type: "submit",
|
|
555
|
-
buttonStyle: customAnswerSubmit
|
|
557
|
+
buttonStyle: customAnswerSubmit?.buttonStyle,
|
|
556
558
|
disabled: inputDisabled || textInput === null || textInput === '',
|
|
557
|
-
children: /*#__PURE__*/jsx(Text,
|
|
559
|
+
children: /*#__PURE__*/jsx(Text, {
|
|
560
|
+
...customAnswerSubmit,
|
|
558
561
|
inline: true
|
|
559
|
-
})
|
|
562
|
+
})
|
|
560
563
|
}) : null]
|
|
561
564
|
}) : null, userAnswerIndex !== null && finalResult !== null ? /*#__PURE__*/jsx(Transitions, {
|
|
562
565
|
transitions: transitions,
|
|
563
566
|
playing: transitionPlaying,
|
|
564
567
|
disabled: transitionDisabled,
|
|
565
|
-
children: /*#__PURE__*/jsx(Text,
|
|
568
|
+
children: /*#__PURE__*/jsx(Text, {
|
|
569
|
+
...(finalResult || {}),
|
|
566
570
|
className: styles.resultText
|
|
567
|
-
})
|
|
571
|
+
})
|
|
568
572
|
}) : null]
|
|
569
573
|
})]
|
|
570
574
|
}), !isPlaceholder && hasFooter ? /*#__PURE__*/jsx("div", {
|
|
571
575
|
ref: footerRef,
|
|
572
|
-
className: classNames([styles.footer,
|
|
576
|
+
className: classNames([styles.footer, {
|
|
577
|
+
[styles.disabled]: !scrolledBottom
|
|
578
|
+
}]),
|
|
573
579
|
style: {
|
|
574
|
-
transform: !isPreview ?
|
|
580
|
+
transform: !isPreview ? `translate(0, -${viewerBottomHeight}px)` : null,
|
|
575
581
|
paddingLeft: Math.max(spacing / 2, viewerBottomSidesWidth),
|
|
576
582
|
paddingRight: Math.max(spacing / 2, viewerBottomSidesWidth),
|
|
577
583
|
paddingTop: spacing / 2,
|
|
578
584
|
paddingBottom: spacing / 2
|
|
579
585
|
},
|
|
580
|
-
children: /*#__PURE__*/jsx(Footer,
|
|
586
|
+
children: /*#__PURE__*/jsx(Footer, {
|
|
587
|
+
...footerProps
|
|
588
|
+
})
|
|
581
589
|
}) : null]
|
|
582
590
|
}), !isPlaceholder ? /*#__PURE__*/jsx(Background, {
|
|
583
591
|
background: background,
|
|
@@ -600,19 +608,13 @@ var definition = {
|
|
|
600
608
|
group: {
|
|
601
609
|
label: defineMessage({
|
|
602
610
|
id: "ZiWlL6",
|
|
603
|
-
defaultMessage:
|
|
604
|
-
"type": 0,
|
|
605
|
-
"value": "Questions"
|
|
606
|
-
}]
|
|
611
|
+
defaultMessage: "Questions"
|
|
607
612
|
}),
|
|
608
613
|
order: 7
|
|
609
614
|
},
|
|
610
615
|
title: defineMessage({
|
|
611
616
|
id: "650XRF",
|
|
612
|
-
defaultMessage:
|
|
613
|
-
"type": 0,
|
|
614
|
-
"value": "Survey"
|
|
615
|
-
}]
|
|
617
|
+
defaultMessage: "Survey"
|
|
616
618
|
}),
|
|
617
619
|
component: SurveyScreen,
|
|
618
620
|
layouts: ['top', 'middle', 'bottom', 'split'],
|
|
@@ -622,10 +624,7 @@ var definition = {
|
|
|
622
624
|
defaultValue: 'top',
|
|
623
625
|
label: defineMessage({
|
|
624
626
|
id: "4iBXj2",
|
|
625
|
-
defaultMessage:
|
|
626
|
-
"type": 0,
|
|
627
|
-
"value": "Layout"
|
|
628
|
-
}]
|
|
627
|
+
defaultMessage: "Layout"
|
|
629
628
|
})
|
|
630
629
|
}, {
|
|
631
630
|
name: 'question',
|
|
@@ -635,10 +634,7 @@ var definition = {
|
|
|
635
634
|
},
|
|
636
635
|
label: defineMessage({
|
|
637
636
|
id: "hVE7TA",
|
|
638
|
-
defaultMessage:
|
|
639
|
-
"type": 0,
|
|
640
|
-
"value": "Question"
|
|
641
|
-
}]
|
|
637
|
+
defaultMessage: "Question"
|
|
642
638
|
})
|
|
643
639
|
}, {
|
|
644
640
|
name: 'answers',
|
|
@@ -650,10 +646,7 @@ var definition = {
|
|
|
650
646
|
},
|
|
651
647
|
label: defineMessage({
|
|
652
648
|
id: "KHWeV7",
|
|
653
|
-
defaultMessage:
|
|
654
|
-
"type": 0,
|
|
655
|
-
"value": "Answers"
|
|
656
|
-
}]
|
|
649
|
+
defaultMessage: "Answers"
|
|
657
650
|
})
|
|
658
651
|
}, {
|
|
659
652
|
name: 'result',
|
|
@@ -663,10 +656,7 @@ var definition = {
|
|
|
663
656
|
},
|
|
664
657
|
label: defineMessage({
|
|
665
658
|
id: "iQ5Uf7",
|
|
666
|
-
defaultMessage:
|
|
667
|
-
"type": 0,
|
|
668
|
-
"value": "Default feedback"
|
|
669
|
-
}]
|
|
659
|
+
defaultMessage: "Default feedback"
|
|
670
660
|
})
|
|
671
661
|
}, {
|
|
672
662
|
name: 'customAnswer',
|
|
@@ -681,10 +671,7 @@ var definition = {
|
|
|
681
671
|
isList: true,
|
|
682
672
|
label: defineMessage({
|
|
683
673
|
id: "R9DB4a",
|
|
684
|
-
defaultMessage:
|
|
685
|
-
"type": 0,
|
|
686
|
-
"value": "Styles"
|
|
687
|
-
}]
|
|
674
|
+
defaultMessage: "Styles"
|
|
688
675
|
}),
|
|
689
676
|
fields: [{
|
|
690
677
|
name: 'showCount',
|
|
@@ -692,10 +679,7 @@ var definition = {
|
|
|
692
679
|
defaultValue: false,
|
|
693
680
|
label: defineMessage({
|
|
694
681
|
id: "ppGXAR",
|
|
695
|
-
defaultMessage:
|
|
696
|
-
"type": 0,
|
|
697
|
-
"value": "Show the answer count"
|
|
698
|
-
}]
|
|
682
|
+
defaultMessage: "Show the answer count"
|
|
699
683
|
})
|
|
700
684
|
}, {
|
|
701
685
|
name: 'withoutPercentage',
|
|
@@ -703,10 +687,7 @@ var definition = {
|
|
|
703
687
|
defaultValue: false,
|
|
704
688
|
label: defineMessage({
|
|
705
689
|
id: "crLqJd",
|
|
706
|
-
defaultMessage:
|
|
707
|
-
"type": 0,
|
|
708
|
-
"value": "Without percentage"
|
|
709
|
-
}]
|
|
690
|
+
defaultMessage: "Without percentage"
|
|
710
691
|
})
|
|
711
692
|
}, {
|
|
712
693
|
name: 'withoutBar',
|
|
@@ -714,47 +695,32 @@ var definition = {
|
|
|
714
695
|
defaultValue: false,
|
|
715
696
|
label: defineMessage({
|
|
716
697
|
id: "D7kxD3",
|
|
717
|
-
defaultMessage:
|
|
718
|
-
"type": 0,
|
|
719
|
-
"value": "Without bar"
|
|
720
|
-
}]
|
|
698
|
+
defaultMessage: "Without bar"
|
|
721
699
|
})
|
|
722
700
|
}, {
|
|
723
701
|
name: 'buttonsStyle',
|
|
724
702
|
type: 'box-style-form',
|
|
725
703
|
label: defineMessage({
|
|
726
704
|
id: "l5uLMd",
|
|
727
|
-
defaultMessage:
|
|
728
|
-
"type": 0,
|
|
729
|
-
"value": "Buttons"
|
|
730
|
-
}]
|
|
705
|
+
defaultMessage: "Buttons"
|
|
731
706
|
})
|
|
732
707
|
}, {
|
|
733
708
|
name: 'buttonsTextStyle',
|
|
734
709
|
type: 'text-style-form',
|
|
735
710
|
label: defineMessage({
|
|
736
711
|
id: "gwPu/I",
|
|
737
|
-
defaultMessage:
|
|
738
|
-
"type": 0,
|
|
739
|
-
"value": "Buttons text"
|
|
740
|
-
}]
|
|
712
|
+
defaultMessage: "Buttons text"
|
|
741
713
|
})
|
|
742
714
|
}, {
|
|
743
715
|
name: 'resultsStyle',
|
|
744
716
|
type: 'graph-bar-style-form',
|
|
745
717
|
label: defineMessage({
|
|
746
718
|
id: "e4UTx9",
|
|
747
|
-
defaultMessage:
|
|
748
|
-
"type": 0,
|
|
749
|
-
"value": "Results"
|
|
750
|
-
}]
|
|
719
|
+
defaultMessage: "Results"
|
|
751
720
|
}),
|
|
752
721
|
noValueLabel: defineMessage({
|
|
753
722
|
id: "65rc70",
|
|
754
|
-
defaultMessage:
|
|
755
|
-
"type": 0,
|
|
756
|
-
"value": "Edit style..."
|
|
757
|
-
}]
|
|
723
|
+
defaultMessage: "Edit style..."
|
|
758
724
|
})
|
|
759
725
|
}]
|
|
760
726
|
}, {
|
|
@@ -762,20 +728,14 @@ var definition = {
|
|
|
762
728
|
type: 'background',
|
|
763
729
|
label: defineMessage({
|
|
764
730
|
id: "+MPZRu",
|
|
765
|
-
defaultMessage:
|
|
766
|
-
"type": 0,
|
|
767
|
-
"value": "Background"
|
|
768
|
-
}]
|
|
731
|
+
defaultMessage: "Background"
|
|
769
732
|
})
|
|
770
733
|
}, {
|
|
771
734
|
name: 'header',
|
|
772
735
|
type: 'header',
|
|
773
736
|
label: defineMessage({
|
|
774
737
|
id: "rhuDxI",
|
|
775
|
-
defaultMessage:
|
|
776
|
-
"type": 0,
|
|
777
|
-
"value": "Header"
|
|
778
|
-
}]
|
|
738
|
+
defaultMessage: "Header"
|
|
779
739
|
}),
|
|
780
740
|
theme: {
|
|
781
741
|
badge: {
|
|
@@ -790,10 +750,7 @@ var definition = {
|
|
|
790
750
|
type: 'footer',
|
|
791
751
|
label: defineMessage({
|
|
792
752
|
id: "g4nybp",
|
|
793
|
-
defaultMessage:
|
|
794
|
-
"type": 0,
|
|
795
|
-
"value": "Footer"
|
|
796
|
-
}]
|
|
753
|
+
defaultMessage: "Footer"
|
|
797
754
|
}),
|
|
798
755
|
theme: {
|
|
799
756
|
callToAction: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-survey",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.76",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"exports": {
|
|
37
37
|
".": {
|
|
38
38
|
"types": "./es/index.d.ts",
|
|
39
|
+
"style": "./assets/css/styles.css",
|
|
39
40
|
"import": "./es/index.js"
|
|
40
41
|
},
|
|
41
42
|
"./assets/css/styles": "./assets/css/styles.css",
|
|
@@ -52,31 +53,31 @@
|
|
|
52
53
|
"build": "../../scripts/prepare-package.sh --types"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
55
|
-
"react": "^
|
|
56
|
-
"react-dom": "^
|
|
56
|
+
"react": "^19.0.0",
|
|
57
|
+
"react-dom": "^19.0.0"
|
|
57
58
|
},
|
|
58
59
|
"peerDependencies": {
|
|
59
|
-
"react": "^
|
|
60
|
-
"react-dom": "^
|
|
60
|
+
"react": "^19.0.0",
|
|
61
|
+
"react-dom": "^19.0.0"
|
|
61
62
|
},
|
|
62
63
|
"dependencies": {
|
|
63
64
|
"@babel/runtime": "^7.28.6",
|
|
64
65
|
"@fortawesome/fontawesome-svg-core": "^7.2.0",
|
|
65
66
|
"@fortawesome/free-solid-svg-icons": "^7.2.0",
|
|
66
67
|
"@fortawesome/react-fontawesome": "^3.2.0",
|
|
67
|
-
"@micromag/core": "^0.4.
|
|
68
|
-
"@micromag/data": "^0.4.
|
|
69
|
-
"@micromag/element-background": "^0.4.
|
|
70
|
-
"@micromag/element-button": "^0.4.
|
|
71
|
-
"@micromag/element-container": "^0.4.
|
|
72
|
-
"@micromag/element-footer": "^0.4.
|
|
73
|
-
"@micromag/element-header": "^0.4.
|
|
74
|
-
"@micromag/element-heading": "^0.4.
|
|
75
|
-
"@micromag/element-layout": "^0.4.
|
|
76
|
-
"@micromag/element-scroll": "^0.4.
|
|
77
|
-
"@micromag/element-text": "^0.4.
|
|
78
|
-
"@micromag/element-text-input": "^0.4.
|
|
79
|
-
"@micromag/transforms": "^0.4.
|
|
68
|
+
"@micromag/core": "^0.4.74",
|
|
69
|
+
"@micromag/data": "^0.4.74",
|
|
70
|
+
"@micromag/element-background": "^0.4.76",
|
|
71
|
+
"@micromag/element-button": "^0.4.76",
|
|
72
|
+
"@micromag/element-container": "^0.4.74",
|
|
73
|
+
"@micromag/element-footer": "^0.4.76",
|
|
74
|
+
"@micromag/element-header": "^0.4.74",
|
|
75
|
+
"@micromag/element-heading": "^0.4.74",
|
|
76
|
+
"@micromag/element-layout": "^0.4.74",
|
|
77
|
+
"@micromag/element-scroll": "^0.4.74",
|
|
78
|
+
"@micromag/element-text": "^0.4.74",
|
|
79
|
+
"@micromag/element-text-input": "^0.4.74",
|
|
80
|
+
"@micromag/transforms": "^0.4.74",
|
|
80
81
|
"classnames": "^2.2.6",
|
|
81
82
|
"dompurify": "^3.2.6",
|
|
82
83
|
"lodash": "^4.17.23",
|
|
@@ -87,6 +88,6 @@
|
|
|
87
88
|
"access": "public",
|
|
88
89
|
"registry": "https://registry.npmjs.org/"
|
|
89
90
|
},
|
|
90
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "42a24f578994b23090271013f136b7f78956b632",
|
|
91
92
|
"types": "es/index.d.ts"
|
|
92
93
|
}
|