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