aprila-wizard
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -23,9 +23,9 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"uWh2":[function(require,module,exports) { | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"DefaultTemplateProcessor",{enumerable:!0,get:function(){return e.DefaultTemplateProcessor}}),Object.defineProperty(exports,"defaultTemplateProcessor",{enumerable:!0,get:function(){return e.defaultTemplateProcessor}}),Object.defineProperty(exports,"SVGTemplateResult",{enumerable:!0,get:function(){return t.SVGTemplateResult}}),Object.defineProperty(exports,"TemplateResult",{enumerable:!0,get:function(){return t.TemplateResult}}),Object.defineProperty(exports,"directive",{enumerable:!0,get:function(){return r.directive}}),Object.defineProperty(exports,"isDirective",{enumerable:!0,get:function(){return r.isDirective}}),Object.defineProperty(exports,"removeNodes",{enumerable:!0,get:function(){return n.removeNodes}}),Object.defineProperty(exports,"reparentNodes",{enumerable:!0,get:function(){return n.reparentNodes}}),Object.defineProperty(exports,"noChange",{enumerable:!0,get:function(){return o.noChange}}),Object.defineProperty(exports,"nothing",{enumerable:!0,get:function(){return o.nothing}}),Object.defineProperty(exports,"AttributeCommitter",{enumerable:!0,get:function(){return i.AttributeCommitter}}),Object.defineProperty(exports,"AttributePart",{enumerable:!0,get:function(){return i.AttributePart}}),Object.defineProperty(exports,"BooleanAttributePart",{enumerable:!0,get:function(){return i.BooleanAttributePart}}),Object.defineProperty(exports,"EventPart",{enumerable:!0,get:function(){return i.EventPart}}),Object.defineProperty(exports,"isIterable",{enumerable:!0,get:function(){return i.isIterable}}),Object.defineProperty(exports,"isPrimitive",{enumerable:!0,get:function(){return i.isPrimitive}}),Object.defineProperty(exports,"NodePart",{enumerable:!0,get:function(){return i.NodePart}}),Object.defineProperty(exports,"PropertyCommitter",{enumerable:!0,get:function(){return i.PropertyCommitter}}),Object.defineProperty(exports,"PropertyPart",{enumerable:!0,get:function(){return i.PropertyPart}}),Object.defineProperty(exports,"parts",{enumerable:!0,get:function(){return u.parts}}),Object.defineProperty(exports,"render",{enumerable:!0,get:function(){return u.render}}),Object.defineProperty(exports,"templateCaches",{enumerable:!0,get:function(){return a.templateCaches}}),Object.defineProperty(exports,"templateFactory",{enumerable:!0,get:function(){return a.templateFactory}}),Object.defineProperty(exports,"TemplateInstance",{enumerable:!0,get:function(){return p.TemplateInstance}}),Object.defineProperty(exports,"createMarker",{enumerable:!0,get:function(){return s.createMarker}}),Object.defineProperty(exports,"isTemplatePartActive",{enumerable:!0,get:function(){return s.isTemplatePartActive}}),Object.defineProperty(exports,"Template",{enumerable:!0,get:function(){return s.Template}}),exports.svg=exports.html=void 0;var e=require("./lib/default-template-processor.js"),t=require("./lib/template-result.js"),r=require("./lib/directive.js"),n=require("./lib/dom.js"),o=require("./lib/part.js"),i=require("./lib/parts.js"),u=require("./lib/render.js"),a=require("./lib/template-factory.js"),p=require("./lib/template-instance.js"),s=require("./lib/template.js");(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.1.2");const l=(r,...n)=>new t.TemplateResult(r,n,"html",e.defaultTemplateProcessor);exports.html=l;const c=(r,...n)=>new t.SVGTemplateResult(r,n,"svg",e.defaultTemplateProcessor);exports.svg=c; | ||
},{"./lib/default-template-processor.js":"LBiL","./lib/template-result.js":"cVNN","./lib/directive.js":"uWh2","./lib/dom.js":"ytxR","./lib/part.js":"pnLb","./lib/parts.js":"atl2","./lib/render.js":"Fhpq","./lib/template-factory.js":"gbKZ","./lib/template-instance.js":"bn5t","./lib/template.js":"Av0K"}],"FOZT":[function(require,module,exports) { | ||
"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function t(t){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?e(a,!0).forEach(function(e){n(t,e,a[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):e(a).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))})}return t}function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e){return u(e)||o(e)||a()}function a(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function o(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}function u(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}function i(e,t){return"function"==typeof e?e(t):e}function c(e){var t=e.state,n=e.schema,r=e.page,a=e.count,o=void 0===a?0:a,u=r.nextPage?i(r.nextPage,t):null;if(u){var s=n.find(function(e){return e.path===u});return s?c({state:t,schema:n,page:s,count:o+1}):o}return o}function s(e){var t=e.state,n=e.schema,r=e.page,a=e.count,o=void 0===a?0:a,u=r.previousPage?i(r.previousPage,t):null;if(u){var c=n.find(function(e){return e.path===u});return c?s({state:t,schema:n,page:c,count:o+1}):o}return o}function l(e){var t=e.schema.find(function(t){return t.path===e.currentPage}),n=c({schema:e.schema,state:e.state,page:t,count:0}),r=s({schema:e.schema,state:e.state,page:t,count:0});return r/(n+r)*100}function f(e){var t=e.schema.find(function(t){return t.path===e.currentPage});return c({schema:e.schema,state:e.state,page:t,count:0})+s({schema:e.schema,state:e.state,page:t,count:0})+1}function p(e){return/^.+@.+\..+$/.test(e)}function d(e){return/^[\s\d+()-]{8,}$/.test(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getValue=i,exports.countNextPages=c,exports.countPrevPages=s,exports.getCurrentStepInPercent=l,exports.getTotalNumberOfPages=f,exports.validateEmail=p,exports.validatePhone=d,exports.reRender=g,exports.routeChange=v,exports.checkPageValidation=b,exports.submitData=m,exports.typeOf=x,exports.classnames=P,exports.getVisibleBlocks=w,exports.getAllVisiblePages=O,exports.flattenBlocks=j,exports.getAllVisibleQuestions=V,exports.validateBlocks=k,exports.schemaToFlatState=E,exports.schemaToFlatValidations=Q,exports.ObservedObject=S,exports.blockTypes=exports.router=void 0;var h={goTo:function(e){return window.history.pushState({},e,window.location.origin+e)},currentPath:function(){return window.location.pathname}};function g(){window.dispatchEvent(new CustomEvent("rerender"))}function v(e){window.dispatchEvent(new CustomEvent("routechange",{detail:e}))}function b(e){window.dispatchEvent(new CustomEvent("checkpagevalidation"))}function m(e){window.dispatchEvent(new CustomEvent("wizard-submit",{detail:Object.freeze(e)}))}function x(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function P(e){return Object.keys(e).filter(function(t){return e[t]}).reduce(function(e,t,n){return e.concat(n>0?" ".concat(t):"".concat(t))},"")}function w(e,n){return e.children?e.children.reduce(function(a,o){if(void 0===o.show||("function"===x(o.show)?o.show(n.state):o.show)){var u=o.children?w(o,n):[];return[].concat(r(a),[t({},o,{path:e.path})],r(u))}return a},[]):[]}exports.router=h;var y=function(e){return{checkbox:{isQuestion:!0,defaultValue:!1},textarea:{isQuestion:!0,defaultValue:null},range:{isQuestion:!0,defaultValue:null},radio:{isQuestion:!0,defaultValue:null},input:{isQuestion:!0,defaultValue:null},file:{isQuestion:!0,defaultValue:[]},"multi-checkbox":{isQuestion:!0,defaultValue:[]},autocomplete:e.multiple?{isQuestion:!0,defaultValue:[]}:{isQuestion:!0,defaultValue:null}}};function O(e){return e.schema.reduce(function(n,a,o){var u=0===o?a:e.schema.find(function(e){return e.path===n.nextPagePath}),c=u.nextPage?i(u.nextPage,e.state):null;return c?t({},n,{pages:[].concat(r(n.pages),[t({},u)]),nextPagePath:c}):n},{pages:[],nextPagePath:""}).pages.filter(function(e){return"page"===e.type})}function j(e){return e.reduce(function(e,n){var a=n.children?j(n.children):{};return[].concat(r(e),[t({},n)],r(a))},[])}function V(e){return e.schema.reduce(function(n,a,o){var u=0===o?a:e.schema.find(function(e){return e.path===n.nextPagePath}),c=u.nextPage?i(u.nextPage,e.state):null;return c?t({},n,{blocks:[].concat(r(n.blocks),r(w(u,e))),nextPagePath:c}):n},{blocks:[],nextPagePath:""}).blocks.filter(function(e){return y(e)[e.type]&&y(e)[e.type].isQuestion})}function k(e,t){return e.every(function(e){var n=!0,r="function"==typeof e.validate,a=void 0===t.state[e.id]||null===t.state[e.id]||""===t.state[e.id]||t.state[e.id]===[],o=!!e.required;return(r||o)&&(r?n="function"===x(e.validate)?e.validate(t.state[e.id]):e.validate:o&&(n=!a)),n})}function E(e){return e.reduce(function(e,r){var a=r.children?E(r.children):{},o=y(r)[r.type]&&y(r)[r.type].defaultValue;return t({},e,n({},r.id,o),a)},{})}function Q(e){return e.reduce(function(e,r){var a=r.children?Q(r.children):{};return t({},e,n({},r.id,void 0),a)},{})}function S(e){var t=this,n=function(n){Object.defineProperty(t,n,{get:function(){return"object"===x(e[n])?new S(e[n]):e[n]},set:function(t){e[n]!==t&&(e[n]=t,b(),g())},enumerable:!0})};for(var r in e)n(r)}exports.blockTypes=y; | ||
},{}],"X1ux":[function(require,module,exports) { | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.blocks=void 0;var n=require("./index.js"),e=require("./utils.js"),t=require("lit-html");function a(){var n=M(["\n <ab-label ?required=","\n >","</ab-label\n >\n "]);return a=function(){return n},n}function r(){var n=M(['\n <ab-container full mt="600">\n ',"\n\n <ab-checkbox\n ?checked=","\n value=","\n @change=","\n >\n ","\n </ab-checkbox>\n </ab-container>\n\n ","\n "]);return r=function(){return n},n}function i(){var n=M(["\n <ab-checkbox\n ?checked=","\n value=","\n @change=","\n >\n ","\n </ab-checkbox>\n ","\n "]);return i=function(){return n},n}function l(){var n=M(['\n <ab-container full mt="600">\n <ab-label ?required=',"\n >","</ab-label\n >\n ","\n </ab-container>\n ","\n "]);return l=function(){return n},n}function u(){var n=M(['\n <ab-container mb="300" mr="300" ?full=',">\n <ab-radio-button\n ?checked=","\n value=","\n name=","\n @change=","\n >\n ","\n </ab-radio-button>\n </ab-container>\n ","\n "]);return u=function(){return n},n}function o(){var n=M(["\n <ab-label ?required=","\n >","</ab-label\n >\n "]);return o=function(){return n},n}function c(){var n=M(['\n <ab-container mt="600" full>\n ',"\n ","\n </ab-container>\n ","\n "]);return c=function(){return n},n}function b(){var n=M(['\n <ab-button\n type="positive"\n @click=',"\n >Oppsummering\n </ab-button>\n "]);return b=function(){return n},n}function s(){var n=M(['\n <ab-button\n type="primary"\n icon="arrow-right"\n ?disabled=',"\n @click=","\n >Neste\n </ab-button>\n "]);return s=function(){return n},n}function d(){var n=M(['\n <ab-button\n type="transparent"\n @click=',"\n >\n Tilbake</ab-button\n >\n "]);return d=function(){return n},n}function f(){var n=M(['\n <ab-container px="300" full center large>\n <ab-grid>\n <ab-grid-item s="12" m="5">\n <img src="https://cdn.sanity.io/images/8j24leyc/production/a987c37d7270624bd71338d217aa702780ba3e5d-300x120.svg?h=240"></img>\n </ab-grid-item>\n <ab-grid-item s="12" m="7">\n <div style="height: 100%" class="ab-flex ab-flex--a-center ab-flex--j-center">\n <ab-container full>\n Steg '," av ",'\n <ab-progress style="width: 100%" value=',' type="primary"></ab-progress>\n\n </ab-container>\n </div>\n </ab-grid-item>\n </ab-grid>\n </ab-container>\n\n <ab-container px="300" pt="900" full large center>\n <ab-grid>\n <ab-grid-item s="12" m="8">\n <ab-container full mb="800">\n <ab-typography color="primary-800" size="h-700">\n ','\n </ab-typography>\n </ab-container>\n <ab-container full narrow mb="800">\n <ab-typography size="p-600">\n ',"\n </ab-typography>\n </ab-container>\n ",'\n </ab-grid-item>\n <ab-grid-item s="12" m="4">\n <ab-container py="600" px="400" my="400" bg="primary-100" radius="200" border="primary-200">\n <ab-typography size="h-400" color="primary-800">Formål og tilsiktet art</ab-typography>\n <ab-container mt="300">\n <ab-typography size="p-300">\n Før kundeforholdet kan etableres må bankens kunder i henhold til\n hvitvaskingsloven blant annet oppgi formål og forventet bruk av\n bankens produkter og tjenester.\n </ab-typography>\n </ab-container>\n </ab-container>\n </ab-grid-item>\n </ab-grid>\n </ab-container>\n <div class="ab-sticky ab-sticky--bottom">\n <ab-container bg="white" py="500" px="300" full center large>\n ',"\n ","\n ","\n </ab-container>\n </div>\n\n "]);return f=function(){return n},n}function p(){var n=M(["\n ","\n "]);return p=function(){return n},n}function m(){var n=M(['\n <ab-container full mb="300">\n <ab-typography size="p-400">\n ',"\n </ab-typography>\n </ab-container>\n "]);return m=function(){return n},n}function g(){var n=M(['\n <ab-container mb="300">\n <ab-typography size="p-600">\n ',"\n </ab-typography>\n </ab-container>\n "]);return g=function(){return n},n}function h(){var n=M(['\n <ab-container full mb="300">\n <ab-typography color="primary-800" size="h-400">\n ',"\n </ab-typography>\n </ab-container>\n "]);return h=function(){return n},n}function v(){var n=M(['\n <ab-container mt="500" full>\n ',"\n ","\n ","\n </ab-container>\n ","\n "]);return v=function(){return n},n}function y(){var n=M(["\n <ab-autocomplete-option\n ?selected=","\n value=","\n label=","\n ></ab-autocomplete-option>\n "]);return y=function(){return n},n}function k(){var n=M(['\n <ab-container mt="500" full>\n <ab-label ?required=',"\n >","</ab-label\n >\n <ab-autocomplete\n placeholder=","\n ?multiple=","\n ?searchable=","\n @change=","\n >\n ","\n </ab-autocomplete>\n </ab-container>\n ","\n "]);return k=function(){return n},n}function V(){var n=M(['\n <ab-container my="500" full>\n <ab-input\n ?required=',"\n @blur=","\n label=","\n type=","\n .value=","\n ?error=","\n error-text=","\n @input=","\n ></ab-input>\n </ab-container>\n ","\n "]);return V=function(){return n},n}function x(){var n=M(['\n <ab-container mt="500" full>\n <ab-label ?required=',"\n >",'</ab-label\n >\n <textarea\n class="ab-textarea"\n value=',"\n @change=","\n @input=","\n ></textarea>\n </ab-container>\n ","\n "]);return x=function(){return n},n}function q(){var n=M(['\n <ab-container\n full=""\n p="300"\n mb="200"\n bg="ui-100"\n radius="200"\n border="ui-400"\n >\n <ab-flex j="between">\n <ab-flex a="center">\n <ab-icon name="file"></ab-icon>\n\n <ab-container ml="300">\n <ab-typography as="p" size="h-300"\n >','</ab-typography\n >\n <ab-typography as="p" size="p-400" color="ui-600"\n >22.06.2019, Onboarding - Jurgen Shlag</ab-typography\n >\n </ab-container>\n </ab-flex>\n <ab-container>\n <ab-button @click=',' type="transparent"\n ><ab-icon name="delete"></ab-icon\n ></ab-button>\n </ab-container>\n </ab-flex>\n </ab-container>\n ']);return q=function(){return n},n}function P(){var n=M(['\n <ab-container mt="500" mb="300" full>\n <ab-label ?required=',"\n >",'</ab-label\n >\n <label class="ab-file-input ab-file-input--full">\n <input @change=',' placeholder="Placeholder" type="file" />\n <div class="ab-file-input__cta">\n <ab-container mr="200">\n <ab-icon name="file"></ab-icon>\n </ab-container>\n <span class="ab-file-input__label"\n >',"</span\n >\n </div>\n </label>\n </ab-container>\n\n ","\n ","\n "]);return P=function(){return n},n}function z(){var n=M(["\n <li>","</li>\n "]);return z=function(){return n},n}function j(){var n=M(['\n <ab-container mt="500" full>\n <ab-label ?required=',">\n ","\n </ab-label>\n <ul class=",">\n ","\n </ul>\n </ab-container>\n ","\n "]);return j=function(){return n},n}function B(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function w(){var n=M(["\n <span>","</span>\n <span>","</span>\n <span>","</span>\n "]);return w=function(){return n},n}function O(n){return S(n)||A(n)||_()}function _(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function A(n){if(Symbol.iterator in Object(n)||"[object Arguments]"===Object.prototype.toString.call(n))return Array.from(n)}function S(n){if(Array.isArray(n)){for(var e=0,t=new Array(n.length);e<n.length;e++)t[e]=n[e];return t}}function C(){var n=M(['\n <ab-container mt="500" full>\n <ab-label ?required=',">\n ",'\n </ab-label>\n\n <div class="ab-slider">\n <output class="ab-slider__output" for=',">\n ",'\n </output>\n <input\n type="range"\n min=',"\n max=","\n name=","\n step=","\n @input=","\n value=",'\n class="ab-slider__input"\n id="myRange"\n />\n <div class="ab-slider__step-labels">\n ',"\n </div>\n </div>\n </ab-container>\n ","\n "]);return C=function(){return n},n}function I(){var n=M(['\n <ab-container mt="500" full>\n <ab-label ?required=',">\n ","\n </ab-label>\n <ab-table\n .columns=","\n .items=","\n ></ab-table>\n </ab-container>\n ","\n "]);return I=function(){return n},n}function N(){var n=M(["\n <ab-radio-tabs-item\n ?checked=","\n value=","\n @change=","\n >\n ","\n </ab-radio-tabs-item>\n "]);return N=function(){return n},n}function T(){var n=M(["\n <ab-label ?required=","\n >","</ab-label\n >\n "]);return T=function(){return n},n}function D(){var n=M(['\n <ab-container mt="600" full>\n ',"\n <ab-radio-tabs>\n ","\n </ab-radio-tabs>\n </ab-container>\n ","\n "]);return D=function(){return n},n}function F(){var n=M(['\n <li>\n <ab-flex j="between">\n <div>\n <ab-label>\n ','\n </ab-label>\n <ab-typography h="600" color="primary-800">\n ','\n </ab-typography>\n </div>\n <ab-button\n icon="edit"\n style="text-align: right"\n size="small"\n type="transparent"\n @click=',"\n >\n Endre\n </ab-button>\n </ab-flex>\n </li>\n "]);return F=function(){return n},n}function E(){var n=M(['\n <ab-container px="300" full center large>\n <ab-grid>\n <ab-grid-item s="12" m="5">\n <img src="https://cdn.sanity.io/images/8j24leyc/production/a987c37d7270624bd71338d217aa702780ba3e5d-300x120.svg?h=240"></img>\n </ab-grid-item>\n </ab-grid>\n </ab-container>\n\n <ab-container px="300" pt="900" full large center>\n <ab-grid>\n <ab-grid-item s="12" m="8">\n <ab-container full mb="800">\n <ab-typography color="primary-800" size="h-700">\n ','\n </ab-typography>\n </ab-container>\n <ab-container full narrow mb="800">\n <ab-typography size="p-600">\n ','\n </ab-typography>\n </ab-container>\n <ul class="ab-list ab-list--full ab-list--large ab-list--bordered">\n ','\n </ul>\n </ab-grid-item>\n </ab-grid>\n </ab-container>\n\n <div class="ab-sticky ab-sticky--bottom">\n <ab-container bg="white" py="500" px="300" full center large>\n <ab-button @click=',' type="primary" size="large">Send inn</ab-button>\n </ab-container>\n </div>\n ']);return E=function(){return n},n}function M(n,e){return e||(e=n.slice(0)),Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(e)}}))}var Q=new Intl.NumberFormat("no-NO",{style:"currency",currency:"NOK"}),J={summary:function(n){var a=n.block,r=n.store;if(r.currentPage===a.path){var i=(0,e.getAllVisibleQuestions)(r);return(0,t.html)(E(),(0,e.getValue)(a.title,r.state),(0,e.getValue)(a.intro,r.state),i.map(function(n){return(0,t.html)(F(),n.label,r.state[n.id],function(){return(0,e.routeChange)(n.path)})}),function(){return"function"===(0,e.typeOf)(a.onSubmit)&&a.onSubmit(r),void(0,e.submitData)(r)})}return null},"radio-tabs":function(a){var r=a.block,i=a.store;return(0,t.html)(D(),r.label?(0,t.html)(T(),r.required,(0,e.getValue)(r.label,i.state)):null,(0,e.getValue)(r.options,i.state).map(function(n){return(0,t.html)(N(),(0,e.getValue)(n.value,i.state)===i.state[r.id],(0,e.getValue)(n.value,i.state),function(){return i.state[r.id]=(0,e.getValue)(n.value,i.state)},(0,e.getValue)(n.label,i.state))}),r.children?(0,n.renderBlocks)({schema:r.children}):null)},table:function(a){var r=a.block,i=a.store;return(0,t.html)(I(),r.required,(0,e.getValue)(r.label,i.state),(0,e.getValue)(r.columns,i.state),(0,e.getValue)(r.items,i.state),r.children?(0,n.renderBlocks)({schema:r.children,store:i}):null)},range:function(a){var r=a.block,i=a.store,l=(0,e.getValue)(r.min,i.state),u=(0,e.getValue)(r.max,i.state),o=(0,e.getValue)(r.label,i.state),c=(0,e.getValue)(r.step,i.state);return(0,t.html)(C(),r.required,o,r.id,i.state[r.id]?Q.format(i.state[r.id]):r.placeholder||"Dra i slideren",l||0,u||100,r.id,c||10,function(n){return i.state[r.id]=n.target.value},i.state[r.id],O(new Array(r.numberOfSteps)).map(function(n,e){return(0,t.html)(w(),Q.format(l),Q.format(u/2),Q.format(u))}),r.children?(0,n.renderBlocks)({schema:r.children,store:i}):null)},list:function(a){var r=a.block,i=a.store,l=(0,e.getValue)(r.items,i.state),u=(0,e.classnames)(B({"ab-list":!0,"ab-list--full":r.full,"ab-list--bordered":r.bordered,"ab-list--bullets":r.bullets},"ab-list--".concat(r.size),r.size));return(0,t.html)(j(),r.required,(0,e.getValue)(r.label,i.state),u,l.map(function(n){return(0,t.html)(z(),n)}),r.children?(0,n.renderBlocks)({schema:r.children,store:i}):null)},file:function(a){var r=a.block,i=a.store;return(0,t.html)(P(),r.required,(0,e.getValue)(r.label,i.state),function(n){i.state[r.id]=[].concat(O(i.state[r.id]),O(n.target.files))},r.buttonText||"Last opp fil",i.state[r.id].map(function(n){return(0,t.html)(q(),n.name,function(){return function(n){i.state[r.id]=i.state[r.id].filter(function(e){return e.name!==n.name})}(n)})}),r.children?(0,n.renderBlocks)({schema:r.children,store:i}):null)},textarea:function(a){var r=a.block,i=a.store;return(0,t.html)(x(),r.required,(0,e.getValue)(r.label,i.state),i.state[r.id],function(n){if("function"==typeof r.validate)i.validations[r.id]=r.validate(n.target.value);else if(r.required){var e=void 0===i.state[r.id]||null===i.state[r.id]||""===i.state[r.id]||i.state[r.id]===[];i.validations[r.id]=!e}},function(n){return i.state[r.id]=n.target.value},r.children?(0,n.renderBlocks)({schema:r.children,store:i}):null)},input:function(a){var r=a.block,i=a.store;return(0,t.html)(V(),r.required,function(n){if("function"==typeof r.validate)i.validations[r.id]=r.validate(n.target.value);else if(r.required){var e=void 0===i.state[r.id]||null===i.state[r.id]||""===i.state[r.id]||i.state[r.id]===[];i.validations[r.id]=!e}},(0,e.getValue)(r.label,i.state),r.inputType||"text",i.state[r.id],!1===i.validations[r.id],r.errorMessage||"Du har oppgitt en ugyldig verdi",function(n){return i.state[r.id]=n.target.value},r.children?(0,n.renderBlocks)({schema:r.children,store:i}):null)},autocomplete:function(a){var r=a.block,i=a.store;return(0,t.html)(k(),r.required,(0,e.getValue)(r.label,i.state),r.placeholder,r.multiple,r.searchable,function(n){return i.state[r.id]=n.target.selected},r.options.map(function(n){return(0,t.html)(y(),i.state[r.id].some(function(e){return e===n.value}),(0,e.getValue)(n.value,i.state),(0,e.getValue)(n.label,i.state))}),r.children?(0,n.renderBlocks)({schema:r.children}):null)},info:function(a){var r=a.block,i=a.store;return(0,t.html)(v(),r.title?(0,t.html)(h(),(0,e.getValue)(r.title,i.state)):null,r.intro?(0,t.html)(g(),(0,e.getValue)(r.intro,i.state)):null,r.body?(0,t.html)(m(),(0,e.getValue)(r.body,i.state)):null,r.children?(0,n.renderBlocks)({schema:r.children}):null)},page:function(a){var r=a.block,i=a.store,l=(0,e.getAllVisibleQuestions)(i),u=(0,e.validateBlocks)(l,i),o=(0,e.getAllVisiblePages)(i).every(function(n){return i.confirmedPages[r.id]});return(0,t.html)(p(),i.currentPage===r.path?(0,t.html)(f(),(0,e.countPrevPages)({state:i.state,schema:i.schema,page:r})+1,(0,e.getTotalNumberOfPages)(i),(0,e.getCurrentStepInPercent)(i),(0,e.getValue)(r.title,i.state),(0,e.getValue)(r.intro,i.state),r.children?(0,n.renderBlocks)({schema:r.children,store:i}):null,r.previousPage?(0,t.html)(d(),function(){return n=r.previousPage(i.state),void(0,e.routeChange)(n);var n}):null,r.nextPage?(0,t.html)(s(),!i.currentPageIsValidated,function(){return n=r.nextPage(i.state),void(i.currentPageIsValidated&&(i.confirmedPages[r.id]=!0,(0,e.routeChange)(n)));var n}):null,u&&o?(0,t.html)(b(),function(){return(0,e.routeChange)(i.schema[i.schema.length-1].path)}):null):null)},radio:function(a){var r=a.block,i=a.store;return(0,t.html)(c(),r.label?(0,t.html)(o(),r.required,(0,e.getValue)(r.label,i.state)):null,(0,e.getValue)(r.options,i.state).map(function(a){return(0,t.html)(u(),!r.horisontal,(0,e.getValue)(a.value,i.state)===i.state[r.id],(0,e.getValue)(a.value,i.state),r.id,function(){return i.state[r.id]=(0,e.getValue)(a.value,i.state)},(0,e.getValue)(a.label,i.state),a.children?(0,n.renderBlocks)({schema:a.children}):null)}),r.children?(0,n.renderBlocks)({schema:r.children}):null)},"multi-checkbox":function(a){var r=a.block,u=a.store;return(0,t.html)(l(),r.required,(0,e.getValue)(r.label,u.state),(0,e.getValue)(r.options,u.state).map(function(a){return(0,t.html)(i(),function(n){return!!u.state[r.id]&&u.state[r.id].some(function(t){return t===(0,e.getValue)(n.value,u.state)})}(a),(0,e.getValue)(a.value,u.state),function(n){return function(n,t){if(n.target.checked){var a=u.state[r.id]?u.state[r.id]:[];u.state[r.id]=[].concat(O(a),[(0,e.getValue)(t.value,u.state)])}else u.state[r.id]=u.state[r.id].filter(function(n){return n!==(0,e.getValue)(t.value,u.state)})}(n,a)},(0,e.getValue)(a.label,u.state),a.children?(0,n.renderBlocks)({schema:a.children}):null)}),r.children?(0,n.renderBlocks)({schema:r.children}):null)},checkbox:function(i){var l=i.block,u=i.store;return(0,t.html)(r(),l.title?(0,t.html)(a(),l.required,(0,e.getValue)(l.title,u.state)):null,u.state[l.id],l.id,function(n){return u.state[l.id]=n.target.checked},(0,e.getValue)(l.label,u.state),l.children?(0,n.renderBlocks)({schema:l.children}):null)}};exports.blocks=J; | ||
},{"./index.js":"Focm","./utils.js":"FOZT","lit-html":"SPDu"}],"Focm":[function(require,module,exports) { | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.renderBlocks=d,exports.createWizard=b;var e=require("lit-html"),t=require("./blocks.js"),r=require("./utils.js");function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(r,!0).forEach(function(t){o(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e){return s(e)||u(e)||c()}function c(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function u(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}function s(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}var l={};function d(e){return e.schema.reduce(function(e,r){var n=!r.hasOwnProperty("show")||r.show(l.state)?t.blocks[r.type]({block:r,store:l}):null;return[].concat(i(e),[n])},[])}function f(e){return e.reduce(function(e,t){return"page"===t.type?a({},e,o({},t.id,!1)):e},{})}function p(e){var t=e.schema,n=e.initialState,o={el:e.el,schema:t,confirmedPages:f(t),validations:(0,r.schemaToFlatValidations)(t),currentPage:"/"===r.router.currentPath()?t[0].path:r.router.currentPath(),hadReachedSummary:!1,currentPageIsValidated:!1,state:a({},(0,r.schemaToFlatState)(t),{},n)};l=new r.ObservedObject(o)}function h(){window.addEventListener("rerender",function(){var t=d({schema:l.schema});(0,e.render)(t,document.querySelector(l.el))}),window.addEventListener("routechange",function(e){l.currentPage=e.detail,r.router.goTo(e.detail),(0,r.reRender)()}),window.addEventListener("checkpagevalidation",function(){var e=l.schema.find(function(e){return e.path===l.currentPage}),t=(0,r.getVisibleBlocks)(e,l),n=(0,r.validateBlocks)(t,l);l.currentPageIsValidated!==n&&(l.currentPageIsValidated=n)}),window.addEventListener("popstate",function(){(0,r.routeChange)(r.router.currentPath())},!1)}function b(e){var t=e.initialState,n=void 0===t?{}:t,a=e.schema,o=void 0===a?{}:a,i=e.el;p({schema:o,initialState:n,el:void 0===i?"#app":i}),h(),(0,r.checkPageValidation)(),(0,r.reRender)()} | ||
},{"lit-html":"SPDu","./blocks.js":"X1ux","./utils.js":"FOZT"}]},{},["Focm"], "AbWizard") | ||
},{"./lib/default-template-processor.js":"LBiL","./lib/template-result.js":"cVNN","./lib/directive.js":"uWh2","./lib/dom.js":"ytxR","./lib/part.js":"pnLb","./lib/parts.js":"atl2","./lib/render.js":"Fhpq","./lib/template-factory.js":"gbKZ","./lib/template-instance.js":"bn5t","./lib/template.js":"Av0K"}],"X1ux":[function(require,module,exports) { | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.blocks=void 0;var n=require("./utils.js"),e=require("lit-html");function t(){var n=E(["\n <ab-label ?required=","\n >","</ab-label\n >\n "]);return t=function(){return n},n}function a(){var n=E(['\n <ab-container full mt="600">\n ',"\n\n <ab-checkbox\n ?checked=","\n value=","\n @change=","\n >\n ","\n </ab-checkbox>\n </ab-container>\n\n ","\n "]);return a=function(){return n},n}function r(){var n=E(["\n <ab-checkbox\n ?checked=","\n value=","\n @change=","\n >\n ","\n </ab-checkbox>\n ","\n "]);return r=function(){return n},n}function l(){var n=E(['\n <ab-container full mt="600">\n <ab-label ?required=',"\n >","</ab-label\n >\n ","\n </ab-container>\n ","\n "]);return l=function(){return n},n}function i(){var n=E(['\n <ab-container mb="300" mr="300" ?full=',">\n <ab-radio-button\n ?checked=","\n value=","\n name=","\n @change=","\n >\n ","\n </ab-radio-button>\n </ab-container>\n ","\n "]);return i=function(){return n},n}function u(){var n=E(["\n <ab-label ?required=","\n >","</ab-label\n >\n "]);return u=function(){return n},n}function o(){var n=E(['\n <ab-container mt="600" full>\n ',"\n ","\n </ab-container>\n ","\n "]);return o=function(){return n},n}function c(){var n=E(['\n <ab-button\n type="positive"\n @click=',"\n >Oppsummering\n </ab-button>\n "]);return c=function(){return n},n}function b(){var n=E(['\n <ab-button\n type="primary"\n icon="arrow-right"\n ?disabled=',"\n @click=","\n >Neste\n </ab-button>\n "]);return b=function(){return n},n}function s(){var n=E(['\n <ab-button\n type="transparent"\n @click=',"\n >\n Tilbake</ab-button\n >\n "]);return s=function(){return n},n}function d(){var n=E(['\n <ab-container px="300" full center large>\n <ab-grid>\n <ab-grid-item s="12" m="5">\n <img src="https://cdn.sanity.io/images/8j24leyc/production/a987c37d7270624bd71338d217aa702780ba3e5d-300x120.svg?h=240"></img>\n </ab-grid-item>\n <ab-grid-item s="12" m="7">\n <div style="height: 100%" class="ab-flex ab-flex--a-center ab-flex--j-center">\n <ab-container full>\n Steg '," av ",'\n <ab-progress style="width: 100%" value=',' type="primary"></ab-progress>\n\n </ab-container>\n </div>\n </ab-grid-item>\n </ab-grid>\n </ab-container>\n\n <ab-container px="300" pt="900" full large center>\n <ab-grid>\n <ab-grid-item s="12" m="8">\n <ab-container full mb="800">\n <ab-typography color="primary-800" size="h-700">\n ','\n </ab-typography>\n </ab-container>\n <ab-container full narrow mb="800">\n <ab-typography size="p-600">\n ',"\n </ab-typography>\n </ab-container>\n ",'\n </ab-grid-item>\n <ab-grid-item s="12" m="4">\n <ab-container py="600" px="400" my="400" bg="primary-100" radius="200" border="primary-200">\n <ab-typography size="h-400" color="primary-800">Formål og tilsiktet art</ab-typography>\n <ab-container mt="300">\n <ab-typography size="p-300">\n Før kundeforholdet kan etableres må bankens kunder i henhold til\n hvitvaskingsloven blant annet oppgi formål og forventet bruk av\n bankens produkter og tjenester.\n </ab-typography>\n </ab-container>\n </ab-container>\n </ab-grid-item>\n </ab-grid>\n </ab-container>\n <div class="ab-sticky ab-sticky--bottom">\n <ab-container bg="white" py="500" px="300" full center large>\n ',"\n ","\n ","\n </ab-container>\n </div>\n\n "]);return d=function(){return n},n}function f(){var n=E(["\n ","\n "]);return f=function(){return n},n}function p(){var n=E(['\n <ab-container full mb="300">\n <ab-typography size="p-400">\n ',"\n </ab-typography>\n </ab-container>\n "]);return p=function(){return n},n}function g(){var n=E(['\n <ab-container mb="300">\n <ab-typography size="p-600">\n ',"\n </ab-typography>\n </ab-container>\n "]);return g=function(){return n},n}function m(){var n=E(['\n <ab-container full mb="300">\n <ab-typography color="primary-800" size="h-400">\n ',"\n </ab-typography>\n </ab-container>\n "]);return m=function(){return n},n}function h(){var n=E(['\n <ab-container mt="500" full>\n ',"\n ","\n ","\n </ab-container>\n ","\n "]);return h=function(){return n},n}function v(){var n=E(["\n <ab-autocomplete-option\n ?selected=","\n value=","\n label=","\n ></ab-autocomplete-option>\n "]);return v=function(){return n},n}function y(){var n=E(['\n <ab-container mt="500" full>\n <ab-label ?required=',"\n >","</ab-label\n >\n <ab-autocomplete\n placeholder=","\n ?multiple=","\n ?searchable=","\n @change=","\n >\n ","\n </ab-autocomplete>\n </ab-container>\n ","\n "]);return y=function(){return n},n}function k(){var n=E(['\n <ab-container my="500" full>\n <ab-input\n ?required=',"\n @blur=","\n label=","\n type=","\n .value=","\n ?error=","\n error-text=","\n @input=","\n ></ab-input>\n </ab-container>\n ","\n "]);return k=function(){return n},n}function V(){var n=E(['\n <ab-container mt="500" full>\n <ab-label ?required=',"\n >",'</ab-label\n >\n <textarea\n class="ab-textarea"\n value=',"\n @change=","\n @input=","\n ></textarea>\n </ab-container>\n ","\n "]);return V=function(){return n},n}function x(){var n=E(['\n <ab-container\n full=""\n p="300"\n mb="200"\n bg="ui-100"\n radius="200"\n border="ui-400"\n >\n <ab-flex j="between">\n <ab-flex a="center">\n <ab-icon name="file"></ab-icon>\n\n <ab-container ml="300">\n <ab-typography as="p" size="h-300"\n >','</ab-typography\n >\n <ab-typography as="p" size="p-400" color="ui-600"\n >22.06.2019, Onboarding - Jurgen Shlag</ab-typography\n >\n </ab-container>\n </ab-flex>\n <ab-container>\n <ab-button @click=',' type="transparent"\n ><ab-icon name="delete"></ab-icon\n ></ab-button>\n </ab-container>\n </ab-flex>\n </ab-container>\n ']);return x=function(){return n},n}function q(){var n=E(['\n <ab-container mt="500" mb="300" full>\n <ab-label ?required=',"\n >",'</ab-label\n >\n <label class="ab-file-input ab-file-input--full">\n <input @change=',' placeholder="Placeholder" type="file" />\n <div class="ab-file-input__cta">\n <ab-container mr="200">\n <ab-icon name="file"></ab-icon>\n </ab-container>\n <span class="ab-file-input__label"\n >',"</span\n >\n </div>\n </label>\n </ab-container>\n\n ","\n ","\n "]);return q=function(){return n},n}function P(){var n=E(["\n <li>","</li>\n "]);return P=function(){return n},n}function z(){var n=E(['\n <ab-container mt="500" full>\n <ab-label ?required=',">\n ","\n </ab-label>\n <ul class=",">\n ","\n </ul>\n </ab-container>\n ","\n "]);return z=function(){return n},n}function B(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function j(){var n=E(["\n <span>","</span>\n <span>","</span>\n <span>","</span>\n "]);return j=function(){return n},n}function w(n){return A(n)||_(n)||O()}function O(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function _(n){if(Symbol.iterator in Object(n)||"[object Arguments]"===Object.prototype.toString.call(n))return Array.from(n)}function A(n){if(Array.isArray(n)){for(var e=0,t=new Array(n.length);e<n.length;e++)t[e]=n[e];return t}}function S(){var n=E(['\n <ab-container mt="500" full>\n <ab-label ?required=',">\n ",'\n </ab-label>\n\n <div class="ab-slider">\n <output class="ab-slider__output" for=',">\n ",'\n </output>\n <input\n type="range"\n min=',"\n max=","\n name=","\n step=","\n @input=","\n value=",'\n class="ab-slider__input"\n id="myRange"\n />\n <div class="ab-slider__step-labels">\n ',"\n </div>\n </div>\n </ab-container>\n ","\n "]);return S=function(){return n},n}function C(){var n=E(['\n <ab-container mt="500" full>\n <ab-label ?required=',">\n ","\n </ab-label>\n <ab-table\n .columns=","\n .items=","\n ></ab-table>\n </ab-container>\n ","\n "]);return C=function(){return n},n}function I(){var n=E(["\n <ab-radio-tabs-item\n ?checked=","\n value=","\n @change=","\n >\n ","\n </ab-radio-tabs-item>\n "]);return I=function(){return n},n}function N(){var n=E(["\n <ab-label ?required=","\n >","</ab-label\n >\n "]);return N=function(){return n},n}function T(){var n=E(['\n <ab-container mt="600" full>\n ',"\n <ab-radio-tabs>\n ","\n </ab-radio-tabs>\n </ab-container>\n ","\n "]);return T=function(){return n},n}function D(){var n=E(['\n <li>\n <ab-flex j="between">\n <div>\n <ab-label>\n ','\n </ab-label>\n <ab-typography h="600" color="primary-800">\n ','\n </ab-typography>\n </div>\n <ab-button\n icon="edit"\n style="text-align: right"\n size="small"\n type="transparent"\n @click=',"\n >\n Endre\n </ab-button>\n </ab-flex>\n </li>\n "]);return D=function(){return n},n}function F(){var n=E(['\n <ab-container px="300" full center large>\n <ab-grid>\n <ab-grid-item s="12" m="5">\n <img src="https://cdn.sanity.io/images/8j24leyc/production/a987c37d7270624bd71338d217aa702780ba3e5d-300x120.svg?h=240"></img>\n </ab-grid-item>\n </ab-grid>\n </ab-container>\n\n <ab-container px="300" pt="900" full large center>\n <ab-grid>\n <ab-grid-item s="12" m="8">\n <ab-container full mb="800">\n <ab-typography color="primary-800" size="h-700">\n ','\n </ab-typography>\n </ab-container>\n <ab-container full narrow mb="800">\n <ab-typography size="p-600">\n ','\n </ab-typography>\n </ab-container>\n <ul class="ab-list ab-list--full ab-list--large ab-list--bordered">\n ','\n </ul>\n </ab-grid-item>\n </ab-grid>\n </ab-container>\n\n <div class="ab-sticky ab-sticky--bottom">\n <ab-container bg="white" py="500" px="300" full center large>\n <ab-button @click=',' type="primary" size="large">Send inn</ab-button>\n </ab-container>\n </div>\n ']);return F=function(){return n},n}function E(n,e){return e||(e=n.slice(0)),Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(e)}}))}var M=new Intl.NumberFormat("no-NO",{style:"currency",currency:"NOK"}),Q={summary:function(t){var a=t.block,r=t.store;if(r.currentPage===a.path){var l=(0,n.getAllVisibleQuestions)(r);return(0,e.html)(F(),(0,n.getValue)(a.title,r.state),(0,n.getValue)(a.intro,r.state),l.map(function(t){return(0,e.html)(D(),t.label,r.state[t.id],function(){return(0,n.routeChange)(t.path)})}),function(){return"function"===(0,n.typeOf)(a.onSubmit)&&a.onSubmit(r),void(0,n.submitData)(r)})}return null},"radio-tabs":function(t){var a=t.block,r=t.store;return(0,e.html)(T(),a.label?(0,e.html)(N(),a.required,(0,n.getValue)(a.label,r.state)):null,(0,n.getValue)(a.options,r.state).map(function(t){return(0,e.html)(I(),(0,n.getValue)(t.value,r.state)===r.state[a.id],(0,n.getValue)(t.value,r.state),function(){return r.state[a.id]=(0,n.getValue)(t.value,r.state)},(0,n.getValue)(t.label,r.state))}),a.children?(0,n.renderBlocks)({blocks:a.children,store:r}):null)},table:function(t){var a=t.block,r=t.store;return(0,e.html)(C(),a.required,(0,n.getValue)(a.label,r.state),(0,n.getValue)(a.columns,r.state),(0,n.getValue)(a.items,r.state),a.children?(0,n.renderBlocks)({schema:a.children,store:r}):null)},range:function(t){var a=t.block,r=t.store,l=(0,n.getValue)(a.min,r.state),i=(0,n.getValue)(a.max,r.state),u=(0,n.getValue)(a.label,r.state),o=(0,n.getValue)(a.step,r.state);return(0,e.html)(S(),a.required,u,a.id,r.state[a.id]?M.format(r.state[a.id]):a.placeholder||"Dra i slideren",l||0,i||100,a.id,o||10,function(n){return r.state[a.id]=n.target.value},r.state[a.id],w(new Array(a.numberOfSteps)).map(function(n,t){return(0,e.html)(j(),M.format(l),M.format(i/2),M.format(i))}),a.children?(0,n.renderBlocks)({schema:a.children,store:r}):null)},list:function(t){var a=t.block,r=t.store,l=(0,n.getValue)(a.items,r.state),i=(0,n.classnames)(B({"ab-list":!0,"ab-list--full":a.full,"ab-list--bordered":a.bordered,"ab-list--bullets":a.bullets},"ab-list--".concat(a.size),a.size));return(0,e.html)(z(),a.required,(0,n.getValue)(a.label,r.state),i,l.map(function(n){return(0,e.html)(P(),n)}),a.children?(0,n.renderBlocks)({schema:a.children,store:r}):null)},file:function(t){var a=t.block,r=t.store;return(0,e.html)(q(),a.required,(0,n.getValue)(a.label,r.state),function(n){r.state[a.id]=[].concat(w(r.state[a.id]),w(n.target.files))},a.buttonText||"Last opp fil",r.state[a.id].map(function(n){return(0,e.html)(x(),n.name,function(){return function(n){r.state[a.id]=r.state[a.id].filter(function(e){return e.name!==n.name})}(n)})}),a.children?(0,n.renderBlocks)({schema:a.children,store:r}):null)},textarea:function(t){var a=t.block,r=t.store;return(0,e.html)(V(),a.required,(0,n.getValue)(a.label,r.state),r.state[a.id],function(n){if("function"==typeof a.validate)r.validations[a.id]=a.validate(n.target.value);else if(a.required){var e=void 0===r.state[a.id]||null===r.state[a.id]||""===r.state[a.id]||r.state[a.id]===[];r.validations[a.id]=!e}},function(n){return r.state[a.id]=n.target.value},a.children?(0,n.renderBlocks)({schema:a.children,store:r}):null)},input:function(t){var a=t.block,r=t.store;return(0,e.html)(k(),a.required,function(n){if("function"==typeof a.validate)r.validations[a.id]=a.validate(n.target.value);else if(a.required){var e=void 0===r.state[a.id]||null===r.state[a.id]||""===r.state[a.id]||r.state[a.id]===[];r.validations[a.id]=!e}},(0,n.getValue)(a.label,r.state),a.inputType||"text",r.state[a.id],!1===r.validations[a.id],a.errorMessage||"Du har oppgitt en ugyldig verdi",function(n){return r.state[a.id]=n.target.value},a.children?(0,n.renderBlocks)({schema:a.children,store:r}):null)},autocomplete:function(t){var a=t.block,r=t.store;return(0,e.html)(y(),a.required,(0,n.getValue)(a.label,r.state),a.placeholder,a.multiple,a.searchable,function(n){return r.state[a.id]=n.target.selected},a.options.map(function(t){return(0,e.html)(v(),r.state[a.id].some(function(n){return n===t.value}),(0,n.getValue)(t.value,r.state),(0,n.getValue)(t.label,r.state))}),a.children?(0,n.renderBlocks)({blocks:a.children,store:r}):null)},info:function(t){var a=t.block,r=t.store;return(0,e.html)(h(),a.title?(0,e.html)(m(),(0,n.getValue)(a.title,r.state)):null,a.intro?(0,e.html)(g(),(0,n.getValue)(a.intro,r.state)):null,a.body?(0,e.html)(p(),(0,n.getValue)(a.body,r.state)):null,a.children?(0,n.renderBlocks)({schema:a.children}):null)},page:function(t){var a=t.block,r=t.store,l=(0,n.getAllVisibleQuestions)(r),i=(0,n.validateBlocks)(l,r),u=(0,n.getAllVisiblePages)(r).every(function(n){return r.confirmedPages[a.id]});return(0,e.html)(f(),r.currentPage===a.path?(0,e.html)(d(),(0,n.countPrevPages)({state:r.state,schema:r.schema,page:a})+1,(0,n.getTotalNumberOfPages)(r),(0,n.getCurrentStepInPercent)(r),(0,n.getValue)(a.title,r.state),(0,n.getValue)(a.intro,r.state),a.children?(0,n.renderBlocks)({blocks:a.children,store:r}):null,a.previousPage?(0,e.html)(s(),function(){return e=a.previousPage(r.state),void(0,n.routeChange)(e);var e}):null,a.nextPage?(0,e.html)(b(),!r.currentPageIsValidated,function(){return e=a.nextPage(r.state),void(r.currentPageIsValidated&&(r.confirmedPages[a.id]=!0,(0,n.routeChange)(e)));var e}):null,i&&u?(0,e.html)(c(),function(){return(0,n.routeChange)(r.schema[r.schema.length-1].path)}):null):null)},radio:function(t){var a=t.block,r=t.store;return(0,e.html)(o(),a.label?(0,e.html)(u(),a.required,(0,n.getValue)(a.label,r.state)):null,(0,n.getValue)(a.options,r.state).map(function(t){return(0,e.html)(i(),!a.horisontal,(0,n.getValue)(t.value,r.state)===r.state[a.id],(0,n.getValue)(t.value,r.state),a.id,function(){return r.state[a.id]=(0,n.getValue)(t.value,r.state)},(0,n.getValue)(t.label,r.state),t.children?(0,n.renderBlocks)({blocks:t.children,store:r}):null)}),a.children?(0,n.renderBlocks)({blocks:a.children,store:r}):null)},"multi-checkbox":function(t){var a=t.block,i=t.store;return(0,e.html)(l(),a.required,(0,n.getValue)(a.label,i.state),(0,n.getValue)(a.options,i.state).map(function(t){return(0,e.html)(r(),function(e){return!!i.state[a.id]&&i.state[a.id].some(function(t){return t===(0,n.getValue)(e.value,i.state)})}(t),(0,n.getValue)(t.value,i.state),function(e){return function(e,t){if(e.target.checked){var r=i.state[a.id]?i.state[a.id]:[];i.state[a.id]=[].concat(w(r),[(0,n.getValue)(t.value,i.state)])}else i.state[a.id]=i.state[a.id].filter(function(e){return e!==(0,n.getValue)(t.value,i.state)})}(e,t)},(0,n.getValue)(t.label,i.state),t.children?(0,n.renderBlocks)({blocks:t.children,store:i}):null)}),a.children?(0,n.renderBlocks)({blocks:a.children,store:i}):null)},checkbox:function(r){var l=r.block,i=r.store;return(0,e.html)(a(),l.title?(0,e.html)(t(),l.required,(0,n.getValue)(l.title,i.state)):null,i.state[l.id],l.id,function(n){return i.state[l.id]=n.target.checked},(0,n.getValue)(l.label,i.state),l.children?(0,n.renderBlocks)({blocks:l.children,store:i}):null)}};exports.blocks=Q; | ||
},{"./utils.js":"FOZT","lit-html":"SPDu"}],"FOZT":[function(require,module,exports) { | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getValue=c,exports.countNextPages=s,exports.countPrevPages=l,exports.getCurrentStepInPercent=f,exports.getTotalNumberOfPages=p,exports.validateEmail=d,exports.validatePhone=h,exports.reRender=v,exports.routeChange=b,exports.checkPageValidation=x,exports.submitData=P,exports.typeOf=m,exports.classnames=w,exports.getVisibleBlocks=y,exports.getAllVisiblePages=j,exports.flattenBlocks=k,exports.getAllVisibleQuestions=V,exports.validateBlocks=E,exports.schemaToFlatState=Q,exports.schemaToFlatValidations=S,exports.ObservedObject=A,exports.renderBlocks=C,exports.blockTypes=exports.router=void 0;var e=require("./blocks.js");function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function n(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?t(o,!0).forEach(function(t){r(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(o).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){return i(e)||u(e)||a()}function a(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function u(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}function i(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}function c(e,t){return"function"==typeof e?e(t):e}function s(e){var t=e.state,n=e.schema,r=e.page,o=e.count,a=void 0===o?0:o,u=r.nextPage?c(r.nextPage,t):null;if(u){var i=n.find(function(e){return e.path===u});return i?s({state:t,schema:n,page:i,count:a+1}):a}return a}function l(e){var t=e.state,n=e.schema,r=e.page,o=e.count,a=void 0===o?0:o,u=r.previousPage?c(r.previousPage,t):null;if(u){var i=n.find(function(e){return e.path===u});return i?l({state:t,schema:n,page:i,count:a+1}):a}return a}function f(e){var t=e.schema.find(function(t){return t.path===e.currentPage}),n=s({schema:e.schema,state:e.state,page:t,count:0}),r=l({schema:e.schema,state:e.state,page:t,count:0});return r/(n+r)*100}function p(e){var t=e.schema.find(function(t){return t.path===e.currentPage});return s({schema:e.schema,state:e.state,page:t,count:0})+l({schema:e.schema,state:e.state,page:t,count:0})+1}function d(e){return/^.+@.+\..+$/.test(e)}function h(e){return/^[\s\d+()-]{8,}$/.test(e)}var g={goTo:function(e){return window.history.pushState({},e,window.location.origin+e)},currentPath:function(){return window.location.pathname}};function v(){window.dispatchEvent(new CustomEvent("rerender"))}function b(e){window.dispatchEvent(new CustomEvent("routechange",{detail:e}))}function x(e){window.dispatchEvent(new CustomEvent("checkpagevalidation"))}function P(e){window.dispatchEvent(new CustomEvent("wizard-submit",{detail:Object.freeze(e)}))}function m(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function w(e){return Object.keys(e).filter(function(t){return e[t]}).reduce(function(e,t,n){return e.concat(n>0?" ".concat(t):"".concat(t))},"")}function y(e,t){return e.children?e.children.reduce(function(r,a){if(void 0===a.show||("function"===m(a.show)?a.show(t.state):a.show)){var u=a.children?y(a,t):[];return[].concat(o(r),[n({},a,{path:e.path})],o(u))}return r},[]):[]}exports.router=g;var O=function(e){return{checkbox:{isQuestion:!0,defaultValue:!1},textarea:{isQuestion:!0,defaultValue:null},range:{isQuestion:!0,defaultValue:null},radio:{isQuestion:!0,defaultValue:null},input:{isQuestion:!0,defaultValue:null},file:{isQuestion:!0,defaultValue:[]},"multi-checkbox":{isQuestion:!0,defaultValue:[]},autocomplete:e.multiple?{isQuestion:!0,defaultValue:[]}:{isQuestion:!0,defaultValue:null}}};function j(e){return e.schema.reduce(function(t,r,a){var u=0===a?r:e.schema.find(function(e){return e.path===t.nextPagePath}),i=u.nextPage?c(u.nextPage,e.state):null;return i?n({},t,{pages:[].concat(o(t.pages),[n({},u)]),nextPagePath:i}):t},{pages:[],nextPagePath:""}).pages.filter(function(e){return"page"===e.type})}function k(e){return e.reduce(function(e,t){var r=t.children?k(t.children):{};return[].concat(o(e),[n({},t)],o(r))},[])}function V(e){return e.schema.reduce(function(t,r,a){var u=0===a?r:e.schema.find(function(e){return e.path===t.nextPagePath}),i=u.nextPage?c(u.nextPage,e.state):null;return i?n({},t,{blocks:[].concat(o(t.blocks),o(y(u,e))),nextPagePath:i}):t},{blocks:[],nextPagePath:""}).blocks.filter(function(e){return O(e)[e.type]&&O(e)[e.type].isQuestion})}function E(e,t){return e.every(function(e){var n=!0,r="function"==typeof e.validate,o=void 0===t.state[e.id]||null===t.state[e.id]||""===t.state[e.id]||t.state[e.id]===[],a=!!e.required;return(r||a)&&(r?n="function"===m(e.validate)?e.validate(t.state[e.id]):e.validate:a&&(n=!o)),n})}function Q(e){return e.reduce(function(e,t){var o=t.children?Q(t.children):{},a=O(t)[t.type]&&O(t)[t.type].defaultValue;return n({},e,r({},t.id,a),o)},{})}function S(e){return e.reduce(function(e,t){var o=t.children?S(t.children):{};return n({},e,r({},t.id,void 0),o)},{})}function A(e){var t=this,n=function(n){Object.defineProperty(t,n,{get:function(){return"object"===m(e[n])?new A(e[n]):e[n]},set:function(t){e[n]!==t&&(e[n]=t,x(),v())},enumerable:!0})};for(var r in e)n(r)}function C(t){var n=t.blocks,r=t.store;return n.reduce(function(t,n){var a=!n.hasOwnProperty("show")||n.show(r.state)?e.blocks[n.type]({block:n,store:r}):null;return[].concat(o(t),[a])},[])}exports.blockTypes=O; | ||
},{"./blocks.js":"X1ux"}],"Focm":[function(require,module,exports) { | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=d;var e=require("lit-html"),t=require("./utils.js");function r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(n,!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var i={};function o(e){return e.reduce(function(e,t){return"page"===t.type?n({},e,a({},t.id,!1)):e},{})}function c(e){var r=e.schema,a=e.initialState,c={el:e.el,schema:r,confirmedPages:o(r),validations:(0,t.schemaToFlatValidations)(r),currentPage:"/"===t.router.currentPath()?r[0].path:t.router.currentPath(),hadReachedSummary:!1,currentPageIsValidated:!1,state:n({},(0,t.schemaToFlatState)(r),{},a)};i=new t.ObservedObject(c)}function u(){window.addEventListener("rerender",function(){var r=(0,t.renderBlocks)({blocks:i.schema,store:i});(0,e.render)(r,document.querySelector(i.el))}),window.addEventListener("routechange",function(e){i.currentPage=e.detail,t.router.goTo(e.detail),(0,t.reRender)()}),window.addEventListener("checkpagevalidation",function(){var e=i.schema.find(function(e){return e.path===i.currentPage}),r=(0,t.getVisibleBlocks)(e,i),n=(0,t.validateBlocks)(r,i);i.currentPageIsValidated!==n&&(i.currentPageIsValidated=n)}),window.addEventListener("popstate",function(){(0,t.routeChange)(t.router.currentPath())},!1)}function d(e){var r=e.initialState,n=void 0===r?{}:r,a=e.schema,i=void 0===a?{}:a,o=e.el;c({schema:i,initialState:n,el:void 0===o?"#app":o}),u(),(0,t.checkPageValidation)(),(0,t.reRender)()} | ||
},{"lit-html":"SPDu","./utils.js":"FOZT"}]},{},["Focm"], "AbWizard") | ||
//# sourceMappingURL=/index.js.map |
{ | ||
"name": "aprila-wizard", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "", | ||
@@ -22,3 +22,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"aprilabank": "^0.6.9-beta.12", | ||
"aprilabank": "^0.6.9-beta.14", | ||
"lit-html": "^1.1.2" | ||
@@ -25,0 +25,0 @@ }, |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
173851
1
Updatedaprilabank@^0.6.9-beta.14