You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sidebar-form/example/example.js

11 lines
22 KiB

(()=>{var e,t={432:e=>{!function(t,n){const r="*",s=Object.defineProperties,o=Object.entries,i=(e,t)=>(n,r)=>(e.has(n)?e.get(n).add(r):e.set(n,(new Set).add(r)),t),a=(e,t)=>(n,s)=>(n!==r||s?((e,t,n,r)=>{if(r){const t=e.get(n);t&&(t.delete(r),0===t.size&&e.delete(n))}else e.delete(n)})(e,0,n,s):e.clear(),t),u=(e,t)=>(e,n)=>t.on(e,(function r(...s){t.off(e,r),n.apply(t,s)})),l=(e,t)=>(n,...s)=>{const o=e.get(n);return o&&o.forEach((e=>e.apply(t,s))),e.get(r)&&n!==r&&t.trigger(r,n,...s),t};e.exports=function(e){const t=new Map;return s(e=e||{},o({on:i,off:a,one:u,trigger:l}).reduce(((n,[r,s])=>(n[r]={value:s(t,e),enumerable:!1,writable:!1,configurable:!1},n)),{})),e}}("undefined"!=typeof window&&window)},737:(e,t,n)=>{"use strict";function r(e){return e.replace(/-(\w)/g,((e,t)=>t.toUpperCase()))}function s(e,t){e.firstChild&&(t.appendChild(e.firstChild),s(e,t))}function o(e){i(e.childNodes)}function i(e){Array.from(e).forEach(a)}const a=e=>e&&e.parentNode&&e.parentNode.removeChild(e),u=(e,t)=>t&&t.parentNode&&t.parentNode.insertBefore(e,t),l=new Map,c=Symbol("riot-component"),p=new Set,d="is",h="mount",m="update",f="unmount",b="shouldUpdate",v="onBeforeMount",g="onMounted",O="onBeforeUpdate",x="onUpdated",y="onBeforeUnmount",E="onUnmounted",T="props",N="state",_="slots",A="root",M=Symbol("pure"),j=Symbol("is_updating"),S=Symbol("parent"),w=Symbol("attributes"),C=Symbol("template");var U=Object.freeze({__proto__:null,COMPONENTS_IMPLEMENTATION_MAP:l,DOM_COMPONENT_INSTANCE_PROPERTY:c,PLUGINS_SET:p,IS_DIRECTIVE:d,VALUE_ATTRIBUTE:"value",MOUNT_METHOD_KEY:h,UPDATE_METHOD_KEY:m,UNMOUNT_METHOD_KEY:f,SHOULD_UPDATE_KEY:b,ON_BEFORE_MOUNT_KEY:v,ON_MOUNTED_KEY:g,ON_BEFORE_UPDATE_KEY:O,ON_UPDATED_KEY:x,ON_BEFORE_UNMOUNT_KEY:y,ON_UNMOUNTED_KEY:E,PROPS_KEY:T,STATE_KEY:N,SLOTS_KEY:_,ROOT_KEY:A,IS_PURE_SYMBOL:M,IS_COMPONENT_UPDATING:j,PARENT_KEY_SYMBOL:S,ATTRIBUTES_KEY_SYMBOL:w,TEMPLATE_KEY_SYMBOL:C});var I={EACH:0,IF:1,SIMPLE:2,TAG:3,SLOT:4};var P={ATTRIBUTE:0,EVENT:1,TEXT:2,VALUE:3};const D=Symbol("head"),L=Symbol("tail");function B(e){const t=e.dom.cloneNode(!0),{head:n,tail:r}=function(){const e=document.createTextNode(""),t=document.createTextNode("");return e[D]=!0,t[L]=!0,{head:e,tail:t}}();return{avoidDOMInjection:!0,fragment:t,head:n,tail:r,children:[n,...Array.from(t.childNodes),r]}}function k(e,t,n,r){return void 0===r&&(r={}),Object.defineProperty(e,t,Object.assign({value:n,enumerable:!1,writable:!1,configurable:!0},r)),e}function R(e,t,n){return Object.entries(t).forEach((t=>{let[r,s]=t;k(e,r,s,n)})),e}function Y(e,t){return Object.entries(t).forEach((t=>{let[n,r]=t;e[n]||(e[n]=r)})),e}function K(e,t){return typeof e===t}function z(e){const t=e.ownerSVGElement;return!!t||null===t}function $(e){return"template"===e.tagName.toLowerCase()}function H(e){return K(e,"function")}function V(e){return!F(e)&&e.constructor===Object}function F(e){return null==e}const G=Symbol("unmount"),q={nodes:[],mount(e,t){return this.update(e,t)},update(e,t){const{placeholder:n,nodes:r,childrenMap:s}=this,o=e===G?null:this.evaluate(e),i=o?Array.from(o):[],{newChildrenMap:l,batches:c,futureNodes:p}=function(e,t,n,r){const{condition:s,template:o,childrenMap:i,itemName:a,getKey:u,indexName:l,root:c,isTemplateTag:p}=r,d=new Map,h=[],m=[];return e.forEach(((e,r)=>{const f=function(e,t){let{itemName:n,indexName:r,index:s,item:o}=t;k(e,n,o),r&&k(e,r,s);return e}(Object.create(t),{itemName:a,indexName:l,index:r,item:e}),b=u?u(f):r,v=i.get(b),g=[];if(function(e,t){return!!e&&!e(t)}(s,f))return;const O=!v,x=v?v.template:o.clone(),y=x.el||c.cloneNode(),E=p&&O?B(x):x.meta;O?h.push((()=>x.mount(y,f,n,E))):h.push((()=>x.update(f,n))),p?g.push(...E.children):g.push(y),i.delete(b),m.push(...g),d.set(b,{nodes:g,template:x,context:f,index:r})})),{newChildrenMap:d,batches:h,futureNodes:m}}(i,e,t,this);return((e,t,n,r)=>{const s=t.length;let o=e.length,i=s,l=0,c=0,p=null;for(;l<o||c<i;)if(o===l){const e=i<s?c?n(t[c-1],-0).nextSibling:n(t[i-c],0):r;for(;c<i;)u(n(t[c++],1),e)}else if(i===c)for(;l<o;)p&&p.has(e[l])||a(n(e[l],-1)),l++;else if(e[l]===t[c])l++,c++;else if(e[o-1]===t[i-1])o--,i--;else if(e[l]===t[i-1]&&t[c]===e[o-1]){const r=n(e[--o],-1).nextSibling;u(n(t[c++],1),n(e[l++],-1).nextSibling),u(n(t[--i],1),r),e[o]=t[i]}else{if(!p){p=new Map;let e=c;for(;e<i;)p.set(t[e],e++)}if(p.has(e[l])){const r=p.get(e[l]);if(c<r&&r<i){let s=l,a=1;for(;++s<o&&s<i&&p.get(e[s])===r+a;)a++;if(a>r-c){const s=n(e[l],0);for(;c<r;)u(n(t[c++],1),s)}else d=n(t[c++],1),(h=n(e[l++],-1))&&h.parentNode&&h.parentNode.replaceChild(d,h)}else l++}else a(n(e[l++],-1))}var d,h})(r,p,function(e,t){return(n,r)=>{if(r<0){const n=e[e.length-1];if(n){const{template:r,nodes:s,context:o}=n;s.pop(),s.length||(e.pop(),r.unmount(o,t,null))}}return n}}(Array.from(s.values()),t),n),c.forEach((e=>e())),this.childrenMap=l,this.nodes=p,this},unmount(e,t){return this.update(G,t),this}};const W={mount(e,t){return this.update(e,t)},update(e,t){const n=!!this.evaluate(e),r=!this.value&&n,s=this.value&&!n,o=()=>{const n=this.node.cloneNode();u(n,this.placeholder),this.template=this.template.clone(),this.template.mount(n,e,t)};switch(!0){case r:o();break;case s:this.unmount(e);break;default:n&&this.template.update(e,t)}return this.value=n,this},unmount(e,t){return this.template.unmount(e,t,!0),this}};function X(e){throw new Error(e)}function Z(e){const t=new Map,n=n=>(t.has(n)||t.set(n,e.call(this,n)))&&t.get(n);return n.cache=t,n}function J(e){return e.reduce(((e,t)=>{const{value:n,type:s}=t;switch(!0){case!t.name&&0===s:return Object.assign({},e,n);case 3===s:e.value=t.value;break;default:e[r(t.name)]=t.value}return e}),{})}const Q="undefined"==typeof Element?{}:Element.prototype,ee=Z((e=>Q.hasOwnProperty(e)));function te(e,t,n,r){let{name:s}=t;if(!s)return r&&function(e,t,n){const r=t?Object.keys(t):[];Object.keys(n).filter((e=>!r.includes(e))).forEach((t=>e.removeAttribute(t)))}(e,n,r),void(n&&function(e,t){Object.entries(t).forEach((t=>{let[n,r]=t;return te(e,{name:n},r)}))}(e,n));!ee(s)&&(function(e){return K(e,"boolean")}(n)||V(n)||H(n))&&(e[s]=n),!function(e){return!e&&0!==e}(n)?function(e){return!0===e||["string","number"].includes(typeof e)}(n)&&e.setAttribute(s,function(e,t){return!0===t?e:t}(s,n)):e.removeAttribute(s)}const ne=/^on/,re={handleEvent(e){this[e.type](e)}},se=new WeakMap;function oe(e){return F(e)?"":e}const ie=(e,t)=>{const n=e.childNodes[t];if(n.nodeType===Node.COMMENT_NODE){const t=document.createTextNode("");return e.replaceChild(t,n),t}return n};var ae={0:te,1:function(e,t,n){let{name:r}=t;const s=r.replace(ne,""),o=se.get(e)||(e=>{const t=Object.create(re);return se.set(e,t),t})(e),[i,a]=(e=>Array.isArray(e)?e:[e,!1])(n),u=o[s],l=i&&!u;u&&!i&&e.removeEventListener(s,o),l&&e.addEventListener(s,o,a),o[s]=i},2:function(e,t,n){e.data=oe(n)},3:function(e,t,n){e.value=oe(n)}};const ue={mount(e){return this.value=this.evaluate(e),le(this,this.value),this},update(e){const t=this.evaluate(e);return this.value!==t&&(le(this,t),this.value=t),this},unmount(){return 1===this.type&&le(this,null),this}};function le(e,t){return ae[e.type](e.node,e,t,e.value)}function ce(e,t){return Object.assign({},ue,t,{node:2===t.type?ie(e,t.childNodeIndex):e})}const pe=(e,t)=>e[S]||t,de={attributes:[],getTemplateScope(e,t){return function(e,t,n){if(!e||!e.length)return n;const r=e.map((e=>Object.assign({},e,{value:e.evaluate(t)})));return Object.assign(Object.create(n||null),J(r))}(this.attributes,e,t)},mount(e,t){const n=!!e.slots&&e.slots.find((e=>{let{id:t}=e;return t===this.name})),{parentNode:r}=this.node,s=pe(e,t);return this.template=n&&Ee(n.html,n.bindings).createDOM(r),this.template&&(o(this.node),this.template.mount(this.node,this.getTemplateScope(e,s),s),this.template.children=Array.from(this.node.childNodes)),he(this.node),a(this.node),this},update(e,t){if(this.template){const n=pe(e,t);this.template.update(this.getTemplateScope(e,n),n)}return this},unmount(e,t,n){return this.template&&this.template.unmount(this.getTemplateScope(e,t),null,n),this}};function he(e){const t=e&&e.firstChild;t&&(u(t,e),he(e))}function me(e){return e.reduce(((e,t)=>{let{bindings:n}=t;return e.concat(n)}),[])}const fe={mount(e){return this.update(e)},update(e,t){const n=this.evaluate(e);return n&&n===this.name?this.tag.update(e):(this.unmount(e,t,!0),this.name=n,this.tag=function(e,t,n){return void 0===t&&(t=[]),void 0===n&&(n=[]),e?e({slots:t,attributes:n}):Ee(function(e){return e.reduce(((e,t)=>e+t.html),"")}(t),[...me(t),{expressions:n.map((e=>Object.assign({type:0},e)))}])}(this.getComponent(n),this.slots,this.attributes),this.tag.mount(this.node,e)),this},unmount(e,t,n){return this.tag&&this.tag.unmount(n),this}};var be={1:function(e,t){let{evaluate:n,template:r}=t;const s=document.createTextNode("");return u(s,e),a(e),Object.assign({},W,{node:e,evaluate:n,placeholder:s,template:r.createDOM(e)})},2:function(e,t){let{expressions:n}=t;return Object.assign({},(r=n.map((t=>ce(e,t))),["mount","update","unmount"].reduce(((e,t)=>Object.assign({},e,{[t]:e=>r.map((n=>n[t](e)))&&s})),{})));var r,s},0:function(e,t){let{evaluate:n,condition:r,itemName:s,indexName:o,getKey:i,template:l}=t;const c=document.createTextNode(""),p=e.cloneNode();return u(c,e),a(e),Object.assign({},q,{childrenMap:new Map,node:e,root:p,condition:r,evaluate:n,isTemplateTag:$(p),template:l.createDOM(e),getKey:i,indexName:o,itemName:s,placeholder:c})},3:function(e,t){let{evaluate:n,getComponent:r,slots:s,attributes:o}=t;return Object.assign({},fe,{node:e,evaluate:n,slots:s,attributes:o,getComponent:r})},4:function(e,t){let{name:n,attributes:r}=t;return Object.assign({},de,{attributes:r,node:e,name:n})}};function ve(e,t){return e.map((e=>2===e.type?Object.assign({},e,{childNodeIndex:e.childNodeIndex+t}):e))}function ge(e,t,n){const{selector:r,type:s,redundantAttribute:o,expressions:i}=t,a=r?e.querySelector(r):e;o&&a.removeAttribute(o);const u=i||[];return(be[s]||be[2])(a,Object.assign({},t,{expressions:n&&!r?ve(u,n):u}))}function Oe(e,t){return z(e)?function(e,t){return t.ownerDocument.importNode((new window.DOMParser).parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${e}</svg>`,"application/xml").documentElement,!0)}(t,e):function(e,t){const n=$(t)?t:document.createElement("template");return n.innerHTML=e,n.content}(t,e)}function xe(e,t){switch(!0){case z(e):s(t,e);break;case $(e):e.parentNode.replaceChild(t,e);break;default:e.appendChild(t)}}const ye=Object.freeze({createDOM(e){return this.dom=this.dom||function(e,t){return t&&("string"==typeof t?Oe(e,t):t)}(e,this.html)||document.createDocumentFragment(),this},mount(e,t,n,r){if(void 0===r&&(r={}),!e)throw new Error("Please provide DOM node to mount properly your template");this.el&&this.unmount(t);const{fragment:s,children:o,avoidDOMInjection:i}=r,{parentNode:a}=o?o[0]:e,u=$(e),l=u?function(e,t,n){const r=Array.from(e.childNodes);return Math.max(r.indexOf(t),r.indexOf(n.head)+1,0)}(a,e,r):null;this.createDOM(e);const c=s||this.dom.cloneNode(!0);return this.el=u?a:e,this.children=u?o||Array.from(c.childNodes):null,!i&&c&&xe(e,c),this.bindings=this.bindingsData.map((e=>ge(this.el,e,l))),this.bindings.forEach((e=>e.mount(t,n))),this.meta=r,this},update(e,t){return this.bindings.forEach((n=>n.update(e,t))),this},unmount(e,t,n){void 0===n&&(n=!1);const r=this.el;if(!r)return this;switch(this.bindings.forEach((r=>r.unmount(e,t,n))),!0){case r[M]||null===n:break;case Array.isArray(this.children):i(this.children);break;case!n:o(r);break;case!!n:a(r)}return this.el=null,this},clone(){return Object.assign({},this,{meta:{},el:null})}});function Ee(e,t){return void 0===t&&(t=[]),Object.assign({},ye,{html:e,bindingsData:t})}function Te(){return this}function Ne(e){return H(e)?e.prototype&&e.prototype.constructor?new e:e():e}function _e(e){return Array.isArray(e)?e:/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(e))&&"number"==typeof e.length?Array.from(e):[e]}function Ae(e,t){return _e("string"==typeof e?(t||document).querySelectorAll(e):e)}const Me=e=>1===e.length?e[0]:e;function je(e,t,n){const r="object"==typeof t?t:{[t]:n},s=Object.keys(r);return _e(e).forEach((e=>{s.forEach((t=>e.setAttribute(t,r[t])))})),e}function Se(e,t){return function(e,t,n){const r="string"==typeof t?[t]:t;return Me(_e(e).map((e=>Me(r.map((t=>e[n](t)))))))}(e,t,"getAttribute")}const we=new Map,Ce=()=>Ue||(je(Ue=Ae("style[riot]")[0]||document.createElement("style"),"type","text/css"),Ue.parentNode||document.head.appendChild(Ue),Ue);var Ue,Ie={CSS_BY_NAME:we,add(e,t){return we.has(e)||(we.set(e,t),this.inject()),this},inject(){return Ce().innerHTML=[...we.values()].join("\n"),this},remove(e){return we.has(e)&&(we.delete(e),this.inject()),this}};function Pe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return(r=[...n,...r]).length<e.length?Pe(e,...r):e(...r)}}function De(e){return Se(e,d)||e.tagName.toLowerCase()}const Le=Object.freeze({$(e){return Ae(e,this.root)[0]},$$(e){return Ae(e,this.root)}}),Be=Object.freeze({[h]:Te,[m]:Te,[f]:Te}),ke=Object.freeze({[b]:Te,[v]:Te,[g]:Te,[O]:Te,[x]:Te,[y]:Te,[E]:Te}),Re=Object.assign({},Be,{clone:Te,createDOM:Te}),Ye=Z(Ve);function Ke(e,t){return void 0===t&&(t={}),Object.assign({},function(e){return Array.from(e.attributes).reduce(((e,t)=>(e[r(t.name)]=t.value,e)),{})}(e),Ne(t))}const ze=(e,t)=>e[c]=t;function $e(e){return[h,m,f].reduce(((t,n)=>(t[n]=e(n),t)),{})}function He(e,t){const n=function(e){void 0===e&&(e={});return Object.entries(Ne(e)).reduce(((e,t)=>{let[n,r]=t;
/* Riot v6.1.2, @license MIT */
var s;return e[(s=n,s.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())]=Ve(r),e}),{})}(t.exports?t.exports.components:{});return e(Ee,P,I,(e=>e===t.name?Ye(t):n[e]||l.get(e)))}function Ve(e){const{css:t,template:n,exports:r,name:s}=e,o=n?He(n,e):Re;return e=>{let{slots:i,attributes:a,props:u}=e;if(r&&r[M])return function(e,t){let{slots:n,attributes:r,props:s,css:o,template:i}=t;i&&X("Pure components can not have html"),o&&X("Pure components do not have css");const a=Y(e({slots:n,attributes:r,props:s}),Be);return $e((e=>function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];if(e===h){const[e]=n;k(e,M,!0),ze(e,a)}return a[e](...n),a}))}(r,{slots:i,attributes:a,props:u,css:t,template:n});const l=Ne(r)||{},c=Fe({css:t,template:o,componentAPI:l,name:s})({slots:i,attributes:a,props:u});return{mount:(e,t,n)=>c.mount(e,n,t),update:(e,t)=>c.update(t,e),unmount:e=>c.unmount(e)}}}function Fe(e){let{css:t,template:n,componentAPI:r,name:s}=e;return t&&s&&Ie.add(s,t),Pe(qe)(R(Y(r,Object.assign({},ke,{[T]:{},[N]:{}})),Object.assign({[_]:null,[A]:null},Le,{name:s,css:t,template:n})))}function Ge(e,t){return Object.assign({},e,Ne(t))}function qe(e,t){let{slots:n,attributes:r,props:s}=t;return o=function(e){return[...p].reduce(((e,t)=>t(e)||e),e)}(R(V(e)?Object.create(e):e,{mount(t,o,i){return void 0===o&&(o={}),k(t,M,!1),this[S]=i,this[w]=function(e,t){void 0===t&&(t=[]);const n=t.map((t=>ce(e,t))),r={};return Object.assign(r,Object.assign({expressions:n},$e((e=>t=>(n.forEach((n=>n[e](t))),r)))))}(t,r).mount(i),k(this,T,Object.freeze(Object.assign({},Ke(t,s),J(this[w].expressions)))),this.state=Ge(this.state,o),this[C]=this.template.createDOM(t).clone(),ze(t,this),e.name&&function(e,t){De(e)!==t&&je(e,d,t)}(t,e.name),k(this,A,t),k(this,_,n),this.onBeforeMount(this.props,this.state),this[C].mount(t,this,i),this.onMounted(this.props,this.state),this},update(e,t){void 0===e&&(e={}),t&&(this[S]=t,this[w].update(t));const n=J(this[w].expressions);if(!1!==this.shouldUpdate(n,this.props))return k(this,T,Object.freeze(Object.assign({},this.props,n))),this.state=Ge(this.state,e),this.onBeforeUpdate(this.props,this.state),this[j]||(this[j]=!0,this[C].update(this,this[S])),this.onUpdated(this.props,this.state),this[j]=!1,this},unmount(e){return this.onBeforeUnmount(this.props,this.state),this[w].unmount(),this[C].unmount(this,this[S],null===e?null:!e),this.onUnmounted(this.props,this.state),this}})),Object.keys(e).filter((t=>H(e[t]))).forEach((e=>{o[e]=o[e].bind(o)})),o;var o}const{DOM_COMPONENT_INSTANCE_PROPERTY:We,COMPONENTS_IMPLEMENTATION_MAP:Xe,PLUGINS_SET:Ze}=U;function Je(e,t){let{css:n,template:r,exports:s}=t;return Xe.has(e)&&X(`The component "${e}" was already registered`),Xe.set(e,Ve({name:e,css:n,template:r,exports:s})),Xe}function Qe(e,t,n){return Ae(e).map((e=>function(e,t,n){const r=n||De(e);return l.has(r)||X(`The component named "${r}" was never registered`),l.get(r)({props:t}).mount(e)}(e,t,n)))}Je("tiny-loading",{css:null,exports:null,template:(e,t,n,r)=>e('<div expr10="expr10" class="loading-wrapper"></div>',[{type:n.IF,evaluate:e=>e.props.active,redundantAttribute:"expr10",selector:"[expr10]",template:e('<div class="loading"><span></span><span></span><span></span></div>',[])}]),name:"tiny-loading"});const et={css:null,exports:{handleClose(){this.props.close()},getCssClasses(){const e=["sidebar"];return!0===this.props.open&&e.push("sidebar--open"),e.join(" ")}},template:(e,t,n,r)=>e('<div expr0="expr0"><div class="sidebar__inner"><div class="bar"><div class="bar__main"><slot expr1="expr1" name="title"></slot></div><div class="bar__end"><button expr2="expr2" class="button button--transparent" type="button"><svg class="icon fill-danger fill-text-hover" aria-hidden="true"><use xlink:href="/symbol-defs.svg#icon-close"/></svg></button></div></div><div class="sidebar__body"><slot expr3="expr3" name="form"></slot><tiny-loading expr4="expr4"></tiny-loading></div><div class="sidebar__footer"><button expr5="expr5" class="button m-bottom-0" type="submit">\n Save\n <svg class="icon fill-success p-left-3" aria-hidden="true"><use xlink:href="/symbol-defs.svg#icon-check"/></svg></button><button expr6="expr6" class="button m-bottom-0" type="submit" close>\n Save and Close\n <svg class="icon fill-success p-left-3" aria-hidden="true"><use xlink:href="/symbol-defs.svg#icon-arrow-right"/></svg></button></div></div></div>',[{redundantAttribute:"expr0",selector:"[expr0]",expressions:[{type:t.ATTRIBUTE,name:"class",evaluate:e=>e.getCssClasses()}]},{type:n.SLOT,attributes:[],name:"title",redundantAttribute:"expr1",selector:"[expr1]"},{redundantAttribute:"expr2",selector:"[expr2]",expressions:[{type:t.EVENT,name:"onclick",evaluate:e=>t=>{e.handleClose(t)}}]},{type:n.SLOT,attributes:[],name:"form",redundantAttribute:"expr3",selector:"[expr3]"},{type:n.TAG,getComponent:r,evaluate:e=>"tiny-loading",slots:[],attributes:[{type:t.ATTRIBUTE,name:"active",evaluate:e=>e.props.loading}],redundantAttribute:"expr4",selector:"[expr4]"},{redundantAttribute:"expr5",selector:"[expr5]",expressions:[{type:t.ATTRIBUTE,name:"form",evaluate:e=>e.props.formId},{type:t.ATTRIBUTE,name:"disabled",evaluate:e=>e.props.loading}]},{redundantAttribute:"expr6",selector:"[expr6]",expressions:[{type:t.ATTRIBUTE,name:"form",evaluate:e=>e.props.formId},{type:t.ATTRIBUTE,name:"disabled",evaluate:e=>e.props.loading}]}]),name:"tiny-sidebar-form"},tt={state:{isOpen:!1,isLoading:!1},handleClose:function(){this.state.isOpen=!1,this.reset(),this.update()},onBeforeMount:function(){this.reset()},reset:function(){}};var nt=n(432);
/**
* example store for trigger open
*
* @author Björn Hase
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://gitea.node001.net/tiny-components/sidebar-form
*
*/const rt=n.n(nt)()({open:function(){this.trigger("open")}}),st={css:null,exports:()=>({...tt,onMounted(){rt.on("open",(()=>{this.state.isOpen=!0,this.update()}))},handleSubmit(e){e.preventDefault(),this.state.isLoading=!0,this.update(),setTimeout((()=>{this.state.isLoading=!1,e.submitter.attributes.close&&this.handleClose(),this.update()}),2500)}}),template:(e,t,n,r)=>e('<div class="m-top-4 m-bottom-4"><tiny-sidebar-form expr7="expr7" form-id="example-form"></tiny-sidebar-form></div>',[{type:n.TAG,getComponent:r,evaluate:e=>"tiny-sidebar-form",slots:[{id:"title",html:'<span slot="title">\n New\n </span>',bindings:[]},{id:"form",html:'<form expr8="expr8" id="example-form" class="form" slot="form"><div class="field-group"><label class="field-label">\n Note\n <textarea class="field-text" name="name"></textarea></label></div></form>',bindings:[{redundantAttribute:"expr8",selector:"[expr8]",expressions:[{type:t.EVENT,name:"onsubmit",evaluate:e=>t=>{e.handleSubmit(t)}}]}]}],attributes:[{type:t.ATTRIBUTE,name:"open",evaluate:e=>e.state.isOpen},{type:t.ATTRIBUTE,name:"close",evaluate:e=>()=>{e.handleClose()}},{type:t.ATTRIBUTE,name:"loading",evaluate:e=>e.state.isLoading}],redundantAttribute:"expr7",selector:"[expr7]"}]),name:"example-sidebar-form"},ot={css:null,exports:{handleClick(){rt.trigger("open")}},template:(e,t,n,r)=>e('<button expr9="expr9" class="button">\n Open\n </button>',[{redundantAttribute:"expr9",selector:"[expr9]",expressions:[{type:t.EVENT,name:"onclick",evaluate:e=>t=>{e.handleClick(t)}}]}]),name:"example-button"};Je("tiny-sidebar-form",et),Je("example-sidebar-form",st),Qe("example-sidebar-form"),Je("example-button",ot),Qe("example-button")},37:()=>{}},n={};function r(e){var s=n[e];if(void 0!==s)return s.exports;var o=n[e]={exports:{}};return t[e](o,o.exports,r),o.exports}r.m=t,e=[],r.O=(t,n,s,o)=>{if(!n){var i=1/0;for(c=0;c<e.length;c++){for(var[n,s,o]=e[c],a=!0,u=0;u<n.length;u++)(!1&o||i>=o)&&Object.keys(r.O).every((e=>r.O[e](n[u])))?n.splice(u--,1):(a=!1,o<i&&(i=o));if(a){e.splice(c--,1);var l=s();void 0!==l&&(t=l)}}return t}o=o||0;for(var c=e.length;c>0&&e[c-1][2]>o;c--)e[c]=e[c-1];e[c]=[n,s,o]},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={268:0,908:0};r.O.j=t=>0===e[t];var t=(t,n)=>{var s,o,[i,a,u]=n,l=0;if(i.some((t=>0!==e[t]))){for(s in a)r.o(a,s)&&(r.m[s]=a[s]);if(u)var c=u(r)}for(t&&t(n);l<i.length;l++)o=i[l],r.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return r.O(c)},n=self.webpackChunk_tiny_components_sidebar_form=self.webpackChunk_tiny_components_sidebar_form||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),r.O(void 0,[908],(()=>r(737)));var s=r.O(void 0,[908],(()=>r(37)));s=r.O(s)})();