@yoobic/yobi 8.3.0-47 → 8.3.0-48

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.
@@ -3,12 +3,12 @@ import { O as SwipeCardsMode, P as SwipeCardsDirection } from './index-e7f48bcb.
3
3
  import './index-c7d02f02.js';
4
4
  import { A as isEqual, S as shuffle, V as inRange, X as clamp } from './lodash-f6e59a8e.js';
5
5
  import { g as getAppContext } from './common-helpers-0071c2da.js';
6
- import { s as showWarningAlert, h as hasDuplicates } from './draggable-tags-helpers-39c6661b.js';
6
+ import { h as hasDuplicates, s as showWarningAlert } from './draggable-tags-helpers-39c6661b.js';
7
7
  import { a as setValueAndValidateInput } from './form-input-helpers-a792a9ab.js';
8
- import { au as isCloudinaryLink, Q as findParent, aO as Draggable, aN as getUUID, Z as translateMulti, q as gsapTimeline, bO as Power1, aP as gsapTo, bg as getMedia, A as isWeb, t as translate } from './overlays-be5a9ab3.js';
8
+ import { au as isCloudinaryLink, Q as findParent, aO as Draggable, aN as getUUID, aQ as gsapSet, Z as translateMulti, q as gsapTimeline, bO as Power1, aP as gsapTo, bg as getMedia, A as isWeb, t as translate } from './overlays-be5a9ab3.js';
9
9
  import './_commonjsHelpers-f4d11124.js';
10
10
 
11
- const formSwipeCardsCss = ".accent{color:var(--accent, #276ef1);fill:var(--accent, #276ef1)}.app-color{color:var(--app-color, #5a30f4);fill:var(--app-color, #5a30f4)}.danger{color:var(--danger, #d44333);fill:var(--danger, #d44333)}.dark{color:var(--dark, #000000);fill:var(--dark, #000000)}.energized{color:var(--energized, #ffc043);fill:var(--energized, #ffc043)}.info{color:var(--info, #d84c96);fill:var(--info, #d84c96)}.light{color:var(--light, #ffffff);fill:var(--light, #ffffff)}.stable{color:var(--stable, #adadad);fill:var(--stable, #adadad)}.stable-alt{color:var(--stable-alt, #d0d0d0);fill:var(--stable-alt, #d0d0d0)}.stable-light{color:var(--stable-light, #f1f1f1);fill:var(--stable-light, #f1f1f1)}.stable-ultralight{color:var(--stable-ultralight, #fafafa);fill:var(--stable-ultralight, #fafafa)}.success{color:var(--success, #3aa76d);fill:var(--success, #3aa76d)}.text-color{color:var(--text-color, #807f83);fill:var(--text-color, #807f83)}.warning{color:var(--warning, #ed6e33);fill:var(--warning, #ed6e33)}.wood{color:var(--wood, #99644c);fill:var(--wood, #99644c)}@-webkit-keyframes fade-out{from{opacity:1}to{opacity:0}}@keyframes fade-out{from{opacity:1}to{opacity:0}}.hidden{display:none !important}.flex{display:-ms-flexbox !important;display:flex !important}.block{display:block !important}:host{position:relative;display:block;height:100%}:host yoo-banner{height:0}:host #instructions{height:100%;-webkit-transition:opacity 1s ease-in-out;transition:opacity 1s ease-in-out}:host #instructions #header{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host #instructions #header #title{font-weight:bold}:host #instructions #categories{display:inline-grid;grid-template-columns:1fr 0.5fr 1fr;width:100%;margin:var(--spacing-24, 1.5rem) 0;text-align:center}:host #instructions #categories .category{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;height:100%;padding:0;color:var(--stable, #adadad)}:host #instructions #categories .category p{max-width:75%;margin:auto;padding:var(--spacing-16, 1rem) 0;font-weight:bold}:host #instructions #categories .category yoo-tag{margin:0 auto}:host #instructions yoo-button{position:absolute;right:0;bottom:0;z-index:1;-webkit-box-sizing:border-box;box-sizing:border-box}:host #instructions #document{background-color:var(--light, #ffffff)}:host #instructions #document .document-title{padding:0 var(--spacing-16, 1rem);font-size:var(--font-size-16, 1rem)}:host #instructions #document yoo-form-document{--outer-container-padding:cssvar(spacing-16) cssvar(spacing-16);width:calc(100% - var(--spacing-16, 1rem))}:host [direction].card{z-index:5;-webkit-transition:-webkit-transform 0.35s !important;transition:-webkit-transform 0.35s !important;transition:transform 0.35s !important;transition:transform 0.35s, -webkit-transform 0.35s !important;-webkit-transform:translate(0%, 9%) scale(1);transform:translate(0%, 9%) scale(1);opacity:1}:host [direction].card.current .content-category{color:var(--light, #ffffff);opacity:1 !important;-webkit-transition:opacity 0.35s linear;transition:opacity 0.35s linear}:host [direction].card.current.card+.card{-webkit-transform:translate(0%, 9%) scale(1);transform:translate(0%, 9%) scale(1);opacity:1}:host [direction].card.current.card+.card .content-image,:host [direction].card.current.card+.card .content-text{opacity:1 !important}:host [direction].card.current.card+.card+.card{-webkit-transform:translate(0%, 3.5%) scale(0.95);transform:translate(0%, 3.5%) scale(0.95);opacity:1}:host [direction].card.current.card+.card+.card+.card{-webkit-transform:translate(0%, -2%) scale(0.9);transform:translate(0%, -2%) scale(0.9);opacity:1}:host [direction=left]#game,:host [direction=left].current>.content-category{background-color:var(--app-color, #5a30f4) !important}:host [direction=left].current{-webkit-transform:translate(0%, 9%) scale(1) rotate(-3.5deg) !important;transform:translate(0%, 9%) scale(1) rotate(-3.5deg) !important}:host [direction=right]#game,:host [direction=right].current>.content-category{background-color:var(--warning, #ed6e33) !important}:host [direction=right].current{-webkit-transform:translate(0%, 9%) scale(1) rotate(3.5deg) !important;transform:translate(0%, 9%) scale(1) rotate(3.5deg) !important}:host #game{position:relative;width:100%;background-color:var(--dark, #000000);-webkit-transition:background-color 0.25s ease-in-out;transition:background-color 0.25s ease-in-out}:host #game #end-message{position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);width:calc(100% - 4rem);max-width:25rem;color:var(--light, #ffffff);font-size:var(--font-size-18, 1.125rem);text-align:center;visibility:hidden;opacity:0;-webkit-transition:opacity 0.5s ease-in-out;transition:opacity 0.5s ease-in-out}:host #game #end-message.rtl{top:50%;right:50%;-webkit-transform:translate(50%, -50%);transform:translate(50%, -50%)}:host #game #end-message yoo-lottie{width:30%;margin:0 auto}:host #game #end-message div{padding:var(--spacing-16, 1rem) 0;font-weight:bold;font-size:var(--font-size-24, 1.5rem)}:host #game #end-message.active{visibility:visible;opacity:1}:host #game:after{display:block;height:0;padding-top:85%;content:\"\"}:host #cards{position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);width:100%;width:65%;max-width:16rem;height:100%;margin-top:var(--spacing-16, 1rem)}:host #cards.rtl{top:50%;right:50%;-webkit-transform:translate(50%, -50%);transform:translate(50%, -50%)}:host #cards .card{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;max-width:16rem;height:100%;max-height:21.3333333333rem;margin:0 auto;overflow:hidden;color:var(--dark, #000000);font-size:var(--font-size-28, 1.75rem);text-align:center;background-color:var(--stable-light, #f1f1f1);border-radius:var(--border-radius-08, 0.5rem);-webkit-box-shadow:var(--shadow-05, -0.375rem -0.375rem 0.5rem 0 rgba(0, 0, 0, 0.1));box-shadow:var(--shadow-05, -0.375rem -0.375rem 0.5rem 0 rgba(0, 0, 0, 0.1));-webkit-transition:opacity 0.25s, background-color 0.25s, -webkit-transform 0.25s;transition:opacity 0.25s, background-color 0.25s, -webkit-transform 0.25s;transition:transform 0.25s, opacity 0.25s, background-color 0.25s;transition:transform 0.25s, opacity 0.25s, background-color 0.25s, -webkit-transform 0.25s;will-change:transform, opacity}:host #cards .card:not([direction]){-webkit-transform:translate(0, -5%) scale(0.85);transform:translate(0, -5%) scale(0.85);opacity:0}:host #cards .card.current{z-index:3}:host #cards .card.current:not(.revealing){-webkit-transform:translate(0%, 9%) scale(1);transform:translate(0%, 9%) scale(1);opacity:1;-webkit-transition-delay:200ms;transition-delay:200ms}:host #cards .card.current.revealing{-webkit-animation:\"current\" 0.25s ease-in-out;animation:\"current\" 0.25s ease-in-out;-webkit-animation-delay:150ms;animation-delay:150ms;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}@-webkit-keyframes current{to{-webkit-transform:translate(0%, 9%) scale(1);transform:translate(0%, 9%) scale(1);opacity:1}}@keyframes current{to{-webkit-transform:translate(0%, 9%) scale(1);transform:translate(0%, 9%) scale(1);opacity:1}}:host #cards .card.second{z-index:2}:host #cards .card.second:not(.revealing){-webkit-transform:translate(0%, 3.5%) scale(0.95);transform:translate(0%, 3.5%) scale(0.95);opacity:1;-webkit-transition-delay:400ms;transition-delay:400ms}:host #cards .card.second.revealing{-webkit-animation:\"second\" 0.25s ease-in-out;animation:\"second\" 0.25s ease-in-out;-webkit-animation-delay:300ms;animation-delay:300ms;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}@-webkit-keyframes second{to{-webkit-transform:translate(0%, 3.5%) scale(0.95);transform:translate(0%, 3.5%) scale(0.95);opacity:1}}@keyframes second{to{-webkit-transform:translate(0%, 3.5%) scale(0.95);transform:translate(0%, 3.5%) scale(0.95);opacity:1}}:host #cards .card.third{z-index:1}:host #cards .card.third:not(.revealing){-webkit-transform:translate(0%, -2%) scale(0.9);transform:translate(0%, -2%) scale(0.9);opacity:1;-webkit-transition-delay:600ms;transition-delay:600ms}:host #cards .card.third.revealing{-webkit-animation:\"third\" 0.25s ease-in-out;animation:\"third\" 0.25s ease-in-out;-webkit-animation-delay:450ms;animation-delay:450ms;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}@-webkit-keyframes third{to{-webkit-transform:translate(0%, -2%) scale(0.9);transform:translate(0%, -2%) scale(0.9);opacity:1}}@keyframes third{to{-webkit-transform:translate(0%, -2%) scale(0.9);transform:translate(0%, -2%) scale(0.9);opacity:1}}:host #cards .card.current .content-image,:host #cards .card.current .content-text,:host #cards .card[direction] .content-image,:host #cards .card[direction] .content-text{opacity:1 !important}:host #cards .card[swiped]{-webkit-animation:fade-out 1s ease-out;animation:fade-out 1s ease-out;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}:host #cards .card[swiped=left]{-webkit-transform:translate(-100%, 15%) rotate(-15deg);transform:translate(-100%, 15%) rotate(-15deg)}:host #cards .card[swiped=right]{-webkit-transform:translate(100%, 15%) rotate(15deg);transform:translate(100%, 15%) rotate(15deg)}:host #cards .card [class^=content]{position:absolute;width:100%;height:100%;word-break:break-word;opacity:0}:host #cards .card .content-category,:host #cards .card .content-text{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-box-sizing:border-box;box-sizing:border-box;padding:var(--spacing-16, 1rem)}:host #cards .card .content-image{-webkit-transition:opacity 0.25s linear;transition:opacity 0.25s linear}:host #cards .card[type=image] yoo-img{height:100%}:host #cards .card[type=textimage] .content-image{top:0;bottom:3.5rem}:host #cards .card[type=textimage] .content-image yoo-img{height:calc(100% - 3.5rem)}:host #cards .card[type=textimage] .content-text,:host #cards .card[type=textimage] .content-category{bottom:0;height:3.5rem}:host #actions{position:absolute;left:50%;z-index:1;display:inline-grid;grid-template-columns:1fr 1fr 1fr;width:100%;max-width:85%;line-height:2.5;-webkit-transform:translate(-50%, 80%);transform:translate(-50%, 80%)}:host #actions .action{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:start;justify-content:flex-start;text-align:center}:host([readonly]){display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}:host([readonly]) .category-title{margin-bottom:var(--spacing-08, 0.5rem)}:host([readonly]) ul{display:grid;grid-gap:var(--spacing-16, 1rem);grid-template-columns:repeat(auto-fill, 6rem);margin:0;padding-left:0;list-style:none}:host([readonly]) ul+.category-title{margin-top:var(--spacing-16, 1rem)}:host([readonly]) ul li{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;height:8rem;overflow:hidden;border-style:solid;border-width:var(--border-width-01, 0.0625rem);border-radius:var(--border-radius-08, 0.5rem)}:host([readonly]) ul li.invalid{border-color:var(--danger, #d44333)}:host([readonly]) ul li.invalid yoo-img::before{position:absolute;width:100%;height:100%;background:var(--danger-20, rgba(212, 67, 51, 0.2));content:\"\"}:host([readonly]) ul li.invalid yoo-truncate{background:var(--danger, #d44333)}:host([readonly]) ul li.valid{border-color:var(--success, #3aa76d)}:host([readonly]) ul li.valid yoo-img::before{position:absolute;width:100%;height:100%;background:var(--success-20, rgba(58, 167, 109, 0.2));content:\"\"}:host([readonly]) ul li.valid yoo-truncate{background:var(--success, #3aa76d)}:host([readonly]) ul li yoo-img{position:relative;-ms-flex-positive:1;flex-grow:1}:host([readonly]) ul li yoo-truncate{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;color:var(--light, #ffffff);font-size:var(--font-size-14, 0.875rem)}:host([readonly]) ul li yoo-truncate:only-child{--max-lines:4;height:100%;padding:0 var(--spacing-08, 0.5rem)}:host([readonly]) ul li yoo-truncate:not(:only-child){--max-lines:1;height:2.125rem;padding:0 var(--spacing-04, 0.25rem)}:host([animated]) #game{-webkit-animation:show 0.5s ease-in-out forwards;animation:show 0.5s ease-in-out forwards}@-webkit-keyframes show{from{-webkit-transform:scale(0.85);transform:scale(0.85);opacity:0}to{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes show{from{-webkit-transform:scale(0.85);transform:scale(0.85);opacity:0}to{-webkit-transform:scale(1);transform:scale(1);opacity:1}}:host([animated]) .action.hide>*{-webkit-animation:fadeOut 0.75s ease-in-out forwards;animation:fadeOut 0.75s ease-in-out forwards}@-webkit-keyframes fadeOut{from{opacity:1}to{opacity:0}}@keyframes fadeOut{from{opacity:1}to{opacity:0}}:host([animated]) .action:not(.hide)>*{-webkit-animation:fadeIn 0.75s ease-in-out forwards;animation:fadeIn 0.75s ease-in-out forwards}@-webkit-keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}:host([animated]) .action yoo-button{-webkit-transition:-webkit-transform 0.8s linear;transition:-webkit-transform 0.8s linear;transition:transform 0.8s linear;transition:transform 0.8s linear, -webkit-transform 0.8s linear}:host([live-preview]),:host(.mobile){min-height:60vh}:host([live-preview]) #instructions #header,:host(.mobile) #instructions #header{padding:var(--spacing-16, 1rem);background:var(--dark, #000000);border-radius:var(--border-radius-04, 0.25rem)}:host([live-preview]) #instructions #header #title,:host(.mobile) #instructions #header #title{color:var(--light, #ffffff);font-weight:bold;font-size:var(--font-size-28, 1.75rem)}:host([live-preview]) #instructions yoo-button,:host(.mobile) #instructions yoo-button{position:absolute;bottom:0;width:-webkit-fill-available;width:-moz-available;width:stretch}:host(.web:not([live-preview])) #instructions{position:relative}:host(.web:not([live-preview])) #instructions yoo-icon[name=swipe-explanation]{width:5rem;height:5rem;margin:auto;--inner-width:5rem;--inner-height:5rem}:host(.web:not([live-preview])) #instructions yoo-button{position:fixed;right:var(--spacing-32, 2rem);bottom:var(--spacing-16, 1rem);z-index:1;-webkit-transform:translateY(-50%);transform:translateY(-50%)}:host(.web:not([live-preview])) #game{height:60%;max-height:21rem}:host(.web:not([live-preview])) #game #cards{top:5%;margin-top:unset;-webkit-transform:translate(-50%, 0);transform:translate(-50%, 0)}:host(.web:not([live-preview])) #actions{-ms-flex-align:start;align-items:start;max-width:unset;margin-top:2.5%;-webkit-transform:translate(-50%, 0);transform:translate(-50%, 0)}:host(.web:not([live-preview])) #actions .action:nth-child(2){-ms-flex-item-align:end;align-self:end}:host(.web:not([live-preview])) #header{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;padding:var(--spacing-08, 0.5rem) var(--spacing-16, 1rem);line-height:1.75;text-align:center;background-color:var(--stable-ultralight, #fafafa)}:host(.web:not([live-preview])) #header #title{color:var(--dark, #000000) !important;font-weight:bold;font-size:var(--font-size-28, 1.75rem)}";
11
+ const formSwipeCardsCss = ".accent{color:var(--accent, #276ef1);fill:var(--accent, #276ef1)}.app-color{color:var(--app-color, #5a30f4);fill:var(--app-color, #5a30f4)}.danger{color:var(--danger, #d44333);fill:var(--danger, #d44333)}.dark{color:var(--dark, #000000);fill:var(--dark, #000000)}.energized{color:var(--energized, #ffc043);fill:var(--energized, #ffc043)}.info{color:var(--info, #d84c96);fill:var(--info, #d84c96)}.light{color:var(--light, #ffffff);fill:var(--light, #ffffff)}.stable{color:var(--stable, #adadad);fill:var(--stable, #adadad)}.stable-alt{color:var(--stable-alt, #d0d0d0);fill:var(--stable-alt, #d0d0d0)}.stable-light{color:var(--stable-light, #f1f1f1);fill:var(--stable-light, #f1f1f1)}.stable-ultralight{color:var(--stable-ultralight, #fafafa);fill:var(--stable-ultralight, #fafafa)}.success{color:var(--success, #3aa76d);fill:var(--success, #3aa76d)}.text-color{color:var(--text-color, #807f83);fill:var(--text-color, #807f83)}.warning{color:var(--warning, #ed6e33);fill:var(--warning, #ed6e33)}.wood{color:var(--wood, #99644c);fill:var(--wood, #99644c)}@-webkit-keyframes fade-out{from{opacity:1}to{opacity:0}}@keyframes fade-out{from{opacity:1}to{opacity:0}}.hidden{display:none !important}.flex{display:-ms-flexbox !important;display:flex !important}.block{display:block !important}:host(:not([readonly])){position:relative;display:block;height:100%}:host(:not([readonly])) yoo-banner{height:0}:host(:not([readonly])) main{display:grid;height:100%;-webkit-transition:opacity 1s ease-in-out;transition:opacity 1s ease-in-out}:host(:not([readonly])) [direction] .card{-webkit-transition:-webkit-transform 0.35s !important;transition:-webkit-transform 0.35s !important;transition:transform 0.35s !important;transition:transform 0.35s, -webkit-transform 0.35s !important;-webkit-transform:translate(0%, 9%) scale(1);transform:translate(0%, 9%) scale(1);opacity:1}:host(:not([readonly])) [direction] .card.current [class^=content]::after{opacity:0.8 !important}:host(:not([readonly])) [direction] .card.current .content-text{color:var(--stable-light, #f1f1f1)}:host(:not([readonly])) [direction] .card.current.card+.card{-webkit-transform:translate(0%, 9%) scale(1);transform:translate(0%, 9%) scale(1);opacity:1}:host(:not([readonly])) [direction] .card.current.card+.card .content-image,:host(:not([readonly])) [direction] .card.current.card+.card .content-text{opacity:1 !important}:host(:not([readonly])) [direction] .card.current.card+.card+.card{-webkit-transform:translate(0%, 3.5%) scale(0.95);transform:translate(0%, 3.5%) scale(0.95);opacity:1}:host(:not([readonly])) [direction] .card.current.card+.card+.card+.card{-webkit-transform:translate(0%, -2%) scale(0.9);transform:translate(0%, -2%) scale(0.9);opacity:1}:host(:not([readonly])) [direction=left] #background,:host(:not([readonly])) [direction=left] .current [class^=content]::after{background-color:var(--app-color, #5a30f4) !important}:host(:not([readonly])) [direction=left] .current{-webkit-transform:translate(0%, 9%) scale(1) rotate(-3.5deg) !important;transform:translate(0%, 9%) scale(1) rotate(-3.5deg) !important}:host(:not([readonly])) [direction=right] #background,:host(:not([readonly])) [direction=right] .current [class^=content]::after{background-color:var(--warning, #ed6e33) !important}:host(:not([readonly])) [direction=right] .current{-webkit-transform:translate(0%, 9%) scale(1) rotate(3.5deg) !important;transform:translate(0%, 9%) scale(1) rotate(3.5deg) !important}:host(:not([readonly])) #game #background{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;height:100%;max-height:calc(min(65vw, 16rem) * 1.3333333333 - var(--spacing-40, 2.5rem));background-color:var(--dark, #000000);-webkit-transition:background-color 0.25s ease-in-out;transition:background-color 0.25s ease-in-out}:host(:not([readonly])) #game #end-message{display:grid;color:var(--light, #ffffff);font-size:var(--font-size-18, 1.125rem);text-align:center;visibility:hidden;opacity:0;-webkit-transition:opacity 0.5s ease-in-out;transition:opacity 0.5s ease-in-out}:host(:not([readonly])) #game #end-message yoo-lottie{width:30%;margin:0 auto}:host(:not([readonly])) #game #end-message div{font-weight:bold;font-size:var(--font-size-24, 1.5rem)}:host(:not([readonly])) #game #end-message span{padding-top:var(--spacing-16, 1rem)}:host(:not([readonly])) #game #end-message.active{visibility:visible;opacity:1}:host(:not([readonly])) #cards,:host(:not([readonly])) .card{width:100%;height:100%}:host(:not([readonly])) #cards{position:absolute;top:0;left:50%;max-width:min(65vw, 16rem);max-height:calc(min(65vw, 16rem) * 1.3333333333 - var(--spacing-40, 2.5rem));margin-top:var(--spacing-16, 1rem);-webkit-transform:translateX(-50%);transform:translateX(-50%)}:host(:not([readonly])) #cards .card{position:absolute;top:0;right:0;bottom:0;left:0;margin:0 auto;overflow:hidden;color:var(--dark, #000000);font-size:var(--font-size-28, 1.75rem);text-align:center;background-color:var(--stable-light, #f1f1f1);border-radius:var(--border-radius-08, 0.5rem);-webkit-box-shadow:var(--shadow-05, -0.375rem -0.375rem 0.5rem 0 rgba(0, 0, 0, 0.1));box-shadow:var(--shadow-05, -0.375rem -0.375rem 0.5rem 0 rgba(0, 0, 0, 0.1));-webkit-transition:opacity 0.25s, background-color 0.25s, -webkit-transform 0.25s;transition:opacity 0.25s, background-color 0.25s, -webkit-transform 0.25s;transition:transform 0.25s, opacity 0.25s, background-color 0.25s;transition:transform 0.25s, opacity 0.25s, background-color 0.25s, -webkit-transform 0.25s;will-change:transform, opacity}:host(:not([readonly])) #cards .card:not([direction]){-webkit-transform:translate(0, -5%) scale(0.85);transform:translate(0, -5%) scale(0.85);opacity:0}:host(:not([readonly])) #cards .card.current{z-index:3}:host(:not([readonly])) #cards .card.current:not(.revealing){-webkit-transform:translate(0%, 9%) scale(1);transform:translate(0%, 9%) scale(1);opacity:1;-webkit-transition-delay:200ms;transition-delay:200ms}:host(:not([readonly])) #cards .card.current.revealing{-webkit-animation:\"current\" 0.25s ease-in-out;animation:\"current\" 0.25s ease-in-out;-webkit-animation-delay:150ms;animation-delay:150ms;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}@-webkit-keyframes current{to{-webkit-transform:translate(0%, 9%) scale(1);transform:translate(0%, 9%) scale(1);opacity:1}}@keyframes current{to{-webkit-transform:translate(0%, 9%) scale(1);transform:translate(0%, 9%) scale(1);opacity:1}}:host(:not([readonly])) #cards .card.second{z-index:2}:host(:not([readonly])) #cards .card.second:not(.revealing){-webkit-transform:translate(0%, 3.5%) scale(0.95);transform:translate(0%, 3.5%) scale(0.95);opacity:1;-webkit-transition-delay:400ms;transition-delay:400ms}:host(:not([readonly])) #cards .card.second.revealing{-webkit-animation:\"second\" 0.25s ease-in-out;animation:\"second\" 0.25s ease-in-out;-webkit-animation-delay:300ms;animation-delay:300ms;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}@-webkit-keyframes second{to{-webkit-transform:translate(0%, 3.5%) scale(0.95);transform:translate(0%, 3.5%) scale(0.95);opacity:1}}@keyframes second{to{-webkit-transform:translate(0%, 3.5%) scale(0.95);transform:translate(0%, 3.5%) scale(0.95);opacity:1}}:host(:not([readonly])) #cards .card.third{z-index:1}:host(:not([readonly])) #cards .card.third:not(.revealing){-webkit-transform:translate(0%, -2%) scale(0.9);transform:translate(0%, -2%) scale(0.9);opacity:1;-webkit-transition-delay:600ms;transition-delay:600ms}:host(:not([readonly])) #cards .card.third.revealing{-webkit-animation:\"third\" 0.25s ease-in-out;animation:\"third\" 0.25s ease-in-out;-webkit-animation-delay:450ms;animation-delay:450ms;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}@-webkit-keyframes third{to{-webkit-transform:translate(0%, -2%) scale(0.9);transform:translate(0%, -2%) scale(0.9);opacity:1}}@keyframes third{to{-webkit-transform:translate(0%, -2%) scale(0.9);transform:translate(0%, -2%) scale(0.9);opacity:1}}:host(:not([readonly])) #cards .card.current [class^=content],:host(:not([readonly])) #cards .card.current [class^=content]::after{-webkit-transition:color 0.5s, background-color 0.5s ease-in-out, opacity 0.5s ease-in-out;transition:color 0.5s, background-color 0.5s ease-in-out, opacity 0.5s ease-in-out}:host(:not([readonly])) #cards .card.current [class^=content]::after{position:absolute;top:0;left:0;z-index:1;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%;color:var(--light, #ffffff);opacity:0;content:attr(data-category)}:host(:not([readonly])) #cards .card.current .content-image,:host(:not([readonly])) #cards .card.current .content-text,:host(:not([readonly])) #cards .card[direction] .content-image,:host(:not([readonly])) #cards .card[direction] .content-text{opacity:1 !important}:host(:not([readonly])) #cards .card[swiped]{-webkit-animation:fade-out 1s ease-out;animation:fade-out 1s ease-out;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}:host(:not([readonly])) #cards .card[swiped=left]{-webkit-transform:translate(-100%, 15%) rotate(-15deg);transform:translate(-100%, 15%) rotate(-15deg)}:host(:not([readonly])) #cards .card[swiped=right]{-webkit-transform:translate(100%, 15%) rotate(15deg);transform:translate(100%, 15%) rotate(15deg)}:host(:not([readonly])) #cards .card [class^=content]{position:absolute;width:100%;height:100%;word-break:break-word}:host(:not([readonly])) #cards .card .content-text{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-box-sizing:border-box;box-sizing:border-box;padding:var(--spacing-16, 1rem)}:host(:not([readonly])) #cards .card .content-image{-webkit-transition:opacity 0.25s linear;transition:opacity 0.25s linear}:host(:not([readonly])) #cards .card[type=image] yoo-img{height:100%}:host(:not([readonly])) #cards .card[type=textimage] .content-image{top:0;bottom:3.5rem}:host(:not([readonly])) #cards .card[type=textimage] .content-image yoo-img{height:calc(100% - 3.5rem)}:host(:not([readonly])) #cards .card[type=textimage] .content-text{bottom:0;height:3.5rem}:host(:not([readonly])) #actions{position:absolute;top:calc(109% + var(--spacing-16, 1rem));display:inline-grid;grid-template-columns:1fr 1fr 1fr;width:100%;max-width:min(65vw, 16rem);margin-top:var(--spacing-16, 1rem);padding-bottom:var(--spacing-16, 1rem);line-height:2.5}:host(:not([readonly])) #actions .action{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:start;justify-content:flex-start;line-height:1.75;text-align:center}:host(:not([readonly])) #actions .action yoo-button{margin-bottom:var(--spacing-08, 0.5rem)}:host([readonly]){display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}:host([readonly]) .category-title{margin-bottom:var(--spacing-08, 0.5rem)}:host([readonly]) ul{display:grid;grid-gap:var(--spacing-16, 1rem);grid-template-columns:repeat(auto-fill, 6rem);margin:0;padding-left:0;list-style:none}:host([readonly]) ul+.category-title{margin-top:var(--spacing-16, 1rem)}:host([readonly]) ul li{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;height:8rem;overflow:hidden;border-style:solid;border-width:var(--border-width-01, 0.0625rem);border-radius:var(--border-radius-08, 0.5rem)}:host([readonly]) ul li.invalid{border-color:var(--danger, #d44333)}:host([readonly]) ul li.invalid yoo-img::before{position:absolute;width:100%;height:100%;background:var(--danger-20, rgba(212, 67, 51, 0.2));content:\"\"}:host([readonly]) ul li.invalid yoo-truncate{background:var(--danger, #d44333)}:host([readonly]) ul li.valid{border-color:var(--success, #3aa76d)}:host([readonly]) ul li.valid yoo-img::before{position:absolute;width:100%;height:100%;background:var(--success-20, rgba(58, 167, 109, 0.2));content:\"\"}:host([readonly]) ul li.valid yoo-truncate{background:var(--success, #3aa76d)}:host([readonly]) ul li yoo-img{position:relative;-ms-flex-positive:1;flex-grow:1}:host([readonly]) ul li yoo-truncate{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;color:var(--light, #ffffff);font-size:var(--font-size-14, 0.875rem)}:host([readonly]) ul li yoo-truncate:only-child{--max-lines:4;height:100%;padding:0 var(--spacing-08, 0.5rem)}:host([readonly]) ul li yoo-truncate:not(:only-child){--max-lines:1;height:2.125rem;padding:0 var(--spacing-04, 0.25rem)}:host([animated]) #game{-webkit-animation:show 0.5s ease-in-out forwards;animation:show 0.5s ease-in-out forwards}@-webkit-keyframes show{from{-webkit-transform:scale(0.85);transform:scale(0.85);opacity:0}to{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes show{from{-webkit-transform:scale(0.85);transform:scale(0.85);opacity:0}to{-webkit-transform:scale(1);transform:scale(1);opacity:1}}:host([animated]) .action.hide>*{-webkit-animation:fadeOut 0.75s ease-in-out forwards;animation:fadeOut 0.75s ease-in-out forwards}@-webkit-keyframes fadeOut{from{opacity:1}to{opacity:0}}@keyframes fadeOut{from{opacity:1}to{opacity:0}}:host([animated]) .action:not(.hide)>*{-webkit-animation:fadeIn 0.75s ease-in-out forwards;animation:fadeIn 0.75s ease-in-out forwards}@-webkit-keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}:host([animated]) .action yoo-button{-webkit-transition:-webkit-transform 0.8s linear;transition:-webkit-transform 0.8s linear;transition:transform 0.8s linear;transition:transform 0.8s linear, -webkit-transform 0.8s linear}:host([live-preview][view=instructions]) #instructions #header,:host(.mobile[view=instructions]) #instructions #header{padding:var(--spacing-16, 1rem);background:var(--dark, #000000);border-radius:var(--border-radius-04, 0.25rem)}:host([live-preview][view=instructions]) #instructions #header #title,:host(.mobile[view=instructions]) #instructions #header #title{color:var(--light, #ffffff);font-weight:bold;font-size:var(--font-size-28, 1.75rem)}:host(.web:not([live-preview])) #cards{-webkit-transform:translate(-50%, 0);transform:translate(-50%, 0)}:host(.web:not([live-preview])) .action:nth-child(2){margin-top:calc(10% + 3rem)}:host(.web:not([live-preview])) #header{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;padding:var(--spacing-08, 0.5rem) var(--spacing-16, 1rem);line-height:1.75;text-align:center;background-color:var(--stable-ultralight, #fafafa)}:host(.web:not([live-preview])) #header #title{color:var(--dark, #000000) !important;font-weight:bold;font-size:var(--font-size-28, 1.75rem)}:host(.web:not([live-preview])[view=game]) main{grid-template-rows:auto 100% 1fr}:host(.web:not([live-preview])[view=game]) main #actions{top:109%;min-width:32rem;margin-top:0}:host(.web:not([live-preview])[view=instructions]) yoo-icon[name=swipe-explanation]{width:5rem;height:5rem;margin:auto;--inner-width:5rem;--inner-height:5rem}:host(.web:not([live-preview])[view=instructions]) yoo-button{position:fixed;right:var(--spacing-32, 2rem);bottom:var(--spacing-16, 1rem)}:host([view=instructions]) main{grid-template-rows:1fr auto}:host([view=instructions]) main #instructions #header{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host([view=instructions]) main #instructions #header #title{font-weight:bold}:host([view=instructions]) main #instructions #categories{display:inline-grid;grid-template-columns:1fr 0.5fr 1fr;width:100%;margin:var(--spacing-24, 1.5rem) 0;text-align:center}:host([view=instructions]) main #instructions #categories .category{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;height:100%;padding:0;color:var(--stable, #adadad)}:host([view=instructions]) main #instructions #categories .category p{max-width:75%;margin:auto;padding:var(--spacing-16, 1rem) 0;font-weight:bold}:host([view=instructions]) main #instructions #categories .category yoo-tag{margin:0 auto}:host([view=instructions]) main #instructions #document{background-color:var(--light, #ffffff)}:host([view=instructions]) main #instructions #document .document-title{padding:0 var(--spacing-16, 1rem);font-size:var(--font-size-16, 1rem)}:host([view=instructions]) main #instructions #document yoo-form-document{--outer-container-padding:cssvar(spacing-16) cssvar(spacing-16);width:calc(100% - var(--spacing-16, 1rem))}:host([view=instructions]) main yoo-button{-ms-flex-align:end;align-items:flex-end;padding-bottom:var(--spacing-16, 1rem)}";
12
12
 
13
13
  const YooFormSwipeCardsComponent = class {
14
14
  constructor(hostRef) {
@@ -23,36 +23,36 @@ const YooFormSwipeCardsComponent = class {
23
23
  this.shuffled = true;
24
24
  this.values = [];
25
25
  this.swipeCards = [];
26
- this.cardsElements = [];
27
26
  this.swipeButtons = [];
28
27
  }
28
+ onIsVisibleChanged() {
29
+ // Timeout here to wait for the yoo-form-footer to be mounted after a slide has
30
+ // been changed, this will be removed after the refactor of the slides component
31
+ setTimeout(() => this.displayFooterElement(), 150);
32
+ }
29
33
  onCategoriesChanged(nv, ov) {
30
34
  this.hasDataChanged = !isEqual(nv, ov);
31
- if (this.hasDataChanged) {
32
- this.spyOnValuesChanged();
33
- }
35
+ this.showWarnings();
34
36
  }
35
37
  onValuesChanged(nv, ov) {
36
38
  this.hasDataChanged = !isEqual(nv, ov);
39
+ this.hasDataChanged && this.prepareGame();
40
+ this.resetCards();
37
41
  if (!this.isMode.image) {
38
- this.spyOnValuesChanged();
42
+ this.showWarnings();
39
43
  }
40
44
  }
41
45
  onImagesChanged(nv, ov) {
42
46
  this.hasDataChanged = !isEqual(nv, ov);
47
+ this.hasDataChanged && this.prepareGame();
48
+ this.resetCards();
43
49
  if (!this.isMode.text) {
44
- this.spyOnValuesChanged();
50
+ this.showWarnings();
45
51
  }
46
52
  }
47
53
  onRequireChanged() {
48
54
  this.validate();
49
55
  }
50
- // eslint-disable-next-line @stencil/decorators-style
51
- onIsVisibleChanged() {
52
- // Timeout here to wait for the yoo-form-footer to be mounted after a slide has
53
- // been changed, this will be removed after the refactor of the slides component
54
- setTimeout(() => this.displayFooterElement(!this.showInstructionView), 150);
55
- }
56
56
  get isMode() {
57
57
  const { image, text, textimage } = SwipeCardsMode;
58
58
  return {
@@ -61,14 +61,26 @@ const YooFormSwipeCardsComponent = class {
61
61
  text: this.mode === text
62
62
  };
63
63
  }
64
- get numberEmptyItems() {
65
- var _a;
66
- const checkEmptyValues = (v) => { var _a; return ((_a = v === null || v === void 0 ? void 0 : v.filter((v) => !v)) === null || _a === void 0 ? void 0 : _a.length) || 0; };
64
+ get cardData() {
65
+ var _a, _b;
67
66
  return {
68
- image: checkEmptyValues((_a = this.images) === null || _a === void 0 ? void 0 : _a.map(img => img._downloadURL)),
69
- text: checkEmptyValues(this.values)
67
+ imagesUrls: ((_a = this.images) === null || _a === void 0 ? void 0 : _a.filter(({ _downloadURL }) => _downloadURL)) || [],
68
+ texts: ((_b = this.values) === null || _b === void 0 ? void 0 : _b.filter((v) => v)) || [],
69
+ getLength(type) {
70
+ return type === 'images' ? this.imagesUrls.length : this.texts.length;
71
+ },
72
+ hasMinimum(type) {
73
+ return (type === 'images' ? this.imagesUrls.length : this.texts.length) >= 2;
74
+ },
75
+ hasEmpty(type) {
76
+ var _a, _b;
77
+ return !!(type === 'images' ? (_a = this.image) === null || _a === void 0 ? void 0 : _a.filter(({ _downloadURL }) => !_downloadURL).length : (_b = this.image) === null || _b === void 0 ? void 0 : _b.filter((v) => !v).length);
78
+ }
70
79
  };
71
80
  }
81
+ get cardsElements() {
82
+ return Array.from(this.host.shadowRoot.querySelectorAll('.card')) || [];
83
+ }
72
84
  get hasImage() {
73
85
  return this.isMode.image || this.isMode.textimage;
74
86
  }
@@ -76,8 +88,34 @@ const YooFormSwipeCardsComponent = class {
76
88
  return this.isMode.text || this.isMode.textimage;
77
89
  }
78
90
  get hasTwoCategories() {
79
- var _a, _b;
80
- return !!(((_a = this.categories) === null || _a === void 0 ? void 0 : _a.length) && ((_b = this.categories) === null || _b === void 0 ? void 0 : _b.filter((v) => v).length) === 2);
91
+ var _a;
92
+ return ((_a = this.categories) === null || _a === void 0 ? void 0 : _a.filter((v) => v).length) === 2;
93
+ }
94
+ get hasDuplicateValues() {
95
+ return this.hasText && hasDuplicates(this.cardData.texts);
96
+ }
97
+ get hasEmptyValues() {
98
+ const hasEmptyImagesValues = this.cardData.hasEmpty('images');
99
+ const hasEmptyTextsValues = this.cardData.hasEmpty('texts');
100
+ return (this.hasMinimumRequiredData &&
101
+ (this.isMode.image
102
+ ? hasEmptyImagesValues
103
+ : this.isMode.text
104
+ ? hasEmptyTextsValues
105
+ : hasEmptyImagesValues || hasEmptyTextsValues || this.cardData.getLength('images') !== this.cardData.getLength('texts')));
106
+ }
107
+ get hasMinimumRequiredData() {
108
+ const hasMinimumImagesValues = this.cardData.hasMinimum('images');
109
+ const hasMinimumTextsValues = this.cardData.hasMinimum('texts');
110
+ return this.isMode.image ? hasMinimumImagesValues : this.isMode.text ? hasMinimumTextsValues : hasMinimumImagesValues && hasMinimumTextsValues;
111
+ }
112
+ get hasData() {
113
+ const hasImagesValues = !!this.cardData.getLength('images');
114
+ const hasTextsValues = !!this.cardData.getLength('texts');
115
+ return this.isMode.image ? hasImagesValues : this.isMode.text ? hasTextsValues : hasImagesValues && hasTextsValues;
116
+ }
117
+ get isDataValid() {
118
+ return this.hasTwoCategories && this.hasMinimumRequiredData && !this.hasDuplicateValues && !this.hasEmptyValues;
81
119
  }
82
120
  get hasAllCardBeenSwiped() {
83
121
  var _a;
@@ -85,7 +123,7 @@ const YooFormSwipeCardsComponent = class {
85
123
  }
86
124
  get buttons() {
87
125
  const { left, right, undo } = SwipeCardsDirection;
88
- const getButton = (direction) => { var _a, _b; return (_b = (_a = this.swipeButtons) === null || _a === void 0 ? void 0 : _a.filter(({ id }) => id === `swipe-${direction}`)) === null || _b === void 0 ? void 0 : _b[0]; };
126
+ const getButton = (direction) => { var _a, _b, _c; return (_c = (_b = (_a = this.swipeButtons) === null || _a === void 0 ? void 0 : _a.filter((button) => button)) === null || _b === void 0 ? void 0 : _b.filter(({ id }) => id === `swipe-${direction}`)) === null || _c === void 0 ? void 0 : _c[0]; };
89
127
  return {
90
128
  left: getButton(left),
91
129
  undo: getButton(undo),
@@ -112,20 +150,20 @@ const YooFormSwipeCardsComponent = class {
112
150
  this.updateGame();
113
151
  }
114
152
  validate() {
115
- var _a;
116
- const numberSwipedCards = (_a = this.swipeCards.filter(card => card.swipedDirection)) === null || _a === void 0 ? void 0 : _a.length;
117
- this.validity = numberSwipedCards === (this.hasImage ? this.images.length : this.values.length);
153
+ var _a, _b;
154
+ const numberSwipedCards = (_a = this.swipeCards.filter((card) => card.swipedDirection)) === null || _a === void 0 ? void 0 : _a.length;
155
+ this.validity = !this.required || numberSwipedCards === ((_b = this.cardData[this.hasImage ? 'imagesUrls' : 'texts']) === null || _b === void 0 ? void 0 : _b.length);
118
156
  this.validityChanged.emit(this.validity);
119
157
  return this.validity;
120
158
  }
121
159
  prepareGame() {
122
160
  this.shuffleCardValues();
123
- this.animationDelay = this.animated ? .25 : 0;
161
+ this.animationDelay = this.animated ? 0.25 : 0;
124
162
  this.revealCards = !this.showInstructionView;
125
163
  this.swipeCards = this.initCards();
126
164
  }
127
165
  initGame() {
128
- this.displayFooterElement(false);
166
+ this.displayFooterElement();
129
167
  !this.showInstructionView && this.initDraggable();
130
168
  }
131
169
  updateCardsData() {
@@ -139,34 +177,32 @@ const YooFormSwipeCardsComponent = class {
139
177
  updateGame() {
140
178
  if (this.revealCards) {
141
179
  this.hasDataChanged = false;
142
- this.revealCards = false;
143
180
  this.initDraggable();
181
+ setTimeout(() => {
182
+ if (this.host.scrollHeight > this.host.clientHeight) {
183
+ this.host.scrollTo({
184
+ top: this.host.scrollHeight,
185
+ behavior: 'smooth'
186
+ });
187
+ }
188
+ }, 1000);
144
189
  }
145
- setTimeout(() => this.lockSwipeButtons(false), 750);
190
+ setTimeout(() => this.lockSwipeActions(false), 750);
191
+ this.displayFooterElement();
146
192
  }
147
193
  shuffleCardValues() {
148
- const cardData = this.hasImage ? this.images.filter((f) => (this.isMode.textimage ? f === null || f === void 0 ? void 0 : f._filename : f)) : this.values.filter((v) => v);
194
+ const cardData = this.hasImage ? this.cardData.imagesUrls : this.cardData.texts;
149
195
  this.cardValues = this.shuffled ? shuffle(cardData) : cardData;
150
196
  }
151
- getCardElement(id) {
197
+ getCardElement(cardId) {
152
198
  var _a;
153
- return (_a = this.cardsElements) === null || _a === void 0 ? void 0 : _a.find((cardElement) => (cardElement === null || cardElement === void 0 ? void 0 : cardElement.id) === id);
154
- }
155
- spyOnValuesChanged() {
156
- this.hasDataChanged && this.showWarnings();
199
+ return (_a = this.cardsElements) === null || _a === void 0 ? void 0 : _a.find(({ id }) => cardId === id);
157
200
  }
158
201
  showWarnings() {
159
- var _a;
160
- if (((_a = this.values) === null || _a === void 0 ? void 0 : _a.length) && this.livePreview && !this.hasTwoCategories) {
161
- showWarningAlert(this.host, true, 'NOTFULFILLEDCATEGORIES');
162
- }
163
- else if (this.hasTwoCategories && this.livePreview) {
164
- this.hasEmptyValues = !!this.numberEmptyItems.text || !!this.numberEmptyItems.image;
165
- this.hasDuplicatesValues = this.hasText && hasDuplicates(this.values);
166
- let showAlert = this.hasEmptyValues || this.hasDuplicatesValues;
167
- this.isMode.textimage && this.hasEmptyValues && (showAlert = showAlert && this.numberEmptyItems.text !== this.numberEmptyItems.image);
168
- const bannerMessage = this.hasDuplicatesValues ? 'NODUPLICATEVALUES' : this.hasEmptyValues ? 'NOEMPTYVALUES' : '';
169
- const bannerColor = this.hasDuplicatesValues ? 'danger' : this.hasEmptyValues ? 'warning' : null;
202
+ if (this.livePreview && this.hasDataChanged && this.hasData) {
203
+ const bannerMessage = this.hasDuplicateValues ? 'NODUPLICATEVALUES' : this.hasEmptyValues ? 'NOEMPTYVALUES' : !this.hasTwoCategories ? 'NOTFULFILLEDCATEGORIES' : '';
204
+ const bannerColor = this.hasDuplicateValues || !this.hasTwoCategories ? 'danger' : this.hasEmptyValues ? 'warning' : null;
205
+ const showAlert = !!bannerMessage;
170
206
  showWarningAlert(this.host, showAlert, bannerMessage, bannerColor);
171
207
  this.hasDataChanged = !showAlert;
172
208
  if (showAlert)
@@ -177,48 +213,49 @@ const YooFormSwipeCardsComponent = class {
177
213
  const formatCardValue = (value) => {
178
214
  var _a, _b;
179
215
  if (this.isMode.image) {
180
- return isCloudinaryLink((_b = (_a = this.answer) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b[0]) ? value._downloadURL :
181
- value._downloadURL.split('/').pop();
216
+ return isCloudinaryLink((_b = (_a = this.answer) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b[0]) ? value._downloadURL : value._downloadURL.split('/').pop();
182
217
  }
183
218
  if (this.isMode.textimage) {
184
219
  return value._filename;
185
220
  }
186
221
  return value;
187
222
  };
188
- const getValuesFromDirection = (direction) => this.swipeCards.filter(c => c.swipedDirection === direction).map(c => formatCardValue(c.value));
189
- this.livePreview ? forceUpdate(this) : setValueAndValidateInput([
190
- getValuesFromDirection(SwipeCardsDirection.left),
191
- getValuesFromDirection(SwipeCardsDirection.right)
192
- ], this);
223
+ const getValuesFromDirection = (direction) => this.swipeCards.filter((c) => c.swipedDirection === direction).map((c) => formatCardValue(c.value));
224
+ this.livePreview ? forceUpdate(this) : setValueAndValidateInput([getValuesFromDirection(SwipeCardsDirection.left), getValuesFromDirection(SwipeCardsDirection.right)], this);
193
225
  }
194
- displayFooterElement(show = true) {
226
+ displayFooterElement() {
195
227
  var _a, _b;
196
228
  const yooIonSlideEl = findParent(this.host, 'yoo-ion-slide');
197
- if (yooIonSlideEl) {
198
- const footerElement = yooIonSlideEl.querySelector('yoo-form-footer');
199
- if (footerElement) {
200
- this.nextButtonText = ((_b = (_a = footerElement === null || footerElement === void 0 ? void 0 : footerElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('yoo-button:last-of-type')) === null || _b === void 0 ? void 0 : _b.textContent) || '';
201
- footerElement.style.display = show ? 'block' : 'none';
202
- }
229
+ const footerElement = yooIonSlideEl === null || yooIonSlideEl === void 0 ? void 0 : yooIonSlideEl.querySelector('yoo-form-footer');
230
+ if (footerElement) {
231
+ this.nextButtonText = ((_b = (_a = footerElement === null || footerElement === void 0 ? void 0 : footerElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('yoo-button:last-of-type')) === null || _b === void 0 ? void 0 : _b.textContent) || '';
232
+ footerElement.style.display = !this.showInstructionView ? 'block' : 'none';
203
233
  }
204
234
  }
205
235
  initDraggable() {
206
- this.cardsElements
207
- .filter(e => !Draggable.get(e))
208
- .forEach(e => this.getDraggableInstance(e));
209
- this.cardsElements.forEach(e => e === null || e === void 0 ? void 0 : e.classList.remove('revealing'));
236
+ this.cardsElements.filter((e) => !Draggable.get(e)).forEach((e) => this.getDraggableInstance(e));
237
+ this.cardsElements.forEach((e) => e === null || e === void 0 ? void 0 : e.classList.remove('revealing'));
210
238
  }
211
239
  initCards() {
212
240
  var _a;
213
- return ((_a = this.cardValues) === null || _a === void 0 ? void 0 : _a.map(v => ({ id: getUUID(), value: this.hasImage ? v : v }))) || [];
241
+ return ((_a = this.cardValues) === null || _a === void 0 ? void 0 : _a.map((value) => ({ id: getUUID(), value }))) || [];
214
242
  }
215
- lockSwipeButtons(lockState = true) {
243
+ lockSwipeActions(lockState = true) {
216
244
  var _a;
217
- (_a = this.swipeButtons) === null || _a === void 0 ? void 0 : _a.forEach(b => b && (b.disabled = lockState));
245
+ (_a = this.swipeButtons) === null || _a === void 0 ? void 0 : _a.forEach((b) => b && (b.disabled = this.animated ? lockState : false));
246
+ }
247
+ async resetCards() {
248
+ var _a, _b;
249
+ this.showInstructionView = true;
250
+ await Promise.all((_a = this.swipeCards) === null || _a === void 0 ? void 0 : _a.map((card) => this.undoCard(card, false)));
251
+ (_b = this.cardsElements) === null || _b === void 0 ? void 0 : _b.forEach((cardElement) => {
252
+ cardElement.removeAttribute('swiped');
253
+ gsapSet(cardElement, { clearProps: 'all' });
254
+ });
218
255
  }
219
256
  swipeCard(direction) {
220
257
  if (this.currentCard) {
221
- this.lockSwipeButtons();
258
+ this.lockSwipeActions();
222
259
  this.buttons[direction].style.removeProperty('transform');
223
260
  this.gameContainerElement.removeAttribute('direction');
224
261
  this.currentCardElement.setAttribute('swiped', direction);
@@ -229,11 +266,7 @@ const YooFormSwipeCardsComponent = class {
229
266
  getSwipedState(swipeProgress) {
230
267
  const swipeThresholds = [0.35, 0.65];
231
268
  return {
232
- swipedDirection: swipeProgress < swipeThresholds[0]
233
- ? SwipeCardsDirection.left
234
- : swipeProgress > swipeThresholds[1]
235
- ? SwipeCardsDirection.right
236
- : null,
269
+ swipedDirection: swipeProgress < swipeThresholds[0] ? SwipeCardsDirection.left : swipeProgress > swipeThresholds[1] ? SwipeCardsDirection.right : null,
237
270
  isCardThrowable: !inRange(swipeProgress, swipeThresholds[0], swipeThresholds[1])
238
271
  };
239
272
  }
@@ -241,12 +274,16 @@ const YooFormSwipeCardsComponent = class {
241
274
  if (this.currentCardElement) {
242
275
  const { left, right } = SwipeCardsDirection;
243
276
  const [categoryLeft, categoryRight] = this.categories;
244
- const categoryContainer = this.currentCardElement.querySelector('.content-category');
245
277
  const isThrowable = [left, right].includes(swipingDirection);
246
- categoryContainer.textContent = translateMulti(swipingDirection === left ? categoryLeft : swipingDirection === right ? categoryRight : '');
247
- [this.gameContainerElement, this.currentCardElement].forEach(e => {
248
- isThrowable ? e.setAttribute('direction', swipingDirection) : e.removeAttribute('direction');
249
- });
278
+ const contentContainer = this.currentCardElement.querySelector(`.content-${this.isMode.image ? 'image' : 'text'}`);
279
+ if (isThrowable) {
280
+ this.gameContainerElement.setAttribute('direction', swipingDirection);
281
+ contentContainer.dataset.category = translateMulti(swipingDirection === left ? categoryLeft : swipingDirection === right ? categoryRight : '');
282
+ }
283
+ else {
284
+ this.gameContainerElement.removeAttribute('direction');
285
+ contentContainer.removeAttribute('data-category');
286
+ }
250
287
  }
251
288
  }
252
289
  async getDraggableInstance(cardElement) {
@@ -254,16 +291,12 @@ const YooFormSwipeCardsComponent = class {
254
291
  if (!timeline || !cardElement) {
255
292
  return;
256
293
  }
257
- this.revealCards = false;
258
294
  const maxRange = this.host.clientWidth / 2;
259
295
  const returnedAnimation = timeline();
260
296
  // building swiping animation
261
297
  const swipeAnimation = timeline({ paused: true });
262
- const isSwipeable = el => el.classList.contains('current');
263
- swipeAnimation
264
- .fromTo(this.buttons.left, 1, { scale: 1.5 }, { scale: 1 }, 0)
265
- .fromTo(this.buttons.right, 1, { scale: 1 }, { scale: 1.5 }, 1)
266
- .progress(.5);
298
+ const isSwipeable = (el) => el.classList.contains('current');
299
+ swipeAnimation.fromTo(this.buttons.left, 1, { scale: 1.5 }, { scale: 1 }, 0).fromTo(this.buttons.right, 1, { scale: 1 }, { scale: 1.5 }, 1).progress(0.5);
267
300
  const onStartSwiping = () => {
268
301
  if (isSwipeable(cardElement)) {
269
302
  this.blockMoves.emit(true);
@@ -281,26 +314,26 @@ const YooFormSwipeCardsComponent = class {
281
314
  const baseProps = { left: 0, top: 0 };
282
315
  if (isSwipeable(cardElement)) {
283
316
  const { isCardThrowable, swipedDirection } = this.getSwipedState(swipeAnimation.progress());
284
- !isCardThrowable ?
285
- returnedAnimation
286
- .to(cardElement, this.animationDelay, baseProps)
287
- .to([this.buttons.left, this.buttons.right], { scale: 1, ease: Power1.easeInOut }, 0) :
288
- this.swipeCard(swipedDirection);
317
+ !isCardThrowable
318
+ ? returnedAnimation.to(cardElement, this.animationDelay, baseProps).to([this.buttons.left, this.buttons.right], { scale: 1, ease: Power1.easeInOut }, 0)
319
+ : this.swipeCard(swipedDirection);
289
320
  }
290
321
  else {
291
322
  gsapTo(cardElement, this.animationDelay, baseProps);
292
323
  }
293
324
  this.blockMoves.emit(false);
294
325
  };
295
- return (new Draggable(cardElement, {
326
+ return new Draggable(cardElement, {
296
327
  bound: this.host,
297
328
  type: 'left, top',
298
329
  cursor: 'grab',
299
330
  zIndexBoost: false,
300
331
  onDragStart: () => onStartSwiping(),
301
- onDrag() { onSwiping(this); },
332
+ onDrag() {
333
+ onSwiping(this);
334
+ },
302
335
  onDragEnd: () => onThrowing()
303
- }));
336
+ });
304
337
  }
305
338
  clickToSwipe(clickedDirection) {
306
339
  if (!this.buttons[clickedDirection].disabled) {
@@ -308,37 +341,52 @@ const YooFormSwipeCardsComponent = class {
308
341
  this.swipeCard(clickedDirection);
309
342
  }
310
343
  }
311
- async undoSwipe() {
312
- const lastThrownCard = this.swipeCards[this.swipeCards.reduce((acc, card, index) => (card.swipedDirection ? index : acc), 0)];
313
- if (!this.buttons.undo.disabled && (lastThrownCard === null || lastThrownCard === void 0 ? void 0 : lastThrownCard.swipedDirection)) {
314
- this.lockSwipeButtons();
315
- const lastThrownCardElement = this.getCardElement(lastThrownCard === null || lastThrownCard === void 0 ? void 0 : lastThrownCard.id);
344
+ async undoCard(card, shouldLockActions = true) {
345
+ var _a, _b;
346
+ card = card || this.swipeCards[this.swipeCards.reduce((acc, card, index) => (card.swipedDirection ? index : acc), 0)];
347
+ if (!((_b = (_a = this.buttons) === null || _a === void 0 ? void 0 : _a.undo) === null || _b === void 0 ? void 0 : _b.disabled) && (card === null || card === void 0 ? void 0 : card.swipedDirection)) {
348
+ shouldLockActions && this.lockSwipeActions();
349
+ const lastThrownCardElement = this.getCardElement(card === null || card === void 0 ? void 0 : card.id);
316
350
  if (lastThrownCardElement) {
351
+ lastThrownCardElement.style.zIndex = '4';
317
352
  lastThrownCardElement.style.removeProperty('top');
318
353
  lastThrownCardElement.style.removeProperty('left');
319
354
  lastThrownCardElement.removeAttribute('swiped');
320
- lastThrownCard === null || lastThrownCard === void 0 ? true : delete lastThrownCard.swipedDirection;
321
- setTimeout(() => {
322
- this.getUserAnswer();
323
- }, 225);
355
+ card === null || card === void 0 ? true : delete card.swipedDirection;
356
+ await new Promise((resolve) => {
357
+ setTimeout(() => {
358
+ this.getUserAnswer();
359
+ resolve();
360
+ }, 225);
361
+ });
324
362
  }
325
363
  }
326
364
  }
327
365
  renderCards() {
328
- return h("section", { id: "cards" }, this.swipeCards.map(({ swipedDirection, value, id }, i, s) => {
366
+ let nbrCardRevealed = 0;
367
+ return (h("section", { id: "cards" }, this.swipeCards.map(({ swipedDirection, value, id }, i, s) => {
329
368
  const currentCardIndex = s.indexOf(this.currentCard);
330
369
  const hasCurrentCard = currentCardIndex !== -1;
331
- return h("div", { id: id, class: {
370
+ const isCurrentCard = i === currentCardIndex;
371
+ return (h("div", { id: id, class: {
332
372
  card: true,
333
- current: i === currentCardIndex,
373
+ current: isCurrentCard,
334
374
  second: hasCurrentCard && i === currentCardIndex + 1,
335
375
  third: hasCurrentCard && i === currentCardIndex + 2,
336
376
  revealing: this.revealCards
337
- }, ref: el => this.cardsElements[i] = el, ...{
377
+ }, onTransitionEnd: () => {
378
+ nbrCardRevealed += 1;
379
+ if (this.revealCards && nbrCardRevealed === Math.min(s.length + 1, 3)) {
380
+ this.enableButtonActions = true;
381
+ }
382
+ if (isCurrentCard) {
383
+ this.currentCardElement.style.removeProperty('z-index');
384
+ }
385
+ }, ...{
338
386
  type: this.mode,
339
387
  ...(swipedDirection && { direction: swipedDirection })
340
- } }, this.hasImage && (h("div", { class: "content-image" }, h("yoo-img", { instant: true, src: getMedia(value['_downloadURL']) }))), this.hasText && (h("div", { class: "content-text" }, translateMulti((value === null || value === void 0 ? void 0 : value['_filename']) || value))), h("div", { class: "content-category" }));
341
- }));
388
+ } }, this.hasImage && (h("div", { class: "content-image" }, h("yoo-img", { instant: true, src: getMedia(value['_downloadURL']) }))), this.hasText && h("div", { class: "content-text" }, translateMulti((value === null || value === void 0 ? void 0 : value['_filename']) || value))));
389
+ })));
342
390
  }
343
391
  renderInstructionCategory(side) {
344
392
  const isLeftCategory = side === SwipeCardsDirection.left;
@@ -346,19 +394,19 @@ const YooFormSwipeCardsComponent = class {
346
394
  const iconColor = isWeb(this.host) ? categoryColor : 'light';
347
395
  const iconSize = isWeb(this.host) ? 'large' : 'medium';
348
396
  const category = this.categories && translateMulti(isLeftCategory ? this.categories[0] : this.categories[1]);
349
- return h("div", { class: { category: true, [side]: true } }, h("yoo-tag", { noBackground: isWeb(this.host), color: categoryColor, size: "large", icon: `big-arrow-${side}`, iconOnlyColor: iconColor, iconOnlySize: iconSize }), h("p", { class: `${categoryColor}` }, category), h("span", { class: "stable" }, translate(`SWIPE${side.toUpperCase()}`)));
397
+ return (h("div", { class: { category: true, [side]: true } }, h("yoo-tag", { noBackground: isWeb(this.host), color: categoryColor, size: "large", icon: `big-arrow-${side}`, iconOnlyColor: iconColor, iconOnlySize: iconSize }), h("p", { class: `${categoryColor}` }, category), h("span", { class: "stable" }, translate(`SWIPE${side.toUpperCase()}`))));
350
398
  }
351
399
  renderTopDescription() {
352
- return h("div", { id: "header" }, h("span", { id: "title", innerHTML: translateMulti(this.label) }), h("span", { class: "stable" }, translate(this.description || 'CARDSWIPEDEFAULTINSTRUCTIONS')));
400
+ return (h("div", { id: "header" }, h("span", { id: "title", innerHTML: translateMulti(this.label) }), h("span", { class: "stable" }, translate(this.description || 'CARDSWIPEDEFAULTINSTRUCTIONS'))));
353
401
  }
354
- renderInstructions() {
355
- return (h("section", { id: "instructions" }, this.renderTopDescription(), h("section", { id: "categories" }, this.renderInstructionCategory(SwipeCardsDirection.left), h("yoo-icon", { size: "extra-extra-large", name: "swipe-explanation", color: "stable-alt" }), this.renderInstructionCategory(SwipeCardsDirection.right)), this.instructionsDocument && (h("section", { id: "document" }, h("div", { class: "document-title" }, translate('ATTACHMENTS')), h("yoo-form-document", { document: this.instructionsDocument, readonly: true, onInputChanged: (ev) => ev.stopPropagation() }))), h("yoo-button", { disabled: !(this.hasTwoCategories && !this.hasDuplicatesValues), size: (isWeb(this.host) && !this.livePreview) ? 'medium' : 'large', color: "app-color", onClick: () => {
356
- this.revealCards = true;
357
- this.showInstructionView = false;
358
- this.displayFooterElement();
359
- } }, translate('START'))));
402
+ renderHeaderInstructions() {
403
+ return [
404
+ this.renderTopDescription(),
405
+ h("section", { id: "categories" }, this.renderInstructionCategory(SwipeCardsDirection.left), h("yoo-icon", { size: "extra-extra-large", name: "swipe-explanation", color: "stable-alt" }), this.renderInstructionCategory(SwipeCardsDirection.right)),
406
+ this.instructionsDocument && (h("section", { id: "document" }, h("div", { class: "document-title" }, translate('ATTACHMENTS')), h("yoo-form-document", { document: this.instructionsDocument, readonly: true, onInputChanged: (ev) => ev.stopPropagation() })))
407
+ ];
360
408
  }
361
- renderSwipeButtons() {
409
+ renderActions() {
362
410
  const { left, undo, right } = SwipeCardsDirection;
363
411
  return h("section", { id: "actions" }, [left, undo, right].map((d, i) => this.renderSwipeAction(d, i)));
364
412
  }
@@ -367,51 +415,67 @@ const YooFormSwipeCardsComponent = class {
367
415
  const isUndo = direction === SwipeCardsDirection.undo;
368
416
  const isLeft = direction === SwipeCardsDirection.left;
369
417
  const isMobile = !isWeb(this.host) || this.livePreview;
370
- const actionColor = isUndo ? isWeb(this.host) ? 'light' : 'stable-alt' : isLeft ? 'app-color' : 'warning';
418
+ const actionColor = isUndo ? (isWeb(this.host) ? 'light' : 'stable-alt') : isLeft ? 'app-color' : 'warning';
371
419
  const swipeIcon = isUndo ? 'undo' : `big-arrow-${direction}`;
372
420
  const categoryIndex = isLeft ? 0 : 1;
373
- return (h("div", { class: { action: true, hide: this.hasAllCardBeenSwiped && !isUndo } }, h("yoo-button", { shape: "circular", rippleType: "unbounded", id: `swipe-${direction}`, size: (isUndo && !isMobile) ? 'medium' : 'large', fill: (isMobile || isUndo) ? 'solid' : 'transparent', color: isUndo ? isMobile ? 'stable-light' : 'text-color' : actionColor.concat('-20'), ref: (element) => (this.swipeButtons[index] = element), onClick: () => isUndo ? this.undoSwipe() : this.clickToSwipe(direction) }, h("yoo-icon", { name: swipeIcon, color: actionColor, size: isMobile ? 'medium' : isUndo ? 'small' : 'large' })), !isUndo && ((_a = this.categories) === null || _a === void 0 ? void 0 : _a.length) && h("span", { class: actionColor }, translateMulti(this.categories[categoryIndex]))));
421
+ return (h("div", { class: { action: true, hide: this.hasAllCardBeenSwiped && !isUndo } }, h("yoo-button", { shape: "circular", rippleType: "unbounded", id: `swipe-${direction}`, disabled: !this.enableButtonActions, size: isUndo && !isMobile ? 'medium' : 'large', fill: isMobile || isUndo ? 'solid' : 'transparent', color: isUndo ? (isMobile ? 'stable-light' : 'text-color') : actionColor.concat('-20'), ref: (element) => (this.swipeButtons[index] = element), onClick: () => (isUndo ? this.undoCard() : this.clickToSwipe(direction)) }, h("yoo-icon", { name: swipeIcon, color: actionColor, size: isMobile ? 'medium' : isUndo ? 'small' : 'large' })), !isUndo && ((_a = this.categories) === null || _a === void 0 ? void 0 : _a.length) && h("span", { class: actionColor }, translateMulti(this.categories[categoryIndex]))));
374
422
  }
375
- renderEndGameMessage() {
376
- return h("section", { id: "end-message", class: { active: this.hasAllCardBeenSwiped } }, h("yoo-lottie", { autoplay: this.hasAllCardBeenSwiped, type: "check" }), h("div", { innerHTML: translate('ENDSWIPINGCARDSMESSAGE') }), h("span", null, translate('CLICKTOCONTINUE', { buttonName: this.nextButtonText })));
423
+ renderBackground() {
424
+ return (h("section", { id: "background" }, h("div", { id: "end-message", class: { active: this.hasAllCardBeenSwiped } }, h("yoo-lottie", { autoplay: this.hasAllCardBeenSwiped, type: "check" }), h("div", { innerHTML: translate('ENDSWIPINGCARDSMESSAGE') }), h("span", null, translate('CLICKTOCONTINUE', { buttonName: this.nextButtonText }))), this.renderActions()));
377
425
  }
378
426
  renderGame() {
379
427
  return [
380
428
  isWeb(this.host) && !this.livePreview && this.renderTopDescription(),
381
- h("section", { id: "game", ref: (element) => (this.gameContainerElement = element) }, this.renderEndGameMessage(), this.renderCards()),
382
- this.renderSwipeButtons()
429
+ h("section", { id: "game", ref: (element) => (this.gameContainerElement = element) }, this.renderBackground(), this.renderCards())
383
430
  ];
384
431
  }
432
+ renderStartButton() {
433
+ return (!this.readonly &&
434
+ this.showInstructionView && (h("yoo-button", { disabled: !this.hasData || !this.isDataValid, size: isWeb(this.host) && !this.livePreview ? 'medium' : 'large', color: "app-color", onClick: () => {
435
+ this.revealCards = true;
436
+ this.showInstructionView = false;
437
+ this.displayFooterElement();
438
+ } }, translate('START'))));
439
+ }
440
+ renderInstructions() {
441
+ return [h("section", { id: "instructions" }, this.renderHeaderInstructions()), this.renderStartButton()];
442
+ }
385
443
  renderSummary() {
386
- const getAnswerCounter = (category) => { var _a, _b; return ((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) && ((_b = this.answer) === null || _b === void 0 ? void 0 : _b.length) ? translateMulti(category) : ''; };
444
+ const getAnswerCounter = (category) => { var _a, _b; return (((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) && ((_b = this.answer) === null || _b === void 0 ? void 0 : _b.length) ? translateMulti(category) : ''); };
387
445
  const getAnswerImage = (answerValue) => {
388
446
  var _a, _b;
389
447
  const getImageValue = (image) => image[`${this.isMode.image ? '_downloadURL' : '_filename'}`];
390
- return (((_a = this.images.find(image => getImageValue(image) === answerValue)) === null || _a === void 0 ? void 0 : _a._downloadURL) ||
391
- ((_b = this.images.find(image => { var _a; return (_a = getImageValue(image)) === null || _a === void 0 ? void 0 : _a.includes(answerValue); })) === null || _b === void 0 ? void 0 : _b._downloadURL) || '');
448
+ return (((_a = this.images.find((image) => getImageValue(image) === answerValue)) === null || _a === void 0 ? void 0 : _a._downloadURL) ||
449
+ ((_b = this.images.find((image) => { var _a; return (_a = getImageValue(image)) === null || _a === void 0 ? void 0 : _a.includes(answerValue); })) === null || _b === void 0 ? void 0 : _b._downloadURL) ||
450
+ '');
392
451
  };
393
452
  const getValidationClass = (categoryIndex, answerValue) => this.answer[categoryIndex].find((answer) => answerValue.includes(answer)) ? 'valid' : 'invalid';
394
- return this.categories.map((categoryValue, catIndex) => [
395
- h("div", { class: "category-title" }, getAnswerCounter(categoryValue)),
396
- h("ul", null, Array.from(new Set(this.value[catIndex])).map((userAnswer) => {
397
- var _a;
398
- return (h("li", { class: getValidationClass(catIndex, userAnswer) }, !!((_a = this.images) === null || _a === void 0 ? void 0 : _a.length) && h("yoo-img", { src: getAnswerImage(userAnswer) }), !this.isMode.image && h("yoo-truncate", null, translateMulti(userAnswer))));
399
- }))
400
- ]);
453
+ return (this.readonly &&
454
+ this.categories.map((categoryValue, catIndex) => [
455
+ h("div", { class: "category-title" }, getAnswerCounter(categoryValue)),
456
+ h("ul", null, Array.from(new Set(this.value[catIndex])).map((userAnswer) => {
457
+ var _a;
458
+ return (h("li", { class: getValidationClass(catIndex, userAnswer) }, !!((_a = this.images) === null || _a === void 0 ? void 0 : _a.length) && h("yoo-img", { src: getAnswerImage(userAnswer) }), !this.isMode.image && h("yoo-truncate", null, translateMulti(userAnswer))));
459
+ }))
460
+ ]));
401
461
  }
402
462
  renderBanner() {
403
- return this.livePreview && h("yoo-banner", null, h("p", { slot: "content" }));
463
+ return (this.livePreview &&
464
+ !this.readonly && (h("yoo-banner", null, h("p", { slot: "content" }))));
465
+ }
466
+ renderMain() {
467
+ return h("main", null, !this.readonly && (this.showInstructionView ? this.renderInstructions() : this.renderGame()));
404
468
  }
405
469
  render() {
406
- return (h(Host, { class: { ...getAppContext(this.host), 'swiper-no-swiping': !this.readonly, instructions: this.showInstructionView } }, this.renderBanner(), !this.readonly && (this.showInstructionView ? this.renderInstructions() : this.renderGame()), this.readonly && this.renderSummary()));
470
+ return (h(Host, { class: { ...getAppContext(this.host), 'swiper-no-swiping': !this.readonly }, ...{ view: this.showInstructionView ? 'instructions' : 'game' } }, this.renderBanner(), this.renderMain(), this.renderSummary()));
407
471
  }
408
472
  get host() { return getElement(this); }
409
473
  static get watchers() { return {
474
+ "isVisible": ["onIsVisibleChanged"],
410
475
  "categories": ["onCategoriesChanged"],
411
476
  "values": ["onValuesChanged"],
412
477
  "images": ["onImagesChanged"],
413
- "required": ["onRequireChanged"],
414
- "isVisible": ["onIsVisibleChanged"]
478
+ "required": ["onRequireChanged"]
415
479
  }; }
416
480
  };
417
481
  YooFormSwipeCardsComponent.style = formSwipeCardsCss;