@yoobic/yobi 8.3.0-45 → 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.
- package/dist/cjs/design-system.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/yoo-card-feed.cjs.entry.js +2 -2
- package/dist/cjs/yoo-detail-bar.cjs.entry.js +1 -1
- package/dist/cjs/yoo-form-dynamic.cjs.entry.js +11 -10
- package/dist/cjs/yoo-form-input-container.cjs.entry.js +1 -1
- package/dist/cjs/yoo-form-swipe-cards.cjs.entry.js +199 -135
- package/dist/cjs/yoo-form-todo-task-list.cjs.entry.js +1 -2
- package/dist/cjs/yoo-login.cjs.entry.js +54 -63
- package/dist/collection/components/form/form-dynamic/form-dynamic.js +11 -10
- package/dist/collection/components/form/form-input-container/form-input-container.css +7 -0
- package/dist/collection/components/form/form-swipe-cards/form-swipe-cards.css +169 -179
- package/dist/collection/components/form/form-swipe-cards/form-swipe-cards.js +233 -169
- package/dist/collection/components/form/form-todo-task-list/form-todo-task-list.js +1 -2
- package/dist/collection/feature-communicate/feed/card-feed/components/sub-cards.js +2 -2
- package/dist/collection/feature-operate/campaign/detail-bar/detail-bar.js +3 -3
- package/dist/collection/feature-platform/login/login/login.css +119 -46
- package/dist/collection/feature-platform/login/login/login.js +25 -30
- package/dist/collection/feature-platform/login/login/parts/Header.js +15 -16
- package/dist/collection/feature-platform/login/login/parts/LoginForm.js +15 -18
- package/dist/collection/feature-platform/login/login/parts/LoginOptions.js +2 -2
- package/dist/design-system/design-system.esm.js +1 -1
- package/dist/design-system/yoo-card-feed.entry.js +3 -3
- package/dist/design-system/yoo-detail-bar.entry.js +1 -1
- package/dist/design-system/yoo-form-dynamic.entry.js +11 -10
- package/dist/design-system/yoo-form-input-container.entry.js +1 -1
- package/dist/design-system/yoo-form-swipe-cards.entry.js +201 -137
- package/dist/design-system/yoo-form-todo-task-list.entry.js +1 -2
- package/dist/design-system/yoo-login.entry.js +55 -64
- package/dist/esm/design-system.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/yoo-card-feed.entry.js +3 -3
- package/dist/esm/yoo-detail-bar.entry.js +1 -1
- package/dist/esm/yoo-form-dynamic.entry.js +11 -10
- package/dist/esm/yoo-form-input-container.entry.js +1 -1
- package/dist/esm/yoo-form-swipe-cards.entry.js +201 -137
- package/dist/esm/yoo-form-todo-task-list.entry.js +1 -2
- package/dist/esm/yoo-login.entry.js +55 -64
- package/dist/types/components/form/form-swipe-cards/form-swipe-cards.d.ts +20 -13
- package/dist/types/feature-platform/login/login/parts/LoginForm.d.ts +0 -1
- package/dist/types/feature-platform/login/login/parts/LoginOptions.d.ts +0 -1
- package/dist/types/home/runner/work/yoobic-ng-6/yoobic-ng-6/design-system/stencil/.stencil/shared/interfaces/src/entities/form-field/form-field.interface.d.ts +1 -0
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ const formInputHelpers = require('./form-input-helpers-651487c0.js');
|
|
|
12
12
|
const overlays = require('./overlays-046b4f60.js');
|
|
13
13
|
require('./_commonjsHelpers-94df2ea7.js');
|
|
14
14
|
|
|
15
|
-
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)}";
|
|
15
|
+
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)}";
|
|
16
16
|
|
|
17
17
|
const YooFormSwipeCardsComponent = class {
|
|
18
18
|
constructor(hostRef) {
|
|
@@ -27,36 +27,36 @@ const YooFormSwipeCardsComponent = class {
|
|
|
27
27
|
this.shuffled = true;
|
|
28
28
|
this.values = [];
|
|
29
29
|
this.swipeCards = [];
|
|
30
|
-
this.cardsElements = [];
|
|
31
30
|
this.swipeButtons = [];
|
|
32
31
|
}
|
|
32
|
+
onIsVisibleChanged() {
|
|
33
|
+
// Timeout here to wait for the yoo-form-footer to be mounted after a slide has
|
|
34
|
+
// been changed, this will be removed after the refactor of the slides component
|
|
35
|
+
setTimeout(() => this.displayFooterElement(), 150);
|
|
36
|
+
}
|
|
33
37
|
onCategoriesChanged(nv, ov) {
|
|
34
38
|
this.hasDataChanged = !lodash.isEqual(nv, ov);
|
|
35
|
-
|
|
36
|
-
this.spyOnValuesChanged();
|
|
37
|
-
}
|
|
39
|
+
this.showWarnings();
|
|
38
40
|
}
|
|
39
41
|
onValuesChanged(nv, ov) {
|
|
40
42
|
this.hasDataChanged = !lodash.isEqual(nv, ov);
|
|
43
|
+
this.hasDataChanged && this.prepareGame();
|
|
44
|
+
this.resetCards();
|
|
41
45
|
if (!this.isMode.image) {
|
|
42
|
-
this.
|
|
46
|
+
this.showWarnings();
|
|
43
47
|
}
|
|
44
48
|
}
|
|
45
49
|
onImagesChanged(nv, ov) {
|
|
46
50
|
this.hasDataChanged = !lodash.isEqual(nv, ov);
|
|
51
|
+
this.hasDataChanged && this.prepareGame();
|
|
52
|
+
this.resetCards();
|
|
47
53
|
if (!this.isMode.text) {
|
|
48
|
-
this.
|
|
54
|
+
this.showWarnings();
|
|
49
55
|
}
|
|
50
56
|
}
|
|
51
57
|
onRequireChanged() {
|
|
52
58
|
this.validate();
|
|
53
59
|
}
|
|
54
|
-
// eslint-disable-next-line @stencil/decorators-style
|
|
55
|
-
onIsVisibleChanged() {
|
|
56
|
-
// Timeout here to wait for the yoo-form-footer to be mounted after a slide has
|
|
57
|
-
// been changed, this will be removed after the refactor of the slides component
|
|
58
|
-
setTimeout(() => this.displayFooterElement(!this.showInstructionView), 150);
|
|
59
|
-
}
|
|
60
60
|
get isMode() {
|
|
61
61
|
const { image, text, textimage } = index$1.SwipeCardsMode;
|
|
62
62
|
return {
|
|
@@ -65,14 +65,26 @@ const YooFormSwipeCardsComponent = class {
|
|
|
65
65
|
text: this.mode === text
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
get
|
|
69
|
-
var _a;
|
|
70
|
-
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; };
|
|
68
|
+
get cardData() {
|
|
69
|
+
var _a, _b;
|
|
71
70
|
return {
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
imagesUrls: ((_a = this.images) === null || _a === void 0 ? void 0 : _a.filter(({ _downloadURL }) => _downloadURL)) || [],
|
|
72
|
+
texts: ((_b = this.values) === null || _b === void 0 ? void 0 : _b.filter((v) => v)) || [],
|
|
73
|
+
getLength(type) {
|
|
74
|
+
return type === 'images' ? this.imagesUrls.length : this.texts.length;
|
|
75
|
+
},
|
|
76
|
+
hasMinimum(type) {
|
|
77
|
+
return (type === 'images' ? this.imagesUrls.length : this.texts.length) >= 2;
|
|
78
|
+
},
|
|
79
|
+
hasEmpty(type) {
|
|
80
|
+
var _a, _b;
|
|
81
|
+
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);
|
|
82
|
+
}
|
|
74
83
|
};
|
|
75
84
|
}
|
|
85
|
+
get cardsElements() {
|
|
86
|
+
return Array.from(this.host.shadowRoot.querySelectorAll('.card')) || [];
|
|
87
|
+
}
|
|
76
88
|
get hasImage() {
|
|
77
89
|
return this.isMode.image || this.isMode.textimage;
|
|
78
90
|
}
|
|
@@ -80,8 +92,34 @@ const YooFormSwipeCardsComponent = class {
|
|
|
80
92
|
return this.isMode.text || this.isMode.textimage;
|
|
81
93
|
}
|
|
82
94
|
get hasTwoCategories() {
|
|
83
|
-
var _a
|
|
84
|
-
return
|
|
95
|
+
var _a;
|
|
96
|
+
return ((_a = this.categories) === null || _a === void 0 ? void 0 : _a.filter((v) => v).length) === 2;
|
|
97
|
+
}
|
|
98
|
+
get hasDuplicateValues() {
|
|
99
|
+
return this.hasText && draggableTagsHelpers.hasDuplicates(this.cardData.texts);
|
|
100
|
+
}
|
|
101
|
+
get hasEmptyValues() {
|
|
102
|
+
const hasEmptyImagesValues = this.cardData.hasEmpty('images');
|
|
103
|
+
const hasEmptyTextsValues = this.cardData.hasEmpty('texts');
|
|
104
|
+
return (this.hasMinimumRequiredData &&
|
|
105
|
+
(this.isMode.image
|
|
106
|
+
? hasEmptyImagesValues
|
|
107
|
+
: this.isMode.text
|
|
108
|
+
? hasEmptyTextsValues
|
|
109
|
+
: hasEmptyImagesValues || hasEmptyTextsValues || this.cardData.getLength('images') !== this.cardData.getLength('texts')));
|
|
110
|
+
}
|
|
111
|
+
get hasMinimumRequiredData() {
|
|
112
|
+
const hasMinimumImagesValues = this.cardData.hasMinimum('images');
|
|
113
|
+
const hasMinimumTextsValues = this.cardData.hasMinimum('texts');
|
|
114
|
+
return this.isMode.image ? hasMinimumImagesValues : this.isMode.text ? hasMinimumTextsValues : hasMinimumImagesValues && hasMinimumTextsValues;
|
|
115
|
+
}
|
|
116
|
+
get hasData() {
|
|
117
|
+
const hasImagesValues = !!this.cardData.getLength('images');
|
|
118
|
+
const hasTextsValues = !!this.cardData.getLength('texts');
|
|
119
|
+
return this.isMode.image ? hasImagesValues : this.isMode.text ? hasTextsValues : hasImagesValues && hasTextsValues;
|
|
120
|
+
}
|
|
121
|
+
get isDataValid() {
|
|
122
|
+
return this.hasTwoCategories && this.hasMinimumRequiredData && !this.hasDuplicateValues && !this.hasEmptyValues;
|
|
85
123
|
}
|
|
86
124
|
get hasAllCardBeenSwiped() {
|
|
87
125
|
var _a;
|
|
@@ -89,7 +127,7 @@ const YooFormSwipeCardsComponent = class {
|
|
|
89
127
|
}
|
|
90
128
|
get buttons() {
|
|
91
129
|
const { left, right, undo } = index$1.SwipeCardsDirection;
|
|
92
|
-
const getButton = (direction) => { var _a, _b; return (_b = (_a = this.swipeButtons) === null || _a === void 0 ? void 0 : _a.filter(({ id }) => id === `swipe-${direction}`)) === null ||
|
|
130
|
+
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]; };
|
|
93
131
|
return {
|
|
94
132
|
left: getButton(left),
|
|
95
133
|
undo: getButton(undo),
|
|
@@ -116,20 +154,20 @@ const YooFormSwipeCardsComponent = class {
|
|
|
116
154
|
this.updateGame();
|
|
117
155
|
}
|
|
118
156
|
validate() {
|
|
119
|
-
var _a;
|
|
120
|
-
const numberSwipedCards = (_a = this.swipeCards.filter(card => card.swipedDirection)) === null || _a === void 0 ? void 0 : _a.length;
|
|
121
|
-
this.validity = numberSwipedCards === (this.hasImage ?
|
|
157
|
+
var _a, _b;
|
|
158
|
+
const numberSwipedCards = (_a = this.swipeCards.filter((card) => card.swipedDirection)) === null || _a === void 0 ? void 0 : _a.length;
|
|
159
|
+
this.validity = !this.required || numberSwipedCards === ((_b = this.cardData[this.hasImage ? 'imagesUrls' : 'texts']) === null || _b === void 0 ? void 0 : _b.length);
|
|
122
160
|
this.validityChanged.emit(this.validity);
|
|
123
161
|
return this.validity;
|
|
124
162
|
}
|
|
125
163
|
prepareGame() {
|
|
126
164
|
this.shuffleCardValues();
|
|
127
|
-
this.animationDelay = this.animated ? .25 : 0;
|
|
165
|
+
this.animationDelay = this.animated ? 0.25 : 0;
|
|
128
166
|
this.revealCards = !this.showInstructionView;
|
|
129
167
|
this.swipeCards = this.initCards();
|
|
130
168
|
}
|
|
131
169
|
initGame() {
|
|
132
|
-
this.displayFooterElement(
|
|
170
|
+
this.displayFooterElement();
|
|
133
171
|
!this.showInstructionView && this.initDraggable();
|
|
134
172
|
}
|
|
135
173
|
updateCardsData() {
|
|
@@ -143,34 +181,32 @@ const YooFormSwipeCardsComponent = class {
|
|
|
143
181
|
updateGame() {
|
|
144
182
|
if (this.revealCards) {
|
|
145
183
|
this.hasDataChanged = false;
|
|
146
|
-
this.revealCards = false;
|
|
147
184
|
this.initDraggable();
|
|
185
|
+
setTimeout(() => {
|
|
186
|
+
if (this.host.scrollHeight > this.host.clientHeight) {
|
|
187
|
+
this.host.scrollTo({
|
|
188
|
+
top: this.host.scrollHeight,
|
|
189
|
+
behavior: 'smooth'
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}, 1000);
|
|
148
193
|
}
|
|
149
|
-
setTimeout(() => this.
|
|
194
|
+
setTimeout(() => this.lockSwipeActions(false), 750);
|
|
195
|
+
this.displayFooterElement();
|
|
150
196
|
}
|
|
151
197
|
shuffleCardValues() {
|
|
152
|
-
const cardData = this.hasImage ? this.
|
|
198
|
+
const cardData = this.hasImage ? this.cardData.imagesUrls : this.cardData.texts;
|
|
153
199
|
this.cardValues = this.shuffled ? lodash.shuffle(cardData) : cardData;
|
|
154
200
|
}
|
|
155
|
-
getCardElement(
|
|
201
|
+
getCardElement(cardId) {
|
|
156
202
|
var _a;
|
|
157
|
-
return (_a = this.cardsElements) === null || _a === void 0 ? void 0 : _a.find((
|
|
158
|
-
}
|
|
159
|
-
spyOnValuesChanged() {
|
|
160
|
-
this.hasDataChanged && this.showWarnings();
|
|
203
|
+
return (_a = this.cardsElements) === null || _a === void 0 ? void 0 : _a.find(({ id }) => cardId === id);
|
|
161
204
|
}
|
|
162
205
|
showWarnings() {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
else if (this.hasTwoCategories && this.livePreview) {
|
|
168
|
-
this.hasEmptyValues = !!this.numberEmptyItems.text || !!this.numberEmptyItems.image;
|
|
169
|
-
this.hasDuplicatesValues = this.hasText && draggableTagsHelpers.hasDuplicates(this.values);
|
|
170
|
-
let showAlert = this.hasEmptyValues || this.hasDuplicatesValues;
|
|
171
|
-
this.isMode.textimage && this.hasEmptyValues && (showAlert = showAlert && this.numberEmptyItems.text !== this.numberEmptyItems.image);
|
|
172
|
-
const bannerMessage = this.hasDuplicatesValues ? 'NODUPLICATEVALUES' : this.hasEmptyValues ? 'NOEMPTYVALUES' : '';
|
|
173
|
-
const bannerColor = this.hasDuplicatesValues ? 'danger' : this.hasEmptyValues ? 'warning' : null;
|
|
206
|
+
if (this.livePreview && this.hasDataChanged && this.hasData) {
|
|
207
|
+
const bannerMessage = this.hasDuplicateValues ? 'NODUPLICATEVALUES' : this.hasEmptyValues ? 'NOEMPTYVALUES' : !this.hasTwoCategories ? 'NOTFULFILLEDCATEGORIES' : '';
|
|
208
|
+
const bannerColor = this.hasDuplicateValues || !this.hasTwoCategories ? 'danger' : this.hasEmptyValues ? 'warning' : null;
|
|
209
|
+
const showAlert = !!bannerMessage;
|
|
174
210
|
draggableTagsHelpers.showWarningAlert(this.host, showAlert, bannerMessage, bannerColor);
|
|
175
211
|
this.hasDataChanged = !showAlert;
|
|
176
212
|
if (showAlert)
|
|
@@ -181,48 +217,49 @@ const YooFormSwipeCardsComponent = class {
|
|
|
181
217
|
const formatCardValue = (value) => {
|
|
182
218
|
var _a, _b;
|
|
183
219
|
if (this.isMode.image) {
|
|
184
|
-
return overlays.isCloudinaryLink((_b = (_a = this.answer) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b[0]) ? value._downloadURL :
|
|
185
|
-
value._downloadURL.split('/').pop();
|
|
220
|
+
return overlays.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();
|
|
186
221
|
}
|
|
187
222
|
if (this.isMode.textimage) {
|
|
188
223
|
return value._filename;
|
|
189
224
|
}
|
|
190
225
|
return value;
|
|
191
226
|
};
|
|
192
|
-
const getValuesFromDirection = (direction) => this.swipeCards.filter(c => c.swipedDirection === direction).map(c => formatCardValue(c.value));
|
|
193
|
-
this.livePreview ? index.forceUpdate(this) : formInputHelpers.setValueAndValidateInput([
|
|
194
|
-
getValuesFromDirection(index$1.SwipeCardsDirection.left),
|
|
195
|
-
getValuesFromDirection(index$1.SwipeCardsDirection.right)
|
|
196
|
-
], this);
|
|
227
|
+
const getValuesFromDirection = (direction) => this.swipeCards.filter((c) => c.swipedDirection === direction).map((c) => formatCardValue(c.value));
|
|
228
|
+
this.livePreview ? index.forceUpdate(this) : formInputHelpers.setValueAndValidateInput([getValuesFromDirection(index$1.SwipeCardsDirection.left), getValuesFromDirection(index$1.SwipeCardsDirection.right)], this);
|
|
197
229
|
}
|
|
198
|
-
displayFooterElement(
|
|
230
|
+
displayFooterElement() {
|
|
199
231
|
var _a, _b;
|
|
200
232
|
const yooIonSlideEl = overlays.findParent(this.host, 'yoo-ion-slide');
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
footerElement.style.display = show ? 'block' : 'none';
|
|
206
|
-
}
|
|
233
|
+
const footerElement = yooIonSlideEl === null || yooIonSlideEl === void 0 ? void 0 : yooIonSlideEl.querySelector('yoo-form-footer');
|
|
234
|
+
if (footerElement) {
|
|
235
|
+
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) || '';
|
|
236
|
+
footerElement.style.display = !this.showInstructionView ? 'block' : 'none';
|
|
207
237
|
}
|
|
208
238
|
}
|
|
209
239
|
initDraggable() {
|
|
210
|
-
this.cardsElements
|
|
211
|
-
|
|
212
|
-
.forEach(e => this.getDraggableInstance(e));
|
|
213
|
-
this.cardsElements.forEach(e => e === null || e === void 0 ? void 0 : e.classList.remove('revealing'));
|
|
240
|
+
this.cardsElements.filter((e) => !overlays.Draggable.get(e)).forEach((e) => this.getDraggableInstance(e));
|
|
241
|
+
this.cardsElements.forEach((e) => e === null || e === void 0 ? void 0 : e.classList.remove('revealing'));
|
|
214
242
|
}
|
|
215
243
|
initCards() {
|
|
216
244
|
var _a;
|
|
217
|
-
return ((_a = this.cardValues) === null || _a === void 0 ? void 0 : _a.map(
|
|
245
|
+
return ((_a = this.cardValues) === null || _a === void 0 ? void 0 : _a.map((value) => ({ id: overlays.getUUID(), value }))) || [];
|
|
218
246
|
}
|
|
219
|
-
|
|
247
|
+
lockSwipeActions(lockState = true) {
|
|
220
248
|
var _a;
|
|
221
|
-
(_a = this.swipeButtons) === null || _a === void 0 ? void 0 : _a.forEach(b => b && (b.disabled = lockState));
|
|
249
|
+
(_a = this.swipeButtons) === null || _a === void 0 ? void 0 : _a.forEach((b) => b && (b.disabled = this.animated ? lockState : false));
|
|
250
|
+
}
|
|
251
|
+
async resetCards() {
|
|
252
|
+
var _a, _b;
|
|
253
|
+
this.showInstructionView = true;
|
|
254
|
+
await Promise.all((_a = this.swipeCards) === null || _a === void 0 ? void 0 : _a.map((card) => this.undoCard(card, false)));
|
|
255
|
+
(_b = this.cardsElements) === null || _b === void 0 ? void 0 : _b.forEach((cardElement) => {
|
|
256
|
+
cardElement.removeAttribute('swiped');
|
|
257
|
+
overlays.gsapSet(cardElement, { clearProps: 'all' });
|
|
258
|
+
});
|
|
222
259
|
}
|
|
223
260
|
swipeCard(direction) {
|
|
224
261
|
if (this.currentCard) {
|
|
225
|
-
this.
|
|
262
|
+
this.lockSwipeActions();
|
|
226
263
|
this.buttons[direction].style.removeProperty('transform');
|
|
227
264
|
this.gameContainerElement.removeAttribute('direction');
|
|
228
265
|
this.currentCardElement.setAttribute('swiped', direction);
|
|
@@ -233,11 +270,7 @@ const YooFormSwipeCardsComponent = class {
|
|
|
233
270
|
getSwipedState(swipeProgress) {
|
|
234
271
|
const swipeThresholds = [0.35, 0.65];
|
|
235
272
|
return {
|
|
236
|
-
swipedDirection: swipeProgress < swipeThresholds[0]
|
|
237
|
-
? index$1.SwipeCardsDirection.left
|
|
238
|
-
: swipeProgress > swipeThresholds[1]
|
|
239
|
-
? index$1.SwipeCardsDirection.right
|
|
240
|
-
: null,
|
|
273
|
+
swipedDirection: swipeProgress < swipeThresholds[0] ? index$1.SwipeCardsDirection.left : swipeProgress > swipeThresholds[1] ? index$1.SwipeCardsDirection.right : null,
|
|
241
274
|
isCardThrowable: !lodash.inRange(swipeProgress, swipeThresholds[0], swipeThresholds[1])
|
|
242
275
|
};
|
|
243
276
|
}
|
|
@@ -245,12 +278,16 @@ const YooFormSwipeCardsComponent = class {
|
|
|
245
278
|
if (this.currentCardElement) {
|
|
246
279
|
const { left, right } = index$1.SwipeCardsDirection;
|
|
247
280
|
const [categoryLeft, categoryRight] = this.categories;
|
|
248
|
-
const categoryContainer = this.currentCardElement.querySelector('.content-category');
|
|
249
281
|
const isThrowable = [left, right].includes(swipingDirection);
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
282
|
+
const contentContainer = this.currentCardElement.querySelector(`.content-${this.isMode.image ? 'image' : 'text'}`);
|
|
283
|
+
if (isThrowable) {
|
|
284
|
+
this.gameContainerElement.setAttribute('direction', swipingDirection);
|
|
285
|
+
contentContainer.dataset.category = overlays.translateMulti(swipingDirection === left ? categoryLeft : swipingDirection === right ? categoryRight : '');
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
this.gameContainerElement.removeAttribute('direction');
|
|
289
|
+
contentContainer.removeAttribute('data-category');
|
|
290
|
+
}
|
|
254
291
|
}
|
|
255
292
|
}
|
|
256
293
|
async getDraggableInstance(cardElement) {
|
|
@@ -258,16 +295,12 @@ const YooFormSwipeCardsComponent = class {
|
|
|
258
295
|
if (!timeline || !cardElement) {
|
|
259
296
|
return;
|
|
260
297
|
}
|
|
261
|
-
this.revealCards = false;
|
|
262
298
|
const maxRange = this.host.clientWidth / 2;
|
|
263
299
|
const returnedAnimation = timeline();
|
|
264
300
|
// building swiping animation
|
|
265
301
|
const swipeAnimation = timeline({ paused: true });
|
|
266
|
-
const isSwipeable = el => el.classList.contains('current');
|
|
267
|
-
swipeAnimation
|
|
268
|
-
.fromTo(this.buttons.left, 1, { scale: 1.5 }, { scale: 1 }, 0)
|
|
269
|
-
.fromTo(this.buttons.right, 1, { scale: 1 }, { scale: 1.5 }, 1)
|
|
270
|
-
.progress(.5);
|
|
302
|
+
const isSwipeable = (el) => el.classList.contains('current');
|
|
303
|
+
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);
|
|
271
304
|
const onStartSwiping = () => {
|
|
272
305
|
if (isSwipeable(cardElement)) {
|
|
273
306
|
this.blockMoves.emit(true);
|
|
@@ -285,26 +318,26 @@ const YooFormSwipeCardsComponent = class {
|
|
|
285
318
|
const baseProps = { left: 0, top: 0 };
|
|
286
319
|
if (isSwipeable(cardElement)) {
|
|
287
320
|
const { isCardThrowable, swipedDirection } = this.getSwipedState(swipeAnimation.progress());
|
|
288
|
-
!isCardThrowable
|
|
289
|
-
returnedAnimation
|
|
290
|
-
|
|
291
|
-
.to([this.buttons.left, this.buttons.right], { scale: 1, ease: overlays.Power1.easeInOut }, 0) :
|
|
292
|
-
this.swipeCard(swipedDirection);
|
|
321
|
+
!isCardThrowable
|
|
322
|
+
? returnedAnimation.to(cardElement, this.animationDelay, baseProps).to([this.buttons.left, this.buttons.right], { scale: 1, ease: overlays.Power1.easeInOut }, 0)
|
|
323
|
+
: this.swipeCard(swipedDirection);
|
|
293
324
|
}
|
|
294
325
|
else {
|
|
295
326
|
overlays.gsapTo(cardElement, this.animationDelay, baseProps);
|
|
296
327
|
}
|
|
297
328
|
this.blockMoves.emit(false);
|
|
298
329
|
};
|
|
299
|
-
return
|
|
330
|
+
return new overlays.Draggable(cardElement, {
|
|
300
331
|
bound: this.host,
|
|
301
332
|
type: 'left, top',
|
|
302
333
|
cursor: 'grab',
|
|
303
334
|
zIndexBoost: false,
|
|
304
335
|
onDragStart: () => onStartSwiping(),
|
|
305
|
-
onDrag() {
|
|
336
|
+
onDrag() {
|
|
337
|
+
onSwiping(this);
|
|
338
|
+
},
|
|
306
339
|
onDragEnd: () => onThrowing()
|
|
307
|
-
})
|
|
340
|
+
});
|
|
308
341
|
}
|
|
309
342
|
clickToSwipe(clickedDirection) {
|
|
310
343
|
if (!this.buttons[clickedDirection].disabled) {
|
|
@@ -312,37 +345,52 @@ const YooFormSwipeCardsComponent = class {
|
|
|
312
345
|
this.swipeCard(clickedDirection);
|
|
313
346
|
}
|
|
314
347
|
}
|
|
315
|
-
async
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
348
|
+
async undoCard(card, shouldLockActions = true) {
|
|
349
|
+
var _a, _b;
|
|
350
|
+
card = card || this.swipeCards[this.swipeCards.reduce((acc, card, index) => (card.swipedDirection ? index : acc), 0)];
|
|
351
|
+
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)) {
|
|
352
|
+
shouldLockActions && this.lockSwipeActions();
|
|
353
|
+
const lastThrownCardElement = this.getCardElement(card === null || card === void 0 ? void 0 : card.id);
|
|
320
354
|
if (lastThrownCardElement) {
|
|
355
|
+
lastThrownCardElement.style.zIndex = '4';
|
|
321
356
|
lastThrownCardElement.style.removeProperty('top');
|
|
322
357
|
lastThrownCardElement.style.removeProperty('left');
|
|
323
358
|
lastThrownCardElement.removeAttribute('swiped');
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
359
|
+
card === null || card === void 0 ? true : delete card.swipedDirection;
|
|
360
|
+
await new Promise((resolve) => {
|
|
361
|
+
setTimeout(() => {
|
|
362
|
+
this.getUserAnswer();
|
|
363
|
+
resolve();
|
|
364
|
+
}, 225);
|
|
365
|
+
});
|
|
328
366
|
}
|
|
329
367
|
}
|
|
330
368
|
}
|
|
331
369
|
renderCards() {
|
|
332
|
-
|
|
370
|
+
let nbrCardRevealed = 0;
|
|
371
|
+
return (index.h("section", { id: "cards" }, this.swipeCards.map(({ swipedDirection, value, id }, i, s) => {
|
|
333
372
|
const currentCardIndex = s.indexOf(this.currentCard);
|
|
334
373
|
const hasCurrentCard = currentCardIndex !== -1;
|
|
335
|
-
|
|
374
|
+
const isCurrentCard = i === currentCardIndex;
|
|
375
|
+
return (index.h("div", { id: id, class: {
|
|
336
376
|
card: true,
|
|
337
|
-
current:
|
|
377
|
+
current: isCurrentCard,
|
|
338
378
|
second: hasCurrentCard && i === currentCardIndex + 1,
|
|
339
379
|
third: hasCurrentCard && i === currentCardIndex + 2,
|
|
340
380
|
revealing: this.revealCards
|
|
341
|
-
},
|
|
381
|
+
}, onTransitionEnd: () => {
|
|
382
|
+
nbrCardRevealed += 1;
|
|
383
|
+
if (this.revealCards && nbrCardRevealed === Math.min(s.length + 1, 3)) {
|
|
384
|
+
this.enableButtonActions = true;
|
|
385
|
+
}
|
|
386
|
+
if (isCurrentCard) {
|
|
387
|
+
this.currentCardElement.style.removeProperty('z-index');
|
|
388
|
+
}
|
|
389
|
+
}, ...{
|
|
342
390
|
type: this.mode,
|
|
343
391
|
...(swipedDirection && { direction: swipedDirection })
|
|
344
|
-
} }, this.hasImage && (index.h("div", { class: "content-image" }, index.h("yoo-img", { instant: true, src: overlays.getMedia(value['_downloadURL']) }))), this.hasText &&
|
|
345
|
-
}));
|
|
392
|
+
} }, this.hasImage && (index.h("div", { class: "content-image" }, index.h("yoo-img", { instant: true, src: overlays.getMedia(value['_downloadURL']) }))), this.hasText && index.h("div", { class: "content-text" }, overlays.translateMulti((value === null || value === void 0 ? void 0 : value['_filename']) || value))));
|
|
393
|
+
})));
|
|
346
394
|
}
|
|
347
395
|
renderInstructionCategory(side) {
|
|
348
396
|
const isLeftCategory = side === index$1.SwipeCardsDirection.left;
|
|
@@ -350,19 +398,19 @@ const YooFormSwipeCardsComponent = class {
|
|
|
350
398
|
const iconColor = overlays.isWeb(this.host) ? categoryColor : 'light';
|
|
351
399
|
const iconSize = overlays.isWeb(this.host) ? 'large' : 'medium';
|
|
352
400
|
const category = this.categories && overlays.translateMulti(isLeftCategory ? this.categories[0] : this.categories[1]);
|
|
353
|
-
return index.h("div", { class: { category: true, [side]: true } }, index.h("yoo-tag", { noBackground: overlays.isWeb(this.host), color: categoryColor, size: "large", icon: `big-arrow-${side}`, iconOnlyColor: iconColor, iconOnlySize: iconSize }), index.h("p", { class: `${categoryColor}` }, category), index.h("span", { class: "stable" }, overlays.translate(`SWIPE${side.toUpperCase()}`)));
|
|
401
|
+
return (index.h("div", { class: { category: true, [side]: true } }, index.h("yoo-tag", { noBackground: overlays.isWeb(this.host), color: categoryColor, size: "large", icon: `big-arrow-${side}`, iconOnlyColor: iconColor, iconOnlySize: iconSize }), index.h("p", { class: `${categoryColor}` }, category), index.h("span", { class: "stable" }, overlays.translate(`SWIPE${side.toUpperCase()}`))));
|
|
354
402
|
}
|
|
355
403
|
renderTopDescription() {
|
|
356
|
-
return index.h("div", { id: "header" }, index.h("span", { id: "title", innerHTML: overlays.translateMulti(this.label) }), index.h("span", { class: "stable" }, overlays.translate(this.description || 'CARDSWIPEDEFAULTINSTRUCTIONS')));
|
|
404
|
+
return (index.h("div", { id: "header" }, index.h("span", { id: "title", innerHTML: overlays.translateMulti(this.label) }), index.h("span", { class: "stable" }, overlays.translate(this.description || 'CARDSWIPEDEFAULTINSTRUCTIONS'))));
|
|
357
405
|
}
|
|
358
|
-
|
|
359
|
-
return
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
406
|
+
renderHeaderInstructions() {
|
|
407
|
+
return [
|
|
408
|
+
this.renderTopDescription(),
|
|
409
|
+
index.h("section", { id: "categories" }, this.renderInstructionCategory(index$1.SwipeCardsDirection.left), index.h("yoo-icon", { size: "extra-extra-large", name: "swipe-explanation", color: "stable-alt" }), this.renderInstructionCategory(index$1.SwipeCardsDirection.right)),
|
|
410
|
+
this.instructionsDocument && (index.h("section", { id: "document" }, index.h("div", { class: "document-title" }, overlays.translate('ATTACHMENTS')), index.h("yoo-form-document", { document: this.instructionsDocument, readonly: true, onInputChanged: (ev) => ev.stopPropagation() })))
|
|
411
|
+
];
|
|
364
412
|
}
|
|
365
|
-
|
|
413
|
+
renderActions() {
|
|
366
414
|
const { left, undo, right } = index$1.SwipeCardsDirection;
|
|
367
415
|
return index.h("section", { id: "actions" }, [left, undo, right].map((d, i) => this.renderSwipeAction(d, i)));
|
|
368
416
|
}
|
|
@@ -371,51 +419,67 @@ const YooFormSwipeCardsComponent = class {
|
|
|
371
419
|
const isUndo = direction === index$1.SwipeCardsDirection.undo;
|
|
372
420
|
const isLeft = direction === index$1.SwipeCardsDirection.left;
|
|
373
421
|
const isMobile = !overlays.isWeb(this.host) || this.livePreview;
|
|
374
|
-
const actionColor = isUndo ? overlays.isWeb(this.host) ? 'light' : 'stable-alt' : isLeft ? 'app-color' : 'warning';
|
|
422
|
+
const actionColor = isUndo ? (overlays.isWeb(this.host) ? 'light' : 'stable-alt') : isLeft ? 'app-color' : 'warning';
|
|
375
423
|
const swipeIcon = isUndo ? 'undo' : `big-arrow-${direction}`;
|
|
376
424
|
const categoryIndex = isLeft ? 0 : 1;
|
|
377
|
-
return (index.h("div", { class: { action: true, hide: this.hasAllCardBeenSwiped && !isUndo } }, index.h("yoo-button", { shape: "circular", rippleType: "unbounded", id: `swipe-${direction}`, size:
|
|
425
|
+
return (index.h("div", { class: { action: true, hide: this.hasAllCardBeenSwiped && !isUndo } }, index.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$2] = element), onClick: () => (isUndo ? this.undoCard() : this.clickToSwipe(direction)) }, index.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) && index.h("span", { class: actionColor }, overlays.translateMulti(this.categories[categoryIndex]))));
|
|
378
426
|
}
|
|
379
|
-
|
|
380
|
-
return index.h("section", { id: "end-message", class: { active: this.hasAllCardBeenSwiped } }, index.h("yoo-lottie", { autoplay: this.hasAllCardBeenSwiped, type: "check" }), index.h("div", { innerHTML: overlays.translate('ENDSWIPINGCARDSMESSAGE') }), index.h("span", null, overlays.translate('CLICKTOCONTINUE', { buttonName: this.nextButtonText })));
|
|
427
|
+
renderBackground() {
|
|
428
|
+
return (index.h("section", { id: "background" }, index.h("div", { id: "end-message", class: { active: this.hasAllCardBeenSwiped } }, index.h("yoo-lottie", { autoplay: this.hasAllCardBeenSwiped, type: "check" }), index.h("div", { innerHTML: overlays.translate('ENDSWIPINGCARDSMESSAGE') }), index.h("span", null, overlays.translate('CLICKTOCONTINUE', { buttonName: this.nextButtonText }))), this.renderActions()));
|
|
381
429
|
}
|
|
382
430
|
renderGame() {
|
|
383
431
|
return [
|
|
384
432
|
overlays.isWeb(this.host) && !this.livePreview && this.renderTopDescription(),
|
|
385
|
-
index.h("section", { id: "game", ref: (element) => (this.gameContainerElement = element) }, this.
|
|
386
|
-
this.renderSwipeButtons()
|
|
433
|
+
index.h("section", { id: "game", ref: (element) => (this.gameContainerElement = element) }, this.renderBackground(), this.renderCards())
|
|
387
434
|
];
|
|
388
435
|
}
|
|
436
|
+
renderStartButton() {
|
|
437
|
+
return (!this.readonly &&
|
|
438
|
+
this.showInstructionView && (index.h("yoo-button", { disabled: !this.hasData || !this.isDataValid, size: overlays.isWeb(this.host) && !this.livePreview ? 'medium' : 'large', color: "app-color", onClick: () => {
|
|
439
|
+
this.revealCards = true;
|
|
440
|
+
this.showInstructionView = false;
|
|
441
|
+
this.displayFooterElement();
|
|
442
|
+
} }, overlays.translate('START'))));
|
|
443
|
+
}
|
|
444
|
+
renderInstructions() {
|
|
445
|
+
return [index.h("section", { id: "instructions" }, this.renderHeaderInstructions()), this.renderStartButton()];
|
|
446
|
+
}
|
|
389
447
|
renderSummary() {
|
|
390
|
-
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) ? overlays.translateMulti(category) : ''; };
|
|
448
|
+
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) ? overlays.translateMulti(category) : ''); };
|
|
391
449
|
const getAnswerImage = (answerValue) => {
|
|
392
450
|
var _a, _b;
|
|
393
451
|
const getImageValue = (image) => image[`${this.isMode.image ? '_downloadURL' : '_filename'}`];
|
|
394
|
-
return (((_a = this.images.find(image => getImageValue(image) === answerValue)) === null || _a === void 0 ? void 0 : _a._downloadURL) ||
|
|
395
|
-
((_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) ||
|
|
452
|
+
return (((_a = this.images.find((image) => getImageValue(image) === answerValue)) === null || _a === void 0 ? void 0 : _a._downloadURL) ||
|
|
453
|
+
((_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) ||
|
|
454
|
+
'');
|
|
396
455
|
};
|
|
397
456
|
const getValidationClass = (categoryIndex, answerValue) => this.answer[categoryIndex].find((answer) => answerValue.includes(answer)) ? 'valid' : 'invalid';
|
|
398
|
-
return this.
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
457
|
+
return (this.readonly &&
|
|
458
|
+
this.categories.map((categoryValue, catIndex) => [
|
|
459
|
+
index.h("div", { class: "category-title" }, getAnswerCounter(categoryValue)),
|
|
460
|
+
index.h("ul", null, Array.from(new Set(this.value[catIndex])).map((userAnswer) => {
|
|
461
|
+
var _a;
|
|
462
|
+
return (index.h("li", { class: getValidationClass(catIndex, userAnswer) }, !!((_a = this.images) === null || _a === void 0 ? void 0 : _a.length) && index.h("yoo-img", { src: getAnswerImage(userAnswer) }), !this.isMode.image && index.h("yoo-truncate", null, overlays.translateMulti(userAnswer))));
|
|
463
|
+
}))
|
|
464
|
+
]));
|
|
405
465
|
}
|
|
406
466
|
renderBanner() {
|
|
407
|
-
return this.livePreview &&
|
|
467
|
+
return (this.livePreview &&
|
|
468
|
+
!this.readonly && (index.h("yoo-banner", null, index.h("p", { slot: "content" }))));
|
|
469
|
+
}
|
|
470
|
+
renderMain() {
|
|
471
|
+
return index.h("main", null, !this.readonly && (this.showInstructionView ? this.renderInstructions() : this.renderGame()));
|
|
408
472
|
}
|
|
409
473
|
render() {
|
|
410
|
-
return (index.h(index.Host, { class: { ...commonHelpers.getAppContext(this.host), 'swiper-no-swiping': !this.readonly,
|
|
474
|
+
return (index.h(index.Host, { class: { ...commonHelpers.getAppContext(this.host), 'swiper-no-swiping': !this.readonly }, ...{ view: this.showInstructionView ? 'instructions' : 'game' } }, this.renderBanner(), this.renderMain(), this.renderSummary()));
|
|
411
475
|
}
|
|
412
476
|
get host() { return index.getElement(this); }
|
|
413
477
|
static get watchers() { return {
|
|
478
|
+
"isVisible": ["onIsVisibleChanged"],
|
|
414
479
|
"categories": ["onCategoriesChanged"],
|
|
415
480
|
"values": ["onValuesChanged"],
|
|
416
481
|
"images": ["onImagesChanged"],
|
|
417
|
-
"required": ["onRequireChanged"]
|
|
418
|
-
"isVisible": ["onIsVisibleChanged"]
|
|
482
|
+
"required": ["onRequireChanged"]
|
|
419
483
|
}; }
|
|
420
484
|
};
|
|
421
485
|
YooFormSwipeCardsComponent.style = formSwipeCardsCss;
|