@micromag/screen-survey 0.3.693 → 0.3.694

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.
@@ -1 +1 @@
1
- .micromag-screen-survey-container .micromag-screen-survey-background{height:100%;left:0;position:absolute;top:0;width:100%}.micromag-screen-survey-container{height:100%;overflow:hidden;position:relative;width:100%}.micromag-screen-survey-disabled.micromag-screen-survey-container{overflow:hidden;pointer-events:none}.micromag-screen-survey-hidden.micromag-screen-survey-container{display:none;visibility:hidden}.micromag-screen-survey-placeholder.micromag-screen-survey-container .micromag-screen-survey-content{padding:6px;position:relative}.micromag-screen-survey-container .micromag-screen-survey-emptyAnswer,.micromag-screen-survey-container .micromag-screen-survey-emptyQuestion{border:2px dashed #343434;color:#343434;margin:5px auto}.micromag-screen-survey-container .micromag-screen-survey-background{z-index:0}.micromag-screen-survey-container .micromag-screen-survey-content{z-index:1}.micromag-screen-survey-container .micromag-screen-survey-question{margin-bottom:20px}.micromag-screen-survey-container .micromag-screen-survey-answers,.micromag-screen-survey-container .micromag-screen-survey-items{position:relative}.micromag-screen-survey-container .micromag-screen-survey-header{left:0;position:absolute;top:0;-webkit-transition:opacity .2s ease-out;transition:opacity .2s ease-out;width:100%}.micromag-screen-survey-container .micromag-screen-survey-header.micromag-screen-survey-disabled{opacity:0;pointer-events:none}.micromag-screen-survey-container .micromag-screen-survey-footer{bottom:0;left:0;position:absolute;-webkit-transition:opacity .2s ease-out;transition:opacity .2s ease-out;width:100%}.micromag-screen-survey-container .micromag-screen-survey-footer a{padding:0}.micromag-screen-survey-container .micromag-screen-survey-footer.micromag-screen-survey-disabled{opacity:0;pointer-events:none}.micromag-screen-survey-container .micromag-screen-survey-item{padding:5px 0}.micromag-screen-survey-container .micromag-screen-survey-item:first-child .micromag-screen-survey-placeholderAnswer{width:80%}.micromag-screen-survey-container .micromag-screen-survey-item:last-child .micromag-screen-survey-placeholderAnswer{width:90%}.micromag-screen-survey-container .micromag-screen-survey-itemContent{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.micromag-screen-survey-container .micromag-screen-survey-resultBar{background-color:hsla(0,0%,100%,.2);height:100%;left:0;position:absolute;top:0}.micromag-screen-survey-container .micromag-screen-survey-resultLabel{color:#fff;padding:0 8px;position:absolute;right:0;text-align:right;top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);width:4em;z-index:1}.micromag-screen-survey-container .micromag-screen-survey-resultText{margin-top:10px}.micromag-screen-survey-container .micromag-screen-survey-itemInner{width:100%}.micromag-screen-survey-container .micromag-screen-survey-button{display:-ms-flexbox;display:flex;overflow:hidden;padding:10px;position:relative;-webkit-transition:opacity .5s ease-out;transition:opacity .5s ease-out;width:100%}.micromag-screen-survey-container .micromag-screen-survey-button:disabled{opacity:1;pointer-events:none}.micromag-screen-survey-container .micromag-screen-survey-itemLabel{width:100%}.micromag-screen-survey-container .micromag-screen-survey-itemLabel,.micromag-screen-survey-container .micromag-screen-survey-itemText{display:inline-block;-webkit-transition:margin-left .3s ease-out,-webkit-transform .3s ease-out;transition:margin-left .3s ease-out,-webkit-transform .3s ease-out;transition:margin-left .3s ease-out,transform .3s ease-out;transition:margin-left .3s ease-out,transform .3s ease-out,-webkit-transform .3s ease-out}.micromag-screen-survey-container .micromag-screen-survey-itemText{position:relative;z-index:1}.micromag-screen-survey-container .micromag-screen-survey-emptyAnswer,.micromag-screen-survey-container .micromag-screen-survey-emptyQuestion{margin:0 auto;width:100%}.micromag-screen-survey-container .micromag-screen-survey-emptyQuestion{height:75px}.micromag-screen-survey-container .micromag-screen-survey-emptyAnswer{height:50px}.micromag-screen-survey-container .micromag-screen-survey-userAnswer .micromag-screen-survey-button,.micromag-screen-survey-container .micromag-screen-survey-userAnswer .micromag-screen-survey-result,.micromag-screen-survey-container .micromag-screen-survey-userAnswer .micromag-screen-survey-resultLabel{opacity:1!important}.micromag-screen-survey-container .micromag-screen-survey-input{margin:5px 0;position:relative}.micromag-screen-survey-container .micromag-screen-survey-input.micromag-screen-survey-disabled{opacity:.5}.micromag-screen-survey-container .micromag-screen-survey-input.micromag-screen-survey-disabled .micromag-screen-survey-confirm,.micromag-screen-survey-container .micromag-screen-survey-input.micromag-screen-survey-disabled .micromag-screen-survey-textInput{background:transparent}.micromag-screen-survey-container .micromag-screen-survey-input.micromag-screen-survey-selected{opacity:1!important}.micromag-screen-survey-container .micromag-screen-survey-input.micromag-screen-survey-selected .micromag-screen-survey-confirm{opacity:0}.micromag-screen-survey-container .micromag-screen-survey-input.micromag-screen-survey-focused .micromag-screen-survey-confirm{opacity:1}.micromag-screen-survey-container .micromag-screen-survey-textInput{color:#fff;display:-ms-flexbox;display:flex;margin:0;overflow:hidden;padding:10px 40px;position:relative;text-align:center;-webkit-transition:margin-left .3s ease-out,opacity .5s ease-out,-webkit-transform .3s ease-out;transition:margin-left .3s ease-out,opacity .5s ease-out,-webkit-transform .3s ease-out;transition:margin-left .3s ease-out,transform .3s ease-out,opacity .5s ease-out;transition:margin-left .3s ease-out,transform .3s ease-out,opacity .5s ease-out,-webkit-transform .3s ease-out;width:100%;z-index:0}.micromag-screen-survey-container .micromag-screen-survey-confirm{bottom:0;opacity:0;position:absolute;right:0;top:0;-webkit-transition:opacity .15s ease-out;transition:opacity .15s ease-out;z-index:1}.micromag-screen-survey-container .micromag-screen-survey-confirm.micromag-screen-survey-disabled .micromag-screen-survey-icon{opacity:.5}.micromag-screen-survey-container.micromag-screen-survey-answered{line-height:1}.micromag-screen-survey-container.micromag-screen-survey-answered .micromag-screen-survey-resultContainer{padding-left:15px;padding-right:50px}.micromag-screen-survey-container.micromag-screen-survey-answered .micromag-screen-survey-resultContent{opacity:1;width:100%}.micromag-screen-survey-container.micromag-screen-survey-answered .micromag-screen-survey-button{background-color:transparent;border-color:transparent}.micromag-screen-survey-container.micromag-screen-survey-answered .micromag-screen-survey-button,.micromag-screen-survey-container.micromag-screen-survey-answered .micromag-screen-survey-result,.micromag-screen-survey-container.micromag-screen-survey-answered .micromag-screen-survey-resultLabel{opacity:.6}.micromag-screen-survey-container.micromag-screen-survey-answered .micromag-screen-survey-itemLabel{margin-left:0;margin-right:0;text-align:left}.micromag-screen-survey-container.micromag-screen-survey-answered .micromag-screen-survey-textInput{padding:10px;pointer-events:none;text-align:left}.micromag-screen-survey-container.micromag-screen-survey-answered.micromag-screen-survey-withPercentage .micromag-screen-survey-itemText{-webkit-transform:translate(-2em);-ms-transform:translate(-2em);transform:translate(-2em)}.micromag-screen-survey-container.micromag-screen-survey-answered.micromag-screen-survey-withPercentage .micromag-screen-survey-textInput{-webkit-transform:translate(0);-ms-transform:translate(0);transform:translate(0)}.micromag-screen-survey-container.micromag-screen-survey-withPercentage .micromag-screen-survey-itemLabel{margin-left:2em;margin-right:2em}.micromag-screen-survey-container.micromag-screen-survey-inputFocused .micromag-screen-survey-answers,.micromag-screen-survey-container.micromag-screen-survey-inputFocused .micromag-screen-survey-question{opacity:.5}.micromag-screen-survey-container.micromag-screen-survey-isPlaceholder .micromag-screen-survey-layout{padding:10px}.micromag-screen-survey-container.micromag-screen-survey-isPlaceholder .micromag-screen-survey-item{padding:1px 0}.micromag-screen-survey-reset{background-color:transparent;border:0;padding:10px;position:absolute;right:0;top:0;-webkit-transform-origin:center;-ms-transform-origin:center;transform-origin:center;-webkit-transition:opacity .15s ease-out,-webkit-transform .15s ease-out;transition:opacity .15s ease-out,-webkit-transform .15s ease-out;transition:opacity .15s ease-out,transform .15s ease-out;transition:opacity .15s ease-out,transform .15s ease-out,-webkit-transform .15s ease-out;z-index:1000}.micromag-screen-survey-reset:hover{border:0;opacity:.8}.micromag-screen-survey-reset:hover:active{-webkit-transform:rotate(30deg);-ms-transform:rotate(30deg);transform:rotate(30deg)}
1
+ .micromag-screen-survey-container .micromag-screen-survey-background{height:100%;left:0;position:absolute;top:0;width:100%}.micromag-screen-survey-container{height:100%;overflow:hidden;position:relative;width:100%}.micromag-screen-survey-disabled.micromag-screen-survey-container{overflow:hidden;pointer-events:none}.micromag-screen-survey-hidden.micromag-screen-survey-container{display:none;visibility:hidden}.micromag-screen-survey-placeholder.micromag-screen-survey-container .micromag-screen-survey-content{padding:6px;position:relative}.micromag-screen-survey-container .micromag-screen-survey-emptyAnswer,.micromag-screen-survey-container .micromag-screen-survey-emptyQuestion{border:2px dashed #343434;color:#343434;margin:5px auto}.micromag-screen-survey-container .micromag-screen-survey-background{z-index:0}.micromag-screen-survey-container .micromag-screen-survey-content{z-index:1}.micromag-screen-survey-container .micromag-screen-survey-question{margin-bottom:20px}.micromag-screen-survey-container .micromag-screen-survey-answers,.micromag-screen-survey-container .micromag-screen-survey-items{position:relative}.micromag-screen-survey-container .micromag-screen-survey-header{left:0;position:absolute;top:0;-webkit-transition:opacity .2s ease-out;transition:opacity .2s ease-out;width:100%}.micromag-screen-survey-container .micromag-screen-survey-header.micromag-screen-survey-disabled{opacity:0;pointer-events:none}.micromag-screen-survey-container .micromag-screen-survey-footer{bottom:0;left:0;position:absolute;-webkit-transition:opacity .2s ease-out;transition:opacity .2s ease-out;width:100%}.micromag-screen-survey-container .micromag-screen-survey-footer a{padding:0}.micromag-screen-survey-container .micromag-screen-survey-footer.micromag-screen-survey-disabled{opacity:0;pointer-events:none}.micromag-screen-survey-container .micromag-screen-survey-item{padding:5px 0}.micromag-screen-survey-container .micromag-screen-survey-item:first-child .micromag-screen-survey-placeholderAnswer{width:80%}.micromag-screen-survey-container .micromag-screen-survey-item:last-child .micromag-screen-survey-placeholderAnswer{width:90%}.micromag-screen-survey-container .micromag-screen-survey-itemContent{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.micromag-screen-survey-container .micromag-screen-survey-resultBar{background-color:hsla(0,0%,100%,.2);height:100%;left:0;position:absolute;top:0}.micromag-screen-survey-container .micromag-screen-survey-resultLabel{color:#fff;padding:0 8px;position:absolute;right:0;text-align:right;top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);width:4em;z-index:1}.micromag-screen-survey-container .micromag-screen-survey-resultText{margin-top:10px}.micromag-screen-survey-container .micromag-screen-survey-itemInner{width:100%}.micromag-screen-survey-container .micromag-screen-survey-button{display:-ms-flexbox;display:flex;overflow:hidden;padding:10px;position:relative;-webkit-transition:opacity .5s ease-out;transition:opacity .5s ease-out;width:100%}.micromag-screen-survey-container .micromag-screen-survey-button:disabled{opacity:1;pointer-events:none}.micromag-screen-survey-container .micromag-screen-survey-itemLabel{width:100%}.micromag-screen-survey-container .micromag-screen-survey-itemLabel,.micromag-screen-survey-container .micromag-screen-survey-itemText{display:inline-block;-webkit-transition:margin-left .3s ease-out,-webkit-transform .3s ease-out;transition:margin-left .3s ease-out,-webkit-transform .3s ease-out;transition:margin-left .3s ease-out,transform .3s ease-out;transition:margin-left .3s ease-out,transform .3s ease-out,-webkit-transform .3s ease-out}.micromag-screen-survey-container .micromag-screen-survey-itemText{position:relative;z-index:1}.micromag-screen-survey-container .micromag-screen-survey-emptyAnswer,.micromag-screen-survey-container .micromag-screen-survey-emptyQuestion{margin:0 auto;width:100%}.micromag-screen-survey-container .micromag-screen-survey-emptyQuestion{height:75px}.micromag-screen-survey-container .micromag-screen-survey-emptyAnswer{height:50px}.micromag-screen-survey-container .micromag-screen-survey-userAnswer .micromag-screen-survey-button,.micromag-screen-survey-container .micromag-screen-survey-userAnswer .micromag-screen-survey-result,.micromag-screen-survey-container .micromag-screen-survey-userAnswer .micromag-screen-survey-resultLabel{opacity:1!important}.micromag-screen-survey-container .micromag-screen-survey-input{margin:5px 0;position:relative}.micromag-screen-survey-container .micromag-screen-survey-input.micromag-screen-survey-disabled{opacity:.5}.micromag-screen-survey-container .micromag-screen-survey-input.micromag-screen-survey-disabled .micromag-screen-survey-confirm,.micromag-screen-survey-container .micromag-screen-survey-input.micromag-screen-survey-disabled .micromag-screen-survey-textInput{background:transparent}.micromag-screen-survey-container .micromag-screen-survey-input.micromag-screen-survey-selected{opacity:1!important}.micromag-screen-survey-container .micromag-screen-survey-input.micromag-screen-survey-selected .micromag-screen-survey-confirm,.micromag-screen-survey-container .micromag-screen-survey-input.micromag-screen-survey-selected .micromag-screen-survey-submit{opacity:0}.micromag-screen-survey-container .micromag-screen-survey-input.micromag-screen-survey-filled .micromag-screen-survey-confirm,.micromag-screen-survey-container .micromag-screen-survey-input.micromag-screen-survey-filled .micromag-screen-survey-submit,.micromag-screen-survey-container .micromag-screen-survey-input.micromag-screen-survey-focused .micromag-screen-survey-confirm,.micromag-screen-survey-container .micromag-screen-survey-input.micromag-screen-survey-focused .micromag-screen-survey-submit{opacity:1}.micromag-screen-survey-container .micromag-screen-survey-textInput{color:#fff;display:-ms-flexbox;display:flex;margin:0;overflow:hidden;padding:10px 35px;position:relative;text-align:center;-webkit-transition:margin-left .3s ease-out,opacity .5s ease-out,-webkit-transform .3s ease-out;transition:margin-left .3s ease-out,opacity .5s ease-out,-webkit-transform .3s ease-out;transition:margin-left .3s ease-out,transform .3s ease-out,opacity .5s ease-out;transition:margin-left .3s ease-out,transform .3s ease-out,opacity .5s ease-out,-webkit-transform .3s ease-out;width:100%;z-index:0}.micromag-screen-survey-container .micromag-screen-survey-textInput.micromag-screen-survey-padded{padding:10px 40px}.micromag-screen-survey-container .micromag-screen-survey-confirm{bottom:0;opacity:0;padding:10px;position:absolute;right:0;top:0;-webkit-transition:opacity .15s ease-out;transition:opacity .15s ease-out;z-index:1}.micromag-screen-survey-container .micromag-screen-survey-confirm.micromag-screen-survey-disabled .micromag-screen-survey-icon{opacity:.5}.micromag-screen-survey-container .micromag-screen-survey-confirm.micromag-screen-survey-isClear .micromag-screen-survey-icon{height:10px;margin:0 auto;width:10px}.micromag-screen-survey-container .micromag-screen-survey-submit{margin-top:10px;opacity:0;padding:10px;position:absolute;top:100%;-webkit-transition:opacity .15s ease-out;transition:opacity .15s ease-out;z-index:1}.micromag-screen-survey-container.micromag-screen-survey-answered{line-height:1}.micromag-screen-survey-container.micromag-screen-survey-answered .micromag-screen-survey-resultContainer{padding-left:15px;padding-right:50px}.micromag-screen-survey-container.micromag-screen-survey-answered .micromag-screen-survey-resultContent{opacity:1;width:100%}.micromag-screen-survey-container.micromag-screen-survey-answered .micromag-screen-survey-button{background-color:transparent;border-color:transparent}.micromag-screen-survey-container.micromag-screen-survey-answered .micromag-screen-survey-button,.micromag-screen-survey-container.micromag-screen-survey-answered .micromag-screen-survey-result,.micromag-screen-survey-container.micromag-screen-survey-answered .micromag-screen-survey-resultLabel{opacity:.6}.micromag-screen-survey-container.micromag-screen-survey-answered .micromag-screen-survey-itemLabel{margin-left:0;margin-right:0;text-align:left}.micromag-screen-survey-container.micromag-screen-survey-answered .micromag-screen-survey-textInput{padding:10px;pointer-events:none;text-align:left}.micromag-screen-survey-container.micromag-screen-survey-answered.micromag-screen-survey-withPercentage .micromag-screen-survey-itemText{-webkit-transform:translate(-2em);-ms-transform:translate(-2em);transform:translate(-2em)}.micromag-screen-survey-container.micromag-screen-survey-answered.micromag-screen-survey-withPercentage .micromag-screen-survey-textInput{-webkit-transform:translate(0);-ms-transform:translate(0);transform:translate(0)}.micromag-screen-survey-container.micromag-screen-survey-withPercentage .micromag-screen-survey-itemLabel{margin-left:2em;margin-right:2em}.micromag-screen-survey-container.micromag-screen-survey-inputFocused .micromag-screen-survey-answers,.micromag-screen-survey-container.micromag-screen-survey-inputFocused .micromag-screen-survey-question{opacity:.5}.micromag-screen-survey-container.micromag-screen-survey-isPlaceholder .micromag-screen-survey-layout{padding:10px}.micromag-screen-survey-container.micromag-screen-survey-isPlaceholder .micromag-screen-survey-item{padding:1px 0}.micromag-screen-survey-reset{background-color:transparent;border:0;padding:10px;position:absolute;right:0;top:0;-webkit-transform-origin:center;-ms-transform-origin:center;transform-origin:center;-webkit-transition:opacity .15s ease-out,-webkit-transform .15s ease-out;transition:opacity .15s ease-out,-webkit-transform .15s ease-out;transition:opacity .15s ease-out,transform .15s ease-out;transition:opacity .15s ease-out,transform .15s ease-out,-webkit-transform .15s ease-out;z-index:1000}.micromag-screen-survey-reset:hover{border:0;opacity:.8}.micromag-screen-survey-reset:hover:active{-webkit-transform:rotate(30deg);-ms-transform:rotate(30deg);transform:rotate(30deg)}
package/es/index.js CHANGED
@@ -11,7 +11,7 @@ import isNumber from 'lodash/isNumber';
11
11
  import PropTypes from 'prop-types';
12
12
  import React, { useState, useMemo, useCallback, useEffect } from 'react';
13
13
  import { PropTypes as PropTypes$1 } from '@micromag/core';
14
- import { ScreenElement, Transitions, ArrowIcon } from '@micromag/core/components';
14
+ import { ScreenElement, Transitions, CloseIcon, ArrowIcon } from '@micromag/core/components';
15
15
  import { useScreenSize, useScreenRenderContext, useViewerContext, useViewerWebView, usePlaybackContext, usePlaybackMediaRef } from '@micromag/core/contexts';
16
16
  import { useTrackScreenEvent, useDimensionObserver } from '@micromag/core/hooks';
17
17
  import { isTextFilled, getLargestRemainderRound, isHeaderFilled, isFooterFilled, getFooterProps, getStyleFromColor } from '@micromag/core/utils';
@@ -27,7 +27,7 @@ import Scroll from '@micromag/element-scroll';
27
27
  import Text from '@micromag/element-text';
28
28
  import TextInput from '@micromag/element-text-input';
29
29
 
30
- var styles = {"container":"micromag-screen-survey-container","background":"micromag-screen-survey-background","disabled":"micromag-screen-survey-disabled","content":"micromag-screen-survey-content","emptyQuestion":"micromag-screen-survey-emptyQuestion","emptyAnswer":"micromag-screen-survey-emptyAnswer","question":"micromag-screen-survey-question","answers":"micromag-screen-survey-answers","items":"micromag-screen-survey-items","header":"micromag-screen-survey-header","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","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","focused":"micromag-screen-survey-focused","icon":"micromag-screen-survey-icon","answered":"micromag-screen-survey-answered","withPercentage":"micromag-screen-survey-withPercentage","inputFocused":"micromag-screen-survey-inputFocused","isPlaceholder":"micromag-screen-survey-isPlaceholder","layout":"micromag-screen-survey-layout","reset":"micromag-screen-survey-reset"};
30
+ var styles = {"container":"micromag-screen-survey-container","background":"micromag-screen-survey-background","disabled":"micromag-screen-survey-disabled","content":"micromag-screen-survey-content","emptyQuestion":"micromag-screen-survey-emptyQuestion","emptyAnswer":"micromag-screen-survey-emptyAnswer","question":"micromag-screen-survey-question","answers":"micromag-screen-survey-answers","items":"micromag-screen-survey-items","header":"micromag-screen-survey-header","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","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","padded":"micromag-screen-survey-padded","icon":"micromag-screen-survey-icon","isClear":"micromag-screen-survey-isClear","answered":"micromag-screen-survey-answered","withPercentage":"micromag-screen-survey-withPercentage","inputFocused":"micromag-screen-survey-inputFocused","isPlaceholder":"micromag-screen-survey-isPlaceholder","layout":"micromag-screen-survey-layout","reset":"micromag-screen-survey-reset"};
31
31
 
32
32
  var propTypes = {
33
33
  id: PropTypes.string,
@@ -171,7 +171,9 @@ var SurveyScreen = function SurveyScreen(_ref) {
171
171
  _ref5$textStyle = _ref5.textStyle,
172
172
  customAnswerTextStyle = _ref5$textStyle === void 0 ? null : _ref5$textStyle,
173
173
  _ref5$boxStyle = _ref5.boxStyle,
174
- customAnswerBoxStyle = _ref5$boxStyle === void 0 ? null : _ref5$boxStyle;
174
+ customAnswerBoxStyle = _ref5$boxStyle === void 0 ? null : _ref5$boxStyle,
175
+ _ref5$submit = _ref5.submit,
176
+ customAnswerSubmit = _ref5$submit === void 0 ? null : _ref5$submit;
175
177
  var _ref6 = placeholder || {},
176
178
  _ref6$body = _ref6.body,
177
179
  placeholderBody = _ref6$body === void 0 ? null : _ref6$body,
@@ -273,6 +275,9 @@ var SurveyScreen = function SurveyScreen(_ref) {
273
275
  var value = DOMPurify.sanitize(e.currentTarget.value || '');
274
276
  setTextInput(value !== '' ? value : null);
275
277
  }, [setTextInput]);
278
+ var onTextInputClear = useCallback(function () {
279
+ setTextInput('');
280
+ }, [setTextInput]);
276
281
  var onSubmitSuggestion = useCallback(function (e) {
277
282
  e.preventDefault();
278
283
  e.stopPropagation();
@@ -487,6 +492,7 @@ var SurveyScreen = function SurveyScreen(_ref) {
487
492
  })
488
493
  }) : null)))) : null));
489
494
  })) : null));
495
+ var isClear = answers === null || answers.length === 0;
490
496
  return /*#__PURE__*/React.createElement("div", {
491
497
  className: classNames([styles.container, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, className, className !== null), styles.answered, answered), styles.inputFocused, inputFocused), styles.withPercentage, !withoutPercentage), styles.isPlaceholder, isPlaceholder)])
492
498
  }, /*#__PURE__*/React.createElement(Container, {
@@ -526,10 +532,10 @@ var SurveyScreen = function SurveyScreen(_ref) {
526
532
  paddingBottom: (current && !isPreview ? viewerBottomHeight : 0) + (footerHeight + spacing)
527
533
  } : null
528
534
  }, items, !isPlaceholder && allowCustomAnswer ? /*#__PURE__*/React.createElement("form", {
529
- className: classNames([styles.input, _defineProperty(_defineProperty(_defineProperty({}, styles.focused, inputFocused), styles.disabled, inputDisabled), styles.selected, userAnswerIndex === 'input')]),
535
+ className: classNames([styles.input, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles.focused, inputFocused), styles.filled, textInput !== null && textInput !== ''), styles.disabled, inputDisabled), styles.selected, userAnswerIndex === 'input')]),
530
536
  onSubmit: onSubmitSuggestion
531
537
  }, /*#__PURE__*/React.createElement(TextInput, {
532
- className: styles.textInput,
538
+ className: classNames([styles.textInput, _defineProperty({}, styles.padded, answers !== null && answers.length > 0)]),
533
539
  disabled: inputDisabled,
534
540
  focusable: current && isView,
535
541
  buttonStyle: _objectSpread(_objectSpread({}, buttonsStyle), customAnswerBoxStyle),
@@ -540,13 +546,23 @@ var SurveyScreen = function SurveyScreen(_ref) {
540
546
  onChange: onTextInputChange,
541
547
  onFocus: onInputFocused,
542
548
  onBlur: onInputBlurred
543
- }), /*#__PURE__*/React.createElement(Button, {
544
- className: classNames([styles.confirm, _defineProperty({}, styles.disabled, inputDisabled || textInput === null || textInput === '')]),
545
- type: "submit",
549
+ }), !answered ? /*#__PURE__*/React.createElement(Button, {
550
+ className: classNames([styles.confirm, _defineProperty(_defineProperty({}, styles.disabled, inputDisabled || textInput === null || textInput === ''), styles.isClear, isClear)]),
551
+ type: isClear ? 'button' : 'submit',
552
+ onClick: isClear ? onTextInputClear : null,
546
553
  disabled: inputDisabled || textInput === null || textInput === ''
547
- }, /*#__PURE__*/React.createElement(ArrowIcon, {
554
+ }, isClear ? /*#__PURE__*/React.createElement(CloseIcon, {
555
+ className: styles.icon
556
+ }) : /*#__PURE__*/React.createElement(ArrowIcon, {
548
557
  className: styles.icon
549
- }))) : null, userAnswerIndex !== null && finalResult !== null ? /*#__PURE__*/React.createElement(Transitions, {
558
+ })) : null, (answers === null || answers.length === 0) && !answered ? /*#__PURE__*/React.createElement(Button, {
559
+ className: classNames([styles.submit, _defineProperty({}, styles.disabled, inputDisabled || textInput === null || textInput === '')]),
560
+ type: "submit",
561
+ buttonStyle: customAnswerSubmit === null || customAnswerSubmit === void 0 ? void 0 : customAnswerSubmit.buttonStyle,
562
+ disabled: inputDisabled || textInput === null || textInput === ''
563
+ }, /*#__PURE__*/React.createElement(Text, Object.assign({}, customAnswerSubmit, {
564
+ inline: true
565
+ }))) : null) : null, userAnswerIndex !== null && finalResult !== null ? /*#__PURE__*/React.createElement(Transitions, {
550
566
  transitions: transitions,
551
567
  playing: transitionPlaying,
552
568
  disabled: transitionDisabled
@@ -659,9 +675,6 @@ var definition = {
659
675
  isList: true,
660
676
  theme: {
661
677
  textStyle: 'button'
662
- // placeholder: {
663
- // textStyle: 'text',
664
- // },
665
678
  }
666
679
  }, {
667
680
  type: 'fields',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/screen-survey",
3
- "version": "0.3.693",
3
+ "version": "0.3.694",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -87,5 +87,5 @@
87
87
  "access": "public",
88
88
  "registry": "https://registry.npmjs.org/"
89
89
  },
90
- "gitHead": "662297219d49d234efcc13ad507529d0ebff5427"
90
+ "gitHead": "7d141396597c43d5951088f0124d1a9ca092e2f8"
91
91
  }