UNPKG

@aiui/ai-form

Version:
10 lines (9 loc) 22.8 kB
import e from"react";function t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function r(){return(r=Object.assign||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}).apply(this,arguments)}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?n(Object(o),!0).forEach((function(r){t(e,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function i(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 a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==r)return;var n,o,i=[],a=!0,l=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,o=e}finally{try{a||null==r.return||r.return()}finally{if(l)throw o}}return i}(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 c(e){var t={exports:{}};return e(t,t.exports),t.exports /** @license React v16.13.1 * react-is.production.min.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. */}var u="function"==typeof Symbol&&Symbol.for,s=u?Symbol.for("react.element"):60103,f=u?Symbol.for("react.portal"):60106,p=u?Symbol.for("react.fragment"):60107,y=u?Symbol.for("react.strict_mode"):60108,d=u?Symbol.for("react.profiler"):60114,m=u?Symbol.for("react.provider"):60109,b=u?Symbol.for("react.context"):60110,v=u?Symbol.for("react.async_mode"):60111,h=u?Symbol.for("react.concurrent_mode"):60111,g=u?Symbol.for("react.forward_ref"):60112,w=u?Symbol.for("react.suspense"):60113,O=u?Symbol.for("react.suspense_list"):60120,S=u?Symbol.for("react.memo"):60115,x=u?Symbol.for("react.lazy"):60116,E=u?Symbol.for("react.block"):60121,j=u?Symbol.for("react.fundamental"):60117,P=u?Symbol.for("react.responder"):60118,k=u?Symbol.for("react.scope"):60119;function T(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case s:switch(e=e.type){case v:case h:case p:case d:case y:case w:return e;default:switch(e=e&&e.$$typeof){case b:case g:case x:case S:case m:return e;default:return t}}case f:return t}}}function $(e){return T(e)===h}var _={AsyncMode:v,ConcurrentMode:h,ContextConsumer:b,ContextProvider:m,Element:s,ForwardRef:g,Fragment:p,Lazy:x,Memo:S,Portal:f,Profiler:d,StrictMode:y,Suspense:w,isAsyncMode:function(e){return $(e)||T(e)===v},isConcurrentMode:$,isContextConsumer:function(e){return T(e)===b},isContextProvider:function(e){return T(e)===m},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===s},isForwardRef:function(e){return T(e)===g},isFragment:function(e){return T(e)===p},isLazy:function(e){return T(e)===x},isMemo:function(e){return T(e)===S},isPortal:function(e){return T(e)===f},isProfiler:function(e){return T(e)===d},isStrictMode:function(e){return T(e)===y},isSuspense:function(e){return T(e)===w},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===p||e===h||e===d||e===y||e===w||e===O||"object"==typeof e&&null!==e&&(e.$$typeof===x||e.$$typeof===S||e.$$typeof===m||e.$$typeof===b||e.$$typeof===g||e.$$typeof===j||e.$$typeof===P||e.$$typeof===k||e.$$typeof===E)},typeOf:T},I=c((function(e,t){"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,r=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,o=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,l=e?Symbol.for("react.provider"):60109,c=e?Symbol.for("react.context"):60110,u=e?Symbol.for("react.async_mode"):60111,s=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,d=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,b=e?Symbol.for("react.block"):60121,v=e?Symbol.for("react.fundamental"):60117,h=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function w(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:var y=e.type;switch(y){case u:case s:case o:case a:case i:case p:return y;default:var b=y&&y.$$typeof;switch(b){case c:case f:case m:case d:case l:return b;default:return t}}case n:return t}}}var O=u,S=s,x=c,E=l,j=r,P=f,k=o,T=m,$=d,_=n,I=a,C=i,F=p,N=!1;function R(e){return w(e)===s}t.AsyncMode=O,t.ConcurrentMode=S,t.ContextConsumer=x,t.ContextProvider=E,t.Element=j,t.ForwardRef=P,t.Fragment=k,t.Lazy=T,t.Memo=$,t.Portal=_,t.Profiler=I,t.StrictMode=C,t.Suspense=F,t.isAsyncMode=function(e){return N||(N=!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)||w(e)===u},t.isConcurrentMode=R,t.isContextConsumer=function(e){return w(e)===c},t.isContextProvider=function(e){return w(e)===l},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return w(e)===f},t.isFragment=function(e){return w(e)===o},t.isLazy=function(e){return w(e)===m},t.isMemo=function(e){return w(e)===d},t.isPortal=function(e){return w(e)===n},t.isProfiler=function(e){return w(e)===a},t.isStrictMode=function(e){return w(e)===i},t.isSuspense=function(e){return w(e)===p},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===s||e===a||e===i||e===p||e===y||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===d||e.$$typeof===l||e.$$typeof===c||e.$$typeof===f||e.$$typeof===v||e.$$typeof===h||e.$$typeof===g||e.$$typeof===b)},t.typeOf=w}()})),C=c((function(e){"production"===process.env.NODE_ENV?e.exports=_:e.exports=I})),F=Object.getOwnPropertySymbols,N=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable;function V(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var z=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(e,t){for(var r,n,o=V(e),i=1;i<arguments.length;i++){for(var a in r=Object(arguments[i]))N.call(r,a)&&(o[a]=r[a]);if(F){n=F(r);for(var l=0;l<n.length;l++)R.call(r,n[l])&&(o[n[l]]=r[n[l]])}}return o},A="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",L=function(){};if("production"!==process.env.NODE_ENV){var D=A,W={},M=Function.call.bind(Object.prototype.hasOwnProperty);L=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function G(e,t,r,n,o){if("production"!==process.env.NODE_ENV)for(var i in e)if(M(e,i)){var a;try{if("function"!=typeof e[i]){var l=Error((n||"React class")+": "+r+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.");throw l.name="Invariant Violation",l}a=e[i](t,i,n,r,null,D)}catch(e){a=e}if(!a||a instanceof Error||L((n||"React class")+": type specification of "+r+" `"+i+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof a+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),a instanceof Error&&!(a.message in W)){W[a.message]=!0;var c=o?o():"";L("Failed "+r+" type: "+a.message+(null!=c?c:""))}}}G.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(W={})};var q=G,B=Function.call.bind(Object.prototype.hasOwnProperty),H=function(){};function U(){return null}"production"!==process.env.NODE_ENV&&(H=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}});var Y=function(e,t){var r="function"==typeof Symbol&&Symbol.iterator;var n="<<anonymous>>",o={array:c("array"),bool:c("boolean"),func:c("function"),number:c("number"),object:c("object"),string:c("string"),symbol:c("symbol"),any:l(U),arrayOf:function(e){return l((function(t,r,n,o,i){if("function"!=typeof e)return new a("Property `"+i+"` of component `"+n+"` has invalid PropType notation inside arrayOf.");var l=t[r];if(!Array.isArray(l))return new a("Invalid "+o+" `"+i+"` of type `"+s(l)+"` supplied to `"+n+"`, expected an array.");for(var c=0;c<l.length;c++){var u=e(l,c,n,o,i+"["+c+"]",A);if(u instanceof Error)return u}return null}))},element:l((function(t,r,n,o,i){var l=t[r];return e(l)?null:new a("Invalid "+o+" `"+i+"` of type `"+s(l)+"` supplied to `"+n+"`, expected a single ReactElement.")})),elementType:l((function(e,t,r,n,o){var i=e[t];return C.isValidElementType(i)?null:new a("Invalid "+n+" `"+o+"` of type `"+s(i)+"` supplied to `"+r+"`, expected a single ReactElement type.")})),instanceOf:function(e){return l((function(t,r,o,i,l){if(!(t[r]instanceof e)){var c=e.name||n;return new a("Invalid "+i+" `"+l+"` of type `"+(((u=t[r]).constructor&&u.constructor.name?u.constructor.name:n)+"` supplied to `")+o+"`, expected instance of `"+c+"`.")}var u;return null}))},node:l((function(e,t,r,n,o){return u(e[t])?null:new a("Invalid "+n+" `"+o+"` supplied to `"+r+"`, expected a ReactNode.")})),objectOf:function(e){return l((function(t,r,n,o,i){if("function"!=typeof e)return new a("Property `"+i+"` of component `"+n+"` has invalid PropType notation inside objectOf.");var l=t[r],c=s(l);if("object"!==c)return new a("Invalid "+o+" `"+i+"` of type `"+c+"` supplied to `"+n+"`, expected an object.");for(var u in l)if(B(l,u)){var f=e(l,u,n,o,i+"."+u,A);if(f instanceof Error)return f}return null}))},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&H(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."),U;function t(t,r,n,o,l){for(var c=t[r],u=0;u<e.length;u++)if(i(c,e[u]))return null;var s=JSON.stringify(e,(function(e,t){return"symbol"===f(t)?String(t):t}));return new a("Invalid "+o+" `"+l+"` of value `"+String(c)+"` supplied to `"+n+"`, expected one of "+s+".")}return l(t)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&H("Invalid argument supplied to oneOfType, expected an instance of array."),U;for(var t=0;t<e.length;t++){var r=e[t];if("function"!=typeof r)return H("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+p(r)+" at index "+t+"."),U}return l((function(t,r,n,o,i){for(var l=0;l<e.length;l++)if(null==(0,e[l])(t,r,n,o,i,A))return null;return new a("Invalid "+o+" `"+i+"` supplied to `"+n+"`.")}))},shape:function(e){return l((function(t,r,n,o,i){var l=t[r],c=s(l);if("object"!==c)return new a("Invalid "+o+" `"+i+"` of type `"+c+"` supplied to `"+n+"`, expected `object`.");for(var u in e){var f=e[u];if(f){var p=f(l,u,n,o,i+"."+u,A);if(p)return p}}return null}))},exact:function(e){return l((function(t,r,n,o,i){var l=t[r],c=s(l);if("object"!==c)return new a("Invalid "+o+" `"+i+"` of type `"+c+"` supplied to `"+n+"`, expected `object`.");var u=z({},t[r],e);for(var f in u){var p=e[f];if(!p)return new a("Invalid "+o+" `"+i+"` key `"+f+"` supplied to `"+n+"`.\nBad object: "+JSON.stringify(t[r],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var y=p(l,f,n,o,i+"."+f,A);if(y)return y}return null}))}};function i(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function a(e){this.message=e,this.stack=""}function l(e){if("production"!==process.env.NODE_ENV)var r={},o=0;function i(i,l,c,u,s,f,p){if(u=u||n,f=f||c,p!==A){if(t){var y=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 y.name="Invariant Violation",y}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var d=u+":"+c;!r[d]&&o<3&&(H("You are manually calling a React.PropTypes validation function for the `"+f+"` 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."),r[d]=!0,o++)}}return null==l[c]?i?null===l[c]?new a("The "+s+" `"+f+"` is marked as required in `"+u+"`, but its value is `null`."):new a("The "+s+" `"+f+"` is marked as required in `"+u+"`, but its value is `undefined`."):null:e(l,c,u,s,f)}var l=i.bind(null,!1);return l.isRequired=i.bind(null,!0),l}function c(e){return l((function(t,r,n,o,i,l){var c=t[r];return s(c)!==e?new a("Invalid "+o+" `"+i+"` of type `"+f(c)+"` supplied to `"+n+"`, expected `"+e+"`."):null}))}function u(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(u);if(null===t||e(t))return!0;var n=function(e){var t=e&&(r&&e[r]||e["@@iterator"]);if("function"==typeof t)return t}(t);if(!n)return!1;var o,i=n.call(t);if(n!==t.entries){for(;!(o=i.next()).done;)if(!u(o.value))return!1}else for(;!(o=i.next()).done;){var a=o.value;if(a&&!u(a[1]))return!1}return!0;default:return!1}}function s(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 f(e){if(null==e)return""+e;var t=s(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function p(e){var t=f(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return a.prototype=Error.prototype,o.checkPropTypes=q,o.resetWarningCache=q.resetWarningCache,o.PropTypes=o,o};function J(){}function K(){}K.resetWarningCache=J;var Q=c((function(e){if("production"!==process.env.NODE_ENV){var t=C;e.exports=Y(t.isElement,!0)}else e.exports=function(){function e(e,t,r,n,o,i){if(i!==A){var a=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 a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:K,resetWarningCache:J};return r.PropTypes=r,r}()})),X=function(t){var n=e.useRef(null),o=t.onDone,a=void 0===o?function(){}:o,l=t.children;t.onSubmit;var c=i(t,["onDone","children","onSubmit"]);return e.createElement("form",r({ref:n,onSubmit:function(e){e.preventDefault();var t=n.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)&&a(t)},noValidate:!0},c),l)};X.propTypes={onDone:Q.func,children:Q.node},X.defaultProps={onDone:function(){}};var Z=function(t){var n=t.showLabel,l=void 0===n||n,c=t.withGroup,u=void 0===c||c,s=t.style,f=void 0===s?{}:s,p=i(t,["showLabel","withGroup","style"]),y=t.label||t.name,d=t.type||"text",m="".concat(d,"_id_").concat(t.name),b=a(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"}},l?e.createElement("label",{htmlFor:m,style:{display:"block",padding:"0.2rem 0",fontWeight:500,textTransform:"capitalize"}},y):null,"textarea"===d?e.createElement("textarea",r({onFocus:g,onBlur:w,id:m,placeholder:y,style:o(o({},O),f)},p)):e.createElement("input",r({onFocus:g,onBlur:w,type:d,id:m,style:o(o({},O),{},{overflow:"visible"},f)},p)))};Z.propTypes={name:Q.string.isRequired,type:Q.string,label:Q.string,showLabel:Q.bool,withGroup:Q.bool},Z.defaultProps={type:"text",name:"field1",showLabel:!0,withGroup:!0};var ee=function(t){var n=t.showLabel,l=void 0===n||n,c=t.withGroup,u=void 0===c||c,s=t.options,f=void 0===s?[]:s,p=t.style,y=void 0===p?{}:p,d=i(t,["showLabel","withGroup","options","style"]),m=a(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"}},l?e.createElement("label",{htmlFor:g,style:{display:"block",padding:"0.2rem 0",fontWeight:500,textTransform:"capitalize"}},h):null,e.createElement("select",r({onFocus:function(){v("#212121")},onBlur:function(){v("#cccccc")},id:g,style:o(o({},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)}))))};ee.propTypes={name:Q.string.isRequired,label:Q.string,showLabel:Q.bool,withGroup:Q.bool,options:Q.arrayOf(Q.exact({label:Q.any,value:Q.any}))},ee.defaultProps={name:"selectfield1",showLabel:!0,withGroup:!0};var te=function(t){var n=t.inline,a=void 0===n||n,l=t.showLabel,c=void 0===l||l,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=i(t,["inline","showLabel","withGroup","options","selectedValues","style"]),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"}},c?e.createElement("label",{style:{display:"block",padding:"0.2rem 0",fontWeight:500,textTransform:"capitalize"}},h):null,e.createElement("div",{style:{display:"flex",flexFlow:"".concat(a?"row":"column"," wrap")}},p.map((function(n,i){var a="checkbox_id_".concat(t.name,"_").concat(i,"_").concat(n.value);return e.createElement("div",{key:a,style:{margin:4,display:"inline-flex",flexFlow:"row wrap",alignItems:"center"}},e.createElement("input",r({id:a,value:n.value,type:"checkbox",defaultChecked:d&&d.includes(n.value),style:o(o({},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))}))))};te.propTypes={inline:Q.bool,name:Q.string.isRequired,label:Q.string,showLabel:Q.bool,withGroup:Q.bool,options:Q.arrayOf(Q.exact({label:Q.any,value:Q.any})),selectedValues:Q.array},te.defaultProps={inline:!0,name:"checkboxfield1",showLabel:!0,withGroup:!0};var re=function(t){var n=t.inline,a=void 0===n||n,l=t.showLabel,c=void 0===l||l,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=i(t,["inline","showLabel","withGroup","options","selectedValue","style"]),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"}},c?e.createElement("label",{style:{display:"block",padding:"0.2rem 0",fontWeight:500,textTransform:"capitalize"}},v):null,e.createElement("div",{style:{display:"flex",flexFlow:"".concat(a?"row":"column"," wrap")}},p.map((function(n,i){var a="radio_id_".concat(t.name,"_").concat(i,"_").concat(n.value);return e.createElement("div",{key:a,style:{margin:4,display:"inline-flex",flexFlow:"row wrap",alignItems:"center"}},e.createElement("input",r({id:a,value:n.value,type:"radio",defaultChecked:String(y)===String(n.value),style:o(o({},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))}))))};re.propTypes={inline:Q.bool,name:Q.string.isRequired,label:Q.string,showLabel:Q.bool,withGroup:Q.bool,options:Q.arrayOf(Q.exact({label:Q.any,value:Q.any})),selectedValue:Q.any},re.defaultProps={inline:!0,name:"radiofield1",showLabel:!0,withGroup:!0};export default X;export{te as AiCheckbox,Z as AiInput,re as AiRadio,ee as AiSelect};