Comparing version 0.0.1 to 0.0.2
@@ -1,2 +0,2 @@ | ||
var e=function(e,a){return Object.keys(e).forEach(a)},a=function(e){return e&&document.createElement(e)},n=function(e,a){if(!e||!a)return e;var n="string"==typeof a?a.split(" "):a;return n?(n.forEach(function(a){a&&e.classList.add(a)}),e):e},t=function(a,t){return e(t,function(s){var r=t[s];"style"===s?e(r,function(e){a.style[e]=r[e]}):"class"===s?n(a,r):a.setAttribute(s,r)}),a},s=function(e){return"FormElements-"+e};function r(e,a){var n={};for(var t in e)a.indexOf(t)>=0||Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n}var l=Object.assign||function(e){for(var a=arguments,n=1;n<arguments.length;n++){var t=a[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e};var i=function(e,f,m,c){void 0===m&&(m={}),void 0===c&&(c=!1);var p=m.classNames,C=m.shouldNestFieldWithinLabel,N=p.fieldGroupClassName,v=p.fieldClassName,h=p.labelClassName,b=p.nestedFieldClassName,y=p.nestedGroupClassName,F=p.submitClassName,O=a("div");if(n(O,s("FieldGroup")),n(O,s("id-"+f)),n(O,N),Array.isArray(e)){var G=e.map(function(e,a){return i(e,f+"-"+a,m,!0)});return G&&G.forEach(function(e){return O.appendChild(e)}),n(O,"has-fieldGroups"),n(O,y),O}var L=e.html,g=e.label,E=e.type,j=function(e,a){var n={};for(var t in e)a.indexOf(t)>=0||Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n}(e,["html","label","type"]),w=function(e){return s(e)}(f),x=function(e,l){if(e){var i=a("label"),o=r(l,[]);t(i,o),n(i,s("Label"));var d=a("div");return d.innerHTML=e,n(d,s("Label__text")),i.appendChild(d),i}}(g,{class:h,for:w}),W=function(e){var l=e.fieldClassName,i=e.submitClassName,o=e.type,d=r(e,["fieldClassName","submitClassName","type"]),u="textarea"===o.toLowerCase()?"textarea":"input",f=a(u);"textarea"!==u&&(f.type=o);var m="submit"===o?i:l;return t(f,d),n(f,s("Field")),n(f,m),f}(l({type:E,id:w},j,{fieldClassName:v,submitClassName:F}));return x||W?(o(O,x),d(O,x,W,C),u(O,L),c&&(n(O,b),n(O,"is-nested")),O):null},o=function(e,a){a&&e.appendChild(a)},d=function(e,a,n,t){void 0===t&&(t=!0),a&&t?a.appendChild(n):e.appendChild(n)},u=function(e,n){if(n&&("string"==typeof n||function(e){return e&&(e instanceof Element||1===e.nodeType||e===document)}(n))){var t="string"==typeof n?function(e){var n=document.createDocumentFragment(),t=a("div");return t.innerHTML=e,Array.from(t.childNodes).forEach(function(e){n.appendChild(e)}),n}(n):n;t&&e.appendChild(t)}},f=Object.assign||function(e){for(var a=arguments,n=1;n<arguments.length;n++){var t=a[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},m={fieldGroupClassName:"",fieldClassName:"",formClassName:"",labelClassName:"",nestedGroupClassName:"",nestedFieldClassName:"",shouldNestFieldWithinLabel:!0,submitClassName:"",onWillRender:function(){},onDidRender:function(){}},c=function(e,a,t){if(void 0===e&&(e=""),void 0===a&&(a=[]),void 0===t&&(t=m),e){var s=document.querySelector(e);if(s){var r=f({},m,t),l=r.onDidRender,o=r.shouldNestFieldWithinLabel,d={fieldGroupClassName:r.fieldGroupClassName,fieldClassName:r.fieldClassName,formClassName:r.formClassName,labelClassName:r.labelClassName,nestedGroupClassName:r.nestedGroupClassName,nestedFieldClassName:r.nestedFieldClassName,submitClassName:r.submitClassName};(0,r.onWillRender)(s,{elements:a,options:t}),function(e,a,t){if(e){if(t&&t.classNames){var s=t.classNames.formClassName;console.log(s),n(e,s)}a.forEach(function(a,n){var s=i(a,n,t);e.appendChild(s)})}}(s,a,{classNames:d,shouldNestFieldWithinLabel:o}),l(s,{elements:a,options:t})}}};window.Formit=c,module.exports=c; | ||
var e=function(e,a){return Object.keys(e).forEach(a)},a=function(e){return e&&document.createElement(e)},n=function(e,a){if(!e||!a)return e;var n="string"==typeof a?a.split(" "):a;return n?(n.forEach(function(a){a&&e.classList.add(a)}),e):e},t=function(a,t){return e(t,function(s){var r=t[s];"style"===s?e(r,function(e){a.style[e]=r[e]}):"class"===s?n(a,r):a.setAttribute(s,r)}),a},s=function(e){return"FormElements-"+e};function r(e,a){var n={};for(var t in e)a.indexOf(t)>=0||Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n}var l=Object.assign||function(e){for(var a=arguments,n=1;n<arguments.length;n++){var t=a[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e};var i=function(e,f,m,c){void 0===m&&(m={}),void 0===c&&(c=!1);var p=m.classNames,C=m.shouldNestFieldWithinLabel,N=p.fieldGroupClassName,v=p.fieldClassName,h=p.labelClassName,b=p.nestedFieldClassName,y=p.nestedGroupClassName,F=p.submitClassName,O=a("div");if(n(O,s("FieldGroup")),n(O,s("id-"+f)),n(O,N),Array.isArray(e)){var G=e.map(function(e,a){return i(e,f+"-"+a,m,!0)});return G&&G.forEach(function(e){return O.appendChild(e)}),n(O,"has-fieldGroups"),n(O,y),O}var L=e.html,g=e.label,E=e.type,j=function(e,a){var n={};for(var t in e)a.indexOf(t)>=0||Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n}(e,["html","label","type"]),w=function(e){return s(e)}(f),x=function(e,l){if(e){var i=a("label"),o=r(l,[]);t(i,o),n(i,s("Label"));var d=a("div");return d.innerHTML=e,n(d,s("Label__text")),i.appendChild(d),i}}(g,{class:h,for:w}),W=function(e){var l=e.fieldClassName,i=e.submitClassName,o=e.type,d=r(e,["fieldClassName","submitClassName","type"]),u="textarea"===o.toLowerCase()?"textarea":"input",f=a(u);"textarea"!==u&&(f.type=o);var m="submit"===o?i:l;return t(f,d),n(f,s("Field")),n(f,m),f}(l({type:E,id:w},j,{fieldClassName:v,submitClassName:F}));return x||W?(o(O,x),d(O,x,W,C),u(O,L),c&&(n(O,b),n(O,"is-nested")),O):null},o=function(e,a){a&&e.appendChild(a)},d=function(e,a,n,t){void 0===t&&(t=!0),a&&t?a.appendChild(n):e.appendChild(n)},u=function(e,n){if(n&&("string"==typeof n||function(e){return e&&(e instanceof Element||1===e.nodeType||e===document)}(n))){var t="string"==typeof n?function(e){var n=document.createDocumentFragment(),t=a("div");return t.innerHTML=e,Array.from(t.childNodes).forEach(function(e){n.appendChild(e)}),n}(n):n;t&&e.appendChild(t)}},f=Object.assign||function(e){for(var a=arguments,n=1;n<arguments.length;n++){var t=a[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},m={fieldGroupClassName:"",fieldClassName:"",formClassName:"",labelClassName:"",nestedGroupClassName:"",nestedFieldClassName:"",shouldNestFieldWithinLabel:!0,submitClassName:"",onWillRender:function(){},onDidRender:function(){}},c=function(e,a,t){if(void 0===e&&(e=""),void 0===a&&(a=[]),void 0===t&&(t=m),e){var s=document.querySelector(e);if(s){var r=f({},m,t),l=r.onDidRender,o=r.shouldNestFieldWithinLabel,d={fieldGroupClassName:r.fieldGroupClassName,fieldClassName:r.fieldClassName,formClassName:r.formClassName,labelClassName:r.labelClassName,nestedGroupClassName:r.nestedGroupClassName,nestedFieldClassName:r.nestedFieldClassName,submitClassName:r.submitClassName};(0,r.onWillRender)(s,{elements:a,options:t}),function(e,a,t){e&&(t&&t.classNames&&n(e,t.classNames.formClassName),a.forEach(function(a,n){var s=i(a,n,t);e.appendChild(s)}))}(s,a,{classNames:d,shouldNestFieldWithinLabel:o}),l(s,{elements:a,options:t})}}};window.Formit=c,module.exports=c; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
var e=function(e,a){return Object.keys(e).forEach(a)},a=function(e){return e&&document.createElement(e)},n=function(e,a){if(!e||!a)return e;var n="string"==typeof a?a.split(" "):a;return n?(n.forEach(function(a){a&&e.classList.add(a)}),e):e},t=function(a,t){return e(t,function(s){var r=t[s];"style"===s?e(r,function(e){a.style[e]=r[e]}):"class"===s?n(a,r):a.setAttribute(s,r)}),a},s=function(e){return"FormElements-"+e};function r(e,a){var n={};for(var t in e)a.indexOf(t)>=0||Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n}var l=Object.assign||function(e){for(var a=arguments,n=1;n<arguments.length;n++){var t=a[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e};var i=function(e,f,m,c){void 0===m&&(m={}),void 0===c&&(c=!1);var p=m.classNames,C=m.shouldNestFieldWithinLabel,N=p.fieldGroupClassName,v=p.fieldClassName,h=p.labelClassName,b=p.nestedFieldClassName,y=p.nestedGroupClassName,F=p.submitClassName,O=a("div");if(n(O,s("FieldGroup")),n(O,s("id-"+f)),n(O,N),Array.isArray(e)){var G=e.map(function(e,a){return i(e,f+"-"+a,m,!0)});return G&&G.forEach(function(e){return O.appendChild(e)}),n(O,"has-fieldGroups"),n(O,y),O}var L=e.html,g=e.label,E=e.type,j=function(e,a){var n={};for(var t in e)a.indexOf(t)>=0||Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n}(e,["html","label","type"]),w=function(e){return s(e)}(f),x=function(e,l){if(e){var i=a("label"),o=r(l,[]);t(i,o),n(i,s("Label"));var d=a("div");return d.innerHTML=e,n(d,s("Label__text")),i.appendChild(d),i}}(g,{class:h,for:w}),W=function(e){var l=e.fieldClassName,i=e.submitClassName,o=e.type,d=r(e,["fieldClassName","submitClassName","type"]),u="textarea"===o.toLowerCase()?"textarea":"input",f=a(u);"textarea"!==u&&(f.type=o);var m="submit"===o?i:l;return t(f,d),n(f,s("Field")),n(f,m),f}(l({type:E,id:w},j,{fieldClassName:v,submitClassName:F}));return x||W?(o(O,x),d(O,x,W,C),u(O,L),c&&(n(O,b),n(O,"is-nested")),O):null},o=function(e,a){a&&e.appendChild(a)},d=function(e,a,n,t){void 0===t&&(t=!0),a&&t?a.appendChild(n):e.appendChild(n)},u=function(e,n){if(n&&("string"==typeof n||function(e){return e&&(e instanceof Element||1===e.nodeType||e===document)}(n))){var t="string"==typeof n?function(e){var n=document.createDocumentFragment(),t=a("div");return t.innerHTML=e,Array.from(t.childNodes).forEach(function(e){n.appendChild(e)}),n}(n):n;t&&e.appendChild(t)}},f=Object.assign||function(e){for(var a=arguments,n=1;n<arguments.length;n++){var t=a[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},m={fieldGroupClassName:"",fieldClassName:"",formClassName:"",labelClassName:"",nestedGroupClassName:"",nestedFieldClassName:"",shouldNestFieldWithinLabel:!0,submitClassName:"",onWillRender:function(){},onDidRender:function(){}},c=function(e,a,t){if(void 0===e&&(e=""),void 0===a&&(a=[]),void 0===t&&(t=m),e){var s=document.querySelector(e);if(s){var r=f({},m,t),l=r.onDidRender,o=r.shouldNestFieldWithinLabel,d={fieldGroupClassName:r.fieldGroupClassName,fieldClassName:r.fieldClassName,formClassName:r.formClassName,labelClassName:r.labelClassName,nestedGroupClassName:r.nestedGroupClassName,nestedFieldClassName:r.nestedFieldClassName,submitClassName:r.submitClassName};(0,r.onWillRender)(s,{elements:a,options:t}),function(e,a,t){if(e){if(t&&t.classNames){var s=t.classNames.formClassName;console.log(s),n(e,s)}a.forEach(function(a,n){var s=i(a,n,t);e.appendChild(s)})}}(s,a,{classNames:d,shouldNestFieldWithinLabel:o}),l(s,{elements:a,options:t})}}};window.Formit=c;export default c; | ||
var e=function(e,a){return Object.keys(e).forEach(a)},a=function(e){return e&&document.createElement(e)},n=function(e,a){if(!e||!a)return e;var n="string"==typeof a?a.split(" "):a;return n?(n.forEach(function(a){a&&e.classList.add(a)}),e):e},t=function(a,t){return e(t,function(s){var r=t[s];"style"===s?e(r,function(e){a.style[e]=r[e]}):"class"===s?n(a,r):a.setAttribute(s,r)}),a},s=function(e){return"FormElements-"+e};function r(e,a){var n={};for(var t in e)a.indexOf(t)>=0||Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n}var l=Object.assign||function(e){for(var a=arguments,n=1;n<arguments.length;n++){var t=a[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e};var i=function(e,f,m,c){void 0===m&&(m={}),void 0===c&&(c=!1);var p=m.classNames,C=m.shouldNestFieldWithinLabel,N=p.fieldGroupClassName,v=p.fieldClassName,h=p.labelClassName,b=p.nestedFieldClassName,y=p.nestedGroupClassName,F=p.submitClassName,O=a("div");if(n(O,s("FieldGroup")),n(O,s("id-"+f)),n(O,N),Array.isArray(e)){var G=e.map(function(e,a){return i(e,f+"-"+a,m,!0)});return G&&G.forEach(function(e){return O.appendChild(e)}),n(O,"has-fieldGroups"),n(O,y),O}var L=e.html,g=e.label,E=e.type,j=function(e,a){var n={};for(var t in e)a.indexOf(t)>=0||Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n}(e,["html","label","type"]),w=function(e){return s(e)}(f),x=function(e,l){if(e){var i=a("label"),o=r(l,[]);t(i,o),n(i,s("Label"));var d=a("div");return d.innerHTML=e,n(d,s("Label__text")),i.appendChild(d),i}}(g,{class:h,for:w}),W=function(e){var l=e.fieldClassName,i=e.submitClassName,o=e.type,d=r(e,["fieldClassName","submitClassName","type"]),u="textarea"===o.toLowerCase()?"textarea":"input",f=a(u);"textarea"!==u&&(f.type=o);var m="submit"===o?i:l;return t(f,d),n(f,s("Field")),n(f,m),f}(l({type:E,id:w},j,{fieldClassName:v,submitClassName:F}));return x||W?(o(O,x),d(O,x,W,C),u(O,L),c&&(n(O,b),n(O,"is-nested")),O):null},o=function(e,a){a&&e.appendChild(a)},d=function(e,a,n,t){void 0===t&&(t=!0),a&&t?a.appendChild(n):e.appendChild(n)},u=function(e,n){if(n&&("string"==typeof n||function(e){return e&&(e instanceof Element||1===e.nodeType||e===document)}(n))){var t="string"==typeof n?function(e){var n=document.createDocumentFragment(),t=a("div");return t.innerHTML=e,Array.from(t.childNodes).forEach(function(e){n.appendChild(e)}),n}(n):n;t&&e.appendChild(t)}},f=Object.assign||function(e){for(var a=arguments,n=1;n<arguments.length;n++){var t=a[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},m={fieldGroupClassName:"",fieldClassName:"",formClassName:"",labelClassName:"",nestedGroupClassName:"",nestedFieldClassName:"",shouldNestFieldWithinLabel:!0,submitClassName:"",onWillRender:function(){},onDidRender:function(){}},c=function(e,a,t){if(void 0===e&&(e=""),void 0===a&&(a=[]),void 0===t&&(t=m),e){var s=document.querySelector(e);if(s){var r=f({},m,t),l=r.onDidRender,o=r.shouldNestFieldWithinLabel,d={fieldGroupClassName:r.fieldGroupClassName,fieldClassName:r.fieldClassName,formClassName:r.formClassName,labelClassName:r.labelClassName,nestedGroupClassName:r.nestedGroupClassName,nestedFieldClassName:r.nestedFieldClassName,submitClassName:r.submitClassName};(0,r.onWillRender)(s,{elements:a,options:t}),function(e,a,t){e&&(t&&t.classNames&&n(e,t.classNames.formClassName),a.forEach(function(a,n){var s=i(a,n,t);e.appendChild(s)}))}(s,a,{classNames:d,shouldNestFieldWithinLabel:o}),l(s,{elements:a,options:t})}}};window.Formit=c;export default c; | ||
//# sourceMappingURL=index.m.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?module.exports=a():"function"==typeof define&&define.amd?define(a):e.formit=a()}(this,function(){var e=function(e,a){return Object.keys(e).forEach(a)},a=function(e){return e&&document.createElement(e)},n=function(e,a){if(!e||!a)return e;var n="string"==typeof a?a.split(" "):a;return n?(n.forEach(function(a){a&&e.classList.add(a)}),e):e},t=function(a,t){return e(t,function(s){var r=t[s];"style"===s?e(r,function(e){a.style[e]=r[e]}):"class"===s?n(a,r):a.setAttribute(s,r)}),a},s=function(e){return"FormElements-"+e};function r(e,a){var n={};for(var t in e)a.indexOf(t)>=0||Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n}var i=Object.assign||function(e){for(var a=arguments,n=1;n<arguments.length;n++){var t=a[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e};var l=function(e,f,m,c){void 0===m&&(m={}),void 0===c&&(c=!1);var p=m.classNames,C=m.shouldNestFieldWithinLabel,N=p.fieldGroupClassName,v=p.fieldClassName,h=p.labelClassName,b=p.nestedFieldClassName,y=p.nestedGroupClassName,F=p.submitClassName,O=a("div");if(n(O,s("FieldGroup")),n(O,s("id-"+f)),n(O,N),Array.isArray(e)){var G=e.map(function(e,a){return l(e,f+"-"+a,m,!0)});return G&&G.forEach(function(e){return O.appendChild(e)}),n(O,"has-fieldGroups"),n(O,y),O}var L=e.html,g=e.label,j=e.type,x=function(e,a){var n={};for(var t in e)a.indexOf(t)>=0||Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n}(e,["html","label","type"]),E=function(e){return s(e)}(f),w=function(e,i){if(e){var l=a("label"),o=r(i,[]);t(l,o),n(l,s("Label"));var d=a("div");return d.innerHTML=e,n(d,s("Label__text")),l.appendChild(d),l}}(g,{class:h,for:E}),W=function(e){var i=e.fieldClassName,l=e.submitClassName,o=e.type,d=r(e,["fieldClassName","submitClassName","type"]),u="textarea"===o.toLowerCase()?"textarea":"input",f=a(u);"textarea"!==u&&(f.type=o);var m="submit"===o?l:i;return t(f,d),n(f,s("Field")),n(f,m),f}(i({type:j,id:E},x,{fieldClassName:v,submitClassName:F}));return w||W?(o(O,w),d(O,w,W,C),u(O,L),c&&(n(O,b),n(O,"is-nested")),O):null},o=function(e,a){a&&e.appendChild(a)},d=function(e,a,n,t){void 0===t&&(t=!0),a&&t?a.appendChild(n):e.appendChild(n)},u=function(e,n){if(n&&("string"==typeof n||function(e){return e&&(e instanceof Element||1===e.nodeType||e===document)}(n))){var t="string"==typeof n?function(e){var n=document.createDocumentFragment(),t=a("div");return t.innerHTML=e,Array.from(t.childNodes).forEach(function(e){n.appendChild(e)}),n}(n):n;t&&e.appendChild(t)}},f=Object.assign||function(e){for(var a=arguments,n=1;n<arguments.length;n++){var t=a[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},m={fieldGroupClassName:"",fieldClassName:"",formClassName:"",labelClassName:"",nestedGroupClassName:"",nestedFieldClassName:"",shouldNestFieldWithinLabel:!0,submitClassName:"",onWillRender:function(){},onDidRender:function(){}},c=function(e,a,t){if(void 0===e&&(e=""),void 0===a&&(a=[]),void 0===t&&(t=m),e){var s=document.querySelector(e);if(s){var r=f({},m,t),i=r.onDidRender,o=r.shouldNestFieldWithinLabel,d={fieldGroupClassName:r.fieldGroupClassName,fieldClassName:r.fieldClassName,formClassName:r.formClassName,labelClassName:r.labelClassName,nestedGroupClassName:r.nestedGroupClassName,nestedFieldClassName:r.nestedFieldClassName,submitClassName:r.submitClassName};(0,r.onWillRender)(s,{elements:a,options:t}),function(e,a,t){if(e){if(t&&t.classNames){var s=t.classNames.formClassName;console.log(s),n(e,s)}a.forEach(function(a,n){var s=l(a,n,t);e.appendChild(s)})}}(s,a,{classNames:d,shouldNestFieldWithinLabel:o}),i(s,{elements:a,options:t})}}};return window.Formit=c,c}); | ||
!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?module.exports=a():"function"==typeof define&&define.amd?define(a):e.formit=a()}(this,function(){var e=function(e,a){return Object.keys(e).forEach(a)},a=function(e){return e&&document.createElement(e)},n=function(e,a){if(!e||!a)return e;var n="string"==typeof a?a.split(" "):a;return n?(n.forEach(function(a){a&&e.classList.add(a)}),e):e},t=function(a,t){return e(t,function(s){var r=t[s];"style"===s?e(r,function(e){a.style[e]=r[e]}):"class"===s?n(a,r):a.setAttribute(s,r)}),a},s=function(e){return"FormElements-"+e};function r(e,a){var n={};for(var t in e)a.indexOf(t)>=0||Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n}var i=Object.assign||function(e){for(var a=arguments,n=1;n<arguments.length;n++){var t=a[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e};var l=function(e,f,m,c){void 0===m&&(m={}),void 0===c&&(c=!1);var p=m.classNames,C=m.shouldNestFieldWithinLabel,N=p.fieldGroupClassName,v=p.fieldClassName,h=p.labelClassName,b=p.nestedFieldClassName,y=p.nestedGroupClassName,F=p.submitClassName,O=a("div");if(n(O,s("FieldGroup")),n(O,s("id-"+f)),n(O,N),Array.isArray(e)){var G=e.map(function(e,a){return l(e,f+"-"+a,m,!0)});return G&&G.forEach(function(e){return O.appendChild(e)}),n(O,"has-fieldGroups"),n(O,y),O}var L=e.html,g=e.label,j=e.type,x=function(e,a){var n={};for(var t in e)a.indexOf(t)>=0||Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n}(e,["html","label","type"]),E=function(e){return s(e)}(f),w=function(e,i){if(e){var l=a("label"),o=r(i,[]);t(l,o),n(l,s("Label"));var d=a("div");return d.innerHTML=e,n(d,s("Label__text")),l.appendChild(d),l}}(g,{class:h,for:E}),W=function(e){var i=e.fieldClassName,l=e.submitClassName,o=e.type,d=r(e,["fieldClassName","submitClassName","type"]),u="textarea"===o.toLowerCase()?"textarea":"input",f=a(u);"textarea"!==u&&(f.type=o);var m="submit"===o?l:i;return t(f,d),n(f,s("Field")),n(f,m),f}(i({type:j,id:E},x,{fieldClassName:v,submitClassName:F}));return w||W?(o(O,w),d(O,w,W,C),u(O,L),c&&(n(O,b),n(O,"is-nested")),O):null},o=function(e,a){a&&e.appendChild(a)},d=function(e,a,n,t){void 0===t&&(t=!0),a&&t?a.appendChild(n):e.appendChild(n)},u=function(e,n){if(n&&("string"==typeof n||function(e){return e&&(e instanceof Element||1===e.nodeType||e===document)}(n))){var t="string"==typeof n?function(e){var n=document.createDocumentFragment(),t=a("div");return t.innerHTML=e,Array.from(t.childNodes).forEach(function(e){n.appendChild(e)}),n}(n):n;t&&e.appendChild(t)}},f=Object.assign||function(e){for(var a=arguments,n=1;n<arguments.length;n++){var t=a[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},m={fieldGroupClassName:"",fieldClassName:"",formClassName:"",labelClassName:"",nestedGroupClassName:"",nestedFieldClassName:"",shouldNestFieldWithinLabel:!0,submitClassName:"",onWillRender:function(){},onDidRender:function(){}},c=function(e,a,t){if(void 0===e&&(e=""),void 0===a&&(a=[]),void 0===t&&(t=m),e){var s=document.querySelector(e);if(s){var r=f({},m,t),i=r.onDidRender,o=r.shouldNestFieldWithinLabel,d={fieldGroupClassName:r.fieldGroupClassName,fieldClassName:r.fieldClassName,formClassName:r.formClassName,labelClassName:r.labelClassName,nestedGroupClassName:r.nestedGroupClassName,nestedFieldClassName:r.nestedFieldClassName,submitClassName:r.submitClassName};(0,r.onWillRender)(s,{elements:a,options:t}),function(e,a,t){e&&(t&&t.classNames&&n(e,t.classNames.formClassName),a.forEach(function(a,n){var s=l(a,n,t);e.appendChild(s)}))}(s,a,{classNames:d,shouldNestFieldWithinLabel:o}),i(s,{elements:a,options:t})}}};return window.Formit=c,c}); | ||
//# sourceMappingURL=index.umd.js.map |
@@ -9,3 +9,2 @@ import { addClass } from './utilities/dom'; | ||
const { formClassName } = options.classNames; | ||
console.log(formClassName); | ||
addClass(mountNode, formClassName); | ||
@@ -12,0 +11,0 @@ } |
{ | ||
"name": "formit", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A speedy way to create HTML forms.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -5,5 +5,9 @@ # 🐇 Formit | ||
* **Tiny**, around 1.35 KB gzipped | ||
* **Zero dependences** | ||
* ⚡️ **Tiny**, around 1.35 KB gzipped | ||
* 🙌 **Zero dependences** | ||
* 🖌 **Styleless** by design, allowing you to add your own. | ||
**[Check out the demo](http://formit.surge.sh/)** | ||
## 🔧 Installation | ||
@@ -15,3 +19,15 @@ | ||
Then, import it into your Javascript workflow: | ||
```js | ||
import Formit from 'formit' | ||
``` | ||
The UMD build is also available via [unpkg](https://unpkg.com): | ||
```html | ||
<script src="https://unpkg.com/form/dist/index.umd.js"></script> | ||
``` | ||
## 🕹 Usage | ||
@@ -21,2 +37,16 @@ | ||
#### 1. Prepare the HTML | ||
Create somewhere for your Formit elements to render to: | ||
```html | ||
<form> | ||
<div id="Form"></div> | ||
</form> | ||
``` | ||
#### 2. Generate with Formit | ||
Target your selector, and pass in the Formit elements you want to generate: | ||
```js | ||
@@ -42,4 +72,8 @@ Formit('#form', [ | ||
#### Rendered HTML | ||
#### 3. Check out your rendered form | ||
Aw yea! Your selector is now populated with ready-to-use form elements. | ||
A cool feature of Formit is that it'll automatically generate unique IDs and associate the `<label>` (if generated) with the field. | ||
```html | ||
@@ -65,2 +99,10 @@ <div id="form"> | ||
A cool feature of Formit is that it'll automatically generate unique IDs and associate the `<label>` (if generated) with the field. | ||
## 📒 Notes | ||
Tests and additional docs coming soon! | ||
## ❤️ Thanks | ||
A big thanks to [developit](https://github.com/developit) for his amazing tools and for being a source of inspiration. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
655751
104
293