@micromag/screen-contribution 0.4.71 → 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 +2 -2
- package/es/index.js +212 -312
- package/package.json +21 -20
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 { HeadingElement, InputElement, TextElement, TextStyle, ButtonElement, BackgroundElement, Header, Footer, Transitions } from '@micromag/core';
|
|
3
|
+
import { HeadingElement, InputElement, TextElement, TextStyle, ButtonElement, BackgroundElement, Header, Footer, Transitions, MediaElement } from '@micromag/core';
|
|
4
4
|
|
|
5
5
|
interface ContributionScreenProps {
|
|
6
6
|
id?: string | null;
|
|
@@ -26,7 +26,7 @@ interface ContributionScreenProps {
|
|
|
26
26
|
transitionStagger?: number;
|
|
27
27
|
resizeTransitionDuration?: number;
|
|
28
28
|
type?: string | null;
|
|
29
|
-
mediaRef?: ForwardedRef<
|
|
29
|
+
mediaRef?: ForwardedRef<MediaElement> | null;
|
|
30
30
|
className?: string | null;
|
|
31
31
|
}
|
|
32
32
|
declare function ContributionScreen({ id, layout, title, name, message, submit, nameStyle, messageStyle, settings, spacing, background, header, footer, current, preload, transitions, transitionStagger, resizeTransitionDuration, type, mediaRef: customMediaRef, className, }: ContributionScreenProps): react_jsx_runtime.JSX.Element;
|
package/es/index.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { useIntl, FormattedMessage, defineMessage } from 'react-intl';
|
|
2
|
-
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
|
-
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
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 { faSpinner } from '@fortawesome/free-solid-svg-icons/faSpinner';
|
|
8
4
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
@@ -28,221 +24,183 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
28
24
|
|
|
29
25
|
var styles = {"container":"micromag-screen-contribution-container","background":"micromag-screen-contribution-background","content":"micromag-screen-contribution-content","inner":"micromag-screen-contribution-inner","layout":"micromag-screen-contribution-layout","header":"micromag-screen-contribution-header","emptyTitle":"micromag-screen-contribution-emptyTitle","emptyInputName":"micromag-screen-contribution-emptyInputName","emptyInputMessage":"micromag-screen-contribution-emptyInputMessage","emptySubmit":"micromag-screen-contribution-emptySubmit","emptySkip":"micromag-screen-contribution-emptySkip","title":"micromag-screen-contribution-title","interactiveContainer":"micromag-screen-contribution-interactiveContainer","form":"micromag-screen-contribution-form","inputName":"micromag-screen-contribution-inputName","inputMessage":"micromag-screen-contribution-inputMessage","buttonSubmit":"micromag-screen-contribution-buttonSubmit","buttonSkip":"micromag-screen-contribution-buttonSkip","showBack":"micromag-screen-contribution-showBack","formContent":"micromag-screen-contribution-formContent","formLoading":"micromag-screen-contribution-formLoading","loadingIcon":"micromag-screen-contribution-loadingIcon","contributionsContainer":"micromag-screen-contribution-contributionsContainer","contributionsContent":"micromag-screen-contribution-contributionsContent","contributions":"micromag-screen-contribution-contributions","contribution":"micromag-screen-contribution-contribution","footer":"micromag-screen-contribution-footer","disabled":"micromag-screen-contribution-disabled","submitting":"micromag-screen-contribution-submitting","submitted":"micromag-screen-contribution-submitted","showContributions":"micromag-screen-contribution-showContributions","isPlaceholder":"micromag-screen-contribution-isPlaceholder","reset":"micromag-screen-contribution-reset"};
|
|
30
26
|
|
|
31
|
-
function ContributionScreen(
|
|
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
|
-
mediaRef = _usePlaybackMediaRef.ref,
|
|
98
|
-
_usePlaybackMediaRef$ = _usePlaybackMediaRef.isCurrent,
|
|
99
|
-
isCurrentMedia = _usePlaybackMediaRef$ === void 0 ? false : _usePlaybackMediaRef$;
|
|
100
|
-
var backgroundPlaying = current && (isView || isEdit) && (isCurrentMedia || !isView);
|
|
101
|
-
var mediaShouldLoad = current || preload;
|
|
102
|
-
var transitionPlaying = current;
|
|
103
|
-
var transitionDisabled = isStatic || isCapture || isPlaceholder || isPreview || isEdit;
|
|
104
|
-
var scrollingDisabled = !isEdit && transitionDisabled || !current;
|
|
105
|
-
var hasHeader = isHeaderFilled(header);
|
|
106
|
-
var hasFooter = isFooterFilled(footer);
|
|
107
|
-
var footerProps = getFooterProps(footer, {
|
|
108
|
-
isView: isView,
|
|
109
|
-
current: current,
|
|
110
|
-
openWebView: openWebView,
|
|
111
|
-
isPreview: isPreview
|
|
27
|
+
function ContributionScreen({
|
|
28
|
+
id = null,
|
|
29
|
+
layout = 'middle',
|
|
30
|
+
title = null,
|
|
31
|
+
name = null,
|
|
32
|
+
message = null,
|
|
33
|
+
submit = null,
|
|
34
|
+
nameStyle = null,
|
|
35
|
+
messageStyle = null,
|
|
36
|
+
settings = null,
|
|
37
|
+
spacing = 20,
|
|
38
|
+
background = null,
|
|
39
|
+
header = null,
|
|
40
|
+
footer = null,
|
|
41
|
+
current = true,
|
|
42
|
+
preload = true,
|
|
43
|
+
transitions = null,
|
|
44
|
+
transitionStagger = 100,
|
|
45
|
+
resizeTransitionDuration = 750,
|
|
46
|
+
type = null,
|
|
47
|
+
mediaRef: customMediaRef = null,
|
|
48
|
+
className = null
|
|
49
|
+
}) {
|
|
50
|
+
const intl = useIntl();
|
|
51
|
+
const screenId = id || 'screen-id';
|
|
52
|
+
const trackScreenEvent = useTrackScreenEvent(type);
|
|
53
|
+
const {
|
|
54
|
+
width,
|
|
55
|
+
height,
|
|
56
|
+
resolution
|
|
57
|
+
} = useScreenSize();
|
|
58
|
+
const {
|
|
59
|
+
topHeight: viewerTopHeight,
|
|
60
|
+
bottomHeight: viewerBottomHeight,
|
|
61
|
+
bottomSidesWidth: viewerBottomSidesWidth
|
|
62
|
+
} = useViewerContext();
|
|
63
|
+
const {
|
|
64
|
+
isView,
|
|
65
|
+
isPreview,
|
|
66
|
+
isPlaceholder,
|
|
67
|
+
isEdit,
|
|
68
|
+
isStatic,
|
|
69
|
+
isCapture
|
|
70
|
+
} = useScreenRenderContext();
|
|
71
|
+
const {
|
|
72
|
+
open: openWebView
|
|
73
|
+
} = useViewerWebView();
|
|
74
|
+
const {
|
|
75
|
+
muted
|
|
76
|
+
} = usePlaybackContext();
|
|
77
|
+
const {
|
|
78
|
+
ref: mediaRef,
|
|
79
|
+
isCurrent: isCurrentMedia = false
|
|
80
|
+
} = usePlaybackMediaRef(current, true);
|
|
81
|
+
const backgroundPlaying = current && (isView || isEdit) && (isCurrentMedia || !isView);
|
|
82
|
+
const mediaShouldLoad = current || preload;
|
|
83
|
+
const transitionPlaying = current;
|
|
84
|
+
const transitionDisabled = isStatic || isCapture || isPlaceholder || isPreview || isEdit;
|
|
85
|
+
const scrollingDisabled = !isEdit && transitionDisabled || !current;
|
|
86
|
+
const hasHeader = isHeaderFilled(header);
|
|
87
|
+
const hasFooter = isFooterFilled(footer);
|
|
88
|
+
const footerProps = getFooterProps(footer, {
|
|
89
|
+
isView,
|
|
90
|
+
current,
|
|
91
|
+
openWebView,
|
|
92
|
+
isPreview
|
|
112
93
|
});
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
setInteractiveContainerHeight = _useState2[1];
|
|
123
|
-
var _useState3 = useState(''),
|
|
124
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
125
|
-
userName = _useState4[0],
|
|
126
|
-
setUserName = _useState4[1];
|
|
127
|
-
var _useState5 = useState(''),
|
|
128
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
129
|
-
userMessage = _useState6[0],
|
|
130
|
-
setUserMessage = _useState6[1];
|
|
94
|
+
const hasTitle = isTextFilled(title);
|
|
95
|
+
const hasNameLabel = isLabelFilled(name);
|
|
96
|
+
const hasMessageLabel = isLabelFilled(message);
|
|
97
|
+
const hasSubmit = isTextFilled(submit);
|
|
98
|
+
const contributionsRef = useRef(null);
|
|
99
|
+
const formRef = useRef(null);
|
|
100
|
+
const [interactiveContainerHeight, setInteractiveContainerHeight] = useState(null);
|
|
101
|
+
const [userName, setUserName] = useState('');
|
|
102
|
+
const [userMessage, setUserMessage] = useState('');
|
|
131
103
|
|
|
132
104
|
// 0 = default, 1 = submitting, 2 = submitted, 3 = resizing, 4 = done
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
canViewAnswers = _ref2$canViewAnswers === void 0 ? false : _ref2$canViewAnswers,
|
|
144
|
-
_ref2$skipButton = _ref2.skipButton,
|
|
145
|
-
skipButton = _ref2$skipButton === void 0 ? null : _ref2$skipButton,
|
|
146
|
-
_ref2$backButton = _ref2.backButton,
|
|
147
|
-
backButton = _ref2$backButton === void 0 ? null : _ref2$backButton;
|
|
148
|
-
var answersButton = submitState === 4 ? backButton : skipButton;
|
|
149
|
-
var finalAnswersButton = isTextFilled(answersButton) ? answersButton : _objectSpread(_objectSpread({}, answersButton), {}, {
|
|
105
|
+
const [submitState, setSubmitState] = useState(isStatic || isCapture ? 4 : 0);
|
|
106
|
+
const [hasSubmitted, setHasSubmitted] = useState(false);
|
|
107
|
+
const {
|
|
108
|
+
canViewAnswers = false,
|
|
109
|
+
skipButton = null,
|
|
110
|
+
backButton = null
|
|
111
|
+
} = settings || {};
|
|
112
|
+
const answersButton = submitState === 4 ? backButton : skipButton;
|
|
113
|
+
const finalAnswersButton = isTextFilled(answersButton) ? answersButton : {
|
|
114
|
+
...answersButton,
|
|
150
115
|
body: submitState === 4 ? intl.formatMessage({
|
|
151
116
|
id: "8NyYTH",
|
|
152
|
-
defaultMessage:
|
|
153
|
-
"type": 0,
|
|
154
|
-
"value": "Back"
|
|
155
|
-
}]
|
|
117
|
+
defaultMessage: "Back"
|
|
156
118
|
}) : intl.formatMessage({
|
|
157
119
|
id: "HpkW4J",
|
|
158
|
-
defaultMessage:
|
|
159
|
-
"type": 0,
|
|
160
|
-
"value": "Skip"
|
|
161
|
-
}]
|
|
120
|
+
defaultMessage: "Skip"
|
|
162
121
|
})
|
|
163
|
-
}
|
|
164
|
-
|
|
122
|
+
};
|
|
123
|
+
const onContributionSubmitted = useCallback(() => {
|
|
165
124
|
setSubmitState(2);
|
|
166
|
-
trackScreenEvent('submit_success',
|
|
125
|
+
trackScreenEvent('submit_success', `${userName}: ${userMessage}`);
|
|
167
126
|
setHasSubmitted(true);
|
|
168
127
|
}, [setSubmitState, setHasSubmitted, trackScreenEvent, userName, userMessage]);
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
128
|
+
const {
|
|
129
|
+
create: submitContribution
|
|
130
|
+
} = useContributionCreate({
|
|
131
|
+
screenId
|
|
132
|
+
});
|
|
133
|
+
const {
|
|
134
|
+
contributions
|
|
135
|
+
} = useContributions({
|
|
136
|
+
screenId,
|
|
137
|
+
opts: {
|
|
138
|
+
autoload: !isPlaceholder
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
const onNameChange = useCallback(e => {
|
|
142
|
+
const value = DOMPurify.sanitize(e.currentTarget.value || '');
|
|
182
143
|
setUserName(value);
|
|
183
144
|
}, [setUserName]);
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
setUserMessage(
|
|
145
|
+
const onMessageChange = useCallback(e_0 => {
|
|
146
|
+
const value_0 = DOMPurify.sanitize(e_0.currentTarget.value || '');
|
|
147
|
+
setUserMessage(value_0);
|
|
187
148
|
}, [setUserMessage]);
|
|
188
|
-
|
|
149
|
+
const onContributionReset = useCallback(() => {
|
|
189
150
|
setUserName('');
|
|
190
151
|
setUserMessage('');
|
|
191
152
|
setSubmitState(0);
|
|
192
153
|
setHasSubmitted(false);
|
|
193
154
|
}, [setUserName, setUserMessage, setSubmitState, setHasSubmitted]);
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
if (!nameFilled.current &&
|
|
155
|
+
const nameFilled = useRef(false);
|
|
156
|
+
const onNameBlur = useCallback(e_1 => {
|
|
157
|
+
if (!nameFilled.current && e_1.currentTarget.value.length > 0) {
|
|
197
158
|
nameFilled.current = true;
|
|
198
159
|
trackScreenEvent('input_filled', 'Name', {
|
|
199
|
-
userName:
|
|
200
|
-
userMessage
|
|
160
|
+
userName: e_1.currentTarget.value,
|
|
161
|
+
userMessage
|
|
201
162
|
});
|
|
202
163
|
}
|
|
203
164
|
}, [trackScreenEvent, userMessage]);
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
if (!messageFilled.current &&
|
|
165
|
+
const messageFilled = useRef(false);
|
|
166
|
+
const onMessageBlur = useCallback(e_2 => {
|
|
167
|
+
if (!messageFilled.current && e_2.currentTarget.value.length > 0) {
|
|
207
168
|
messageFilled.current = true;
|
|
208
169
|
trackScreenEvent('input_filled', 'Message', {
|
|
209
|
-
userName
|
|
210
|
-
userMessage:
|
|
170
|
+
userName,
|
|
171
|
+
userMessage: e_2.currentTarget.value
|
|
211
172
|
});
|
|
212
173
|
}
|
|
213
174
|
}, [trackScreenEvent, userName]);
|
|
214
175
|
|
|
215
176
|
// Call to Action
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
var onScrolledBottom = useCallback(function (_ref3) {
|
|
226
|
-
var initial = _ref3.initial;
|
|
177
|
+
const [scrolledBottom, setScrolledBottom] = useState(false);
|
|
178
|
+
const swipeUpLinkActive = scrolledBottom && submitState === 4;
|
|
179
|
+
const {
|
|
180
|
+
ref: footerRef,
|
|
181
|
+
height: callToActionHeight = 0
|
|
182
|
+
} = useDimensionObserver();
|
|
183
|
+
const onScrolledBottom = useCallback(({
|
|
184
|
+
initial
|
|
185
|
+
}) => {
|
|
227
186
|
if (initial) {
|
|
228
187
|
trackScreenEvent('scroll', 'Contributions list');
|
|
229
188
|
}
|
|
230
189
|
setScrolledBottom(true);
|
|
231
190
|
}, [trackScreenEvent, setScrolledBottom]);
|
|
232
|
-
|
|
191
|
+
const onScrolledNotBottom = useCallback(() => {
|
|
233
192
|
setScrolledBottom(false);
|
|
234
193
|
}, [setScrolledBottom]);
|
|
235
|
-
|
|
236
|
-
var trigger = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
194
|
+
const onScrolledTrigger = useCallback((trigger = null) => {
|
|
237
195
|
if (trigger !== null) {
|
|
238
|
-
|
|
196
|
+
const scrollPercent = Math.round(trigger * 100);
|
|
239
197
|
trackScreenEvent('scroll', scrollPercent, {
|
|
240
|
-
scrollPercent
|
|
198
|
+
scrollPercent
|
|
241
199
|
});
|
|
242
200
|
}
|
|
243
201
|
}, [trackScreenEvent]);
|
|
244
|
-
|
|
245
|
-
|
|
202
|
+
const onSubmit = useCallback(e_3 => {
|
|
203
|
+
e_3.preventDefault();
|
|
246
204
|
if (submitState === 0) {
|
|
247
205
|
setInteractiveContainerHeight(formRef.current.offsetHeight);
|
|
248
206
|
setSubmitState(1);
|
|
@@ -251,13 +209,13 @@ function ContributionScreen(_ref) {
|
|
|
251
209
|
message: userMessage
|
|
252
210
|
});
|
|
253
211
|
onContributionSubmitted();
|
|
254
|
-
trackScreenEvent('click_submit',
|
|
255
|
-
userName
|
|
256
|
-
userMessage
|
|
212
|
+
trackScreenEvent('click_submit', `${userName}: ${userMessage}`, {
|
|
213
|
+
userName,
|
|
214
|
+
userMessage
|
|
257
215
|
});
|
|
258
216
|
}
|
|
259
217
|
}, [submitState, setSubmitState, userName, userMessage, trackScreenEvent, onContributionSubmitted]);
|
|
260
|
-
|
|
218
|
+
const onClickSkip = useCallback(() => {
|
|
261
219
|
if (submitState === 4) {
|
|
262
220
|
setSubmitState(0);
|
|
263
221
|
trackScreenEvent('click_skip', 'Skip button');
|
|
@@ -266,14 +224,14 @@ function ContributionScreen(_ref) {
|
|
|
266
224
|
trackScreenEvent('click_back', 'Back button');
|
|
267
225
|
}
|
|
268
226
|
}, [submitState, setSubmitState, trackScreenEvent]);
|
|
269
|
-
useEffect(
|
|
270
|
-
|
|
227
|
+
useEffect(() => {
|
|
228
|
+
let timeout = null;
|
|
271
229
|
if (submitState === 2) {
|
|
272
230
|
timeout = setTimeout(setSubmitState, resizeTransitionDuration, 4);
|
|
273
231
|
setInteractiveContainerHeight(contributionsRef.current.offsetHeight);
|
|
274
232
|
setSubmitState(3);
|
|
275
233
|
}
|
|
276
|
-
return
|
|
234
|
+
return () => {
|
|
277
235
|
if (submitState === 3 && timeout !== null) {
|
|
278
236
|
clearTimeout(timeout);
|
|
279
237
|
}
|
|
@@ -282,28 +240,26 @@ function ContributionScreen(_ref) {
|
|
|
282
240
|
|
|
283
241
|
// Title
|
|
284
242
|
|
|
285
|
-
|
|
243
|
+
const items = [/*#__PURE__*/jsx(ScreenElement, {
|
|
286
244
|
placeholder: "title",
|
|
287
245
|
placeholderProps: {
|
|
288
246
|
height: '0.75em'
|
|
289
247
|
},
|
|
290
248
|
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
291
249
|
id: "2ZOPe+",
|
|
292
|
-
defaultMessage:
|
|
293
|
-
"type": 0,
|
|
294
|
-
"value": "Title"
|
|
295
|
-
}]
|
|
250
|
+
defaultMessage: "Title"
|
|
296
251
|
}),
|
|
297
252
|
emptyClassName: styles.emptyTitle,
|
|
298
253
|
isEmpty: !hasTitle,
|
|
299
|
-
children: hasTitle ? /*#__PURE__*/jsx(Heading,
|
|
254
|
+
children: hasTitle ? /*#__PURE__*/jsx(Heading, {
|
|
255
|
+
...title,
|
|
300
256
|
className: styles.title
|
|
301
|
-
})
|
|
257
|
+
}) : null
|
|
302
258
|
}, "title")];
|
|
303
|
-
|
|
259
|
+
const allContributions = [...(userName !== null && userName !== '' && userMessage !== null && userMessage !== '' ? [{
|
|
304
260
|
name: userName,
|
|
305
261
|
message: userMessage
|
|
306
|
-
}] : []),
|
|
262
|
+
}] : []), ...(contributions || [])];
|
|
307
263
|
|
|
308
264
|
// Form
|
|
309
265
|
|
|
@@ -311,7 +267,7 @@ function ContributionScreen(_ref) {
|
|
|
311
267
|
className: styles.interactiveContainer,
|
|
312
268
|
style: {
|
|
313
269
|
height: submitState < 4 ? interactiveContainerHeight : null,
|
|
314
|
-
transitionDuration:
|
|
270
|
+
transitionDuration: `${resizeTransitionDuration}ms`
|
|
315
271
|
},
|
|
316
272
|
children: [/*#__PURE__*/jsxs("form", {
|
|
317
273
|
className: styles.form,
|
|
@@ -326,10 +282,7 @@ function ContributionScreen(_ref) {
|
|
|
326
282
|
},
|
|
327
283
|
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
328
284
|
id: "G/ITGY",
|
|
329
|
-
defaultMessage:
|
|
330
|
-
"type": 0,
|
|
331
|
-
"value": "Your name"
|
|
332
|
-
}]
|
|
285
|
+
defaultMessage: "Your name"
|
|
333
286
|
}),
|
|
334
287
|
emptyClassName: styles.emptyInputName,
|
|
335
288
|
isEmpty: !hasNameLabel,
|
|
@@ -338,20 +291,16 @@ function ContributionScreen(_ref) {
|
|
|
338
291
|
playing: transitionPlaying,
|
|
339
292
|
delay: transitionStagger,
|
|
340
293
|
disabled: transitionDisabled,
|
|
341
|
-
children: /*#__PURE__*/jsx(TextInput,
|
|
342
|
-
className: styles.inputName
|
|
343
|
-
|
|
294
|
+
children: /*#__PURE__*/jsx(TextInput, {
|
|
295
|
+
className: styles.inputName,
|
|
296
|
+
...name,
|
|
344
297
|
value: userName,
|
|
345
|
-
onChange:
|
|
346
|
-
|
|
347
|
-
},
|
|
348
|
-
onBlur: function onBlur(e) {
|
|
349
|
-
return onNameBlur(e);
|
|
350
|
-
},
|
|
298
|
+
onChange: e_4 => onNameChange(e_4),
|
|
299
|
+
onBlur: e_5 => onNameBlur(e_5),
|
|
351
300
|
focusable: current && isView,
|
|
352
301
|
disabled: isPreview,
|
|
353
302
|
required: true
|
|
354
|
-
})
|
|
303
|
+
})
|
|
355
304
|
})
|
|
356
305
|
}), /*#__PURE__*/jsx(ScreenElement, {
|
|
357
306
|
placeholder: "inputText",
|
|
@@ -360,10 +309,7 @@ function ContributionScreen(_ref) {
|
|
|
360
309
|
},
|
|
361
310
|
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
362
311
|
id: "JAguka",
|
|
363
|
-
defaultMessage:
|
|
364
|
-
"type": 0,
|
|
365
|
-
"value": "Your message"
|
|
366
|
-
}]
|
|
312
|
+
defaultMessage: "Your message"
|
|
367
313
|
}),
|
|
368
314
|
emptyClassName: styles.emptyInputMessage,
|
|
369
315
|
isEmpty: !hasMessageLabel,
|
|
@@ -372,30 +318,23 @@ function ContributionScreen(_ref) {
|
|
|
372
318
|
playing: transitionPlaying,
|
|
373
319
|
delay: transitionStagger * 2,
|
|
374
320
|
disabled: transitionDisabled,
|
|
375
|
-
children: /*#__PURE__*/jsx(TextInput,
|
|
376
|
-
className: styles.inputMessage
|
|
377
|
-
|
|
321
|
+
children: /*#__PURE__*/jsx(TextInput, {
|
|
322
|
+
className: styles.inputMessage,
|
|
323
|
+
...message,
|
|
378
324
|
value: userMessage,
|
|
379
|
-
onChange:
|
|
380
|
-
|
|
381
|
-
},
|
|
382
|
-
onBlur: function onBlur(e) {
|
|
383
|
-
return onMessageBlur(e);
|
|
384
|
-
},
|
|
325
|
+
onChange: e_6 => onMessageChange(e_6),
|
|
326
|
+
onBlur: e_7 => onMessageBlur(e_7),
|
|
385
327
|
disabled: isPreview,
|
|
386
328
|
focusable: current && isView,
|
|
387
329
|
multiline: true,
|
|
388
330
|
required: true
|
|
389
|
-
})
|
|
331
|
+
})
|
|
390
332
|
})
|
|
391
333
|
}), /*#__PURE__*/jsx(ScreenElement, {
|
|
392
334
|
placeholder: "button",
|
|
393
335
|
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
394
336
|
id: "5uH4x7",
|
|
395
|
-
defaultMessage:
|
|
396
|
-
"type": 0,
|
|
397
|
-
"value": "Submit"
|
|
398
|
-
}]
|
|
337
|
+
defaultMessage: "Submit"
|
|
399
338
|
}),
|
|
400
339
|
emptyClassName: styles.emptySubmit,
|
|
401
340
|
isEmpty: !hasSubmit,
|
|
@@ -410,9 +349,10 @@ function ContributionScreen(_ref) {
|
|
|
410
349
|
disabled: isPreview,
|
|
411
350
|
buttonStyle: submit !== null ? submit.buttonStyle : null,
|
|
412
351
|
focusable: current && isView,
|
|
413
|
-
children: /*#__PURE__*/jsx(Text,
|
|
352
|
+
children: /*#__PURE__*/jsx(Text, {
|
|
353
|
+
...submit,
|
|
414
354
|
inline: true
|
|
415
|
-
})
|
|
355
|
+
})
|
|
416
356
|
})
|
|
417
357
|
})
|
|
418
358
|
})]
|
|
@@ -427,16 +367,10 @@ function ContributionScreen(_ref) {
|
|
|
427
367
|
placeholder: "button",
|
|
428
368
|
emptyLabel: submitState !== 4 ? /*#__PURE__*/jsx(FormattedMessage, {
|
|
429
369
|
id: "U2RZp5",
|
|
430
|
-
defaultMessage:
|
|
431
|
-
"type": 0,
|
|
432
|
-
"value": "Skip"
|
|
433
|
-
}]
|
|
370
|
+
defaultMessage: "Skip"
|
|
434
371
|
}) : /*#__PURE__*/jsx(FormattedMessage, {
|
|
435
372
|
id: "AzN1aW",
|
|
436
|
-
defaultMessage:
|
|
437
|
-
"type": 0,
|
|
438
|
-
"value": "Back"
|
|
439
|
-
}]
|
|
373
|
+
defaultMessage: "Back"
|
|
440
374
|
}),
|
|
441
375
|
emptyClassName: styles.emptySkip,
|
|
442
376
|
children: /*#__PURE__*/jsx(Transitions, {
|
|
@@ -446,14 +380,17 @@ function ContributionScreen(_ref) {
|
|
|
446
380
|
disabled: transitionDisabled,
|
|
447
381
|
children: /*#__PURE__*/jsx(Button, {
|
|
448
382
|
type: "button",
|
|
449
|
-
className: classNames([styles.buttonSkip,
|
|
383
|
+
className: classNames([styles.buttonSkip, {
|
|
384
|
+
[styles.showBack]: submitState === 4
|
|
385
|
+
}]),
|
|
450
386
|
disabled: isPreview,
|
|
451
387
|
onClick: onClickSkip,
|
|
452
388
|
buttonStyle: finalAnswersButton !== null ? finalAnswersButton.buttonStyle : null,
|
|
453
389
|
focusable: current && isView,
|
|
454
|
-
children: /*#__PURE__*/jsx(Text,
|
|
390
|
+
children: /*#__PURE__*/jsx(Text, {
|
|
391
|
+
...finalAnswersButton,
|
|
455
392
|
inline: true
|
|
456
|
-
})
|
|
393
|
+
})
|
|
457
394
|
})
|
|
458
395
|
})
|
|
459
396
|
}) : null, /*#__PURE__*/jsx("div", {
|
|
@@ -464,9 +401,9 @@ function ContributionScreen(_ref) {
|
|
|
464
401
|
children: /*#__PURE__*/jsx("div", {
|
|
465
402
|
className: styles.contributions,
|
|
466
403
|
ref: contributionsRef,
|
|
467
|
-
children: allContributions.map(
|
|
468
|
-
|
|
469
|
-
|
|
404
|
+
children: allContributions.map((contribution, contributionIndex) => {
|
|
405
|
+
const nameInnerStyle = nameStyle !== null ? nameStyle.style || null : null;
|
|
406
|
+
const messageInnerStyle = messageStyle !== null ? messageStyle.style || null : null;
|
|
470
407
|
return /*#__PURE__*/jsxs("div", {
|
|
471
408
|
className: styles.contribution,
|
|
472
409
|
style: nameInnerStyle !== null ? getStyleFromColor(nameInnerStyle.color, 'borderColor') : null,
|
|
@@ -480,7 +417,7 @@ function ContributionScreen(_ref) {
|
|
|
480
417
|
body: contribution.message,
|
|
481
418
|
textStyle: messageInnerStyle
|
|
482
419
|
})]
|
|
483
|
-
},
|
|
420
|
+
}, `contribution-${contributionIndex}`);
|
|
484
421
|
})
|
|
485
422
|
})
|
|
486
423
|
})
|
|
@@ -490,16 +427,23 @@ function ContributionScreen(_ref) {
|
|
|
490
427
|
}
|
|
491
428
|
}) : null]
|
|
492
429
|
}, "form"));
|
|
493
|
-
|
|
430
|
+
const headerElement = !isPlaceholder && hasHeader ? /*#__PURE__*/jsx("div", {
|
|
494
431
|
className: styles.header,
|
|
495
432
|
style: {
|
|
496
433
|
paddingBottom: spacing
|
|
497
434
|
},
|
|
498
|
-
children: /*#__PURE__*/jsx(Header,
|
|
435
|
+
children: /*#__PURE__*/jsx(Header, {
|
|
436
|
+
...header
|
|
437
|
+
})
|
|
499
438
|
}) : null;
|
|
500
|
-
|
|
439
|
+
const showReset = isEdit && submitState === 4;
|
|
501
440
|
return /*#__PURE__*/jsxs("div", {
|
|
502
|
-
className: classNames([styles.container, className,
|
|
441
|
+
className: classNames([styles.container, className, {
|
|
442
|
+
[styles.isPlaceholder]: isPlaceholder,
|
|
443
|
+
[styles.submitting]: submitState === 1,
|
|
444
|
+
[styles.submitted]: submitState > 1,
|
|
445
|
+
[styles.showContributions]: submitState === 4
|
|
446
|
+
}]),
|
|
503
447
|
"data-screen-ready": true,
|
|
504
448
|
children: [/*#__PURE__*/jsxs(Container, {
|
|
505
449
|
width: width,
|
|
@@ -534,14 +478,18 @@ function ContributionScreen(_ref) {
|
|
|
534
478
|
})
|
|
535
479
|
}), !isPlaceholder && hasFooter ? /*#__PURE__*/jsx("div", {
|
|
536
480
|
ref: footerRef,
|
|
537
|
-
className: classNames([styles.footer,
|
|
481
|
+
className: classNames([styles.footer, {
|
|
482
|
+
[styles.disabled]: !swipeUpLinkActive
|
|
483
|
+
}]),
|
|
538
484
|
style: {
|
|
539
485
|
paddingLeft: Math.max(viewerBottomSidesWidth, spacing / 2),
|
|
540
486
|
paddingRight: Math.max(viewerBottomSidesWidth, spacing / 2),
|
|
541
487
|
paddingTop: 0,
|
|
542
488
|
paddingBottom: (!isPreview ? viewerBottomHeight : 0) + spacing / 2
|
|
543
489
|
},
|
|
544
|
-
children: /*#__PURE__*/jsx(Footer,
|
|
490
|
+
children: /*#__PURE__*/jsx(Footer, {
|
|
491
|
+
...footerProps
|
|
492
|
+
})
|
|
545
493
|
}) : null]
|
|
546
494
|
})]
|
|
547
495
|
}), !isPlaceholder ? /*#__PURE__*/jsx(Background, {
|
|
@@ -565,19 +513,13 @@ var definition = {
|
|
|
565
513
|
group: {
|
|
566
514
|
label: defineMessage({
|
|
567
515
|
id: "ZiWlL6",
|
|
568
|
-
defaultMessage:
|
|
569
|
-
"type": 0,
|
|
570
|
-
"value": "Questions"
|
|
571
|
-
}]
|
|
516
|
+
defaultMessage: "Questions"
|
|
572
517
|
}),
|
|
573
518
|
order: 7
|
|
574
519
|
},
|
|
575
520
|
title: defineMessage({
|
|
576
521
|
id: "g6b9Lg",
|
|
577
|
-
defaultMessage:
|
|
578
|
-
"type": 0,
|
|
579
|
-
"value": "Contribution"
|
|
580
|
-
}]
|
|
522
|
+
defaultMessage: "Contribution"
|
|
581
523
|
}),
|
|
582
524
|
component: ContributionScreen,
|
|
583
525
|
layouts: ['top', 'middle', 'bottom'],
|
|
@@ -587,10 +529,7 @@ var definition = {
|
|
|
587
529
|
defaultValue: 'top',
|
|
588
530
|
label: defineMessage({
|
|
589
531
|
id: "4iBXj2",
|
|
590
|
-
defaultMessage:
|
|
591
|
-
"type": 0,
|
|
592
|
-
"value": "Layout"
|
|
593
|
-
}]
|
|
532
|
+
defaultMessage: "Layout"
|
|
594
533
|
})
|
|
595
534
|
}, {
|
|
596
535
|
name: 'title',
|
|
@@ -600,10 +539,7 @@ var definition = {
|
|
|
600
539
|
},
|
|
601
540
|
label: defineMessage({
|
|
602
541
|
id: "N25iDO",
|
|
603
|
-
defaultMessage:
|
|
604
|
-
"type": 0,
|
|
605
|
-
"value": "Title"
|
|
606
|
-
}]
|
|
542
|
+
defaultMessage: "Title"
|
|
607
543
|
})
|
|
608
544
|
}, {
|
|
609
545
|
name: 'name',
|
|
@@ -613,10 +549,7 @@ var definition = {
|
|
|
613
549
|
},
|
|
614
550
|
label: defineMessage({
|
|
615
551
|
id: "nXVNeg",
|
|
616
|
-
defaultMessage:
|
|
617
|
-
"type": 0,
|
|
618
|
-
"value": "Name"
|
|
619
|
-
}]
|
|
552
|
+
defaultMessage: "Name"
|
|
620
553
|
})
|
|
621
554
|
}, {
|
|
622
555
|
name: 'message',
|
|
@@ -626,10 +559,7 @@ var definition = {
|
|
|
626
559
|
},
|
|
627
560
|
label: defineMessage({
|
|
628
561
|
id: "RcLsua",
|
|
629
|
-
defaultMessage:
|
|
630
|
-
"type": 0,
|
|
631
|
-
"value": "Message"
|
|
632
|
-
}]
|
|
562
|
+
defaultMessage: "Message"
|
|
633
563
|
})
|
|
634
564
|
}, {
|
|
635
565
|
name: 'submit',
|
|
@@ -639,10 +569,7 @@ var definition = {
|
|
|
639
569
|
},
|
|
640
570
|
label: defineMessage({
|
|
641
571
|
id: "uAKPQ9",
|
|
642
|
-
defaultMessage:
|
|
643
|
-
"type": 0,
|
|
644
|
-
"value": "Submit"
|
|
645
|
-
}]
|
|
572
|
+
defaultMessage: "Submit"
|
|
646
573
|
})
|
|
647
574
|
}, {
|
|
648
575
|
name: 'nameStyle',
|
|
@@ -654,10 +581,7 @@ var definition = {
|
|
|
654
581
|
},
|
|
655
582
|
label: defineMessage({
|
|
656
583
|
id: "SyMSDa",
|
|
657
|
-
defaultMessage:
|
|
658
|
-
"type": 0,
|
|
659
|
-
"value": "Published name style"
|
|
660
|
-
}]
|
|
584
|
+
defaultMessage: "Published name style"
|
|
661
585
|
})
|
|
662
586
|
}, {
|
|
663
587
|
name: 'messageStyle',
|
|
@@ -669,10 +593,7 @@ var definition = {
|
|
|
669
593
|
},
|
|
670
594
|
label: defineMessage({
|
|
671
595
|
id: "+SlKOi",
|
|
672
|
-
defaultMessage:
|
|
673
|
-
"type": 0,
|
|
674
|
-
"value": "Published message style"
|
|
675
|
-
}]
|
|
596
|
+
defaultMessage: "Published message style"
|
|
676
597
|
})
|
|
677
598
|
}, {
|
|
678
599
|
name: 'settings',
|
|
@@ -681,10 +602,7 @@ var definition = {
|
|
|
681
602
|
isList: true,
|
|
682
603
|
label: defineMessage({
|
|
683
604
|
id: "9omJnT",
|
|
684
|
-
defaultMessage:
|
|
685
|
-
"type": 0,
|
|
686
|
-
"value": "Answer settings"
|
|
687
|
-
}]
|
|
605
|
+
defaultMessage: "Answer settings"
|
|
688
606
|
}),
|
|
689
607
|
fields: [{
|
|
690
608
|
name: 'canViewAnswers',
|
|
@@ -692,10 +610,7 @@ var definition = {
|
|
|
692
610
|
isHorizontal: true,
|
|
693
611
|
label: defineMessage({
|
|
694
612
|
id: "xcHW4o",
|
|
695
|
-
defaultMessage:
|
|
696
|
-
"type": 0,
|
|
697
|
-
"value": "Can view answers"
|
|
698
|
-
}]
|
|
613
|
+
defaultMessage: "Can view answers"
|
|
699
614
|
})
|
|
700
615
|
}, {
|
|
701
616
|
name: 'skipButton',
|
|
@@ -705,10 +620,7 @@ var definition = {
|
|
|
705
620
|
},
|
|
706
621
|
label: defineMessage({
|
|
707
622
|
id: "CpCykm",
|
|
708
|
-
defaultMessage:
|
|
709
|
-
"type": 0,
|
|
710
|
-
"value": "Skip button"
|
|
711
|
-
}]
|
|
623
|
+
defaultMessage: "Skip button"
|
|
712
624
|
})
|
|
713
625
|
}, {
|
|
714
626
|
name: 'backButton',
|
|
@@ -718,10 +630,7 @@ var definition = {
|
|
|
718
630
|
},
|
|
719
631
|
label: defineMessage({
|
|
720
632
|
id: "KIXg9M",
|
|
721
|
-
defaultMessage:
|
|
722
|
-
"type": 0,
|
|
723
|
-
"value": "Back button"
|
|
724
|
-
}]
|
|
633
|
+
defaultMessage: "Back button"
|
|
725
634
|
})
|
|
726
635
|
}]
|
|
727
636
|
}, {
|
|
@@ -729,20 +638,14 @@ var definition = {
|
|
|
729
638
|
type: 'background',
|
|
730
639
|
label: defineMessage({
|
|
731
640
|
id: "+MPZRu",
|
|
732
|
-
defaultMessage:
|
|
733
|
-
"type": 0,
|
|
734
|
-
"value": "Background"
|
|
735
|
-
}]
|
|
641
|
+
defaultMessage: "Background"
|
|
736
642
|
})
|
|
737
643
|
}, {
|
|
738
644
|
name: 'header',
|
|
739
645
|
type: 'header',
|
|
740
646
|
label: defineMessage({
|
|
741
647
|
id: "rhuDxI",
|
|
742
|
-
defaultMessage:
|
|
743
|
-
"type": 0,
|
|
744
|
-
"value": "Header"
|
|
745
|
-
}]
|
|
648
|
+
defaultMessage: "Header"
|
|
746
649
|
}),
|
|
747
650
|
theme: {
|
|
748
651
|
badge: {
|
|
@@ -757,10 +660,7 @@ var definition = {
|
|
|
757
660
|
type: 'footer',
|
|
758
661
|
label: defineMessage({
|
|
759
662
|
id: "g4nybp",
|
|
760
|
-
defaultMessage:
|
|
761
|
-
"type": 0,
|
|
762
|
-
"value": "Footer"
|
|
763
|
-
}]
|
|
663
|
+
defaultMessage: "Footer"
|
|
764
664
|
}),
|
|
765
665
|
theme: {
|
|
766
666
|
callToAction: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-contribution",
|
|
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,32 +53,32 @@
|
|
|
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-share-incentive": "^0.4.
|
|
78
|
-
"@micromag/element-text": "^0.4.
|
|
79
|
-
"@micromag/element-text-input": "^0.4.
|
|
80
|
-
"@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-share-incentive": "^0.4.74",
|
|
79
|
+
"@micromag/element-text": "^0.4.74",
|
|
80
|
+
"@micromag/element-text-input": "^0.4.74",
|
|
81
|
+
"@micromag/transforms": "^0.4.74",
|
|
81
82
|
"classnames": "^2.2.6",
|
|
82
83
|
"dompurify": "^3.2.6",
|
|
83
84
|
"lodash": "^4.17.23",
|
|
@@ -88,6 +89,6 @@
|
|
|
88
89
|
"access": "public",
|
|
89
90
|
"registry": "https://registry.npmjs.org/"
|
|
90
91
|
},
|
|
91
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "fe510ee87845280d0760cb292aef9d2eb69e67c1",
|
|
92
93
|
"types": "es/index.d.ts"
|
|
93
94
|
}
|