@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.
Files changed (3) hide show
  1. package/es/index.d.ts +2 -2
  2. package/es/index.js +370 -413
  3. 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<HTMLMediaElement> | null;
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(_ref) {
32
- var _ref$id = _ref.id,
33
- id = _ref$id === void 0 ? null : _ref$id,
34
- _ref$layout = _ref.layout,
35
- layout = _ref$layout === void 0 ? 'middle' : _ref$layout,
36
- _ref$question = _ref.question,
37
- question = _ref$question === void 0 ? null : _ref$question,
38
- _ref$answers = _ref.answers,
39
- answers = _ref$answers === void 0 ? null : _ref$answers,
40
- _ref$result = _ref.result,
41
- result = _ref$result === void 0 ? null : _ref$result,
42
- _ref$buttonsStyle = _ref.buttonsStyle,
43
- buttonsStyle = _ref$buttonsStyle === void 0 ? null : _ref$buttonsStyle,
44
- _ref$buttonsTextStyle = _ref.buttonsTextStyle,
45
- buttonsTextStyle = _ref$buttonsTextStyle === void 0 ? null : _ref$buttonsTextStyle,
46
- _ref$resultsStyle = _ref.resultsStyle,
47
- resultsStyle = _ref$resultsStyle === void 0 ? null : _ref$resultsStyle,
48
- _ref$spacing = _ref.spacing,
49
- spacing = _ref$spacing === void 0 ? 20 : _ref$spacing,
50
- _ref$header = _ref.header,
51
- header = _ref$header === void 0 ? null : _ref$header,
52
- _ref$footer = _ref.footer,
53
- footer = _ref$footer === void 0 ? null : _ref$footer,
54
- _ref$background = _ref.background,
55
- background = _ref$background === void 0 ? null : _ref$background,
56
- _ref$customAnswer = _ref.customAnswer,
57
- customAnswer = _ref$customAnswer === void 0 ? false : _ref$customAnswer,
58
- _ref$showCount = _ref.showCount,
59
- showCount = _ref$showCount === void 0 ? false : _ref$showCount,
60
- _ref$withoutPercentag = _ref.withoutPercentage,
61
- withoutPercentage = _ref$withoutPercentag === void 0 ? false : _ref$withoutPercentag,
62
- _ref$withoutBar = _ref.withoutBar,
63
- withoutBar = _ref$withoutBar === void 0 ? false : _ref$withoutBar,
64
- _ref$current = _ref.current,
65
- current = _ref$current === void 0 ? true : _ref$current,
66
- _ref$preload = _ref.preload,
67
- preload = _ref$preload === void 0 ? true : _ref$preload,
68
- _ref$transitions = _ref.transitions,
69
- transitions = _ref$transitions === void 0 ? null : _ref$transitions,
70
- _ref$resultTransition = _ref.resultTransitionDuration,
71
- resultTransitionDuration = _ref$resultTransition === void 0 ? 500 : _ref$resultTransition,
72
- _ref$type = _ref.type,
73
- type = _ref$type === void 0 ? null : _ref$type,
74
- _ref$mediaRef = _ref.mediaRef,
75
- customMediaRef = _ref$mediaRef === void 0 ? null : _ref$mediaRef,
76
- _ref$className = _ref.className,
77
- className = _ref$className === void 0 ? null : _ref$className;
78
- var screenId = id || 'screen-id';
79
- var trackScreenEvent = useTrackScreenEvent(type);
80
- var _useScreenSize = useScreenSize(),
81
- width = _useScreenSize.width,
82
- height = _useScreenSize.height,
83
- resolution = _useScreenSize.resolution;
84
- var _useQuizCreate = useQuizCreate({
85
- screenId: screenId
86
- }),
87
- submitQuiz = _useQuizCreate.create;
88
- var _useScreenRenderConte = useScreenRenderContext(),
89
- isView = _useScreenRenderConte.isView,
90
- isPreview = _useScreenRenderConte.isPreview,
91
- isPlaceholder = _useScreenRenderConte.isPlaceholder,
92
- isEdit = _useScreenRenderConte.isEdit,
93
- isStatic = _useScreenRenderConte.isStatic,
94
- isCapture = _useScreenRenderConte.isCapture;
95
- var _useViewerContext = useViewerContext(),
96
- viewerTopHeight = _useViewerContext.topHeight,
97
- viewerBottomHeight = _useViewerContext.bottomHeight,
98
- viewerBottomSidesWidth = _useViewerContext.bottomSidesWidth;
99
- var _useViewerWebView = useViewerWebView(),
100
- openWebView = _useViewerWebView.open;
101
- var _usePlaybackContext = usePlaybackContext(),
102
- muted = _usePlaybackContext.muted;
103
- var _usePlaybackMediaRef = usePlaybackMediaRef(current, true),
104
- mediaRef = _usePlaybackMediaRef.ref,
105
- _usePlaybackMediaRef$ = _usePlaybackMediaRef.isCurrent,
106
- isCurrentMedia = _usePlaybackMediaRef$ === void 0 ? false : _usePlaybackMediaRef$;
107
- var _useQuiz = useQuiz({
108
- screenId: screenId,
109
- opts: {
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(function (body) {
128
- return body !== null;
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
- var hasQuestion = isTextFilled(question);
139
- var hasDefaultResult = isTextFilled(result);
140
- var _ref5 = customAnswer || {},
141
- _ref5$active = _ref5.active,
142
- allowCustomAnswer = _ref5$active === void 0 ? false : _ref5$active,
143
- _ref5$placeholder = _ref5.placeholder,
144
- placeholder = _ref5$placeholder === void 0 ? null : _ref5$placeholder,
145
- _ref5$textStyle = _ref5.textStyle,
146
- customAnswerTextStyle = _ref5$textStyle === void 0 ? null : _ref5$textStyle,
147
- _ref5$boxStyle = _ref5.boxStyle,
148
- customAnswerBoxStyle = _ref5$boxStyle === void 0 ? null : _ref5$boxStyle,
149
- _ref5$submit = _ref5.submit,
150
- customAnswerSubmit = _ref5$submit === void 0 ? null : _ref5$submit,
151
- _ref5$multiline = _ref5.multiline,
152
- customAnswerMultiline = _ref5$multiline === void 0 ? false : _ref5$multiline;
153
- var _ref6 = placeholder || {},
154
- _ref6$body = _ref6.body,
155
- placeholderBody = _ref6$body === void 0 ? null : _ref6$body,
156
- _ref6$textStyle = _ref6.textStyle,
157
- placeholderTextStyle = _ref6$textStyle === void 0 ? null : _ref6$textStyle;
158
- var showInstantAnswer = isStatic || isCapture;
159
- var _useState = useState(showInstantAnswer ? -1 : null),
160
- _useState2 = _slicedToArray(_useState, 2),
161
- userAnswerIndex = _useState2[0],
162
- setUserAnswerIndex = _useState2[1];
163
- var answered = userAnswerIndex !== null;
164
- var quizAnswersComputed = useMemo(function () {
165
- var total = answers !== null ? (quizAnswers || []).reduce(function (points, _ref7) {
166
- var _ref7$count = _ref7.count,
167
- count = _ref7$count === void 0 ? 0 : _ref7$count;
168
- return points + parseInt(count, 10);
169
- }, userAnswerIndex !== null && userAnswerIndex > -1 ? 1 : 0) : 0;
170
- var computed = answers !== null ? (answers || []).reduce(function (answersTotal, ans, i) {
171
- var _ref8 = ans || {},
172
- _ref8$label = _ref8.label,
173
- label = _ref8$label === void 0 ? {} : _ref8$label;
174
- var _ref9 = label || {},
175
- _ref9$body = _ref9.body,
176
- body = _ref9$body === void 0 ? null : _ref9$body;
177
- var _ref0 = quizAnswers.find(function (qa) {
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
- var quizAnswersPct = total > 0 ? Object.keys(computed).map(function (key) {
192
- return computed[key].percent || 0;
193
- }) : [];
194
- var evenlySplit = getLargestRemainderRound(quizAnswersPct, 100);
195
- return Object.keys(computed).reduce(function (acc, key, i) {
196
- return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, key, _objectSpread(_objectSpread({}, computed[key]), {}, {
197
- percent: evenlySplit[i]
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
- var isSplitted = layout === 'split';
202
- var isMiddleLayout = layout === 'middle';
203
- var verticalAlign = isSplitted ? null : layout;
204
- var transitionPlaying = current;
205
- var transitionDisabled = isStatic || isCapture || isPlaceholder || isPreview || isEdit;
206
- var backgroundPlaying = current && (isView || isEdit) && (isCurrentMedia || !isView);
207
- var mediaShouldLoad = current || preload;
208
- var onAnswerClick = useCallback(function (answerIndex) {
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
- var answer = answers !== null ? answers[answerIndex] : null;
177
+ const answer_0 = answers !== null ? answers[answerIndex] : null;
212
178
  submitQuiz({
213
- choice: answer.label.body || answerIndex,
179
+ choice: answer_0.label.body || answerIndex,
214
180
  value: 1
215
181
  });
216
- trackScreenEvent('click_answer', "Answer ".concat(userAnswerIndex + 1, ": ").concat(answer.label.body), {
182
+ trackScreenEvent('click_answer', `Answer ${userAnswerIndex + 1}: ${answer_0.label.body}`, {
217
183
  linkType: 'survey_answer',
218
- answer: answer,
219
- answerIndex: answerIndex,
184
+ answer: answer_0,
185
+ answerIndex,
220
186
  answerType: 'button'
221
187
  });
222
188
  }
223
189
  }, [userAnswerIndex, setUserAnswerIndex, trackScreenEvent, submitQuiz]);
224
- useEffect(function () {
190
+ useEffect(() => {
225
191
  if (!current && isEdit && userAnswerIndex !== null) {
226
192
  setUserAnswerIndex(null);
227
193
  }
228
194
  }, [isEdit, current, userAnswerIndex, setUserAnswerIndex]);
229
- var onQuizReset = useCallback(function () {
195
+ const onQuizReset = useCallback(() => {
230
196
  setUserAnswerIndex(null);
231
197
  }, [setUserAnswerIndex]);
232
- var _useState3 = useState(null),
233
- _useState4 = _slicedToArray(_useState3, 2),
234
- textInput = _useState4[0],
235
- setTextInput = _useState4[1];
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
- var onInputBlurred = useCallback(function (e) {
247
- e.preventDefault();
248
- e.stopPropagation();
206
+ const onInputBlurred = useCallback(e_0 => {
207
+ e_0.preventDefault();
208
+ e_0.stopPropagation();
249
209
  setInputFocused(false);
250
210
  }, [setInputFocused]);
251
- var onTextInputChange = useCallback(function (e) {
252
- var value = DOMPurify.sanitize(e.currentTarget.value || '');
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
- var onTextInputClear = useCallback(function () {
215
+ const onTextInputClear = useCallback(() => {
256
216
  setTextInput('');
257
217
  }, [setTextInput]);
258
- var onSubmitSuggestion = useCallback(function (e) {
259
- e.preventDefault();
260
- e.stopPropagation();
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', "Answer input: ".concat(textInput), {
269
- textInput: 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
- var hasHeader = isHeaderFilled(header);
276
- var hasFooter = isFooterFilled(footer);
277
- var footerProps = getFooterProps(footer, {
278
- isView: isView,
279
- current: current,
280
- openWebView: openWebView,
281
- isPreview: 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
- var _useDimensionObserver = useDimensionObserver(),
284
- headerRef = _useDimensionObserver.ref,
285
- _useDimensionObserver2 = _useDimensionObserver.height,
286
- headerHeight = _useDimensionObserver2 === void 0 ? 0 : _useDimensionObserver2;
287
- var _useDimensionObserver3 = useDimensionObserver(),
288
- footerRef = _useDimensionObserver3.ref,
289
- _useDimensionObserver4 = _useDimensionObserver3.height,
290
- footerHeight = _useDimensionObserver4 === void 0 ? 0 : _useDimensionObserver4;
291
- var scrollingDisabled = !isEdit && transitionDisabled || !current;
292
- var _useState7 = useState(false),
293
- _useState8 = _slicedToArray(_useState7, 2),
294
- scrolledBottom = _useState8[0],
295
- setScrolledBottom = _useState8[1];
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
- var onScrolledNotBottom = useCallback(function () {
261
+ const onScrolledNotBottom = useCallback(() => {
304
262
  setScrolledBottom(false);
305
263
  }, [setScrolledBottom]);
306
- var onScrolledTrigger = useCallback(function () {
307
- var trigger = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
264
+ const onScrolledTrigger = useCallback((trigger = null) => {
308
265
  if (trigger !== null) {
309
- var scrollPercent = Math.round(trigger * 100);
266
+ const scrollPercent = Math.round(trigger * 100);
310
267
  trackScreenEvent('scroll', scrollPercent, {
311
- scrollPercent: scrollPercent
268
+ scrollPercent
312
269
  });
313
270
  }
314
271
  }, [trackScreenEvent]);
315
- var _useState9 = useState(false),
316
- _useState0 = _slicedToArray(_useState9, 2),
317
- hasScroll = _useState0[0],
318
- setHasScroll = _useState0[1];
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
- var items = [/*#__PURE__*/jsx(ScreenElement, {
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, _objectSpread(_objectSpread({}, question), {}, {
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
- var finalTransitionDuration = useMemo(function () {
350
- return showInstantAnswer ? 0 : "".concat(resultTransitionDuration, "ms");
351
- }, [showInstantAnswer, resultTransitionDuration]);
352
- var _ref11 = resultsStyle || {},
353
- _ref11$barColor = _ref11.barColor,
354
- resultsBarColor = _ref11$barColor === void 0 ? null : _ref11$barColor,
355
- _ref11$textColor = _ref11.textColor,
356
- resultsTextColor = _ref11$textColor === void 0 ? null : _ref11$textColor,
357
- _ref11$percentageText = _ref11.percentageTextStyle,
358
- resultsPercentageTextStyle = _ref11$percentageText === void 0 ? null : _ref11$percentageText;
359
- var finalResult = useMemo(function () {
360
- var defaultResult = hasDefaultResult ? result : null;
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
- var showReset = isEdit && userAnswerIndex !== null;
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 ? _toConsumableArray(new Array(3)) : answers).map(function (answer, answerIndex) {
373
- var hasAnswer = answer !== null;
374
- var _ref13 = answer || {},
375
- _ref13$label = _ref13.label,
376
- label = _ref13$label === void 0 ? null : _ref13$label,
377
- _ref13$buttonStyle = _ref13.buttonStyle,
378
- answerButtonStyle = _ref13$buttonStyle === void 0 ? null : _ref13$buttonStyle,
379
- _ref13$textStyle = _ref13.textStyle,
380
- answerButtonTextStyle = _ref13$textStyle === void 0 ? null : _ref13$textStyle,
381
- _ref13$resultStyle = _ref13.resultStyle,
382
- answerResultStyle = _ref13$resultStyle === void 0 ? null : _ref13$resultStyle;
383
- var _ref14 = answerResultStyle || {},
384
- _ref14$barColor = _ref14.barColor,
385
- answerResultBarColor = _ref14$barColor === void 0 ? null : _ref14$barColor,
386
- answerResultTextColor = _ref14.textColor,
387
- _ref14$percentageText = _ref14.percentageTextStyle,
388
- answerResultPercentageTextStyle = _ref14$percentageText === void 0 ? null : _ref14$percentageText;
389
- var _ref15 = label || {},
390
- _ref15$body = _ref15.body,
391
- body = _ref15$body === void 0 ? null : _ref15$body;
392
- var _ref16 = body !== null ? quizAnswersComputed[body] || {} : {},
393
- _ref16$percent = _ref16.percent,
394
- percent = _ref16$percent === void 0 ? 0 : _ref16$percent,
395
- _ref16$count = _ref16.count,
396
- count = _ref16$count === void 0 ? 0 : _ref16$count;
397
- var _ref17 = label || {},
398
- _ref17$textStyle = _ref17.textStyle,
399
- textStyle = _ref17$textStyle === void 0 ? null : _ref17$textStyle;
400
- var _ref18 = textStyle || {},
401
- _ref18$color = _ref18.color,
402
- labelColor = _ref18$color === void 0 ? null : _ref18$color;
403
- var hasAnswerLabel = isTextFilled(label);
404
- var userAnswer = userAnswerIndex === answerIndex;
405
- var buttonStyles = _objectSpread(_objectSpread(_objectSpread({}, buttonsStyle), answerButtonStyle), answered ? {
406
- textAlign: 'left'
407
- } : null);
408
- var _ref19 = buttonStyles || {},
409
- _ref19$borderRadius = _ref19.borderRadius,
410
- answerResultBorderRadius = _ref19$borderRadius === void 0 ? null : _ref19$borderRadius;
411
- var finalBarBorderRadius = answerResultBorderRadius !== null && isNumber(answerResultBorderRadius) && answerResultBorderRadius > 2 ? answerResultBorderRadius - 2 : answerResultBorderRadius;
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, _defineProperty({}, styles.userAnswer, userAnswer)]),
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: function onPointerUp(e) {
439
- if (e.pointerType !== 'mouse' || e.button === 0) {
440
- onAnswerClick(answerIndex);
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: _objectSpread(_objectSpread(_objectSpread({}, buttonsTextStyle), textStyle), answerButtonTextStyle),
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, _objectSpread(_objectSpread({}, label), {}, {
450
- textStyle: _objectSpread(_objectSpread(_objectSpread({}, buttonsTextStyle), textStyle), answerButtonTextStyle),
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
- })), !withoutPercentage ? /*#__PURE__*/jsx("div", {
409
+ }), !withoutPercentage ? /*#__PURE__*/jsx("div", {
454
410
  className: styles.resultLabel,
455
- style: _objectSpread(_objectSpread({}, getStyleFromColor(answered ? answerResultTextColor || resultsTextColor || answerResultBarColor || resultsBarColor || labelColor : null, 'color')), answered ? {
456
- opacity: 1
457
- } : {
458
- opacity: 0
459
- }),
460
- children: /*#__PURE__*/jsx(Text, _objectSpread(_objectSpread({}, label), {}, {
461
- textStyle: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, buttonsTextStyle), textStyle), answerButtonTextStyle), resultsTextColor), resultsPercentageTextStyle), answerResultTextColor), answerResultPercentageTextStyle),
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 ? count : "".concat(percent, "%")
465
- }))
432
+ body: showCount ? count_1 : `${percent}%`
433
+ })
466
434
  }) : null, !withoutBar ? /*#__PURE__*/jsx("div", {
467
435
  className: styles.resultBar,
468
- style: _objectSpread(_objectSpread({
436
+ style: {
469
437
  borderRadius: finalBarBorderRadius,
470
438
  transitionDuration: finalTransitionDuration,
471
- width: percent !== null ? "".concat(percent, "%") : '0%'
472
- }, getStyleFromColor(answerResultBarColor || resultsBarColor || labelColor, 'backgroundColor')), answered ? {
473
- opacity: 0.5
474
- } : {
475
- opacity: 0
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
- }, "answer-".concat(answerIndex + 1));
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, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles.answered, answered), styles.inputFocused, inputFocused), styles.withPercentage, !withoutPercentage), styles.withBar, !withoutBar), styles.isPlaceholder, isPlaceholder)]),
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, _defineProperty({}, styles.disabled, scrolledBottom && !scrollingDisabled && hasScroll)]),
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 ? "translate(0, ".concat(viewerTopHeight, "px)") : null
494
+ transform: !isPreview ? `translate(0, ${viewerTopHeight}px)` : null
517
495
  },
518
- children: /*#__PURE__*/jsx(Header, _objectSpread({}, 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, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles.focused, inputFocused), styles.filled, textInput !== null && textInput !== ''), styles.disabled, inputDisabled), styles.selected, userAnswerIndex === 'input'), styles.multiline, customAnswerMultiline)]),
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: _objectSpread(_objectSpread({}, buttonsStyle), customAnswerBoxStyle),
536
- textStyle: _objectSpread(_objectSpread({}, buttonsTextStyle), customAnswerTextStyle),
537
- placeholderTextStyle: _objectSpread(_objectSpread(_objectSpread({}, buttonsTextStyle), customAnswerTextStyle), placeholderTextStyle),
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, _defineProperty({}, styles.disabled, inputDisabled || textInput === null || textInput === '')]),
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, _defineProperty({}, styles.disabled, inputDisabled || textInput === null || textInput === '')]),
553
+ className: classNames([styles.submit, {
554
+ [styles.disabled]: inputDisabled || textInput === null || textInput === ''
555
+ }]),
554
556
  type: "submit",
555
- buttonStyle: customAnswerSubmit === null || customAnswerSubmit === void 0 ? void 0 : customAnswerSubmit.buttonStyle,
557
+ buttonStyle: customAnswerSubmit?.buttonStyle,
556
558
  disabled: inputDisabled || textInput === null || textInput === '',
557
- children: /*#__PURE__*/jsx(Text, _objectSpread(_objectSpread({}, customAnswerSubmit), {}, {
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, _objectSpread(_objectSpread({}, finalResult || {}), {}, {
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, _defineProperty({}, styles.disabled, !scrolledBottom)]),
576
+ className: classNames([styles.footer, {
577
+ [styles.disabled]: !scrolledBottom
578
+ }]),
573
579
  style: {
574
- transform: !isPreview ? "translate(0, -".concat(viewerBottomHeight, "px)") : null,
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, _objectSpread({}, footerProps))
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.71",
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": "^18.3.0 || ^19.0.0",
56
- "react-dom": "^18.3.0 || ^19.0.0"
56
+ "react": "^19.0.0",
57
+ "react-dom": "^19.0.0"
57
58
  },
58
59
  "peerDependencies": {
59
- "react": "^18.3.0 || ^19.0.0",
60
- "react-dom": "^18.3.0 || ^19.0.0"
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.71",
68
- "@micromag/data": "^0.4.71",
69
- "@micromag/element-background": "^0.4.71",
70
- "@micromag/element-button": "^0.4.71",
71
- "@micromag/element-container": "^0.4.71",
72
- "@micromag/element-footer": "^0.4.71",
73
- "@micromag/element-header": "^0.4.71",
74
- "@micromag/element-heading": "^0.4.71",
75
- "@micromag/element-layout": "^0.4.71",
76
- "@micromag/element-scroll": "^0.4.71",
77
- "@micromag/element-text": "^0.4.71",
78
- "@micromag/element-text-input": "^0.4.71",
79
- "@micromag/transforms": "^0.4.71",
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": "9101554bc5761e32b4a002a10d26800608c69773",
91
+ "gitHead": "42a24f578994b23090271013f136b7f78956b632",
91
92
  "types": "es/index.d.ts"
92
93
  }