UNPKG

@j4jinxx/form

Version:

Minimal Form & Input React Component

15 lines (14 loc) 24.7 kB
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("react"));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(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,r){return(t=o(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a.apply(this,arguments)}function l(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return u(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var s,p={exports:{}},y={exports:{}},d={};var m,b,v,h,g,w,x,O,S,E,j,P,T,k,_={}; /** @license React v16.13.1 * react-is.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */function $(){return b||(b=1,"production"===process.env.NODE_ENV?y.exports=function(){if(s)return d;s=1;var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,a=e?Symbol.for("react.provider"):60109,l=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,f=e?Symbol.for("react.forward_ref"):60112,p=e?Symbol.for("react.suspense"):60113,y=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,b=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,h=e?Symbol.for("react.fundamental"):60117,g=e?Symbol.for("react.responder"):60118,w=e?Symbol.for("react.scope"):60119;function x(e){if("object"==typeof e&&null!==e){var s=e.$$typeof;switch(s){case t:switch(e=e.type){case c:case u:case n:case i:case o:case p:return e;default:switch(e=e&&e.$$typeof){case l:case f:case b:case m:case a:return e;default:return s}}case r:return s}}}function O(e){return x(e)===u}return d.AsyncMode=c,d.ConcurrentMode=u,d.ContextConsumer=l,d.ContextProvider=a,d.Element=t,d.ForwardRef=f,d.Fragment=n,d.Lazy=b,d.Memo=m,d.Portal=r,d.Profiler=i,d.StrictMode=o,d.Suspense=p,d.isAsyncMode=function(e){return O(e)||x(e)===c},d.isConcurrentMode=O,d.isContextConsumer=function(e){return x(e)===l},d.isContextProvider=function(e){return x(e)===a},d.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},d.isForwardRef=function(e){return x(e)===f},d.isFragment=function(e){return x(e)===n},d.isLazy=function(e){return x(e)===b},d.isMemo=function(e){return x(e)===m},d.isPortal=function(e){return x(e)===r},d.isProfiler=function(e){return x(e)===i},d.isStrictMode=function(e){return x(e)===o},d.isSuspense=function(e){return x(e)===p},d.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===n||e===u||e===i||e===o||e===p||e===y||"object"==typeof e&&null!==e&&(e.$$typeof===b||e.$$typeof===m||e.$$typeof===a||e.$$typeof===l||e.$$typeof===f||e.$$typeof===h||e.$$typeof===g||e.$$typeof===w||e.$$typeof===v)},d.typeOf=x,d}():y.exports=(m||(m=1,"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,a=e?Symbol.for("react.provider"):60109,l=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,f=e?Symbol.for("react.forward_ref"):60112,s=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,y=e?Symbol.for("react.memo"):60115,d=e?Symbol.for("react.lazy"):60116,m=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,h=e?Symbol.for("react.scope"):60119;function g(e){if("object"==typeof e&&null!==e){var p=e.$$typeof;switch(p){case t:var m=e.type;switch(m){case c:case u:case n:case i:case o:case s:return m;default:var b=m&&m.$$typeof;switch(b){case l:case f:case d:case y:case a:return b;default:return p}}case r:return p}}}var w=c,x=u,O=l,S=a,E=t,j=f,P=n,T=d,k=y,$=r,I=i,C=o,N=s,R=!1;function F(e){return g(e)===u}_.AsyncMode=w,_.ConcurrentMode=x,_.ContextConsumer=O,_.ContextProvider=S,_.Element=E,_.ForwardRef=j,_.Fragment=P,_.Lazy=T,_.Memo=k,_.Portal=$,_.Profiler=I,_.StrictMode=C,_.Suspense=N,_.isAsyncMode=function(e){return R||(R=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),F(e)||g(e)===c},_.isConcurrentMode=F,_.isContextConsumer=function(e){return g(e)===l},_.isContextProvider=function(e){return g(e)===a},_.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},_.isForwardRef=function(e){return g(e)===f},_.isFragment=function(e){return g(e)===n},_.isLazy=function(e){return g(e)===d},_.isMemo=function(e){return g(e)===y},_.isPortal=function(e){return g(e)===r},_.isProfiler=function(e){return g(e)===i},_.isStrictMode=function(e){return g(e)===o},_.isSuspense=function(e){return g(e)===s},_.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===n||e===u||e===i||e===o||e===s||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===d||e.$$typeof===y||e.$$typeof===a||e.$$typeof===l||e.$$typeof===f||e.$$typeof===b||e.$$typeof===v||e.$$typeof===h||e.$$typeof===m)},_.typeOf=g}()),_)),y.exports} /* object-assign (c) Sindre Sorhus @license MIT */function I(){if(h)return v;h=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;return v=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(e){n[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(n,o){for(var i,a,l=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(n),c=1;c<arguments.length;c++){for(var u in i=Object(arguments[c]))t.call(i,u)&&(l[u]=i[u]);if(e){a=e(i);for(var f=0;f<a.length;f++)r.call(i,a[f])&&(l[a[f]]=i[a[f]])}}return l},v}function C(){if(w)return g;w=1;return g="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function N(){return O?x:(O=1,x=Function.call.bind(Object.prototype.hasOwnProperty))}if("production"!==process.env.NODE_ENV){var R=$();p.exports=function(){if(P)return j;P=1;var e=$(),t=I(),r=C(),n=N(),o=function(){if(E)return S;E=1;var e=function(){};if("production"!==process.env.NODE_ENV){var t=C(),r={},n=N();e=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function o(o,i,a,l,c){if("production"!==process.env.NODE_ENV)for(var u in o)if(n(o,u)){var f;try{if("function"!=typeof o[u]){var s=Error((l||"React class")+": "+a+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw s.name="Invariant Violation",s}f=o[u](i,u,l,a,null,t)}catch(e){f=e}if(!f||f instanceof Error||e((l||"React class")+": type specification of "+a+" `"+u+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in r)){r[f.message]=!0;var p=c?c():"";e("Failed "+a+" type: "+f.message+(null!=p?p:""))}}}return o.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(r={})},S=o}(),i=function(){};function a(){return null}return"production"!==process.env.NODE_ENV&&(i=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),j=function(l,c){var u="function"==typeof Symbol&&Symbol.iterator,f="@@iterator",s="<<anonymous>>",p={array:b("array"),bigint:b("bigint"),bool:b("boolean"),func:b("function"),number:b("number"),object:b("object"),string:b("string"),symbol:b("symbol"),any:m(a),arrayOf:function(e){return m((function(t,n,o,i,a){if("function"!=typeof e)return new d("Property `"+a+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var l=t[n];if(!Array.isArray(l))return new d("Invalid "+i+" `"+a+"` of type `"+g(l)+"` supplied to `"+o+"`, expected an array.");for(var c=0;c<l.length;c++){var u=e(l,c,o,i,a+"["+c+"]",r);if(u instanceof Error)return u}return null}))},element:m((function(e,t,r,n,o){var i=e[t];return l(i)?null:new d("Invalid "+n+" `"+o+"` of type `"+g(i)+"` supplied to `"+r+"`, expected a single ReactElement.")})),elementType:m((function(t,r,n,o,i){var a=t[r];return e.isValidElementType(a)?null:new d("Invalid "+o+" `"+i+"` of type `"+g(a)+"` supplied to `"+n+"`, expected a single ReactElement type.")})),instanceOf:function(e){return m((function(t,r,n,o,i){if(!(t[r]instanceof e)){var a=e.name||s;return new d("Invalid "+o+" `"+i+"` of type `"+((l=t[r]).constructor&&l.constructor.name?l.constructor.name:s)+"` supplied to `"+n+"`, expected instance of `"+a+"`.")}var l;return null}))},node:m((function(e,t,r,n,o){return h(e[t])?null:new d("Invalid "+n+" `"+o+"` supplied to `"+r+"`, expected a ReactNode.")})),objectOf:function(e){return m((function(t,o,i,a,l){if("function"!=typeof e)return new d("Property `"+l+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var c=t[o],u=g(c);if("object"!==u)return new d("Invalid "+a+" `"+l+"` of type `"+u+"` supplied to `"+i+"`, expected an object.");for(var f in c)if(n(c,f)){var s=e(c,f,i,a,l+"."+f,r);if(s instanceof Error)return s}return null}))},oneOf:function(e){return Array.isArray(e)?m((function(t,r,n,o,i){for(var a=t[r],l=0;l<e.length;l++)if(y(a,e[l]))return null;var c=JSON.stringify(e,(function(e,t){return"symbol"===w(t)?String(t):t}));return new d("Invalid "+o+" `"+i+"` of value `"+String(a)+"` supplied to `"+n+"`, expected one of "+c+".")})):("production"!==process.env.NODE_ENV&&i(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),a)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&i("Invalid argument supplied to oneOfType, expected an instance of array."),a;for(var t=0;t<e.length;t++){var o=e[t];if("function"!=typeof o)return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+x(o)+" at index "+t+"."),a}return m((function(t,o,i,a,l){for(var c=[],u=0;u<e.length;u++){var f=(0,e[u])(t,o,i,a,l,r);if(null==f)return null;f.data&&n(f.data,"expectedType")&&c.push(f.data.expectedType)}return new d("Invalid "+a+" `"+l+"` supplied to `"+i+"`"+(c.length>0?", expected one of type ["+c.join(", ")+"]":"")+".")}))},shape:function(e){return m((function(t,n,o,i,a){var l=t[n],c=g(l);if("object"!==c)return new d("Invalid "+i+" `"+a+"` of type `"+c+"` supplied to `"+o+"`, expected `object`.");for(var u in e){var f=e[u];if("function"!=typeof f)return v(o,i,a,u,w(f));var s=f(l,u,o,i,a+"."+u,r);if(s)return s}return null}))},exact:function(e){return m((function(o,i,a,l,c){var u=o[i],f=g(u);if("object"!==f)return new d("Invalid "+l+" `"+c+"` of type `"+f+"` supplied to `"+a+"`, expected `object`.");var s=t({},o[i],e);for(var p in s){var y=e[p];if(n(e,p)&&"function"!=typeof y)return v(a,l,c,p,w(y));if(!y)return new d("Invalid "+l+" `"+c+"` key `"+p+"` supplied to `"+a+"`.\nBad object: "+JSON.stringify(o[i],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var m=y(u,p,a,l,c+"."+p,r);if(m)return m}return null}))}};function y(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function d(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function m(e){if("production"!==process.env.NODE_ENV)var t={},n=0;function o(o,a,l,u,f,p,y){if(u=u||s,p=p||l,y!==r){if(c){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var b=u+":"+l;!t[b]&&n<3&&(i("You are manually calling a React.PropTypes validation function for the `"+p+"` prop on `"+u+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),t[b]=!0,n++)}}return null==a[l]?o?null===a[l]?new d("The "+f+" `"+p+"` is marked as required in `"+u+"`, but its value is `null`."):new d("The "+f+" `"+p+"` is marked as required in `"+u+"`, but its value is `undefined`."):null:e(a,l,u,f,p)}var a=o.bind(null,!1);return a.isRequired=o.bind(null,!0),a}function b(e){return m((function(t,r,n,o,i,a){var l=t[r];return g(l)!==e?new d("Invalid "+o+" `"+i+"` of type `"+w(l)+"` supplied to `"+n+"`, expected `"+e+"`.",{expectedType:e}):null}))}function v(e,t,r,n,o){return new d((e||"React class")+": "+t+" type `"+r+"."+n+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+o+"`.")}function h(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(h);if(null===e||l(e))return!0;var t=function(e){var t=e&&(u&&e[u]||e[f]);if("function"==typeof t)return t}(e);if(!t)return!1;var r,n=t.call(e);if(t!==e.entries){for(;!(r=n.next()).done;)if(!h(r.value))return!1}else for(;!(r=n.next()).done;){var o=r.value;if(o&&!h(o[1]))return!1}return!0;default:return!1}}function g(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function w(e){if(null==e)return""+e;var t=g(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function x(e){var t=w(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return d.prototype=Error.prototype,p.checkPropTypes=o,p.resetWarningCache=o.resetWarningCache,p.PropTypes=p,p},j}()(R.isElement,!0)}else p.exports=function(){if(k)return T;k=1;var e=C();function t(){}function r(){}return r.resetWarningCache=t,T=function(){function n(t,r,n,o,i,a){if(a!==e){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function o(){return n}n.isRequired=n;var i={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:o,element:n,elementType:n,instanceOf:o,node:n,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:r,resetWarningCache:t};return i.PropTypes=i,i}}()();var F=f(p.exports),V=["onDone","children","onSubmit"],z=function(e){var r=t.default.useRef(null),n=e.onDone,o=void 0===n?function(){}:n,i=e.children;e.onSubmit;var c=l(e,V);return t.default.createElement("form",a({ref:r,onSubmit:function(e){e.preventDefault();var t=r.current;(function(e){for(var t,r=!1,n=0;t=e.elements[n],n<e.elements.length;n++)t.checkValidity()?t.removeAttribute("aria-invalid"):(r||(t.nextElementSibling,t.scrollIntoViewIfNeeded?t.scrollIntoViewIfNeeded():t.scrollIntoView(!1),t.focus(),r=!0),t.setAttribute("aria-invalid","true"));return!r})(t)&&o(t)},noValidate:!0},c),i)};z.propTypes={onDone:F.func,children:F.node},z.defaultProps={onDone:function(){}};var A=["showLabel","withGroup","style"],L=function(e){var r=e.showLabel,o=void 0===r||r,i=e.withGroup,u=void 0===i||i,f=e.style,s=void 0===f?{}:f,p=l(e,A),y=e.label||e.name,d=e.type||"text",m="".concat(d,"_id_").concat(e.name),b=c(t.default.useState("#cccccc"),2),v=b[0],h=b[1],g=function(){h("#212121")},w=function(){h("#cccccc")},x={fontFamily:"inherit",fontSize:"inherit",lineHeight:"inherit",margin:0,fontWeight:400,display:"block",width:"100%",padding:"5px 10px",boxSizing:"border-box",border:"1.5px solid ".concat(v),WebkitTransition:"0.5s",transition:"0.5s",outline:"none",backgroundColor:"transparent"};return t.default.createElement("div",{style:{marginBottom:u?".85rem":0,fontFamily:"inherit",fontSize:"0.95rem"}},o?t.default.createElement("label",{htmlFor:m,style:{display:"block",padding:"0.2rem 0",fontWeight:500,textTransform:"capitalize"}},y):null,"textarea"===d?t.default.createElement("textarea",a({onFocus:g,onBlur:w,id:m,placeholder:y,style:n(n({},x),s)},p)):t.default.createElement("input",a({onFocus:g,onBlur:w,type:d,id:m,style:n(n({},x),{},{overflow:"visible"},s)},p)))};L.propTypes={name:F.string.isRequired,type:F.string,label:F.string,showLabel:F.bool,withGroup:F.bool},L.defaultProps={type:"text",name:"field1",showLabel:!0,withGroup:!0};var D=["showLabel","withGroup","options","style"],M=function(e){var r=e.showLabel,o=void 0===r||r,i=e.withGroup,u=void 0===i||i,f=e.options,s=void 0===f?[]:f,p=e.style,y=void 0===p?{}:p,d=l(e,D),m=c(t.default.useState("#cccccc"),2),b=m[0],v=m[1],h=e.label||e.name,g="select_id_".concat(e.name),w={fontFamily:"inherit",fontSize:"inherit",lineHeight:"inherit",margin:0,fontWeight:400,display:"block",width:"100%",padding:"5px 10px",boxSizing:"border-box",border:"1.5px solid ".concat(b),WebkitTransition:"0.5s",transition:"0.5s",outline:"none",backgroundColor:"transparent"};return t.default.createElement("div",{style:{marginBottom:u?".85rem":0,fontFamily:"inherit",fontSize:"0.95rem"}},o?t.default.createElement("label",{htmlFor:g,style:{display:"block",padding:"0.2rem 0",fontWeight:500,textTransform:"capitalize"}},h):null,t.default.createElement("select",a({onFocus:function(){v("#212121")},onBlur:function(){v("#cccccc")},id:g,style:n(n({},w),y)},d),s.map((function(r,n){return t.default.createElement("option",{key:"select_".concat(e.name,"_").concat(n,"_").concat(r.value),value:r.value},r.label)}))))};M.propTypes={name:F.string.isRequired,label:F.string,showLabel:F.bool,withGroup:F.bool,options:F.arrayOf(F.exact({label:F.any,value:F.any}))},M.defaultProps={name:"selectfield1",showLabel:!0,withGroup:!0};var W=["inline","showLabel","withGroup","options","selectedValues","style"],G=function(e){var r=e.inline,o=void 0===r||r,i=e.showLabel,c=void 0===i||i,u=e.withGroup,f=void 0===u||u,s=e.options,p=void 0===s?[]:s,y=e.selectedValues,d=void 0===y?[]:y,m=e.style,b=void 0===m?{}:m,v=l(e,W),h=e.label||e.name,g={fontFamily:"inherit",fontSize:"inherit",lineHeight:"inherit",margin:0,fontWeight:400,display:"block",width:"100%",padding:"5px 10px",boxSizing:"border-box",border:"1.5px solid #ccc",WebkitTransition:"0.5s",transition:"0.5s",outline:"none",backgroundColor:"transparent"};return t.default.createElement("div",{style:{marginBottom:f?".85rem":0,fontFamily:"inherit",fontSize:"0.95rem"}},c?t.default.createElement("label",{style:{display:"block",padding:"0.2rem 0",fontWeight:500,textTransform:"capitalize"}},h):null,t.default.createElement("div",{style:{display:"flex",flexFlow:"".concat(o?"row":"column"," wrap")}},p.map((function(r,o){var i="checkbox_id_".concat(e.name,"_").concat(o,"_").concat(r.value);return t.default.createElement("div",{key:i,style:{margin:4,display:"inline-flex",flexFlow:"row wrap",alignItems:"center"}},t.default.createElement("input",a({id:i,value:r.value,type:"checkbox",defaultChecked:d&&d.includes(r.value),style:n(n({},g),{},{width:"1.5rem",height:"1.5rem",position:"relative"},b)},v)),t.default.createElement("label",{style:{marginLeft:"0.25rem",marginRight:"0.75rem",textTransform:"capitalize"},htmlFor:i},r.label))}))))};G.propTypes={inline:F.bool,name:F.string.isRequired,label:F.string,showLabel:F.bool,withGroup:F.bool,options:F.arrayOf(F.exact({label:F.any,value:F.any})),selectedValues:F.array},G.defaultProps={inline:!0,name:"checkboxfield1",showLabel:!0,withGroup:!0};var q=["inline","showLabel","withGroup","options","selectedValue","style"],B=function(e){var r=e.inline,o=void 0===r||r,i=e.showLabel,c=void 0===i||i,u=e.withGroup,f=void 0===u||u,s=e.options,p=void 0===s?[]:s,y=e.selectedValue,d=e.style,m=void 0===d?{}:d,b=l(e,q),v=e.label||e.name,h={fontFamily:"inherit",fontSize:"inherit",lineHeight:"inherit",margin:0,fontWeight:400,display:"block",width:"100%",padding:"5px 10px",boxSizing:"border-box",border:"1.5px solid #ccc",WebkitTransition:"0.5s",transition:"0.5s",outline:"none",backgroundColor:"transparent"};return t.default.createElement("div",{style:{marginBottom:f?".85rem":0,fontFamily:"inherit",fontSize:"0.95rem"}},c?t.default.createElement("label",{style:{display:"block",padding:"0.2rem 0",fontWeight:500,textTransform:"capitalize"}},v):null,t.default.createElement("div",{style:{display:"flex",flexFlow:"".concat(o?"row":"column"," wrap")}},p.map((function(r,o){var i="radio_id_".concat(e.name,"_").concat(o,"_").concat(r.value);return t.default.createElement("div",{key:i,style:{margin:4,display:"inline-flex",flexFlow:"row wrap",alignItems:"center"}},t.default.createElement("input",a({id:i,value:r.value,type:"radio",defaultChecked:String(y)===String(r.value),style:n(n({},h),{},{width:"1.5rem",height:"1.5rem",position:"relative"},m)},b)),t.default.createElement("label",{style:{marginLeft:"0.25rem",marginRight:"0.75rem",textTransform:"capitalize"},htmlFor:i},r.label))}))))};B.propTypes={inline:F.bool,name:F.string.isRequired,label:F.string,showLabel:F.bool,withGroup:F.bool,options:F.arrayOf(F.exact({label:F.any,value:F.any})),selectedValue:F.any},B.defaultProps={inline:!0,name:"radiofield1",showLabel:!0,withGroup:!0},exports.Checkbox=G,exports.Input=L,exports.Radio=B,exports.Select=M,exports.default=z;