UNPKG

@j4jinxx/form

Version:

Minimal Form & Input React Component

15 lines (14 loc) 24.3 kB
import e from"react";function t(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 r(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?t(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function n(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 o(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(){return i=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},i.apply(this,arguments)}function a(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,c=[],l=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return l(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 l(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 l(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 u(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var s,f={exports:{}},p={exports:{}},y={};var d,m,b,v,h,g,w,O,S,x,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 m||(m=1,"production"===process.env.NODE_ENV?p.exports=function(){if(s)return y;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,c=e?Symbol.for("react.context"):60110,l=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,d=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 O(e){if("object"==typeof e&&null!==e){var s=e.$$typeof;switch(s){case t:switch(e=e.type){case l:case u:case n:case i:case o:case p:return e;default:switch(e=e&&e.$$typeof){case c:case f:case b:case m:case a:return e;default:return s}}case r:return s}}}function S(e){return O(e)===u}return y.AsyncMode=l,y.ConcurrentMode=u,y.ContextConsumer=c,y.ContextProvider=a,y.Element=t,y.ForwardRef=f,y.Fragment=n,y.Lazy=b,y.Memo=m,y.Portal=r,y.Profiler=i,y.StrictMode=o,y.Suspense=p,y.isAsyncMode=function(e){return S(e)||O(e)===l},y.isConcurrentMode=S,y.isContextConsumer=function(e){return O(e)===c},y.isContextProvider=function(e){return O(e)===a},y.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},y.isForwardRef=function(e){return O(e)===f},y.isFragment=function(e){return O(e)===n},y.isLazy=function(e){return O(e)===b},y.isMemo=function(e){return O(e)===m},y.isPortal=function(e){return O(e)===r},y.isProfiler=function(e){return O(e)===i},y.isStrictMode=function(e){return O(e)===o},y.isSuspense=function(e){return O(e)===p},y.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===n||e===u||e===i||e===o||e===p||e===d||"object"==typeof e&&null!==e&&(e.$$typeof===b||e.$$typeof===m||e.$$typeof===a||e.$$typeof===c||e.$$typeof===f||e.$$typeof===h||e.$$typeof===g||e.$$typeof===w||e.$$typeof===v)},y.typeOf=O,y}():p.exports=(d||(d=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,c=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,s=e?Symbol.for("react.forward_ref"):60112,f=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 l:case u:case n:case i:case o:case f:return m;default:var b=m&&m.$$typeof;switch(b){case c:case s:case d:case y:case a:return b;default:return p}}case r:return p}}}var w=l,O=u,S=c,x=a,E=t,j=s,P=n,T=d,$=y,_=r,I=i,C=o,N=f,F=!1;function R(e){return g(e)===u}k.AsyncMode=w,k.ConcurrentMode=O,k.ContextConsumer=S,k.ContextProvider=x,k.Element=E,k.ForwardRef=j,k.Fragment=P,k.Lazy=T,k.Memo=$,k.Portal=_,k.Profiler=I,k.StrictMode=C,k.Suspense=N,k.isAsyncMode=function(e){return F||(F=!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.")),R(e)||g(e)===l},k.isConcurrentMode=R,k.isContextConsumer=function(e){return g(e)===c},k.isContextProvider=function(e){return g(e)===a},k.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},k.isForwardRef=function(e){return g(e)===s},k.isFragment=function(e){return g(e)===n},k.isLazy=function(e){return g(e)===d},k.isMemo=function(e){return g(e)===y},k.isPortal=function(e){return g(e)===r},k.isProfiler=function(e){return g(e)===i},k.isStrictMode=function(e){return g(e)===o},k.isSuspense=function(e){return g(e)===f},k.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===n||e===u||e===i||e===o||e===f||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===d||e.$$typeof===y||e.$$typeof===a||e.$$typeof===c||e.$$typeof===s||e.$$typeof===b||e.$$typeof===v||e.$$typeof===h||e.$$typeof===m)},k.typeOf=g}()),k)),p.exports} /* object-assign (c) Sindre Sorhus @license MIT */function _(){if(v)return b;v=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;return b=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,c=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(n),l=1;l<arguments.length;l++){for(var u in i=Object(arguments[l]))t.call(i,u)&&(c[u]=i[u]);if(e){a=e(i);for(var s=0;s<a.length;s++)r.call(i,a[s])&&(c[a[s]]=i[a[s]])}}return c},b}function I(){if(g)return h;g=1;return h="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function C(){return O?w:(O=1,w=Function.call.bind(Object.prototype.hasOwnProperty))}if("production"!==process.env.NODE_ENV){var N=$();f.exports=function(){if(j)return E;j=1;var e=$(),t=_(),r=I(),n=C(),o=function(){if(x)return S;x=1;var e=function(){};if("production"!==process.env.NODE_ENV){var t=I(),r={},n=C();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,c,l){if("production"!==process.env.NODE_ENV)for(var u in o)if(n(o,u)){var s;try{if("function"!=typeof o[u]){var f=Error((c||"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 f.name="Invariant Violation",f}s=o[u](i,u,c,a,null,t)}catch(e){s=e}if(!s||s instanceof Error||e((c||"React class")+": type specification of "+a+" `"+u+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof s+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),s instanceof Error&&!(s.message in r)){r[s.message]=!0;var p=l?l():"";e("Failed "+a+" type: "+s.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){}}),E=function(c,l){var u="function"==typeof Symbol&&Symbol.iterator,s="@@iterator",f="<<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 c=t[n];if(!Array.isArray(c))return new d("Invalid "+i+" `"+a+"` of type `"+g(c)+"` supplied to `"+o+"`, expected an array.");for(var l=0;l<c.length;l++){var u=e(c,l,o,i,a+"["+l+"]",r);if(u instanceof Error)return u}return null}))},element:m((function(e,t,r,n,o){var i=e[t];return c(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||f;return new d("Invalid "+o+" `"+i+"` of type `"+((c=t[r]).constructor&&c.constructor.name?c.constructor.name:f)+"` supplied to `"+n+"`, expected instance of `"+a+"`.")}var c;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,c){if("function"!=typeof e)return new d("Property `"+c+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var l=t[o],u=g(l);if("object"!==u)return new d("Invalid "+a+" `"+c+"` of type `"+u+"` supplied to `"+i+"`, expected an object.");for(var s in l)if(n(l,s)){var f=e(l,s,i,a,c+"."+s,r);if(f instanceof Error)return f}return null}))},oneOf:function(e){return Array.isArray(e)?m((function(t,r,n,o,i){for(var a=t[r],c=0;c<e.length;c++)if(y(a,e[c]))return null;var l=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 "+l+".")})):("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 "+O(o)+" at index "+t+"."),a}return m((function(t,o,i,a,c){for(var l=[],u=0;u<e.length;u++){var s=(0,e[u])(t,o,i,a,c,r);if(null==s)return null;s.data&&n(s.data,"expectedType")&&l.push(s.data.expectedType)}return new d("Invalid "+a+" `"+c+"` supplied to `"+i+"`"+(l.length>0?", expected one of type ["+l.join(", ")+"]":"")+".")}))},shape:function(e){return m((function(t,n,o,i,a){var c=t[n],l=g(c);if("object"!==l)return new d("Invalid "+i+" `"+a+"` of type `"+l+"` supplied to `"+o+"`, expected `object`.");for(var u in e){var s=e[u];if("function"!=typeof s)return v(o,i,a,u,w(s));var f=s(c,u,o,i,a+"."+u,r);if(f)return f}return null}))},exact:function(e){return m((function(o,i,a,c,l){var u=o[i],s=g(u);if("object"!==s)return new d("Invalid "+c+" `"+l+"` of type `"+s+"` supplied to `"+a+"`, expected `object`.");var f=t({},o[i],e);for(var p in f){var y=e[p];if(n(e,p)&&"function"!=typeof y)return v(a,c,l,p,w(y));if(!y)return new d("Invalid "+c+" `"+l+"` 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,c,l+"."+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,c,u,s,p,y){if(u=u||f,p=p||c,y!==r){if(l){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+":"+c;!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[c]?o?null===a[c]?new d("The "+s+" `"+p+"` is marked as required in `"+u+"`, but its value is `null`."):new d("The "+s+" `"+p+"` is marked as required in `"+u+"`, but its value is `undefined`."):null:e(a,c,u,s,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 c=t[r];return g(c)!==e?new d("Invalid "+o+" `"+i+"` of type `"+w(c)+"` 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||c(e))return!0;var t=function(e){var t=e&&(u&&e[u]||e[s]);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 O(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},E}()(N.isElement,!0)}else f.exports=function(){if(T)return P;T=1;var e=I();function t(){}function r(){}return r.resetWarningCache=t,P=function(){function n(t,r,n,o,i,a){if(a!==e){var c=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 c.name="Invariant Violation",c}}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=u(f.exports),R=["onDone","children","onSubmit"],V=function(t){var r=e.useRef(null),n=t.onDone,o=void 0===n?function(){}:n,c=t.children;t.onSubmit;var l=a(t,R);return e.createElement("form",i({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},l),c)};V.propTypes={onDone:F.func,children:F.node},V.defaultProps={onDone:function(){}};var z=["showLabel","withGroup","style"],A=function(t){var n=t.showLabel,o=void 0===n||n,l=t.withGroup,u=void 0===l||l,s=t.style,f=void 0===s?{}:s,p=a(t,z),y=t.label||t.name,d=t.type||"text",m="".concat(d,"_id_").concat(t.name),b=c(e.useState("#cccccc"),2),v=b[0],h=b[1],g=function(){h("#212121")},w=function(){h("#cccccc")},O={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 e.createElement("div",{style:{marginBottom:u?".85rem":0,fontFamily:"inherit",fontSize:"0.95rem"}},o?e.createElement("label",{htmlFor:m,style:{display:"block",padding:"0.2rem 0",fontWeight:500,textTransform:"capitalize"}},y):null,"textarea"===d?e.createElement("textarea",i({onFocus:g,onBlur:w,id:m,placeholder:y,style:r(r({},O),f)},p)):e.createElement("input",i({onFocus:g,onBlur:w,type:d,id:m,style:r(r({},O),{},{overflow:"visible"},f)},p)))};A.propTypes={name:F.string.isRequired,type:F.string,label:F.string,showLabel:F.bool,withGroup:F.bool},A.defaultProps={type:"text",name:"field1",showLabel:!0,withGroup:!0};var L=["showLabel","withGroup","options","style"],D=function(t){var n=t.showLabel,o=void 0===n||n,l=t.withGroup,u=void 0===l||l,s=t.options,f=void 0===s?[]:s,p=t.style,y=void 0===p?{}:p,d=a(t,L),m=c(e.useState("#cccccc"),2),b=m[0],v=m[1],h=t.label||t.name,g="select_id_".concat(t.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 e.createElement("div",{style:{marginBottom:u?".85rem":0,fontFamily:"inherit",fontSize:"0.95rem"}},o?e.createElement("label",{htmlFor:g,style:{display:"block",padding:"0.2rem 0",fontWeight:500,textTransform:"capitalize"}},h):null,e.createElement("select",i({onFocus:function(){v("#212121")},onBlur:function(){v("#cccccc")},id:g,style:r(r({},w),y)},d),f.map((function(r,n){return e.createElement("option",{key:"select_".concat(t.name,"_").concat(n,"_").concat(r.value),value:r.value},r.label)}))))};D.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}))},D.defaultProps={name:"selectfield1",showLabel:!0,withGroup:!0};var M=["inline","showLabel","withGroup","options","selectedValues","style"],W=function(t){var n=t.inline,o=void 0===n||n,c=t.showLabel,l=void 0===c||c,u=t.withGroup,s=void 0===u||u,f=t.options,p=void 0===f?[]:f,y=t.selectedValues,d=void 0===y?[]:y,m=t.style,b=void 0===m?{}:m,v=a(t,M),h=t.label||t.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 e.createElement("div",{style:{marginBottom:s?".85rem":0,fontFamily:"inherit",fontSize:"0.95rem"}},l?e.createElement("label",{style:{display:"block",padding:"0.2rem 0",fontWeight:500,textTransform:"capitalize"}},h):null,e.createElement("div",{style:{display:"flex",flexFlow:"".concat(o?"row":"column"," wrap")}},p.map((function(n,o){var a="checkbox_id_".concat(t.name,"_").concat(o,"_").concat(n.value);return e.createElement("div",{key:a,style:{margin:4,display:"inline-flex",flexFlow:"row wrap",alignItems:"center"}},e.createElement("input",i({id:a,value:n.value,type:"checkbox",defaultChecked:d&&d.includes(n.value),style:r(r({},g),{},{width:"1.5rem",height:"1.5rem",position:"relative"},b)},v)),e.createElement("label",{style:{marginLeft:"0.25rem",marginRight:"0.75rem",textTransform:"capitalize"},htmlFor:a},n.label))}))))};W.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},W.defaultProps={inline:!0,name:"checkboxfield1",showLabel:!0,withGroup:!0};var G=["inline","showLabel","withGroup","options","selectedValue","style"],q=function(t){var n=t.inline,o=void 0===n||n,c=t.showLabel,l=void 0===c||c,u=t.withGroup,s=void 0===u||u,f=t.options,p=void 0===f?[]:f,y=t.selectedValue,d=t.style,m=void 0===d?{}:d,b=a(t,G),v=t.label||t.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 e.createElement("div",{style:{marginBottom:s?".85rem":0,fontFamily:"inherit",fontSize:"0.95rem"}},l?e.createElement("label",{style:{display:"block",padding:"0.2rem 0",fontWeight:500,textTransform:"capitalize"}},v):null,e.createElement("div",{style:{display:"flex",flexFlow:"".concat(o?"row":"column"," wrap")}},p.map((function(n,o){var a="radio_id_".concat(t.name,"_").concat(o,"_").concat(n.value);return e.createElement("div",{key:a,style:{margin:4,display:"inline-flex",flexFlow:"row wrap",alignItems:"center"}},e.createElement("input",i({id:a,value:n.value,type:"radio",defaultChecked:String(y)===String(n.value),style:r(r({},h),{},{width:"1.5rem",height:"1.5rem",position:"relative"},m)},b)),e.createElement("label",{style:{marginLeft:"0.25rem",marginRight:"0.75rem",textTransform:"capitalize"},htmlFor:a},n.label))}))))};q.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},q.defaultProps={inline:!0,name:"radiofield1",showLabel:!0,withGroup:!0};export{W as Checkbox,A as Input,q as Radio,D as Select,V as default};