From 6742f6f2885a49b620696a19354300024f25fad9 Mon Sep 17 00:00:00 2001 From: edwardxiao Date: Thu, 17 Sep 2020 18:13:37 +0800 Subject: [PATCH] - Bugfix for `````` ```async customFunc``` when updating unmounted component problem. --- example/index.js | 3 + lib/components/index.js | 2 +- lib/react-inputs-validation.js | 2 +- lib/react-inputs-validation.js.map | 2 +- lib/react-inputs-validation.min.js | 2 +- lib/react-inputs-validation.min.js.map | 2 +- package.json | 2 +- src/js/Inputs/Textbox.tsx | 267 ++++++++++++------------- 8 files changed, 138 insertions(+), 144 deletions(-) diff --git a/example/index.js b/example/index.js index e7cfa5c..86bee2d 100644 --- a/example/index.js +++ b/example/index.js @@ -587,6 +587,9 @@ class Index extends Component { name: 'Name', // Optional.[String].Default: "". To display in the Error message. i.e Please enter your {name}. check: true, // Optional.[Bool].Default: true. To determin if you need to validate. required: true, // Optional.[Bool].Default: true. To determin if it is a required field. + customFunc: (v) =>{ + return '' + } }} />
diff --git a/lib/components/index.js b/lib/components/index.js index 8ccf5f7..4424de9 100644 --- a/lib/components/index.js +++ b/lib/components/index.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports["react-inputs-validation"]=t(require("react")):e["react-inputs-validation"]=t(e.react)}(this,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=6)}([function(t,n){t.exports=e},function(e,t,n){"use strict";var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(0)),i=o.useEffect,a=o.useRef;t.LOCALE_OPTION_LIST=["en-US","zh-CN"],t.REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE="Invalid window.REACT_INPUTS_VALIDATION['customErrorMessage']. EXAMPLE: window.REACT_INPUTS_VALIDATION={customErrorMessage:{'en-US':{textbox:{empty:function empty(name){return getEnglishName(name)+'cannot be empty'},invalid:function invalid(name){return getEnglishName(name)+'invalid format'},invalidFormat:function invalidFormat(name){return getEnglishName(name)+'is not a number'},inBetween:function inBetween(name){return function(min){return function(max){return getEnglishName(name)+'must be '+min+'-'+max}}},lessThan:function lessThan(name){return function(min){return getEnglishName(name)+'cannot less than '+min}},greaterThan:function greaterThan(name){return function(max){return getEnglishName(name)+'cannot greater than '+max}},lengthEqual:function lengthEqual(name){return function(length){return getEnglishName(name)+'length must be '+length}},twoInputsNotEqual:function twoInputsNotEqual(){return'two inputs are not equal'}},radiobox:{empty:function empty(name){return'Please choose one '+getEnglishName(name)}},checkbox:{unchecked:function unchecked(name){return getEnglishName(name)+'must be checked'}},select:{empty:function empty(name){return'Please select a '+getEnglishName(name)}},textarea:{empty:function empty(name){return getEnglishName(name)+'cannot be empty'},invalid:function invalid(name){return getEnglishName(name)+'invalid format'},invalidFormat:function invalidFormat(name){return getEnglishName(name)+'is not a number'},inBetween:function inBetween(name){return function(min){return function(max){return getEnglishName(name)+'must be '+min+'-'+max}}},lessThan:function lessThan(name){return function(min){return getEnglishName(name)+'cannot less than '+min}},greaterThan:function greaterThan(name){return function(max){return getEnglishName(name)+'cannot greater than '+max}},lengthEqual:function lengthEqual(name){return function(length){return getEnglishName(name)+'length must be '+length}},twoInputsNotEqual:function twoInputsNotEqual(){return'two inputs are not equal'}}}}};",t.DEFAULT_LOCALE="en-US",t.WRAPPER_CLASS_IDENTITIFIER="react-inputs-validation__wrapper_identifier",t.CONTAINER_CLASS_IDENTITIFIER="react-inputs-validation__container_identifier",t.OPTION_LIST_ITEM_IDENTITIFIER="react-inputs-validation__option-list-item_identifier",t.MSG_CLASS_IDENTITIFIER="react-inputs-validation__msg_identifier",t.usePrevious=function(e){var t=a();return i((function(){t.current=e})),t.current}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=function(e){var t="";return e&&(t=e+" "),t},i={"zh-CN":{textbox:{empty:function(e){return e+"不能为空"},invalid:function(e){return e+"格式有误"},invalidFormat:function(e){return e+"不是数字"},inBetween:function(e){return function(t){return function(n){return e+"必须在"+t+"-"+n+"之间"}}},lessThan:function(e){return function(t){return e+"不可少于"+t}},greaterThan:function(e){return function(t){return e+"不可大于"+t}},lengthEqual:function(e){return function(t){return e+"长度必须为"+t}},twoInputsNotEqual:function(){return"两次输入不一致"}},radiobox:{empty:function(e){return"必须勾选一个"+e}},checkbox:{unchecked:function(e){return e+"必须勾选"}},select:{empty:function(e){return"请选择一个"+e}},textarea:{empty:function(e){return e+"不能为空"},invalid:function(e){return e+"格式有误"},invalidFormat:function(e){return e+"不是数字"},inBetween:function(e){return function(t){return function(n){return e+"必须在"+t+"-"+n+"之间"}}},lessThan:function(e){return function(t){return e+"不可少于"+t}},greaterThan:function(e){return function(t){return e+"不可大于"+t}},lengthEqual:function(e){return function(t){return e+"长度必须为"+t}},twoInputsNotEqual:function(){return"两次输入不一致"}}},"en-US":{textbox:{empty:function(e){return o(e)+"cannot be empty"},invalid:function(e){return o(e)+"invalid format"},invalidFormat:function(e){return o(e)+"is not a number"},inBetween:function(e){return function(t){return function(n){return o(e)+"must be "+t+"-"+n}}},lessThan:function(e){return function(t){return o(e)+"cannot less than "+t}},greaterThan:function(e){return function(t){return o(e)+"cannot greater than "+t}},lengthEqual:function(e){return function(t){return o(e)+"length must be "+t}},twoInputsNotEqual:function(){return"two inputs are not equal"}},radiobox:{empty:function(e){return"Please choose one "+o(e)}},checkbox:{unchecked:function(e){return o(e)+"must be checked"}},select:{empty:function(e){return"Please select a "+o(e)}},textarea:{empty:function(e){return o(e)+"cannot be empty"},invalid:function(e){return o(e)+"invalid format"},invalidFormat:function(e){return o(e)+"is not a number"},inBetween:function(e){return function(t){return function(n){return o(e)+"must be "+t+"-"+n}}},lessThan:function(e){return function(t){return o(e)+"cannot less than "+t}},greaterThan:function(e){return function(t){return o(e)+"cannot greater than "+t}},lengthEqual:function(e){return function(t){return o(e)+"length must be "+t}},twoInputsNotEqual:function(){return"two inputs are not equal"}}}};t.getCustomErrorMessage=function(e,t){return e&&"object"==typeof e&&e.constructor===Object&&Object.keys(e).length?(Object.keys(e).map((function(n){t[n]?Object.keys(e[n]).length&&Object.keys(e[n]).map((function(r){Object.keys(e[n][r]).length&&Object.keys(e[n][r]).map((function(o){t[n][r][o]=e[n][r][o]}))})):t[n]=e[n]})),t):(console.error(r.REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE),!1)},t.handleCustomErrorMessage=function(e,n){var r;return void 0!==n&&n.REACT_INPUTS_VALIDATION&&n.REACT_INPUTS_VALIDATION.customErrorMessage&&(r=t.getCustomErrorMessage(n.REACT_INPUTS_VALIDATION.customErrorMessage,e)),void 0===r||!1===r?e:r},"undefined"!=typeof window&&(window.REACT_INPUTS_VALIDATION=window.REACT_INPUTS_VALIDATION||{},i=t.handleCustomErrorMessage(i,window)),t.default=i},function(e,t,n){e.exports={ellipsis:"react-inputs-validation__ellipsis___3-Api",textbox__wrapper:"react-inputs-validation__textbox__wrapper___3tnXv",disabled:"react-inputs-validation__disabled___1-57g",textbox__input:"react-inputs-validation__textbox__input___20hDL",error:"react-inputs-validation__error___2aXSp",success:"react-inputs-validation__success___3TpwE",msg:"react-inputs-validation__msg___pxv8o",textarea__wrapper:"react-inputs-validation__textarea__wrapper___35GhF",textarea__input:"react-inputs-validation__textarea__input___1CFm_",radiobox__wrapper:"react-inputs-validation__radiobox__wrapper___1zZ30",radiobox__container:"react-inputs-validation__radiobox__container___FD4vb",radiobox__input:"react-inputs-validation__radiobox__input___2uX2-",radiobox__label:"react-inputs-validation__radiobox__label___2tQsB",checked:"react-inputs-validation__checked___2O0Ju",button:"react-inputs-validation__button___9JBRL",radiobox__item:"react-inputs-validation__radiobox__item___ejuz1",checkbox__wrapper:"react-inputs-validation__checkbox__wrapper___1c1rD",checkbox__input:"react-inputs-validation__checkbox__input___1yF4X",checkbox__container:"react-inputs-validation__checkbox__container___3I1rX",checkbox__box:"react-inputs-validation__checkbox__box___1uj8A",box:"react-inputs-validation__box___3E9nu",select__wrapper:"react-inputs-validation__select__wrapper___1B4OH",select__input:"react-inputs-validation__select__input___3h-P7",select__container:"react-inputs-validation__select__container___3jgUR",select__button:"react-inputs-validation__select__button___vEDoq","select__options-item":"react-inputs-validation__select__options-item___30yY4","select__options-item-show-cursor":"react-inputs-validation__select__options-item-show-cursor___1ZT3b",select__searchInputWrapper:"react-inputs-validation__select__searchInputWrapper___3R5P_",select__searchInputSearchIcon:"react-inputs-validation__select__searchInputSearchIcon___1Q8xX",select__searchInputRemoveIcon:"react-inputs-validation__select__searchInputRemoveIcon___1A1tR",select__searchInput:"react-inputs-validation__select__searchInput___1lN24","select__no-mouse":"react-inputs-validation__select__no-mouse___2uRg6","select__hover-active":"react-inputs-validation__select__hover-active___2z1MQ",active:"react-inputs-validation__active___3eZBB","select__options-container-animate":"react-inputs-validation__select__options-container-animate___2Rm--",show:"react-inputs-validation__show___2NI3u","select__options-container":"react-inputs-validation__select__options-container___d54qE",select__dropdown:"react-inputs-validation__select__dropdown___11yDr","select__dropdown-icon":"react-inputs-validation__select__dropdown-icon___1T5r2","select__dropdown-name":"react-inputs-validation__select__dropdown-name___3hghL",showArrow:"react-inputs-validation__showArrow___3puk1","select__dropdown-icon-container":"react-inputs-validation__select__dropdown-icon-container___2ild-"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){return e.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g,(function(e,t){return 0==+e?"":0===t?e.toLowerCase():e.toUpperCase()}))},o={camelize:r,toCamelCase:function(e){return function(t){void 0===t&&(t=!1);var n=r(e);return t?n.substr(0,1).toUpperCase()+n.substr(1,n.length):n}},getRandomId:function(){return Math.random().toString(36).slice(-8)},getAlphanumeric:function(e){var t="";return String(e).split("").forEach((function(e){var n=e.toLowerCase().charCodeAt(0);(n>=48&&n<=57||n>=97&&n<=122)&&(t+=e)})),t},getAlpha:function(e){var t="";return String(e).split("").forEach((function(e){var n=e.toLowerCase().charCodeAt(0);n>=97&&n<=122&&(t+=e)})),t},getNumeric:function(e){var t="";return String(e).split("").forEach((function(e){var n=e.toLowerCase().charCodeAt(0);n>=48&&n<=57&&(t+=e)})),t},arraysEqual:function(e,t){if(e.length!==t.length)return!1;for(var n=e.length;n-=1;)if(JSON.stringify(e[n])!==JSON.stringify(t[n]))return!1;return!0}};t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},o={reg:function(e,t){var n=!0;return e.test(t)&&(n=!1),n},empty:function(e){return!e.replace(/\s/g,"").length},number:function(e,t,n){return null===t&&null===n||!!r(e)&&!(en)}};t.default=o},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(7));t.Textbox=o.default;var i=r(n(8));t.Textarea=i.default;var a=r(n(9));t.Select=a.default;var u=r(n(10));t.Checkbox=u.default;var s=r(n(11));t.Radiobox=s.default},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]Number(I.maxLength))){var n=ye.type,r=ye.numberType,o=ye.mantissa;n===b[1]&&(t=String(function(e,t,n){var r="",o=!1,i=String(e).split("");i[0];if(t===y[2]&&"0"===i[0]&&"0"===i[1]&&i.shift(),i.forEach((function(e){var n=e.toLowerCase().charCodeAt(0);if(n>=48&&n<=57||46===n&&!o){if(46===n){if(t===y[1])return;o=!0}r+=e}})),o&&n>=0){var a=r.split(".");0===n?r=a[0]:(a[1]=a[1].slice(0,n),r=a.join("."))}return t!==y[0]&&t!==y[2]||r.length&&"."===r[0]&&(r="0"+r),r}(t,y.indexOf(r)>=0?r:y[0],o))),n===b[2]&&(t=p.default.getAlphanumeric(t)),n===b[3]&&(t=p.default.getAlpha(t)),Ee(t),Q&&Q(t,e),le?ce(!1):pe("")}}}),[le,I,ye]),Me=d((function(){return o(void 0,void 0,void 0,(function(){var e,t,n,r,o,a,u,s,l,c,d,f,_,g,y,S;return i(this,(function(i){switch(i.label){case 0:if(e=ye.reg,t=ye.min,n=ye.max,r=ye.type,o=ye.name,a=ye.check,u=ye.length,s=ye.regMsg,l=ye.locale,c=ye.compare,d=ye.required,f=ye.msgOnSuccess,_=ye.customFunc,!a)return[2];if(!r)return[3,5];if(-1===b.indexOf(r))return[3,3];if(!v.default[l]||!v.default[l][E])return console.error(h.REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE),[2];if(g=v.default[l][E],y=o||"",d&&m.default.empty(ge))return Ae(!0,g.empty(y)),[2];if(""!==String(ge)){if(e&&m.default.reg(e,ge))return Ae(!0,""!==s?s:g.invalid(y)),[2];if(r===b[0]){if(t||n)if(t&&n){if(String(ge).lengthn)return Ae(!0,g.inBetween(y)(t)(n)),[2]}else{if(t&&String(ge).lengthn)return Ae(!0,g.greaterThan(y)(n)),[2]}if(u&&String(ge).length!==u)return Ae(!0,g.lengthEqual(y)(u)),[2]}if(r===b[1]){if(!m.default[r](ge,null,null))return Ae(!0,g.invalid(y)),[2];if(t||n)if(t&&n){if(!m.default[r](ge,t,n))return Ae(!0,g.inBetween(y)(t)(n)),[2]}else{if(t&&!m.default[r](ge,t))return Ae(!0,g.lessThan(y)(t)),[2];if(n&&!m.default[r](ge,0,n))return Ae(!0,g.greaterThan(y)(n)),[2]}if(u&&String(ge).length!==u)return Ae(!0,g.lengthEqual(y)(u)),[2]}if(c&&""!==c&&ge!==c)return Ae(!0,g.twoInputsNotEqual()),[2]}return _&&"function"==typeof _?[4,_(ge)]:[3,2];case 1:if("object"==typeof(S=i.sent()))return"boolean"==typeof S.error&&"string"==typeof S.message&&(!1===S.error&&!0===S.showOnSuccess&&pe(S.message),Ae(S.error,S.message,!0)),[2];if(!0!==S)return Ae(!0,S,!0),[2];i.label=2;case 2:return f&&pe(f),Ae(!1,f),[3,4];case 3:console.error("The valid "+p.default.toCamelCase(E)(!0)+' "type" options in validationOption are ['+b.map((function(e){return e}))+"]"),i.label=4;case 4:return[3,6];case 5:console.error('Please provide "type" in validationOption'),i.label=6;case 6:return[2]}}))}))}),[ge,ye]),Ae=d((function(e,t,n){void 0===n&&(n=!1);var r=t,o=ye.msgOnError;e&&o&&!n&&(r=o),ce(e),_e(r),ue&&ue(e)}),[ye.msgOnError]);c((function(){k&&Me()}),[k]),c((function(){Ee(String(T))}),[T]),c((function(){void 0!==be&&be!==ge&&ye.customFunc&&ie&&Me()}),[ge]),c((function(){Se&&Se.message&&(Se.showOnError&&Ae(Se.error,Se.message),!Se.error&&Se.showOnSuccess&&pe(Se.message))}),[J]);var Le,ke=D+" "+g.default[E+"__wrapper"]+" "+(le&&g.default.error)+" "+(""!==me&&!le&&g.default.success)+" "+(A&&g.default.disabled),Re=q+" "+g.default[E+"__container"]+" "+(le&&g.default.error)+" "+(""!==me&&!le&&g.default.success)+" "+(A&&g.default.disabled),Pe=P+" "+g.default[E+"__input"]+" "+(le&&g.default.error)+" "+(""!==me&&!le&&g.default.success)+" "+(A&&g.default.disabled),Fe=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(le&&g.default.error),De=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(!le&&g.default.success),je=ye.showMsg;return je&&le&&fe&&(Le=s.createElement("div",{className:Fe},fe)),je&&!le&&""!==me&&(Le=s.createElement("div",{className:De},me)),s.createElement("div",r({className:ke,style:W},w),s.createElement("div",{className:Re,style:z},s.createElement("input",r({type:"text",value:ge,disabled:A,onBlur:Ie,onKeyUp:Ce,onFocus:Ne,onClick:Te,className:Pe,onChange:xe,style:B,ref:we},I)),x&&I.id&&s.createElement("label",{htmlFor:I.id},x)),Le)}))},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]Number(O.maxLength)||(pe(t),K&&K(t,e),ae?ue(!1):_e(""))}}),[ae]),Te=d((function(){return o(void 0,void 0,void 0,(function(){var e,t,n,r,o,a,u,s,l,c,d,f,_,g,y;return i(this,(function(i){switch(i.label){case 0:if(e=ge.reg,t=ge.min,n=ge.max,r=ge.type,o=ge.name,a=ge.check,u=ge.length,s=ge.regMsg,l=ge.locale,c=ge.required,d=ge.msgOnSuccess,f=ge.customFunc,!a)return[2];if(!r)return[3,5];if(-1===b.indexOf(r))return[3,3];if(!v.default[l]||!v.default[l][E])return console.error(h.REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE),[2];if(_=v.default[l][E],g=o||"",c&&m.default.empty(me))return Ce(!0,_.empty(g)),[2];if(""!==String(me)){if(e&&m.default.reg(e,me))return Ce(!0,""!==s?s:_.invalid(g)),[2];if(t||n)if(t&&n){if(String(me).lengthn)return Ce(!0,_.inBetween(g)(t)(n)),[2]}else{if(t&&String(me).lengthn)return Ce(!0,_.greaterThan(g)(n)),[2]}if(u&&String(me).length!==u)return Ce(!0,_.lengthEqual(g)(u)),[2]}return f&&"function"==typeof f?[4,f(me)]:[3,2];case 1:if("object"==typeof(y=i.sent()))return"boolean"==typeof y.error&&"string"==typeof y.message&&(!1===y.error&&!0===y.showOnSuccess&&_e(y.message),Ce(y.error,y.message,!0)),[2];if(!0!==y)return Ce(!0,y,!0),[2];i.label=2;case 2:return d&&_e(d),Ce(!1,d),[3,4];case 3:console.error("The valid "+p.default.toCamelCase(E)(!0)+' "type" options in validationOption are ['+b.map((function(e){return e}))+"]"),i.label=4;case 4:return[3,6];case 5:console.error('Please provide "type" in validationOption'),i.label=6;case 6:return[2]}}))}))}),[me,ge]),Ce=d((function(e,t,n){void 0===n&&(n=!1);var r=t,o=ge.msgOnError;e&&o&&!n&&(r=o),ue(e),ce(r),oe&&oe(e)}),[ge.msgOnError]);c((function(){M&&Te()}),[M]),c((function(){pe(String(N))}),[N]),c((function(){void 0!==he&&he!==me&&ge.customFunc&&ne&&Te()}),[me]),c((function(){Ee&&Ee.message&&(Ee.showOnError&&Ce(Ee.error,Ee.message),!Ee.error&&Ee.showOnSuccess&&_e(Ee.message))}),[X]);var xe,Me=R+" "+g.default[E+"__wrapper"]+" "+(ae&&g.default.error)+" "+(""!==fe&&!ae&&g.default.success)+" "+(C&&g.default.disabled),Ae=F+" "+g.default[E+"__container"]+" "+(ae&&g.default.error)+" "+(""!==fe&&!ae&&g.default.success)+" "+(C&&g.default.disabled),Le=L+" "+g.default[E+"__input"]+" "+(ae&&g.default.error)+" "+(""!==fe&&!ae&&g.default.success)+" "+(C&&g.default.disabled),ke=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(ae&&g.default.error),Re=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(!ae&&g.default.success),Pe=ge.showMsg;return Pe&&ae&&le&&(xe=s.createElement("div",{className:ke},le)),Pe&&!ae&&""!==fe&&(xe=s.createElement("div",{className:Re},fe)),s.createElement("div",r({className:Me,style:U},S),s.createElement("div",{className:Ae,style:V},s.createElement("textarea",r({value:me,disabled:C,onBlur:Se,onKeyUp:Ie,onFocus:we,onClick:Oe,className:Le,onChange:Ne,style:j,ref:be},O))),xe)}))},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=a){var u=Math.abs(i-a-o);u>=0&&!y?(it.current.scrollTop=r+o-u,y=!0):it.current.scrollTop=r+o}}"up"===e&&(y=!1,S*o<=r&&(it.current.scrollTop=S*o))}else y=!1,it.current.scrollTop=S*o}}),[]),bt=c((function(e,t){_t(e,t),De[1]("")}),[]),yt=c((function(e){S=e,Ot()}),[]),St=c((function(){Xe(!1)}),[]),wt=c((function(){It()}),[]),Ot=c((function(){if(et&&et.current&&et.current.children){var e=et.current.children;if(It(),null===S)return;S>=e.length&&(S=0),S<0&&(S=e.length-1),e[S]&&(e[S].className+=" "+h.default[g+"__hover-active"])}}),[]),It=c((function(){if(et&&et.current&&et.current.children)for(var e=et.current.children,t=0;tut.length-1&&(S=0,Et("up")),Ot();else if(38===e)(S-=1)<0&&(S=ut.length-1,Et("loop")),Ot();else if(13===e&&S>-1&&et&&et.current&&et.current.children){var t=et.current.children;if(!t[S])return;t[S].click()}}),[ut]),Ct=c((function(e){if(!F&&(Xe(!0),e.preventDefault&&e.preventDefault(),Be)){S=null===S?t.getIndex(ut,String(M)):S;var n=e.keyCode,r=Nt(n);if(-1!==E.indexOf(n))Tt(n);else{gt();var i=o(Ke,[n]),a=String.fromCharCode.apply(String,i).toLowerCase(),u=-1;ut.forEach((function(e,t){e.name.toLowerCase().startsWith(a)&&-1===u&&(u=t)})),-1!==u&&(S=u,Ot()),Je(i)}return Et(r),S}}),[Be,M,Ke]);l((function(){return Be&&ot&&document.addEventListener("keydown",Ct),function(){document.removeEventListener("keydown",Ct)}}),[Be,M,Ke]),l((function(){R&&vt()}),[R]),l((function(){t.isValidValue(ut,Pe)&&""!==Pe&&"null"!==Pe&&"undefined"!==Pe?Te(!1):ke("")}),[Pe]),l((function(){Fe(String(M))}),[M]),l((function(){qe&&qe&&!p.default.arraysEqual(qe,V)&&Fe(String(V[0].id))}),[V]),l((function(){void 0!==je&&je!==Pe&&vt()}),[je,Pe]),l((function(){Qe&&Qe.message&&(Qe.showOnError&&mt(Qe.error,Qe.message),!Qe.error&&Qe.showOnSuccess&&ke(Qe.message))}),[ve]),l((function(){Be&&(F&&nt.current.focus(),S=null===S?t.getIndex(ut,String(M)):S,at[S]&&at[S].current.focus()),!0===We&&!1===Be&&rt.current.focus(),ht()}),[Be]);var xt,Mt,At=m.WRAPPER_CLASS_IDENTITIFIER+" "+G+" "+h.default.select__wrapper+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Lt=m.CONTAINER_CLASS_IDENTITIFIER+" "+X+" "+h.default.select__container+" "+(Ne&&h.default.error)+" "+(Be&&h.default.show)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),kt=h.default.select__input+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Rt=K+" "+h.default.ellipsis+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Pt=Y+" "+h.default[g+"__options-container"]+" "+(Ne&&h.default.error)+" "+(Be&&h.default.show)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Ft=h.default.button+" "+(!ze&&h.default[g+"__options-item-show-cursor"])+" "+Z+" "+h.default[g+"__options-item"]+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Dt=ee+" "+h.default[g+"__dropdown-icon"]+" "+(j&&h.default.showArrow),jt=m.MSG_CLASS_IDENTITIFIER+" "+h.default.msg+" "+(Ne&&h.default.error),qt=m.MSG_CLASS_IDENTITIFIER+" "+h.default.msg+" "+(!Ne&&h.default.success),Ut=Ze.showMsg;Ut&&Ne&&xe&&(xt=u.createElement("div",{className:jt},xe)),Ut&&!Ne&&""!==Le&&(xt=u.createElement("div",{className:qt},Le));var Bt=t.getItem(V,String(M));ut.length?Mt=ut.map((function(e,n){return u.createElement(t.Option,{key:n,index:n,id:"react-inputs-validation__select_option-"+e.id,className:String(e.id)===String(M)?Ft+" "+h.default.active:""+Ft,item:e,customStyleOptionListItem:se,onClick:bt,onMouseOver:yt,onMouseMove:St,onMouseOut:wt})})):F&&(Mt=u.createElement("div",{style:{background:"#fff",textAlign:"center",padding:"20px"}},u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},u.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),u.createElement("path",{fill:"#cdcdcd",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12zm8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8z"}))));var Vt=u.createElement("div",{className:h.default.select__dropdown},u.createElement("div",{className:h.default[g+"__dropdown-name"]+" "+h.default.ellipsis},Bt?Bt.name:""),u.createElement("div",{className:Dt}));return u.createElement("button",r({ref:Ye,type:"button",className:h.default.button,onClick:function(e){if(ft(e),!L){if(tt.current&&tt.current.contains(e.target))return void Ve(!0);Ve(!Be)}},onFocus:dt,onBlur:ct},N),u.createElement("div",{ref:$e,className:At,style:ne},u.createElement("div",{className:Lt,style:oe},u.createElement("input",r({type:"hidden",value:Pe,className:kt,onChange:function(){}},C)),u.createElement("div",{className:Rt,style:ae},Vt),u.createElement("div",{className:Pt},F&&u.createElement("div",{ref:tt},u.createElement("div",{className:h.default.select__searchInputWrapper},u.createElement("svg",{className:h.default.select__searchInputSearchIcon,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},u.createElement("path",{fill:"#cdcdcd",d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),u.createElement("path",{d:"M0 0h24v24H0z",fill:"none"})),u.createElement("input",{className:h.default.select__searchInput,ref:nt,value:De[0],onChange:st,onKeyDown:lt}),De[0]&&u.createElement("svg",{className:h.default.select__searchInputRemoveIcon,xmlns:"http://www.w3.org/2000/svg",width:"15",height:"15",viewBox:"0 0 24 24",onClick:function(){De[1](""),nt.current.focus()}},u.createElement("path",{fill:"#cdcdcd",d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}),u.createElement("path",{d:"M0 0h24v24H0z",fill:"none"})))),u.createElement("div",{ref:et,style:ce},Mt))),xt))}))},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=48&&n<=57||n>=97&&n<=122)&&(t+=e)})),t},getAlpha:function(e){var t="";return String(e).split("").forEach((function(e){var n=e.toLowerCase().charCodeAt(0);n>=97&&n<=122&&(t+=e)})),t},getNumeric:function(e){var t="";return String(e).split("").forEach((function(e){var n=e.toLowerCase().charCodeAt(0);n>=48&&n<=57&&(t+=e)})),t},arraysEqual:function(e,t){if(e.length!==t.length)return!1;for(var n=e.length;n-=1;)if(JSON.stringify(e[n])!==JSON.stringify(t[n]))return!1;return!0}};t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},o={reg:function(e,t){var n=!0;return e.test(t)&&(n=!1),n},empty:function(e){return!e.replace(/\s/g,"").length},number:function(e,t,n){return null===t&&null===n||!!r(e)&&!(en)}};t.default=o},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(7));t.Textbox=o.default;var i=r(n(8));t.Textarea=i.default;var a=r(n(9));t.Select=a.default;var u=r(n(10));t.Checkbox=u.default;var s=r(n(11));t.Radiobox=s.default},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]Number(I.maxLength))){var n=ye.type,r=ye.numberType,o=ye.mantissa;n===b[1]&&(t=String(function(e,t,n){var r="",o=!1,i=String(e).split("");i[0];if(t===y[2]&&"0"===i[0]&&"0"===i[1]&&i.shift(),i.forEach((function(e){var n=e.toLowerCase().charCodeAt(0);if(n>=48&&n<=57||46===n&&!o){if(46===n){if(t===y[1])return;o=!0}r+=e}})),o&&n>=0){var a=r.split(".");0===n?r=a[0]:(a[1]=a[1].slice(0,n),r=a.join("."))}return t!==y[0]&&t!==y[2]||r.length&&"."===r[0]&&(r="0"+r),r}(t,y.indexOf(r)>=0?r:y[0],o))),n===b[2]&&(t=p.default.getAlphanumeric(t)),n===b[3]&&(t=p.default.getAlpha(t)),Ee(t),Q&&Q(t,e),le?ce(!1):pe("")}}}),[le,I,ye]),Me=d((function(){return o(void 0,void 0,void 0,(function(){var e,t,n,r,o,a,u,s,l,c,d,f,_,g,y,S;return i(this,(function(i){switch(i.label){case 0:if(e=ye.reg,t=ye.min,n=ye.max,r=ye.type,o=ye.name,a=ye.check,u=ye.length,s=ye.regMsg,l=ye.locale,c=ye.compare,d=ye.required,f=ye.msgOnSuccess,_=ye.customFunc,!a)return[2];if(!r)return[3,5];if(-1===b.indexOf(r))return[3,3];if(!v.default[l]||!v.default[l][E])return console.error(h.REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE),[2];if(g=v.default[l][E],y=o||"",d&&m.default.empty(ge))return Ae(!0,g.empty(y)),[2];if(""!==String(ge)){if(e&&m.default.reg(e,ge))return Ae(!0,""!==s?s:g.invalid(y)),[2];if(r===b[0]){if(t||n)if(t&&n){if(String(ge).lengthn)return Ae(!0,g.inBetween(y)(t)(n)),[2]}else{if(t&&String(ge).lengthn)return Ae(!0,g.greaterThan(y)(n)),[2]}if(u&&String(ge).length!==u)return Ae(!0,g.lengthEqual(y)(u)),[2]}if(r===b[1]){if(!m.default[r](ge,null,null))return Ae(!0,g.invalid(y)),[2];if(t||n)if(t&&n){if(!m.default[r](ge,t,n))return Ae(!0,g.inBetween(y)(t)(n)),[2]}else{if(t&&!m.default[r](ge,t))return Ae(!0,g.lessThan(y)(t)),[2];if(n&&!m.default[r](ge,0,n))return Ae(!0,g.greaterThan(y)(n)),[2]}if(u&&String(ge).length!==u)return Ae(!0,g.lengthEqual(y)(u)),[2]}if(c&&""!==c&&ge!==c)return Ae(!0,g.twoInputsNotEqual()),[2]}return _&&"function"==typeof _?[4,_(ge)]:[3,2];case 1:if(S=i.sent(),!we||!we.current)return[2];if("object"==typeof S)return"boolean"==typeof S.error&&"string"==typeof S.message&&(!1===S.error&&!0===S.showOnSuccess&&pe(S.message),Ae(S.error,S.message,!0)),[2];if(!0!==S)return Ae(!0,S,!0),[2];i.label=2;case 2:return f&&pe(f),Ae(!1,f),[3,4];case 3:console.error("The valid "+p.default.toCamelCase(E)(!0)+' "type" options in validationOption are ['+b.map((function(e){return e}))+"]"),i.label=4;case 4:return[3,6];case 5:console.error('Please provide "type" in validationOption'),i.label=6;case 6:return[2]}}))}))}),[ge,ye]),Ae=d((function(e,t,n){void 0===n&&(n=!1);var r=t,o=ye.msgOnError;e&&o&&!n&&(r=o),ce(e),_e(r),ue&&ue(e)}),[ye.msgOnError]);c((function(){k&&Me()}),[k]),c((function(){Ee(String(T))}),[T]),c((function(){void 0!==be&&be!==ge&&ye.customFunc&&ie&&Me()}),[ge]),c((function(){Se&&Se.message&&(Se.showOnError&&Ae(Se.error,Se.message),!Se.error&&Se.showOnSuccess&&pe(Se.message))}),[J]);var Le,ke=D+" "+g.default[E+"__wrapper"]+" "+(le&&g.default.error)+" "+(""!==me&&!le&&g.default.success)+" "+(A&&g.default.disabled),Re=q+" "+g.default[E+"__container"]+" "+(le&&g.default.error)+" "+(""!==me&&!le&&g.default.success)+" "+(A&&g.default.disabled),Pe=P+" "+g.default[E+"__input"]+" "+(le&&g.default.error)+" "+(""!==me&&!le&&g.default.success)+" "+(A&&g.default.disabled),Fe=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(le&&g.default.error),De=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(!le&&g.default.success),je=ye.showMsg;return je&&le&&fe&&(Le=s.createElement("div",{className:Fe},fe)),je&&!le&&""!==me&&(Le=s.createElement("div",{className:De},me)),s.createElement("div",r({className:ke,style:W},w),s.createElement("div",{className:Re,style:z},s.createElement("input",r({type:"text",value:ge,disabled:A,onBlur:Ie,onKeyUp:Ce,onFocus:Ne,onClick:Te,className:Pe,onChange:xe,style:B,ref:we},I)),x&&I.id&&s.createElement("label",{htmlFor:I.id},x)),Le)}))},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]Number(O.maxLength)||(pe(t),K&&K(t,e),ae?ue(!1):_e(""))}}),[ae]),Te=d((function(){return o(void 0,void 0,void 0,(function(){var e,t,n,r,o,a,u,s,l,c,d,f,_,g,y;return i(this,(function(i){switch(i.label){case 0:if(e=ge.reg,t=ge.min,n=ge.max,r=ge.type,o=ge.name,a=ge.check,u=ge.length,s=ge.regMsg,l=ge.locale,c=ge.required,d=ge.msgOnSuccess,f=ge.customFunc,!a)return[2];if(!r)return[3,5];if(-1===b.indexOf(r))return[3,3];if(!v.default[l]||!v.default[l][E])return console.error(h.REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE),[2];if(_=v.default[l][E],g=o||"",c&&m.default.empty(me))return Ce(!0,_.empty(g)),[2];if(""!==String(me)){if(e&&m.default.reg(e,me))return Ce(!0,""!==s?s:_.invalid(g)),[2];if(t||n)if(t&&n){if(String(me).lengthn)return Ce(!0,_.inBetween(g)(t)(n)),[2]}else{if(t&&String(me).lengthn)return Ce(!0,_.greaterThan(g)(n)),[2]}if(u&&String(me).length!==u)return Ce(!0,_.lengthEqual(g)(u)),[2]}return f&&"function"==typeof f?[4,f(me)]:[3,2];case 1:if("object"==typeof(y=i.sent()))return"boolean"==typeof y.error&&"string"==typeof y.message&&(!1===y.error&&!0===y.showOnSuccess&&_e(y.message),Ce(y.error,y.message,!0)),[2];if(!0!==y)return Ce(!0,y,!0),[2];i.label=2;case 2:return d&&_e(d),Ce(!1,d),[3,4];case 3:console.error("The valid "+p.default.toCamelCase(E)(!0)+' "type" options in validationOption are ['+b.map((function(e){return e}))+"]"),i.label=4;case 4:return[3,6];case 5:console.error('Please provide "type" in validationOption'),i.label=6;case 6:return[2]}}))}))}),[me,ge]),Ce=d((function(e,t,n){void 0===n&&(n=!1);var r=t,o=ge.msgOnError;e&&o&&!n&&(r=o),ue(e),ce(r),oe&&oe(e)}),[ge.msgOnError]);c((function(){M&&Te()}),[M]),c((function(){pe(String(N))}),[N]),c((function(){void 0!==he&&he!==me&&ge.customFunc&&ne&&Te()}),[me]),c((function(){Ee&&Ee.message&&(Ee.showOnError&&Ce(Ee.error,Ee.message),!Ee.error&&Ee.showOnSuccess&&_e(Ee.message))}),[X]);var xe,Me=R+" "+g.default[E+"__wrapper"]+" "+(ae&&g.default.error)+" "+(""!==fe&&!ae&&g.default.success)+" "+(C&&g.default.disabled),Ae=F+" "+g.default[E+"__container"]+" "+(ae&&g.default.error)+" "+(""!==fe&&!ae&&g.default.success)+" "+(C&&g.default.disabled),Le=L+" "+g.default[E+"__input"]+" "+(ae&&g.default.error)+" "+(""!==fe&&!ae&&g.default.success)+" "+(C&&g.default.disabled),ke=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(ae&&g.default.error),Re=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(!ae&&g.default.success),Pe=ge.showMsg;return Pe&&ae&&le&&(xe=s.createElement("div",{className:ke},le)),Pe&&!ae&&""!==fe&&(xe=s.createElement("div",{className:Re},fe)),s.createElement("div",r({className:Me,style:U},S),s.createElement("div",{className:Ae,style:V},s.createElement("textarea",r({value:me,disabled:C,onBlur:Se,onKeyUp:Ie,onFocus:we,onClick:Oe,className:Le,onChange:Ne,style:j,ref:be},O))),xe)}))},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=a){var u=Math.abs(i-a-o);u>=0&&!y?(it.current.scrollTop=r+o-u,y=!0):it.current.scrollTop=r+o}}"up"===e&&(y=!1,S*o<=r&&(it.current.scrollTop=S*o))}else y=!1,it.current.scrollTop=S*o}}),[]),bt=c((function(e,t){_t(e,t),De[1]("")}),[]),yt=c((function(e){S=e,Ot()}),[]),St=c((function(){Xe(!1)}),[]),wt=c((function(){It()}),[]),Ot=c((function(){if(et&&et.current&&et.current.children){var e=et.current.children;if(It(),null===S)return;S>=e.length&&(S=0),S<0&&(S=e.length-1),e[S]&&(e[S].className+=" "+h.default[g+"__hover-active"])}}),[]),It=c((function(){if(et&&et.current&&et.current.children)for(var e=et.current.children,t=0;tut.length-1&&(S=0,Et("up")),Ot();else if(38===e)(S-=1)<0&&(S=ut.length-1,Et("loop")),Ot();else if(13===e&&S>-1&&et&&et.current&&et.current.children){var t=et.current.children;if(!t[S])return;t[S].click()}}),[ut]),Ct=c((function(e){if(!F&&(Xe(!0),e.preventDefault&&e.preventDefault(),Be)){S=null===S?t.getIndex(ut,String(M)):S;var n=e.keyCode,r=Nt(n);if(-1!==E.indexOf(n))Tt(n);else{gt();var i=o(Ke,[n]),a=String.fromCharCode.apply(String,i).toLowerCase(),u=-1;ut.forEach((function(e,t){e.name.toLowerCase().startsWith(a)&&-1===u&&(u=t)})),-1!==u&&(S=u,Ot()),Je(i)}return Et(r),S}}),[Be,M,Ke]);l((function(){return Be&&ot&&document.addEventListener("keydown",Ct),function(){document.removeEventListener("keydown",Ct)}}),[Be,M,Ke]),l((function(){R&&vt()}),[R]),l((function(){t.isValidValue(ut,Pe)&&""!==Pe&&"null"!==Pe&&"undefined"!==Pe?Te(!1):ke("")}),[Pe]),l((function(){Fe(String(M))}),[M]),l((function(){qe&&qe&&!p.default.arraysEqual(qe,V)&&Fe(String(V[0].id))}),[V]),l((function(){void 0!==je&&je!==Pe&&vt()}),[je,Pe]),l((function(){Qe&&Qe.message&&(Qe.showOnError&&mt(Qe.error,Qe.message),!Qe.error&&Qe.showOnSuccess&&ke(Qe.message))}),[ve]),l((function(){Be&&(F&&nt.current.focus(),S=null===S?t.getIndex(ut,String(M)):S,at[S]&&at[S].current.focus()),!0===We&&!1===Be&&rt.current.focus(),ht()}),[Be]);var xt,Mt,At=m.WRAPPER_CLASS_IDENTITIFIER+" "+G+" "+h.default.select__wrapper+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Lt=m.CONTAINER_CLASS_IDENTITIFIER+" "+X+" "+h.default.select__container+" "+(Ne&&h.default.error)+" "+(Be&&h.default.show)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),kt=h.default.select__input+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Rt=K+" "+h.default.ellipsis+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Pt=Y+" "+h.default[g+"__options-container"]+" "+(Ne&&h.default.error)+" "+(Be&&h.default.show)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Ft=h.default.button+" "+(!ze&&h.default[g+"__options-item-show-cursor"])+" "+Z+" "+h.default[g+"__options-item"]+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Dt=ee+" "+h.default[g+"__dropdown-icon"]+" "+(j&&h.default.showArrow),jt=m.MSG_CLASS_IDENTITIFIER+" "+h.default.msg+" "+(Ne&&h.default.error),qt=m.MSG_CLASS_IDENTITIFIER+" "+h.default.msg+" "+(!Ne&&h.default.success),Ut=Ze.showMsg;Ut&&Ne&&xe&&(xt=u.createElement("div",{className:jt},xe)),Ut&&!Ne&&""!==Le&&(xt=u.createElement("div",{className:qt},Le));var Bt=t.getItem(V,String(M));ut.length?Mt=ut.map((function(e,n){return u.createElement(t.Option,{key:n,index:n,id:"react-inputs-validation__select_option-"+e.id,className:String(e.id)===String(M)?Ft+" "+h.default.active:""+Ft,item:e,customStyleOptionListItem:se,onClick:bt,onMouseOver:yt,onMouseMove:St,onMouseOut:wt})})):F&&(Mt=u.createElement("div",{style:{background:"#fff",textAlign:"center",padding:"20px"}},u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},u.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),u.createElement("path",{fill:"#cdcdcd",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12zm8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8z"}))));var Vt=u.createElement("div",{className:h.default.select__dropdown},u.createElement("div",{className:h.default[g+"__dropdown-name"]+" "+h.default.ellipsis},Bt?Bt.name:""),u.createElement("div",{className:Dt}));return u.createElement("button",r({ref:Ye,type:"button",className:h.default.button,onClick:function(e){if(ft(e),!L){if(tt.current&&tt.current.contains(e.target))return void Ve(!0);Ve(!Be)}},onFocus:dt,onBlur:ct},N),u.createElement("div",{ref:$e,className:At,style:ne},u.createElement("div",{className:Lt,style:oe},u.createElement("input",r({type:"hidden",value:Pe,className:kt,onChange:function(){}},C)),u.createElement("div",{className:Rt,style:ae},Vt),u.createElement("div",{className:Pt},F&&u.createElement("div",{ref:tt},u.createElement("div",{className:h.default.select__searchInputWrapper},u.createElement("svg",{className:h.default.select__searchInputSearchIcon,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},u.createElement("path",{fill:"#cdcdcd",d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),u.createElement("path",{d:"M0 0h24v24H0z",fill:"none"})),u.createElement("input",{className:h.default.select__searchInput,ref:nt,value:De[0],onChange:st,onKeyDown:lt}),De[0]&&u.createElement("svg",{className:h.default.select__searchInputRemoveIcon,xmlns:"http://www.w3.org/2000/svg",width:"15",height:"15",viewBox:"0 0 24 24",onClick:function(){De[1](""),nt.current.focus()}},u.createElement("path",{fill:"#cdcdcd",d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}),u.createElement("path",{d:"M0 0h24v24H0z",fill:"none"})))),u.createElement("div",{ref:et,style:ce},Mt))),xt))}))},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=48&&n<=57||n>=97&&n<=122)&&(t+=e)})),t},getAlpha:function(e){var t="";return String(e).split("").forEach((function(e){var n=e.toLowerCase().charCodeAt(0);n>=97&&n<=122&&(t+=e)})),t},getNumeric:function(e){var t="";return String(e).split("").forEach((function(e){var n=e.toLowerCase().charCodeAt(0);n>=48&&n<=57&&(t+=e)})),t},arraysEqual:function(e,t){if(e.length!==t.length)return!1;for(var n=e.length;n-=1;)if(JSON.stringify(e[n])!==JSON.stringify(t[n]))return!1;return!0}};t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},o={reg:function(e,t){var n=!0;return e.test(t)&&(n=!1),n},empty:function(e){return!e.replace(/\s/g,"").length},number:function(e,t,n){return null===t&&null===n||!!r(e)&&!(en)}};t.default=o},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(7));t.Textbox=o.default;var i=r(n(8));t.Textarea=i.default;var a=r(n(9));t.Select=a.default;var u=r(n(10));t.Checkbox=u.default;var s=r(n(11));t.Radiobox=s.default,"undefined"!=typeof window&&(window.Textbox=o.default,window.Textarea=i.default,window.Radiobox=s.default,window.Checkbox=u.default,window.Select=a.default)},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]Number(I.maxLength))){var n=we.type,r=we.numberType,o=we.mantissa;n===b[1]&&(t=String(function(e,t,n){var r="",o=!1,i=String(e).split("");i[0];if(t===w[2]&&"0"===i[0]&&"0"===i[1]&&i.shift(),i.forEach((function(e){var n=e.toLowerCase().charCodeAt(0);if(n>=48&&n<=57||46===n&&!o){if(46===n){if(t===w[1])return;o=!0}r+=e}})),o&&n>=0){var a=r.split(".");0===n?r=a[0]:(a[1]=a[1].slice(0,n),r=a.join("."))}return t!==w[0]&&t!==w[2]||r.length&&"."===r[0]&&(r="0"+r),r}(t,w.indexOf(r)>=0?r:w[0],o))),n===b[2]&&(t=p.default.getAlphanumeric(t)),n===b[3]&&(t=p.default.getAlpha(t)),Ee(t),Q&&Q(t,e),le?ce(!1):pe("")}}}),[le,I,we]),Me=d((function(){return o(void 0,void 0,void 0,(function(){var e,t,n,r,o,a,u,s,l,c,d,f,_,g,w,y;return i(this,(function(i){switch(i.label){case 0:if(e=we.reg,t=we.min,n=we.max,r=we.type,o=we.name,a=we.check,u=we.length,s=we.regMsg,l=we.locale,c=we.compare,d=we.required,f=we.msgOnSuccess,_=we.customFunc,!a)return[2];if(!r)return[3,5];if(-1===b.indexOf(r))return[3,3];if(!v.default[l]||!v.default[l][E])return console.error(h.REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE),[2];if(g=v.default[l][E],w=o||"",d&&m.default.empty(ge))return Ae(!0,g.empty(w)),[2];if(""!==String(ge)){if(e&&m.default.reg(e,ge))return Ae(!0,""!==s?s:g.invalid(w)),[2];if(r===b[0]){if(t||n)if(t&&n){if(String(ge).lengthn)return Ae(!0,g.inBetween(w)(t)(n)),[2]}else{if(t&&String(ge).lengthn)return Ae(!0,g.greaterThan(w)(n)),[2]}if(u&&String(ge).length!==u)return Ae(!0,g.lengthEqual(w)(u)),[2]}if(r===b[1]){if(!m.default[r](ge,null,null))return Ae(!0,g.invalid(w)),[2];if(t||n)if(t&&n){if(!m.default[r](ge,t,n))return Ae(!0,g.inBetween(w)(t)(n)),[2]}else{if(t&&!m.default[r](ge,t))return Ae(!0,g.lessThan(w)(t)),[2];if(n&&!m.default[r](ge,0,n))return Ae(!0,g.greaterThan(w)(n)),[2]}if(u&&String(ge).length!==u)return Ae(!0,g.lengthEqual(w)(u)),[2]}if(c&&""!==c&&ge!==c)return Ae(!0,g.twoInputsNotEqual()),[2]}return _&&"function"==typeof _?[4,_(ge)]:[3,2];case 1:if("object"==typeof(y=i.sent()))return"boolean"==typeof y.error&&"string"==typeof y.message&&(!1===y.error&&!0===y.showOnSuccess&&pe(y.message),Ae(y.error,y.message,!0)),[2];if(!0!==y)return Ae(!0,y,!0),[2];i.label=2;case 2:return f&&pe(f),Ae(!1,f),[3,4];case 3:console.error("The valid "+p.default.toCamelCase(E)(!0)+' "type" options in validationOption are ['+b.map((function(e){return e}))+"]"),i.label=4;case 4:return[3,6];case 5:console.error('Please provide "type" in validationOption'),i.label=6;case 6:return[2]}}))}))}),[ge,we]),Ae=d((function(e,t,n){void 0===n&&(n=!1);var r=t,o=we.msgOnError;e&&o&&!n&&(r=o),ce(e),_e(r),ue&&ue(e)}),[we.msgOnError]);c((function(){k&&Me()}),[k]),c((function(){Ee(String(T))}),[T]),c((function(){void 0!==be&&be!==ge&&we.customFunc&&ie&&Me()}),[ge]),c((function(){ye&&ye.message&&(ye.showOnError&&Ae(ye.error,ye.message),!ye.error&&ye.showOnSuccess&&pe(ye.message))}),[J]);var Le,ke=D+" "+g.default[E+"__wrapper"]+" "+(le&&g.default.error)+" "+(""!==me&&!le&&g.default.success)+" "+(A&&g.default.disabled),Re=q+" "+g.default[E+"__container"]+" "+(le&&g.default.error)+" "+(""!==me&&!le&&g.default.success)+" "+(A&&g.default.disabled),Pe=P+" "+g.default[E+"__input"]+" "+(le&&g.default.error)+" "+(""!==me&&!le&&g.default.success)+" "+(A&&g.default.disabled),Fe=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(le&&g.default.error),De=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(!le&&g.default.success),je=we.showMsg;return je&&le&&fe&&(Le=s.createElement("div",{className:Fe},fe)),je&&!le&&""!==me&&(Le=s.createElement("div",{className:De},me)),s.createElement("div",r({className:ke,style:W},S),s.createElement("div",{className:Re,style:z},s.createElement("input",r({type:"text",value:ge,disabled:A,onBlur:Ie,onKeyUp:Ce,onFocus:Ne,onClick:Te,className:Pe,onChange:xe,style:B,ref:Se},I)),x&&I.id&&s.createElement("label",{htmlFor:I.id},x)),Le)}))},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]Number(O.maxLength)||(pe(t),K&&K(t,e),ae?ue(!1):_e(""))}}),[ae]),Te=d((function(){return o(void 0,void 0,void 0,(function(){var e,t,n,r,o,a,u,s,l,c,d,f,_,g,w;return i(this,(function(i){switch(i.label){case 0:if(e=ge.reg,t=ge.min,n=ge.max,r=ge.type,o=ge.name,a=ge.check,u=ge.length,s=ge.regMsg,l=ge.locale,c=ge.required,d=ge.msgOnSuccess,f=ge.customFunc,!a)return[2];if(!r)return[3,5];if(-1===b.indexOf(r))return[3,3];if(!v.default[l]||!v.default[l][E])return console.error(h.REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE),[2];if(_=v.default[l][E],g=o||"",c&&m.default.empty(me))return Ce(!0,_.empty(g)),[2];if(""!==String(me)){if(e&&m.default.reg(e,me))return Ce(!0,""!==s?s:_.invalid(g)),[2];if(t||n)if(t&&n){if(String(me).lengthn)return Ce(!0,_.inBetween(g)(t)(n)),[2]}else{if(t&&String(me).lengthn)return Ce(!0,_.greaterThan(g)(n)),[2]}if(u&&String(me).length!==u)return Ce(!0,_.lengthEqual(g)(u)),[2]}return f&&"function"==typeof f?[4,f(me)]:[3,2];case 1:if("object"==typeof(w=i.sent()))return"boolean"==typeof w.error&&"string"==typeof w.message&&(!1===w.error&&!0===w.showOnSuccess&&_e(w.message),Ce(w.error,w.message,!0)),[2];if(!0!==w)return Ce(!0,w,!0),[2];i.label=2;case 2:return d&&_e(d),Ce(!1,d),[3,4];case 3:console.error("The valid "+p.default.toCamelCase(E)(!0)+' "type" options in validationOption are ['+b.map((function(e){return e}))+"]"),i.label=4;case 4:return[3,6];case 5:console.error('Please provide "type" in validationOption'),i.label=6;case 6:return[2]}}))}))}),[me,ge]),Ce=d((function(e,t,n){void 0===n&&(n=!1);var r=t,o=ge.msgOnError;e&&o&&!n&&(r=o),ue(e),ce(r),oe&&oe(e)}),[ge.msgOnError]);c((function(){M&&Te()}),[M]),c((function(){pe(String(N))}),[N]),c((function(){void 0!==he&&he!==me&&ge.customFunc&&ne&&Te()}),[me]),c((function(){Ee&&Ee.message&&(Ee.showOnError&&Ce(Ee.error,Ee.message),!Ee.error&&Ee.showOnSuccess&&_e(Ee.message))}),[X]);var xe,Me=R+" "+g.default[E+"__wrapper"]+" "+(ae&&g.default.error)+" "+(""!==fe&&!ae&&g.default.success)+" "+(C&&g.default.disabled),Ae=F+" "+g.default[E+"__container"]+" "+(ae&&g.default.error)+" "+(""!==fe&&!ae&&g.default.success)+" "+(C&&g.default.disabled),Le=L+" "+g.default[E+"__input"]+" "+(ae&&g.default.error)+" "+(""!==fe&&!ae&&g.default.success)+" "+(C&&g.default.disabled),ke=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(ae&&g.default.error),Re=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(!ae&&g.default.success),Pe=ge.showMsg;return Pe&&ae&&le&&(xe=s.createElement("div",{className:ke},le)),Pe&&!ae&&""!==fe&&(xe=s.createElement("div",{className:Re},fe)),s.createElement("div",r({className:Me,style:U},y),s.createElement("div",{className:Ae,style:V},s.createElement("textarea",r({value:me,disabled:C,onBlur:ye,onKeyUp:Ie,onFocus:Se,onClick:Oe,className:Le,onChange:Ne,style:j,ref:be},O))),xe)}))},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=a){var u=Math.abs(i-a-o);u>=0&&!w?(it.current.scrollTop=r+o-u,w=!0):it.current.scrollTop=r+o}}"up"===e&&(w=!1,y*o<=r&&(it.current.scrollTop=y*o))}else w=!1,it.current.scrollTop=y*o}}),[]),bt=c((function(e,t){_t(e,t),De[1]("")}),[]),wt=c((function(e){y=e,Ot()}),[]),yt=c((function(){Xe(!1)}),[]),St=c((function(){It()}),[]),Ot=c((function(){if(et&&et.current&&et.current.children){var e=et.current.children;if(It(),null===y)return;y>=e.length&&(y=0),y<0&&(y=e.length-1),e[y]&&(e[y].className+=" "+h.default[g+"__hover-active"])}}),[]),It=c((function(){if(et&&et.current&&et.current.children)for(var e=et.current.children,t=0;tut.length-1&&(y=0,Et("up")),Ot();else if(38===e)(y-=1)<0&&(y=ut.length-1,Et("loop")),Ot();else if(13===e&&y>-1&&et&&et.current&&et.current.children){var t=et.current.children;if(!t[y])return;t[y].click()}}),[ut]),Ct=c((function(e){if(!F&&(Xe(!0),e.preventDefault&&e.preventDefault(),Be)){y=null===y?t.getIndex(ut,String(M)):y;var n=e.keyCode,r=Nt(n);if(-1!==E.indexOf(n))Tt(n);else{gt();var i=o(Ke,[n]),a=String.fromCharCode.apply(String,i).toLowerCase(),u=-1;ut.forEach((function(e,t){e.name.toLowerCase().startsWith(a)&&-1===u&&(u=t)})),-1!==u&&(y=u,Ot()),Je(i)}return Et(r),y}}),[Be,M,Ke]);l((function(){return Be&&ot&&document.addEventListener("keydown",Ct),function(){document.removeEventListener("keydown",Ct)}}),[Be,M,Ke]),l((function(){R&&vt()}),[R]),l((function(){t.isValidValue(ut,Pe)&&""!==Pe&&"null"!==Pe&&"undefined"!==Pe?Te(!1):ke("")}),[Pe]),l((function(){Fe(String(M))}),[M]),l((function(){qe&&qe&&!p.default.arraysEqual(qe,V)&&Fe(String(V[0].id))}),[V]),l((function(){void 0!==je&&je!==Pe&&vt()}),[je,Pe]),l((function(){Qe&&Qe.message&&(Qe.showOnError&&mt(Qe.error,Qe.message),!Qe.error&&Qe.showOnSuccess&&ke(Qe.message))}),[ve]),l((function(){Be&&(F&&nt.current.focus(),y=null===y?t.getIndex(ut,String(M)):y,at[y]&&at[y].current.focus()),!0===We&&!1===Be&&rt.current.focus(),ht()}),[Be]);var xt,Mt,At=m.WRAPPER_CLASS_IDENTITIFIER+" "+G+" "+h.default.select__wrapper+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Lt=m.CONTAINER_CLASS_IDENTITIFIER+" "+X+" "+h.default.select__container+" "+(Ne&&h.default.error)+" "+(Be&&h.default.show)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),kt=h.default.select__input+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Rt=K+" "+h.default.ellipsis+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Pt=Y+" "+h.default[g+"__options-container"]+" "+(Ne&&h.default.error)+" "+(Be&&h.default.show)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Ft=h.default.button+" "+(!ze&&h.default[g+"__options-item-show-cursor"])+" "+Z+" "+h.default[g+"__options-item"]+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Dt=ee+" "+h.default[g+"__dropdown-icon"]+" "+(j&&h.default.showArrow),jt=m.MSG_CLASS_IDENTITIFIER+" "+h.default.msg+" "+(Ne&&h.default.error),qt=m.MSG_CLASS_IDENTITIFIER+" "+h.default.msg+" "+(!Ne&&h.default.success),Ut=Ze.showMsg;Ut&&Ne&&xe&&(xt=u.createElement("div",{className:jt},xe)),Ut&&!Ne&&""!==Le&&(xt=u.createElement("div",{className:qt},Le));var Bt=t.getItem(V,String(M));ut.length?Mt=ut.map((function(e,n){return u.createElement(t.Option,{key:n,index:n,id:"react-inputs-validation__select_option-"+e.id,className:String(e.id)===String(M)?Ft+" "+h.default.active:""+Ft,item:e,customStyleOptionListItem:se,onClick:bt,onMouseOver:wt,onMouseMove:yt,onMouseOut:St})})):F&&(Mt=u.createElement("div",{style:{background:"#fff",textAlign:"center",padding:"20px"}},u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},u.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),u.createElement("path",{fill:"#cdcdcd",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12zm8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8z"}))));var Vt=u.createElement("div",{className:h.default.select__dropdown},u.createElement("div",{className:h.default[g+"__dropdown-name"]+" "+h.default.ellipsis},Bt?Bt.name:""),u.createElement("div",{className:Dt}));return u.createElement("button",r({ref:Ye,type:"button",className:h.default.button,onClick:function(e){if(ft(e),!L){if(tt.current&&tt.current.contains(e.target))return void Ve(!0);Ve(!Be)}},onFocus:dt,onBlur:ct},N),u.createElement("div",{ref:$e,className:At,style:ne},u.createElement("div",{className:Lt,style:oe},u.createElement("input",r({type:"hidden",value:Pe,className:kt,onChange:function(){}},C)),u.createElement("div",{className:Rt,style:ae},Vt),u.createElement("div",{className:Pt},F&&u.createElement("div",{ref:tt},u.createElement("div",{className:h.default.select__searchInputWrapper},u.createElement("svg",{className:h.default.select__searchInputSearchIcon,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},u.createElement("path",{fill:"#cdcdcd",d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),u.createElement("path",{d:"M0 0h24v24H0z",fill:"none"})),u.createElement("input",{className:h.default.select__searchInput,ref:nt,value:De[0],onChange:st,onKeyDown:lt}),De[0]&&u.createElement("svg",{className:h.default.select__searchInputRemoveIcon,xmlns:"http://www.w3.org/2000/svg",width:"15",height:"15",viewBox:"0 0 24 24",onClick:function(){De[1](""),nt.current.focus()}},u.createElement("path",{fill:"#cdcdcd",d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}),u.createElement("path",{d:"M0 0h24v24H0z",fill:"none"})))),u.createElement("div",{ref:et,style:ce},Mt))),xt))}))},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=48&&n<=57||n>=97&&n<=122)&&(t+=e)})),t},getAlpha:function(e){var t="";return String(e).split("").forEach((function(e){var n=e.toLowerCase().charCodeAt(0);n>=97&&n<=122&&(t+=e)})),t},getNumeric:function(e){var t="";return String(e).split("").forEach((function(e){var n=e.toLowerCase().charCodeAt(0);n>=48&&n<=57&&(t+=e)})),t},arraysEqual:function(e,t){if(e.length!==t.length)return!1;for(var n=e.length;n-=1;)if(JSON.stringify(e[n])!==JSON.stringify(t[n]))return!1;return!0}};t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},o={reg:function(e,t){var n=!0;return e.test(t)&&(n=!1),n},empty:function(e){return!e.replace(/\s/g,"").length},number:function(e,t,n){return null===t&&null===n||!!r(e)&&!(en)}};t.default=o},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(7));t.Textbox=o.default;var i=r(n(8));t.Textarea=i.default;var a=r(n(9));t.Select=a.default;var u=r(n(10));t.Checkbox=u.default;var s=r(n(11));t.Radiobox=s.default,"undefined"!=typeof window&&(window.Textbox=o.default,window.Textarea=i.default,window.Radiobox=s.default,window.Checkbox=u.default,window.Select=a.default)},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]Number(I.maxLength))){var n=we.type,r=we.numberType,o=we.mantissa;n===b[1]&&(t=String(function(e,t,n){var r="",o=!1,i=String(e).split("");i[0];if(t===w[2]&&"0"===i[0]&&"0"===i[1]&&i.shift(),i.forEach((function(e){var n=e.toLowerCase().charCodeAt(0);if(n>=48&&n<=57||46===n&&!o){if(46===n){if(t===w[1])return;o=!0}r+=e}})),o&&n>=0){var a=r.split(".");0===n?r=a[0]:(a[1]=a[1].slice(0,n),r=a.join("."))}return t!==w[0]&&t!==w[2]||r.length&&"."===r[0]&&(r="0"+r),r}(t,w.indexOf(r)>=0?r:w[0],o))),n===b[2]&&(t=p.default.getAlphanumeric(t)),n===b[3]&&(t=p.default.getAlpha(t)),Ee(t),Q&&Q(t,e),le?ce(!1):pe("")}}}),[le,I,we]),Me=d((function(){return o(void 0,void 0,void 0,(function(){var e,t,n,r,o,a,u,s,l,c,d,f,_,g,w,y;return i(this,(function(i){switch(i.label){case 0:if(e=we.reg,t=we.min,n=we.max,r=we.type,o=we.name,a=we.check,u=we.length,s=we.regMsg,l=we.locale,c=we.compare,d=we.required,f=we.msgOnSuccess,_=we.customFunc,!a)return[2];if(!r)return[3,5];if(-1===b.indexOf(r))return[3,3];if(!v.default[l]||!v.default[l][E])return console.error(h.REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE),[2];if(g=v.default[l][E],w=o||"",d&&m.default.empty(ge))return Ae(!0,g.empty(w)),[2];if(""!==String(ge)){if(e&&m.default.reg(e,ge))return Ae(!0,""!==s?s:g.invalid(w)),[2];if(r===b[0]){if(t||n)if(t&&n){if(String(ge).lengthn)return Ae(!0,g.inBetween(w)(t)(n)),[2]}else{if(t&&String(ge).lengthn)return Ae(!0,g.greaterThan(w)(n)),[2]}if(u&&String(ge).length!==u)return Ae(!0,g.lengthEqual(w)(u)),[2]}if(r===b[1]){if(!m.default[r](ge,null,null))return Ae(!0,g.invalid(w)),[2];if(t||n)if(t&&n){if(!m.default[r](ge,t,n))return Ae(!0,g.inBetween(w)(t)(n)),[2]}else{if(t&&!m.default[r](ge,t))return Ae(!0,g.lessThan(w)(t)),[2];if(n&&!m.default[r](ge,0,n))return Ae(!0,g.greaterThan(w)(n)),[2]}if(u&&String(ge).length!==u)return Ae(!0,g.lengthEqual(w)(u)),[2]}if(c&&""!==c&&ge!==c)return Ae(!0,g.twoInputsNotEqual()),[2]}return _&&"function"==typeof _?[4,_(ge)]:[3,2];case 1:if(y=i.sent(),!Se||!Se.current)return[2];if("object"==typeof y)return"boolean"==typeof y.error&&"string"==typeof y.message&&(!1===y.error&&!0===y.showOnSuccess&&pe(y.message),Ae(y.error,y.message,!0)),[2];if(!0!==y)return Ae(!0,y,!0),[2];i.label=2;case 2:return f&&pe(f),Ae(!1,f),[3,4];case 3:console.error("The valid "+p.default.toCamelCase(E)(!0)+' "type" options in validationOption are ['+b.map((function(e){return e}))+"]"),i.label=4;case 4:return[3,6];case 5:console.error('Please provide "type" in validationOption'),i.label=6;case 6:return[2]}}))}))}),[ge,we]),Ae=d((function(e,t,n){void 0===n&&(n=!1);var r=t,o=we.msgOnError;e&&o&&!n&&(r=o),ce(e),_e(r),ue&&ue(e)}),[we.msgOnError]);c((function(){k&&Me()}),[k]),c((function(){Ee(String(T))}),[T]),c((function(){void 0!==be&&be!==ge&&we.customFunc&&ie&&Me()}),[ge]),c((function(){ye&&ye.message&&(ye.showOnError&&Ae(ye.error,ye.message),!ye.error&&ye.showOnSuccess&&pe(ye.message))}),[J]);var Le,ke=D+" "+g.default[E+"__wrapper"]+" "+(le&&g.default.error)+" "+(""!==me&&!le&&g.default.success)+" "+(A&&g.default.disabled),Re=q+" "+g.default[E+"__container"]+" "+(le&&g.default.error)+" "+(""!==me&&!le&&g.default.success)+" "+(A&&g.default.disabled),Pe=P+" "+g.default[E+"__input"]+" "+(le&&g.default.error)+" "+(""!==me&&!le&&g.default.success)+" "+(A&&g.default.disabled),Fe=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(le&&g.default.error),De=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(!le&&g.default.success),je=we.showMsg;return je&&le&&fe&&(Le=s.createElement("div",{className:Fe},fe)),je&&!le&&""!==me&&(Le=s.createElement("div",{className:De},me)),s.createElement("div",r({className:ke,style:W},S),s.createElement("div",{className:Re,style:z},s.createElement("input",r({type:"text",value:ge,disabled:A,onBlur:Ie,onKeyUp:Ce,onFocus:Ne,onClick:Te,className:Pe,onChange:xe,style:B,ref:Se},I)),x&&I.id&&s.createElement("label",{htmlFor:I.id},x)),Le)}))},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]Number(O.maxLength)||(pe(t),K&&K(t,e),ae?ue(!1):_e(""))}}),[ae]),Te=d((function(){return o(void 0,void 0,void 0,(function(){var e,t,n,r,o,a,u,s,l,c,d,f,_,g,w;return i(this,(function(i){switch(i.label){case 0:if(e=ge.reg,t=ge.min,n=ge.max,r=ge.type,o=ge.name,a=ge.check,u=ge.length,s=ge.regMsg,l=ge.locale,c=ge.required,d=ge.msgOnSuccess,f=ge.customFunc,!a)return[2];if(!r)return[3,5];if(-1===b.indexOf(r))return[3,3];if(!v.default[l]||!v.default[l][E])return console.error(h.REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE),[2];if(_=v.default[l][E],g=o||"",c&&m.default.empty(me))return Ce(!0,_.empty(g)),[2];if(""!==String(me)){if(e&&m.default.reg(e,me))return Ce(!0,""!==s?s:_.invalid(g)),[2];if(t||n)if(t&&n){if(String(me).lengthn)return Ce(!0,_.inBetween(g)(t)(n)),[2]}else{if(t&&String(me).lengthn)return Ce(!0,_.greaterThan(g)(n)),[2]}if(u&&String(me).length!==u)return Ce(!0,_.lengthEqual(g)(u)),[2]}return f&&"function"==typeof f?[4,f(me)]:[3,2];case 1:if("object"==typeof(w=i.sent()))return"boolean"==typeof w.error&&"string"==typeof w.message&&(!1===w.error&&!0===w.showOnSuccess&&_e(w.message),Ce(w.error,w.message,!0)),[2];if(!0!==w)return Ce(!0,w,!0),[2];i.label=2;case 2:return d&&_e(d),Ce(!1,d),[3,4];case 3:console.error("The valid "+p.default.toCamelCase(E)(!0)+' "type" options in validationOption are ['+b.map((function(e){return e}))+"]"),i.label=4;case 4:return[3,6];case 5:console.error('Please provide "type" in validationOption'),i.label=6;case 6:return[2]}}))}))}),[me,ge]),Ce=d((function(e,t,n){void 0===n&&(n=!1);var r=t,o=ge.msgOnError;e&&o&&!n&&(r=o),ue(e),ce(r),oe&&oe(e)}),[ge.msgOnError]);c((function(){M&&Te()}),[M]),c((function(){pe(String(N))}),[N]),c((function(){void 0!==he&&he!==me&&ge.customFunc&&ne&&Te()}),[me]),c((function(){Ee&&Ee.message&&(Ee.showOnError&&Ce(Ee.error,Ee.message),!Ee.error&&Ee.showOnSuccess&&_e(Ee.message))}),[X]);var xe,Me=R+" "+g.default[E+"__wrapper"]+" "+(ae&&g.default.error)+" "+(""!==fe&&!ae&&g.default.success)+" "+(C&&g.default.disabled),Ae=F+" "+g.default[E+"__container"]+" "+(ae&&g.default.error)+" "+(""!==fe&&!ae&&g.default.success)+" "+(C&&g.default.disabled),Le=L+" "+g.default[E+"__input"]+" "+(ae&&g.default.error)+" "+(""!==fe&&!ae&&g.default.success)+" "+(C&&g.default.disabled),ke=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(ae&&g.default.error),Re=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(!ae&&g.default.success),Pe=ge.showMsg;return Pe&&ae&&le&&(xe=s.createElement("div",{className:ke},le)),Pe&&!ae&&""!==fe&&(xe=s.createElement("div",{className:Re},fe)),s.createElement("div",r({className:Me,style:U},y),s.createElement("div",{className:Ae,style:V},s.createElement("textarea",r({value:me,disabled:C,onBlur:ye,onKeyUp:Ie,onFocus:Se,onClick:Oe,className:Le,onChange:Ne,style:j,ref:be},O))),xe)}))},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=a){var u=Math.abs(i-a-o);u>=0&&!w?(it.current.scrollTop=r+o-u,w=!0):it.current.scrollTop=r+o}}"up"===e&&(w=!1,y*o<=r&&(it.current.scrollTop=y*o))}else w=!1,it.current.scrollTop=y*o}}),[]),bt=c((function(e,t){_t(e,t),De[1]("")}),[]),wt=c((function(e){y=e,Ot()}),[]),yt=c((function(){Xe(!1)}),[]),St=c((function(){It()}),[]),Ot=c((function(){if(et&&et.current&&et.current.children){var e=et.current.children;if(It(),null===y)return;y>=e.length&&(y=0),y<0&&(y=e.length-1),e[y]&&(e[y].className+=" "+h.default[g+"__hover-active"])}}),[]),It=c((function(){if(et&&et.current&&et.current.children)for(var e=et.current.children,t=0;tut.length-1&&(y=0,Et("up")),Ot();else if(38===e)(y-=1)<0&&(y=ut.length-1,Et("loop")),Ot();else if(13===e&&y>-1&&et&&et.current&&et.current.children){var t=et.current.children;if(!t[y])return;t[y].click()}}),[ut]),Ct=c((function(e){if(!F&&(Xe(!0),e.preventDefault&&e.preventDefault(),Be)){y=null===y?t.getIndex(ut,String(M)):y;var n=e.keyCode,r=Nt(n);if(-1!==E.indexOf(n))Tt(n);else{gt();var i=o(Ke,[n]),a=String.fromCharCode.apply(String,i).toLowerCase(),u=-1;ut.forEach((function(e,t){e.name.toLowerCase().startsWith(a)&&-1===u&&(u=t)})),-1!==u&&(y=u,Ot()),Je(i)}return Et(r),y}}),[Be,M,Ke]);l((function(){return Be&&ot&&document.addEventListener("keydown",Ct),function(){document.removeEventListener("keydown",Ct)}}),[Be,M,Ke]),l((function(){R&&vt()}),[R]),l((function(){t.isValidValue(ut,Pe)&&""!==Pe&&"null"!==Pe&&"undefined"!==Pe?Te(!1):ke("")}),[Pe]),l((function(){Fe(String(M))}),[M]),l((function(){qe&&qe&&!p.default.arraysEqual(qe,V)&&Fe(String(V[0].id))}),[V]),l((function(){void 0!==je&&je!==Pe&&vt()}),[je,Pe]),l((function(){Qe&&Qe.message&&(Qe.showOnError&&mt(Qe.error,Qe.message),!Qe.error&&Qe.showOnSuccess&&ke(Qe.message))}),[ve]),l((function(){Be&&(F&&nt.current.focus(),y=null===y?t.getIndex(ut,String(M)):y,at[y]&&at[y].current.focus()),!0===We&&!1===Be&&rt.current.focus(),ht()}),[Be]);var xt,Mt,At=m.WRAPPER_CLASS_IDENTITIFIER+" "+G+" "+h.default.select__wrapper+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Lt=m.CONTAINER_CLASS_IDENTITIFIER+" "+X+" "+h.default.select__container+" "+(Ne&&h.default.error)+" "+(Be&&h.default.show)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),kt=h.default.select__input+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Rt=K+" "+h.default.ellipsis+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Pt=Y+" "+h.default[g+"__options-container"]+" "+(Ne&&h.default.error)+" "+(Be&&h.default.show)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Ft=h.default.button+" "+(!ze&&h.default[g+"__options-item-show-cursor"])+" "+Z+" "+h.default[g+"__options-item"]+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Dt=ee+" "+h.default[g+"__dropdown-icon"]+" "+(j&&h.default.showArrow),jt=m.MSG_CLASS_IDENTITIFIER+" "+h.default.msg+" "+(Ne&&h.default.error),qt=m.MSG_CLASS_IDENTITIFIER+" "+h.default.msg+" "+(!Ne&&h.default.success),Ut=Ze.showMsg;Ut&&Ne&&xe&&(xt=u.createElement("div",{className:jt},xe)),Ut&&!Ne&&""!==Le&&(xt=u.createElement("div",{className:qt},Le));var Bt=t.getItem(V,String(M));ut.length?Mt=ut.map((function(e,n){return u.createElement(t.Option,{key:n,index:n,id:"react-inputs-validation__select_option-"+e.id,className:String(e.id)===String(M)?Ft+" "+h.default.active:""+Ft,item:e,customStyleOptionListItem:se,onClick:bt,onMouseOver:wt,onMouseMove:yt,onMouseOut:St})})):F&&(Mt=u.createElement("div",{style:{background:"#fff",textAlign:"center",padding:"20px"}},u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},u.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),u.createElement("path",{fill:"#cdcdcd",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12zm8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8z"}))));var Vt=u.createElement("div",{className:h.default.select__dropdown},u.createElement("div",{className:h.default[g+"__dropdown-name"]+" "+h.default.ellipsis},Bt?Bt.name:""),u.createElement("div",{className:Dt}));return u.createElement("button",r({ref:Ye,type:"button",className:h.default.button,onClick:function(e){if(ft(e),!L){if(tt.current&&tt.current.contains(e.target))return void Ve(!0);Ve(!Be)}},onFocus:dt,onBlur:ct},N),u.createElement("div",{ref:$e,className:At,style:ne},u.createElement("div",{className:Lt,style:oe},u.createElement("input",r({type:"hidden",value:Pe,className:kt,onChange:function(){}},C)),u.createElement("div",{className:Rt,style:ae},Vt),u.createElement("div",{className:Pt},F&&u.createElement("div",{ref:tt},u.createElement("div",{className:h.default.select__searchInputWrapper},u.createElement("svg",{className:h.default.select__searchInputSearchIcon,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},u.createElement("path",{fill:"#cdcdcd",d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),u.createElement("path",{d:"M0 0h24v24H0z",fill:"none"})),u.createElement("input",{className:h.default.select__searchInput,ref:nt,value:De[0],onChange:st,onKeyDown:lt}),De[0]&&u.createElement("svg",{className:h.default.select__searchInputRemoveIcon,xmlns:"http://www.w3.org/2000/svg",width:"15",height:"15",viewBox:"0 0 24 24",onClick:function(){De[1](""),nt.current.focus()}},u.createElement("path",{fill:"#cdcdcd",d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}),u.createElement("path",{d:"M0 0h24v24H0z",fill:"none"})))),u.createElement("div",{ref:et,style:ce},Mt))),xt))}))},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n {\n const ref = useRef();\n useEffect(() => {\n ref.current = value;\n });\n return ref.current;\n};\n","import { REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE } from './const';\n\nconst getEnglishName = (name: string) => {\n let res = '';\n if (name) {\n res = `${name} `;\n }\n return res;\n};\n\nconst TEXT_BOX_VALIDATION_ZH_CN = {\n empty: (name: string) => `${name}不能为空`,\n invalid: (name: string) => `${name}格式有误`,\n invalidFormat: (name: string) => `${name}不是数字`,\n inBetween: (name: string) => (min: number) => (max: number) => `${name}必须在${min}-${max}之间`,\n lessThan: (name: string) => (min: number) => `${name}不可少于${min}`,\n greaterThan: (name: string) => (max: number) => `${name}不可大于${max}`,\n lengthEqual: (name: string) => (length: number) => `${name}长度必须为${length}`,\n twoInputsNotEqual: () => `两次输入不一致`,\n};\n\nconst TEXT_BOX_VALIDATION_EN_US = {\n empty: (name: string) => `${getEnglishName(name)}cannot be empty`,\n invalid: (name: string) => `${getEnglishName(name)}invalid format`,\n invalidFormat: (name: string) => `${getEnglishName(name)}is not a number`,\n inBetween: (name: string) => (min: number) => (max: number) => `${getEnglishName(name)}must be ${min}-${max}`,\n lessThan: (name: string) => (min: number) => `${getEnglishName(name)}cannot less than ${min}`,\n greaterThan: (name: string) => (max: number) => `${getEnglishName(name)}cannot greater than ${max}`,\n lengthEqual: (name: string) => (length: number) => `${getEnglishName(name)}length must be ${length}`,\n twoInputsNotEqual: () => `two inputs are not equal`,\n};\n\nconst TEXT_AREA_VALIDATION_ZH_CN = {\n empty: (name: string) => `${name}不能为空`,\n invalid: (name: string) => `${name}格式有误`,\n invalidFormat: (name: string) => `${name}不是数字`,\n inBetween: (name: string) => (min: number) => (max: number) => `${name}必须在${min}-${max}之间`,\n lessThan: (name: string) => (min: number) => `${name}不可少于${min}`,\n greaterThan: (name: string) => (max: number) => `${name}不可大于${max}`,\n lengthEqual: (name: string) => (length: number) => `${name}长度必须为${length}`,\n twoInputsNotEqual: () => `两次输入不一致`,\n};\n\nconst TEXT_AREA_VALIDATION_EN_US = {\n empty: (name: string) => `${getEnglishName(name)}cannot be empty`,\n invalid: (name: string) => `${getEnglishName(name)}invalid format`,\n invalidFormat: (name: string) => `${getEnglishName(name)}is not a number`,\n inBetween: (name: string) => (min: number) => (max: number) => `${getEnglishName(name)}must be ${min}-${max}`,\n lessThan: (name: string) => (min: number) => `${getEnglishName(name)}cannot less than ${min}`,\n greaterThan: (name: string) => (max: number) => `${getEnglishName(name)}cannot greater than ${max}`,\n lengthEqual: (name: string) => (length: number) => `${getEnglishName(name)}length must be ${length}`,\n twoInputsNotEqual: () => `two inputs are not equal`,\n};\n\nconst SELECT_VALIDATION_ZH_CN = {\n empty: (name: string) => `请选择一个${name}`,\n};\n\nconst SELECT_VALIDATION_EN_US = {\n empty: (name: string) => `Please select a ${getEnglishName(name)}`,\n};\n\nconst CHECK_BOX_VALIDATION_ZH_CN = {\n unchecked: (name: string) => `${name}必须勾选`,\n};\n\nconst CHECK_BOX_VALIDATION_EN_US = {\n unchecked: (name: string) => `${getEnglishName(name)}must be checked`,\n};\n\nconst RADIO_BOX_VALIDATION_ZH_CN = {\n empty: (name: string) => `必须勾选一个${name}`,\n};\n\nconst RADIO_BOX_VALIDATION_EN_US = {\n empty: (name: string) => `Please choose one ${getEnglishName(name)}`,\n};\n\ninterface Message {\n [key: string]: Key;\n}\n\ninterface Key {\n [key: string]: Func;\n}\n\ninterface Func {\n [key: string]: Function;\n}\n\nlet message: Message = {\n 'zh-CN': {\n textbox: TEXT_BOX_VALIDATION_ZH_CN,\n radiobox: RADIO_BOX_VALIDATION_ZH_CN,\n checkbox: CHECK_BOX_VALIDATION_ZH_CN,\n select: SELECT_VALIDATION_ZH_CN,\n textarea: TEXT_AREA_VALIDATION_ZH_CN,\n },\n 'en-US': {\n textbox: TEXT_BOX_VALIDATION_EN_US,\n radiobox: RADIO_BOX_VALIDATION_EN_US,\n checkbox: CHECK_BOX_VALIDATION_EN_US,\n select: SELECT_VALIDATION_EN_US,\n textarea: TEXT_AREA_VALIDATION_EN_US,\n },\n};\n\n// TODO: find a rewire way to handle non-export function\nexport const getCustomErrorMessage = (o: any, m: any) => {\n if (!o || typeof o !== 'object' || o.constructor !== Object || !Object.keys(o).length) {\n console.error(REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE);\n return false;\n }\n Object.keys(o).map(i => {\n if (!m[i]) {\n m[i] = o[i];\n } else {\n if (Object.keys(o[i]).length) {\n Object.keys(o[i]).map(j => {\n if (Object.keys(o[i][j]).length) {\n Object.keys(o[i][j]).map(k => {\n m[i][j][k] = o[i][j][k];\n });\n }\n });\n }\n }\n });\n return m;\n};\n\ndeclare global {\n interface Window {\n REACT_INPUTS_VALIDATION: any;\n }\n}\n\n// TODO: find a rewire way to handle non-export function\nexport const handleCustomErrorMessage = (message: any, w: Window) => {\n let res;\n if (typeof w !== 'undefined') {\n if (w.REACT_INPUTS_VALIDATION && w.REACT_INPUTS_VALIDATION['customErrorMessage']) {\n res = getCustomErrorMessage(w.REACT_INPUTS_VALIDATION['customErrorMessage'], message);\n }\n }\n if (typeof res === 'undefined' || res === false) {\n return message;\n }\n return res;\n};\n\n/* istanbul ignore else */\nif (typeof window !== 'undefined') {\n window.REACT_INPUTS_VALIDATION = window.REACT_INPUTS_VALIDATION || {};\n message = handleCustomErrorMessage(message, window);\n}\n\nexport default message;\n","// extracted by mini-css-extract-plugin\nmodule.exports = {\"ellipsis\":\"react-inputs-validation__ellipsis___3-Api\",\"textbox__wrapper\":\"react-inputs-validation__textbox__wrapper___3tnXv\",\"disabled\":\"react-inputs-validation__disabled___1-57g\",\"textbox__input\":\"react-inputs-validation__textbox__input___20hDL\",\"error\":\"react-inputs-validation__error___2aXSp\",\"success\":\"react-inputs-validation__success___3TpwE\",\"msg\":\"react-inputs-validation__msg___pxv8o\",\"textarea__wrapper\":\"react-inputs-validation__textarea__wrapper___35GhF\",\"textarea__input\":\"react-inputs-validation__textarea__input___1CFm_\",\"radiobox__wrapper\":\"react-inputs-validation__radiobox__wrapper___1zZ30\",\"radiobox__container\":\"react-inputs-validation__radiobox__container___FD4vb\",\"radiobox__input\":\"react-inputs-validation__radiobox__input___2uX2-\",\"radiobox__label\":\"react-inputs-validation__radiobox__label___2tQsB\",\"checked\":\"react-inputs-validation__checked___2O0Ju\",\"button\":\"react-inputs-validation__button___9JBRL\",\"radiobox__item\":\"react-inputs-validation__radiobox__item___ejuz1\",\"checkbox__wrapper\":\"react-inputs-validation__checkbox__wrapper___1c1rD\",\"checkbox__input\":\"react-inputs-validation__checkbox__input___1yF4X\",\"checkbox__container\":\"react-inputs-validation__checkbox__container___3I1rX\",\"checkbox__box\":\"react-inputs-validation__checkbox__box___1uj8A\",\"box\":\"react-inputs-validation__box___3E9nu\",\"select__wrapper\":\"react-inputs-validation__select__wrapper___1B4OH\",\"select__input\":\"react-inputs-validation__select__input___3h-P7\",\"select__container\":\"react-inputs-validation__select__container___3jgUR\",\"select__button\":\"react-inputs-validation__select__button___vEDoq\",\"select__options-item\":\"react-inputs-validation__select__options-item___30yY4\",\"select__options-item-show-cursor\":\"react-inputs-validation__select__options-item-show-cursor___1ZT3b\",\"select__searchInputWrapper\":\"react-inputs-validation__select__searchInputWrapper___3R5P_\",\"select__searchInputSearchIcon\":\"react-inputs-validation__select__searchInputSearchIcon___1Q8xX\",\"select__searchInputRemoveIcon\":\"react-inputs-validation__select__searchInputRemoveIcon___1A1tR\",\"select__searchInput\":\"react-inputs-validation__select__searchInput___1lN24\",\"select__no-mouse\":\"react-inputs-validation__select__no-mouse___2uRg6\",\"select__hover-active\":\"react-inputs-validation__select__hover-active___2z1MQ\",\"active\":\"react-inputs-validation__active___3eZBB\",\"select__options-container-animate\":\"react-inputs-validation__select__options-container-animate___2Rm--\",\"show\":\"react-inputs-validation__show___2NI3u\",\"select__options-container\":\"react-inputs-validation__select__options-container___d54qE\",\"select__dropdown\":\"react-inputs-validation__select__dropdown___11yDr\",\"select__dropdown-icon\":\"react-inputs-validation__select__dropdown-icon___1T5r2\",\"select__dropdown-name\":\"react-inputs-validation__select__dropdown-name___3hghL\",\"showArrow\":\"react-inputs-validation__showArrow___3puk1\",\"select__dropdown-icon-container\":\"react-inputs-validation__select__dropdown-icon-container___2ild-\"};","const camelize = (str: string) => {\n return str.replace(/(?:^\\w|[A-Z]|\\b\\w|\\s+)/g, (match, index) => {\n if (+match === 0) return '';\n return index === 0 ? match.toLowerCase() : match.toUpperCase();\n });\n};\n\nconst toCamelCase = (str: string) => (capitalLize: boolean = false) => {\n const res = camelize(str);\n return capitalLize ? res.substr(0, 1).toUpperCase() + res.substr(1, res.length) : res;\n};\n\ninterface Utils {\n [key: string]: Function;\n}\n\nconst getRandomId = () => {\n return Math.random()\n .toString(36)\n .slice(-8);\n};\n\nconst getAlphanumeric = (v: string) => {\n let res = '';\n String(v)\n .split('')\n .forEach(i => {\n const charCode = i.toLowerCase().charCodeAt(0);\n if ((charCode >= 48 && charCode <= 57) || (charCode >= 97 && charCode <= 122)) {\n res += i;\n }\n });\n return res;\n};\n\nconst getAlpha = (v: string) => {\n let res = '';\n String(v)\n .split('')\n .forEach(i => {\n const charCode = i.toLowerCase().charCodeAt(0);\n if (charCode >= 97 && charCode <= 122) {\n res += i;\n }\n });\n return res;\n};\n\nconst getNumeric = (v: string) => {\n let res = '';\n String(v)\n .split('')\n .forEach(i => {\n const charCode = i.toLowerCase().charCodeAt(0);\n if (charCode >= 48 && charCode <= 57) {\n res += i;\n }\n });\n return res;\n};\n\nconst arraysEqual = (arr1: any, arr2: any) => {\n if (arr1.length !== arr2.length) return false;\n for (let i = arr1.length; (i -= 1); ) {\n if (JSON.stringify(arr1[i]) !== JSON.stringify(arr2[i])) return false;\n }\n return true;\n};\n\nconst utils: Utils = {\n camelize,\n toCamelCase,\n getRandomId,\n getAlphanumeric,\n getAlpha,\n getNumeric,\n arraysEqual,\n};\nexport default utils;\n","const empty = (v: string) => (v.replace(/\\s/g, '').length ? false : true);\nconst number = (v: number, min: any, max: any) => {\n if (min === null && max === null){\n return true\n }\n if (!isNumeric(v)) {\n return false;\n }\n return v < min || v > max ? false : true;\n};\n// TODO: find a better type for regex\nconst reg = (reg: any, v: string) => {\n let err = true;\n if (reg.test(v)) {\n err = false;\n }\n return err;\n};\nconst isNumeric = (v: any) => {\n return !isNaN(parseFloat(v)) && isFinite(v);\n};\n\ninterface Validator {\n [key: string]: Function;\n}\n\nconst validator: Validator = {\n reg,\n empty,\n number,\n};\nexport default validator;\n","import Textbox from './Textbox';\nimport Textarea from './Textarea';\nimport Select from './Select';\nimport Checkbox from './Checkbox';\nimport Radiobox from './Radiobox';\n\nif (typeof window !== 'undefined') {\n (window).Textbox = Textbox;\n (window).Textarea = Textarea;\n (window).Radiobox = Radiobox;\n (window).Checkbox = Checkbox;\n (window).Select = Select;\n}\n\nexport { Textbox, Textarea, Select, Checkbox, Radiobox };\n","import * as React from 'react';\nconst { useState, useEffect, useCallback, useRef, memo } = React;\nimport message from './message';\nimport validator from './validator';\nimport utils from './utils';\nimport { REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE, DEFAULT_LOCALE, MSG_CLASS_IDENTITIFIER, usePrevious } from './const';\nimport reactInputsValidationCss from './react-inputs-validation.css';\nconst TYPE = 'textbox';\nconst VALIDATE_OPTION_TYPE_LIST = ['string', 'number', 'alphanumeric', 'alpha'];\nconst VALIDATE_NUMBER_TYPE_LIST = ['decimal', 'int', 'price'];\ninterface DefaultValidationOption {\n locale?: string;\n reg?: string;\n min?: number;\n max?: number;\n type?: string;\n numberType?: string;\n mantissa?: number;\n name?: string;\n check?: boolean;\n showMsg?: boolean;\n length?: number;\n regMsg?: string;\n compare?: string;\n required?: boolean;\n msgOnError?: string;\n msgOnSuccess?: string;\n customFunc?: Function | undefined;\n}\nconst getDefaultValidationOption = (obj: DefaultValidationOption) => {\n let { reg, min, max, type, numberType, mantissa, name, check, length, regMsg, compare, required, showMsg, locale, msgOnError, msgOnSuccess, customFunc } = obj;\n locale = typeof locale !== 'undefined' ? locale : DEFAULT_LOCALE;\n reg = typeof reg !== 'undefined' ? reg : '';\n min = typeof min !== 'undefined' ? min : 0;\n max = typeof max !== 'undefined' ? max : 0;\n type = typeof type !== 'undefined' ? type : 'string';\n numberType = typeof numberType !== 'undefined' ? numberType : 'string';\n mantissa = typeof mantissa !== 'undefined' ? mantissa : -1;\n name = typeof name !== 'undefined' ? name : '';\n check = typeof check !== 'undefined' ? check : true;\n showMsg = typeof showMsg !== 'undefined' ? showMsg : true;\n length = typeof length !== 'undefined' ? length : 0;\n regMsg = typeof regMsg !== 'undefined' ? regMsg : '';\n compare = typeof compare !== 'undefined' ? compare : '';\n required = typeof required !== 'undefined' ? required : true;\n msgOnError = typeof msgOnError !== 'undefined' ? msgOnError : '';\n msgOnSuccess = typeof msgOnSuccess !== 'undefined' ? msgOnSuccess : '';\n customFunc = typeof customFunc !== 'undefined' ? customFunc : undefined;\n return {\n reg,\n min,\n max,\n type,\n numberType,\n mantissa,\n name,\n check,\n length,\n regMsg,\n locale,\n compare,\n required,\n showMsg,\n msgOnError,\n msgOnSuccess,\n customFunc,\n };\n};\ninterface DefaultAsyncMsgObj {\n error?: boolean;\n message?: string;\n showOnError?: boolean;\n showOnSuccess?: boolean;\n}\nconst getDefaultAsyncObj = (obj: DefaultAsyncMsgObj) => {\n let { error, message, showOnError, showOnSuccess } = obj;\n error = typeof error !== 'undefined' ? error : false;\n message = typeof message !== 'undefined' ? message : '';\n showOnError = typeof showOnError !== 'undefined' ? showOnError : true;\n showOnSuccess = typeof showOnSuccess !== 'undefined' ? showOnSuccess : false;\n return {\n error,\n message,\n showOnError,\n showOnSuccess,\n };\n};\ninterface AttributesInputObj {\n id?: string;\n maxLength?: number;\n}\ninterface Props {\n attributesWrapper?: object;\n attributesInput?: AttributesInputObj;\n value?: string;\n label?: string;\n disabled?: boolean;\n validate?: boolean;\n classNameInput?: string;\n classNameWrapper?: string;\n classNameContainer?: string;\n customStyleInput?: object;\n customStyleWrapper?: object;\n customStyleContainer?: object;\n validationOption?: object;\n asyncMsgObj?: object;\n onChange: (res: string, e: React.ChangeEvent) => void;\n onBlur?: (e: React.FocusEvent) => void;\n onFocus?: (e: React.FocusEvent) => void;\n onClick?: (e: React.MouseEvent) => void;\n onKeyUp?: (e: React.KeyboardEvent) => void;\n validationCallback?: (res: boolean) => void;\n}\nconst autoFormatNumber = (v: number | string, numberType: string, mantissa: number) => {\n const DOT = '.';\n const ZERO = '0';\n let res = '';\n let hasDot = false;\n const splitStr = String(v).split('');\n const startedWithZero = splitStr[0] === '0';\n if (numberType === VALIDATE_NUMBER_TYPE_LIST[2] && splitStr[0] === ZERO && splitStr[1] === ZERO) {\n splitStr.shift();\n }\n splitStr.forEach(i => {\n const charCode = i.toLowerCase().charCodeAt(0);\n if ((charCode >= 48 && charCode <= 57) || (charCode === 46 && !hasDot)) {\n if (charCode === 46) {\n if (numberType === VALIDATE_NUMBER_TYPE_LIST[1]) {\n return;\n }\n hasDot = true;\n }\n res += i;\n }\n });\n if (hasDot && mantissa >= 0) {\n const resArr = res.split(DOT);\n if (mantissa === 0) {\n res = resArr[0];\n } else {\n resArr[1] = resArr[1].slice(0, mantissa);\n res = resArr.join('.');\n }\n }\n if (numberType === VALIDATE_NUMBER_TYPE_LIST[0] || numberType === VALIDATE_NUMBER_TYPE_LIST[2]) {\n if (res.length && res[0] === DOT) {\n res = `0${res}`;\n }\n }\n // if (numberType === VALIDATE_NUMBER_TYPE_LIST[2]) {\n // if (startedWithZero) {\n // if (hasDot) {\n // const resArr = res.split(DOT);\n // res = `${Number(resArr[0])}${DOT}${resArr[1]}`;\n // }\n // }\n // }\n return res;\n};\nconst component: React.FC = ({\n attributesWrapper = {},\n attributesInput = {},\n value = '',\n label = '',\n disabled = false,\n validate = false,\n classNameInput = '',\n classNameWrapper = '',\n classNameContainer = '',\n customStyleInput = {},\n customStyleWrapper = {},\n customStyleContainer = {},\n validationOption = {},\n asyncMsgObj = {},\n onChange = (v: string, e: React.ChangeEvent) => {},\n onBlur = null,\n onFocus = null,\n onClick = null,\n onKeyUp = null,\n validationCallback = null,\n}) => {\n const [err, setErr] = useState(false);\n const [msg, setMsg] = useState('');\n const [successMsg, setSuccessMsg] = useState('');\n const [internalValue, setInternalValue] = useState(String(value));\n const prevInternalValue = usePrevious(internalValue);\n const option = getDefaultValidationOption(validationOption);\n const asyncObj = getDefaultAsyncObj(asyncMsgObj);\n const $input = useRef(null);\n const $el: { [key: string]: any } | null = $input;\n const handleOnBlur = useCallback(\n (e: React.FocusEvent) => {\n if (onBlur) {\n check();\n onBlur(e);\n }\n },\n [internalValue, option],\n );\n const handleOnFocus = useCallback((e: React.FocusEvent) => {\n if (onFocus) {\n onFocus(e);\n }\n }, []);\n const handleOnClick = useCallback((e: React.MouseEvent) => {\n if (onClick) {\n onClick(e);\n }\n }, []);\n const handleOnKeyUp = useCallback(\n (e: React.KeyboardEvent) => {\n if (onKeyUp) {\n const { keyCode } = e;\n const keyCodeTab = 9;\n if (keyCode !== keyCodeTab) {\n check();\n }\n onKeyUp(e);\n }\n },\n [internalValue, option],\n );\n const handleOnChange = useCallback(\n (e: React.ChangeEvent) => {\n if (disabled || $el === null) {\n return;\n }\n let v = $el.current.value;\n if (typeof attributesInput.maxLength !== 'undefined') {\n if ((typeof attributesInput.maxLength === 'string' && attributesInput.maxLength !== '') || (typeof attributesInput.maxLength === 'number' && attributesInput.maxLength !== 0)) {\n if (v.length > Number(attributesInput.maxLength)) {\n return;\n }\n }\n }\n const { type, numberType, mantissa } = option;\n if (type === VALIDATE_OPTION_TYPE_LIST[1]) {\n v = String(autoFormatNumber(v, VALIDATE_NUMBER_TYPE_LIST.indexOf(numberType) >= 0 ? numberType : VALIDATE_NUMBER_TYPE_LIST[0], mantissa));\n }\n if (type === VALIDATE_OPTION_TYPE_LIST[2]) {\n v = utils.getAlphanumeric(v);\n }\n if (type === VALIDATE_OPTION_TYPE_LIST[3]) {\n v = utils.getAlpha(v);\n }\n setInternalValue(v);\n onChange && onChange(v, e);\n if (err) {\n setErr(false);\n } else {\n setSuccessMsg('');\n }\n },\n [err, attributesInput, option],\n );\n const check = useCallback(\n async () => {\n const { reg, min, max, type, name, check, length, regMsg, locale, compare, required, msgOnSuccess, customFunc } = option;\n if (!check) {\n return;\n }\n if (type) {\n if (VALIDATE_OPTION_TYPE_LIST.indexOf(type) !== -1) {\n if (!message[locale] || !message[locale][TYPE]) {\n console.error(REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE);\n return;\n }\n const msg = message[locale][TYPE];\n const nameText = name ? name : '';\n if (required) {\n if (validator.empty(internalValue)) {\n handleCheckEnd(true, msg.empty(nameText));\n return;\n }\n }\n if (String(internalValue) !== '') {\n if (reg) {\n if (validator['reg'](reg, internalValue)) {\n handleCheckEnd(true, regMsg !== '' ? regMsg : msg.invalid(nameText));\n return;\n }\n }\n if (type === VALIDATE_OPTION_TYPE_LIST[0]) {\n if (min || max) {\n if (min && max) {\n if (String(internalValue).length < min || String(internalValue).length > max) {\n handleCheckEnd(true, msg.inBetween(nameText)(min)(max));\n return;\n }\n } else {\n if (min) {\n if (String(internalValue).length < min) {\n handleCheckEnd(true, msg.lessThan(nameText)(min));\n return;\n }\n }\n if (max) {\n if (String(internalValue).length > max) {\n handleCheckEnd(true, msg.greaterThan(nameText)(max));\n return;\n }\n }\n }\n }\n if (length) {\n if (String(internalValue).length !== length) {\n handleCheckEnd(true, msg.lengthEqual(nameText)(length));\n return;\n }\n }\n }\n if (type === VALIDATE_OPTION_TYPE_LIST[1]) {\n if (!validator[type](internalValue, null, null)) {\n handleCheckEnd(true, msg.invalid(nameText));\n return;\n }\n if (min || max) {\n if (min && max) {\n if (!validator[type](internalValue, min, max)) {\n handleCheckEnd(true, msg.inBetween(nameText)(min)(max));\n return;\n }\n } else {\n if (min) {\n if (!validator[type](internalValue, min)) {\n handleCheckEnd(true, msg.lessThan(nameText)(min));\n return;\n }\n }\n if (max) {\n if (!validator[type](internalValue, 0, max)) {\n handleCheckEnd(true, msg.greaterThan(nameText)(max));\n return;\n }\n }\n }\n }\n if (length) {\n if (String(internalValue).length !== length) {\n handleCheckEnd(true, msg.lengthEqual(nameText)(length));\n return;\n }\n }\n }\n if (compare && compare !== '') {\n if (internalValue !== compare) {\n handleCheckEnd(true, msg.twoInputsNotEqual());\n return;\n }\n }\n }\n if (customFunc && typeof customFunc === 'function') {\n const customFuncResult = await customFunc(internalValue);\n /* istanbul ignore next because of async problem */\n if (typeof customFuncResult === 'object') {\n if (typeof customFuncResult.error === 'boolean' && typeof customFuncResult.message === 'string') {\n if (customFuncResult.error === false && customFuncResult.showOnSuccess === true) {\n setSuccessMsg(customFuncResult.message);\n }\n handleCheckEnd(customFuncResult.error, customFuncResult.message, true);\n }\n return;\n }\n /* istanbul ignore next because of async problem */\n if (customFuncResult !== true) {\n handleCheckEnd(true, customFuncResult, true);\n return;\n }\n }\n if (msgOnSuccess) {\n setSuccessMsg(msgOnSuccess);\n }\n handleCheckEnd(false, msgOnSuccess);\n } else {\n console.error(`The valid ${utils.toCamelCase(TYPE)(true)} \"type\" options in validationOption are [${VALIDATE_OPTION_TYPE_LIST.map(i => i)}]`);\n }\n } else {\n console.error('Please provide \"type\" in validationOption');\n }\n },\n [internalValue, option],\n );\n const handleCheckEnd = useCallback((err: boolean, message: string, fromCustomFunc: boolean = false) => {\n let msg = message;\n const { msgOnError } = option;\n if (err && msgOnError && !fromCustomFunc) {\n msg = msgOnError;\n }\n setErr(err);\n setMsg(msg);\n validationCallback && validationCallback(err);\n }, [option.msgOnError]);\n useEffect(\n () => {\n if (validate) {\n check();\n }\n },\n [validate],\n );\n useEffect(\n () => {\n setInternalValue(String(value));\n },\n [value],\n );\n useEffect(\n () => {\n /* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */\n if (typeof prevInternalValue !== 'undefined' && prevInternalValue !== internalValue) {\n if (option.customFunc && onKeyUp) {\n check();\n }\n }\n },\n [internalValue],\n );\n useEffect(\n () => {\n if (asyncObj) {\n if (asyncObj.message) {\n if (asyncObj.showOnError) {\n handleCheckEnd(asyncObj.error, asyncObj.message);\n }\n if (!asyncObj.error && asyncObj.showOnSuccess) {\n setSuccessMsg(asyncObj.message);\n }\n }\n }\n },\n [asyncMsgObj],\n );\n const wrapperClass = `${classNameWrapper} ${reactInputsValidationCss[`${TYPE}__wrapper`]} ${err && reactInputsValidationCss['error']} ${successMsg !== '' &&\n !err &&\n reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const containerClass = `${classNameContainer} ${reactInputsValidationCss[`${TYPE}__container`]} ${err && reactInputsValidationCss['error']} ${successMsg !== '' &&\n !err &&\n reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const inputClass = `${classNameInput} ${reactInputsValidationCss[`${TYPE}__input`]} ${err && reactInputsValidationCss['error']} ${successMsg !== '' &&\n !err &&\n reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const errMsgClass = `${MSG_CLASS_IDENTITIFIER} ${reactInputsValidationCss['msg']} ${err && reactInputsValidationCss['error']}`;\n const successMsgClass = `${MSG_CLASS_IDENTITIFIER} ${reactInputsValidationCss['msg']} ${!err && reactInputsValidationCss['success']}`;\n let msgHtml;\n const { showMsg } = option;\n if (showMsg && err && msg) {\n msgHtml =
{msg}
;\n }\n if (showMsg && !err && successMsg !== '') {\n msgHtml =
{successMsg}
;\n }\n return (\n
\n
\n \n {label && attributesInput.id && }\n
\n {msgHtml}\n
\n );\n};\nexport default memo(component);\n","import * as React from 'react';\nconst { useState, useEffect, useCallback, useRef, memo } = React;\nimport message from './message';\nimport validator from './validator';\nimport utils from './utils';\nimport { REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE, DEFAULT_LOCALE, MSG_CLASS_IDENTITIFIER, usePrevious } from './const';\nimport reactInputsValidationCss from './react-inputs-validation.css';\nconst TYPE = 'textarea';\nconst VALIDATE_OPTION_TYPE_LIST = ['string'];\ninterface DefaultValidationOption {\n locale?: string;\n reg?: string;\n min?: number;\n max?: number;\n type?: string;\n name?: string;\n check?: boolean;\n showMsg?: boolean;\n length?: number;\n regMsg?: string;\n required?: boolean;\n msgOnError?: string;\n msgOnSuccess?: string;\n customFunc?: Function | undefined;\n}\nconst getDefaultValidationOption = (obj: DefaultValidationOption) => {\n let { reg, min, max, type, name, check, length, regMsg, required, showMsg, locale, msgOnError, msgOnSuccess, customFunc } = obj;\n locale = typeof locale !== 'undefined' ? locale : DEFAULT_LOCALE;\n reg = typeof reg !== 'undefined' ? reg : '';\n min = typeof min !== 'undefined' ? min : 0;\n max = typeof max !== 'undefined' ? max : 0;\n type = typeof type !== 'undefined' ? type : 'string';\n name = typeof name !== 'undefined' ? name : '';\n check = typeof check !== 'undefined' ? check : true;\n showMsg = typeof showMsg !== 'undefined' ? showMsg : true;\n length = typeof length !== 'undefined' ? length : 0;\n regMsg = typeof regMsg !== 'undefined' ? regMsg : '';\n required = typeof required !== 'undefined' ? required : true;\n msgOnError = typeof msgOnError !== 'undefined' ? msgOnError : '';\n msgOnSuccess = typeof msgOnSuccess !== 'undefined' ? msgOnSuccess : '';\n customFunc = typeof customFunc !== 'undefined' ? customFunc : undefined;\n return {\n reg,\n min,\n max,\n type,\n name,\n check,\n length,\n regMsg,\n locale,\n required,\n showMsg,\n msgOnError,\n msgOnSuccess,\n customFunc,\n };\n};\ninterface DefaultAsyncMsgObj {\n error?: boolean;\n message?: string;\n showOnError?: boolean;\n showOnSuccess?: boolean;\n}\nconst getDefaultAsyncObj = (obj: DefaultAsyncMsgObj) => {\n let { error, message, showOnError, showOnSuccess } = obj;\n error = typeof error !== 'undefined' ? error : false;\n message = typeof message !== 'undefined' ? message : '';\n showOnError = typeof showOnError !== 'undefined' ? showOnError : true;\n showOnSuccess = typeof showOnSuccess !== 'undefined' ? showOnSuccess : false;\n return {\n error,\n message,\n showOnError,\n showOnSuccess,\n };\n};\ninterface AttributesInputObj {\n maxLength?: number;\n}\ninterface Props {\n attributesWrapper?: object;\n attributesInput?: AttributesInputObj;\n value?: string;\n disabled?: boolean;\n validate?: boolean;\n classNameInput?: string;\n classNameWrapper?: string;\n classNameContainer?: string;\n customStyleInput?: object;\n customStyleWrapper?: object;\n customStyleContainer?: object;\n validationOption?: object;\n asyncMsgObj?: object;\n onChange: (res: string, e: React.ChangeEvent) => void;\n onBlur?: (e: React.FocusEvent) => void;\n onFocus?: (e: React.FocusEvent) => void;\n onClick?: (e: React.MouseEvent) => void;\n onKeyUp?: (e: React.KeyboardEvent) => void;\n validationCallback?: (res: boolean) => void;\n}\n\nconst component: React.FC = ({\n attributesWrapper = {},\n attributesInput = {},\n value = '',\n disabled = false,\n validate = false,\n classNameInput = '',\n classNameWrapper = '',\n classNameContainer = '',\n customStyleInput = {},\n customStyleWrapper = {},\n customStyleContainer = {},\n validationOption = {},\n asyncMsgObj = {},\n onChange = () => {},\n onBlur = null,\n onFocus = null,\n onClick = null,\n onKeyUp = null,\n validationCallback = null,\n}) => {\n const [err, setErr] = useState(false);\n const [msg, setMsg] = useState('');\n const [successMsg, setSuccessMsg] = useState('');\n const [internalValue, setInternalValue] = useState(String(value));\n const prevInternalValue = usePrevious(internalValue);\n const option = getDefaultValidationOption(validationOption);\n const asyncObj = getDefaultAsyncObj(asyncMsgObj);\n const $input = useRef(null);\n const $el: { [key: string]: any } | null = $input;\n const handleOnBlur = useCallback(\n (e: React.FocusEvent) => {\n if (onBlur) {\n check();\n onBlur(e);\n }\n },\n [internalValue, option],\n );\n const handleOnFocus = useCallback((e: React.FocusEvent) => {\n if (onFocus) {\n onFocus(e);\n }\n }, []);\n const handleOnClick = useCallback((e: React.MouseEvent) => {\n if (onClick) {\n onClick(e);\n }\n }, []);\n const handleOnKeyUp = useCallback(\n (e: React.KeyboardEvent) => {\n if (onKeyUp) {\n const { keyCode } = e;\n const keyCodeTab = 9;\n if (keyCode !== keyCodeTab) {\n check();\n }\n onKeyUp(e);\n }\n },\n [internalValue, option],\n );\n const handleOnChange = useCallback(\n (e: React.ChangeEvent) => {\n if (disabled || $el === null) {\n return;\n }\n const v = $el.current.value;\n if (typeof attributesInput.maxLength !== 'undefined') {\n if ((typeof attributesInput.maxLength === 'string' && attributesInput.maxLength !== '') || (typeof attributesInput.maxLength === 'number' && attributesInput.maxLength !== 0)) {\n if (v.length > Number(attributesInput.maxLength)) {\n return;\n }\n }\n }\n setInternalValue(v);\n onChange && onChange(v, e);\n if (err) {\n setErr(false);\n } else {\n setSuccessMsg('');\n }\n },\n [err],\n );\n const check = useCallback(\n async () => {\n const { reg, min, max, type, name, check, length, regMsg, locale, required, msgOnSuccess, customFunc } = option;\n if (!check) {\n return;\n }\n if (type) {\n if (VALIDATE_OPTION_TYPE_LIST.indexOf(type) !== -1) {\n if (!message[locale] || !message[locale][TYPE]) {\n console.error(REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE);\n return;\n }\n const msg = message[locale][TYPE];\n const nameText = name ? name : '';\n if (required) {\n if (validator.empty(internalValue)) {\n handleCheckEnd(true, msg.empty(nameText));\n return;\n }\n }\n if (String(internalValue) !== '') {\n if (reg) {\n if (validator['reg'](reg, internalValue)) {\n handleCheckEnd(true, regMsg !== '' ? regMsg : msg.invalid(nameText));\n return;\n }\n }\n if (min || max) {\n if (min && max) {\n if (String(internalValue).length < min || String(internalValue).length > max) {\n handleCheckEnd(true, msg.inBetween(nameText)(min)(max));\n return;\n }\n } else {\n if (min) {\n if (String(internalValue).length < min) {\n handleCheckEnd(true, msg.lessThan(nameText)(min));\n return;\n }\n }\n if (max) {\n if (String(internalValue).length > max) {\n handleCheckEnd(true, msg.greaterThan(nameText)(max));\n return;\n }\n }\n }\n }\n if (length) {\n if (String(internalValue).length !== length) {\n handleCheckEnd(true, msg.lengthEqual(nameText)(length));\n return;\n }\n }\n }\n if (customFunc && typeof customFunc === 'function') {\n const customFuncResult = await customFunc(internalValue);\n /* istanbul ignore next because of async problem */\n if (typeof customFuncResult === 'object') {\n if (typeof customFuncResult.error === 'boolean' && typeof customFuncResult.message === 'string') {\n if (customFuncResult.error === false && customFuncResult.showOnSuccess === true) {\n setSuccessMsg(customFuncResult.message);\n }\n handleCheckEnd(customFuncResult.error, customFuncResult.message, true);\n }\n return;\n }\n /* istanbul ignore next because of async problem */\n if (customFuncResult !== true) {\n handleCheckEnd(true, customFuncResult, true);\n return;\n }\n }\n if (msgOnSuccess) {\n setSuccessMsg(msgOnSuccess);\n }\n handleCheckEnd(false, msgOnSuccess);\n } else {\n console.error(`The valid ${utils.toCamelCase(TYPE)(true)} \"type\" options in validationOption are [${VALIDATE_OPTION_TYPE_LIST.map(i => i)}]`);\n }\n } else {\n console.error('Please provide \"type\" in validationOption');\n }\n },\n [internalValue, option],\n );\n const handleCheckEnd = useCallback((err: boolean, message: string, fromCustomFunc: boolean = false) => {\n let msg = message;\n const { msgOnError } = option;\n if (err && msgOnError && !fromCustomFunc) {\n msg = msgOnError;\n }\n setErr(err);\n setMsg(msg);\n validationCallback && validationCallback(err);\n }, [option.msgOnError]);\n useEffect(\n () => {\n if (validate) {\n check();\n }\n },\n [validate],\n );\n useEffect(\n () => {\n setInternalValue(String(value));\n },\n [value],\n );\n useEffect(\n () => {\n /* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */\n if (typeof prevInternalValue !== 'undefined' && prevInternalValue !== internalValue) {\n if (option.customFunc && onKeyUp) {\n check();\n }\n }\n },\n [internalValue],\n );\n useEffect(\n () => {\n if (asyncObj) {\n if (asyncObj.message) {\n if (asyncObj.showOnError) {\n handleCheckEnd(asyncObj.error, asyncObj.message);\n }\n if (!asyncObj.error && asyncObj.showOnSuccess) {\n setSuccessMsg(asyncObj.message);\n }\n }\n }\n },\n [asyncMsgObj],\n );\n const wrapperClass = `${classNameWrapper} ${reactInputsValidationCss[`${TYPE}__wrapper`]} ${err && reactInputsValidationCss['error']} ${successMsg !== '' &&\n !err &&\n reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const containerClass = `${classNameContainer} ${reactInputsValidationCss[`${TYPE}__container`]} ${err && reactInputsValidationCss['error']} ${successMsg !== '' &&\n !err &&\n reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const inputClass = `${classNameInput} ${reactInputsValidationCss[`${TYPE}__input`]} ${err && reactInputsValidationCss['error']} ${successMsg !== '' &&\n !err &&\n reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const errMsgClass = `${MSG_CLASS_IDENTITIFIER} ${reactInputsValidationCss['msg']} ${err && reactInputsValidationCss['error']}`;\n const successMsgClass = `${MSG_CLASS_IDENTITIFIER} ${reactInputsValidationCss['msg']} ${!err && reactInputsValidationCss['success']}`;\n let msgHtml;\n const { showMsg } = option;\n if (showMsg && err && msg) {\n msgHtml =
{msg}
;\n }\n if (showMsg && !err && successMsg !== '') {\n msgHtml =
{successMsg}
;\n }\n return (\n
\n
\n \n
\n {msgHtml}\n
\n );\n};\nexport default memo(component);\n","import * as React from 'react';\nconst { useState, useEffect, useCallback, useRef, useMemo, memo } = React;\nimport message from './message';\nimport { REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE, DEFAULT_LOCALE, WRAPPER_CLASS_IDENTITIFIER, CONTAINER_CLASS_IDENTITIFIER, MSG_CLASS_IDENTITIFIER, usePrevious } from './const';\nimport utils from './utils';\nimport reactInputsValidationCss from './react-inputs-validation.css';\nconst TYPE = 'select';\nconst keyCodeEsc = 27;\nconst keyCodeDown = 40;\nconst keyCodeUp = 38;\nconst keyCodeEnter = 13;\nconst selectKeyList = [keyCodeEsc, keyCodeDown, keyCodeUp, keyCodeEnter];\n/* istanbul ignore next */\nif (!String.prototype.startsWith) {\n String.prototype.startsWith = function(searchString, position) {\n const p = position || 0;\n return this.indexOf(searchString, p) === p;\n };\n}\ninterface DefaultValidationOption {\n name?: string;\n check?: boolean;\n showMsg?: boolean;\n required?: boolean;\n locale?: string;\n msgOnError?: string;\n msgOnSuccess?: string;\n}\nconst getDefaultValidationOption = (obj: DefaultValidationOption) => {\n let { name, check, required, showMsg, locale, msgOnError, msgOnSuccess } = obj;\n locale = typeof locale !== 'undefined' ? locale : DEFAULT_LOCALE;\n name = typeof name !== 'undefined' ? name : '';\n check = typeof check !== 'undefined' ? check : true;\n showMsg = typeof showMsg !== 'undefined' ? showMsg : true;\n required = typeof required !== 'undefined' ? required : true;\n msgOnSuccess = typeof msgOnSuccess !== 'undefined' ? msgOnSuccess : '';\n msgOnError = typeof msgOnError !== 'undefined' ? msgOnError : '';\n return {\n name,\n check,\n showMsg,\n required,\n locale,\n msgOnError,\n msgOnSuccess,\n };\n};\ninterface DefaultAsyncMsgObj {\n error?: boolean;\n message?: string;\n showOnError?: boolean;\n showOnSuccess?: boolean;\n}\nconst getDefaultAsyncObj = (obj: DefaultAsyncMsgObj) => {\n let { error, message, showOnError, showOnSuccess } = obj;\n error = typeof error !== 'undefined' ? error : false;\n message = typeof message !== 'undefined' ? message : '';\n showOnError = typeof showOnError !== 'undefined' ? showOnError : true;\n showOnSuccess = typeof showOnSuccess !== 'undefined' ? showOnSuccess : false;\n return {\n error,\n message,\n showOnError,\n showOnSuccess,\n };\n};\nexport const isValidValue = (list: OptionListItem[], value: any) => {\n let res = false;\n if (list.length) {\n for (let i = 0; i < list.length; i += 1) {\n if (list[i].id === value) {\n res = true;\n break;\n }\n }\n }\n return res;\n};\nexport const getItem = (list: OptionListItem[], value: any) => {\n let res = null;\n if (list.length) {\n for (let i = 0; i < list.length; i += 1) {\n if (list[i].id === value) {\n res = list[i];\n break;\n }\n }\n }\n return res;\n};\nexport const getIndex = (list: OptionListItem[], value: string) => {\n let key = -1;\n for (let i = 0; i < list.length; i += 1) {\n if (list[i].id === value) {\n key = i;\n break;\n }\n }\n return key;\n};\ninterface OptionListItem {\n id: string;\n name: string;\n}\ninterface Props {\n attributesWrapper?: object;\n attributesInput?: object;\n value?: string | number;\n disabled?: boolean;\n validate?: boolean;\n showSearch?: boolean;\n showArrow?: boolean;\n keyword?: string;\n optionList: OptionListItem[];\n onChange: (res: object, e: React.MouseEvent) => void;\n onBlur?: (e: React.FocusEvent | Event) => void;\n onFocus?: (e: React.FocusEvent) => void;\n onClick?: (e: React.MouseEvent) => void;\n validationOption?: object;\n asyncMsgObj?: object;\n classNameWrapper?: string;\n classNameContainer?: string;\n classNameSelect?: string;\n classNameOptionListContainer?: string;\n classNameDropdownIconOptionListItem?: string;\n classNameOptionListItem?: string;\n customStyleWrapper?: object;\n customStyleContainer?: object;\n customStyleSelect?: object;\n customStyleOptionListContainer?: object;\n customStyleDropdownIcon?: object;\n customStyleOptionListItem?: object;\n validationCallback?: (res: boolean) => void;\n}\ninterface Node {\n [key: string]: any;\n}\nlet globalVariableIsFocusing: boolean = false;\nlet globalVariableIsCorrected: boolean = false;\nlet globalVariableCurrentFocus: any | null = null;\nlet globalVariableTypingTimeout: any | null = null;\nconst component: React.FC = ({\n attributesWrapper = {},\n attributesInput = {},\n value = '',\n disabled = false,\n validate = false,\n showSearch = false,\n showArrow = true,\n keyword = '',\n optionList = [],\n classNameWrapper = '',\n classNameContainer = '',\n classNameSelect = '',\n classNameOptionListItem = '',\n classNameOptionListContainer = '',\n classNameDropdownIconOptionListItem = '',\n customStyleWrapper = {},\n customStyleContainer = {},\n customStyleSelect = {},\n customStyleOptionListItem = {},\n customStyleOptionListContainer = {},\n customStyleDropdownIcon = {},\n validationOption = {},\n asyncMsgObj = {},\n onChange = () => {},\n onBlur = null,\n onFocus = null,\n onClick = null,\n validationCallback = null,\n}) => {\n const [err, setErr] = useState(false);\n const [msg, setMsg] = useState('');\n const [successMsg, setSuccessMsg] = useState('');\n const [internalValue, setInternalValue] = useState(String(value));\n const stateKeyword = useState(keyword);\n const prevKeyword = usePrevious(stateKeyword[0]);\n const prevInternalValue = usePrevious(internalValue);\n const prevOptionList = usePrevious(optionList);\n const [show, setShow] = useState(false);\n const prevShow = usePrevious(show);\n const [isTyping, setIsTyping] = useState(false);\n const initKeycodeList: number[] = [];\n const [keycodeList, setKeycodeList] = useState(initKeycodeList);\n const option = getDefaultValidationOption(validationOption);\n const asyncObj = getDefaultAsyncObj(asyncMsgObj);\n const $button = useRef(null);\n const $wrapper = useRef(null);\n const $itemsWrapper = useRef(null);\n const $searchInputWrapper = useRef(null);\n const $searchInput = useRef(null);\n const $elButton: { [key: string]: any } | null = $button;\n const $elWrapper: { [key: string]: any } | null = $wrapper;\n const $elItemsWrapper: { [key: string]: any } | null = $itemsWrapper;\n const $itemsRef: { [key: string]: any } = [];\n const filteredOptionList = useMemo(() => {\n let res = optionList;\n if (res.length) {\n if (stateKeyword[0]) {\n res = optionList.filter(i => i.name.toLowerCase().includes(stateKeyword[0].toLowerCase()));\n }\n }\n return res;\n }, [stateKeyword[0], optionList]);\n const handleOnSearch = useCallback((e: any) => {\n stateKeyword[1](e.target.value);\n }, []);\n const handleOnSearchKeyDown = useCallback(\n (e: any) => {\n const { keyCode } = e;\n const direction = getDirection(keyCode);\n if (selectKeyList.indexOf(keyCode) !== -1) {\n e.preventDefault();\n handleOnKeyDown(keyCode);\n } else if (keyCode === 32) {\n // space\n stateKeyword[1](`${stateKeyword[0]} `);\n e.preventDefault();\n }\n scroll(direction);\n },\n [filteredOptionList],\n );\n useEffect(() => {\n if (show && showSearch) {\n globalVariableCurrentFocus = 0;\n scroll('up');\n addActive();\n }\n }, [stateKeyword[0]]);\n const handleOnBlur = useCallback(\n (e: React.FocusEvent | Event) => {\n if (onBlur) {\n check();\n onBlur(e);\n }\n },\n [internalValue, option],\n );\n const handleOnFocus = useCallback((e: React.FocusEvent) => {\n if (onFocus) {\n onFocus(e);\n }\n }, []);\n const handleOnClick = useCallback((e: React.MouseEvent) => {\n if (onClick) {\n onClick(e);\n }\n }, []);\n const handleOnChange = useCallback((item: object, e: React.MouseEvent) => {\n if (disabled) {\n return;\n }\n onChange && onChange(item, e);\n }, []);\n const check = useCallback(() => {\n const { name, check, locale, required, msgOnSuccess } = option;\n if (!check) {\n return;\n }\n if (!message[locale] || !message[locale][TYPE]) {\n console.error(REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE);\n return;\n }\n if (required) {\n const msg = message[locale][TYPE];\n const nameText = name ? name : '';\n if (!isValidValue(optionList, internalValue) || internalValue === '' || internalValue === 'null' || internalValue === 'undefined') {\n handleCheckEnd(true, msg.empty(nameText));\n return;\n }\n }\n if (msgOnSuccess) {\n setSuccessMsg(msgOnSuccess);\n }\n handleCheckEnd(false, msgOnSuccess);\n }, [internalValue, option]);\n const handleCheckEnd = useCallback(\n (err: boolean, message: string) => {\n let msg = message;\n const { msgOnError } = option;\n if (err && msgOnError) {\n msg = msgOnError;\n }\n setErr(err);\n setMsg(msg);\n validationCallback && validationCallback(err);\n },\n [option.msgOnError],\n );\n /* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */\n useEffect(() => {\n if (typeof window !== 'undefined') {\n window.addEventListener('mousedown', pageClick);\n window.addEventListener('touchstart', pageClick);\n return () => {\n window.removeEventListener('mousedown', pageClick);\n window.removeEventListener('touchstart', pageClick);\n $elWrapper.current.removeEventListener('keydown', onKeyDown);\n };\n }\n }, []);\n /* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */\n const pageClick = useCallback((e: Event) => {\n if ($elWrapper.current.contains(e.target)) {\n return;\n }\n if (globalVariableIsFocusing) {\n handleOnBlur(e);\n globalVariableIsFocusing = false;\n }\n setShow(false);\n }, []);\n /* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */\n const resetCurrentFocus = useCallback(() => {\n globalVariableCurrentFocus = getIndex(filteredOptionList, internalValue);\n scroll();\n }, [internalValue]);\n /* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */\n const setTimeoutTyping = useCallback(() => {\n if (globalVariableTypingTimeout) {\n clearTimeout(globalVariableTypingTimeout);\n }\n globalVariableTypingTimeout = setTimeout(() => {\n setKeycodeList([]);\n }, 250);\n }, []);\n /* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */\n const scroll = useCallback((direction: undefined | string = undefined) => {\n if ($itemsWrapper && $itemsWrapper.current && $itemsWrapper.current.children) {\n const $children = $itemsWrapper.current.children;\n const containerHeight = $elItemsWrapper.current.offsetHeight;\n const containerScrollTop = $elItemsWrapper.current.scrollTop;\n if (!$children[globalVariableCurrentFocus]) {\n return;\n }\n const itemHeight = $children[globalVariableCurrentFocus].offsetHeight;\n if (direction) {\n if (direction === 'loop') {\n $elItemsWrapper.current.scrollTop = $children.length * itemHeight;\n return;\n }\n if (direction === 'down') {\n const bound = containerScrollTop + containerHeight;\n const heightItems = globalVariableCurrentFocus * itemHeight;\n const heightContainer = bound - itemHeight;\n if (heightItems >= heightContainer) {\n const offset = Math.abs(heightItems - heightContainer - itemHeight);\n if (offset >= 0 && !globalVariableIsCorrected) {\n $elItemsWrapper.current.scrollTop = containerScrollTop + itemHeight - offset;\n globalVariableIsCorrected = true;\n } else {\n $elItemsWrapper.current.scrollTop = containerScrollTop + itemHeight;\n }\n }\n }\n if (direction === 'up') {\n globalVariableIsCorrected = false;\n if (globalVariableCurrentFocus * itemHeight <= containerScrollTop) {\n $elItemsWrapper.current.scrollTop = globalVariableCurrentFocus * itemHeight;\n }\n }\n } else {\n globalVariableIsCorrected = false;\n $elItemsWrapper.current.scrollTop = globalVariableCurrentFocus * itemHeight;\n }\n }\n }, []);\n const handleOnItemClick = useCallback((item: object, e: React.MouseEvent) => {\n handleOnChange(item, e);\n stateKeyword[1]('');\n }, []);\n const handleOnItemMouseOver = useCallback((index: number) => {\n globalVariableCurrentFocus = index;\n addActive();\n }, []);\n const handleOnItemMouseMove = useCallback(() => {\n setIsTyping(false);\n }, []);\n const handleOnItemMouseOut = useCallback(() => {\n removeActive();\n }, []);\n const addActive = useCallback(() => {\n if ($itemsWrapper && $itemsWrapper.current && $itemsWrapper.current.children) {\n const $children = $itemsWrapper.current.children;\n removeActive();\n if (globalVariableCurrentFocus === null) return;\n if (globalVariableCurrentFocus >= $children.length) globalVariableCurrentFocus = 0;\n if (globalVariableCurrentFocus < 0) globalVariableCurrentFocus = $children.length - 1;\n if ($children[globalVariableCurrentFocus]) $children[globalVariableCurrentFocus].className += ` ${reactInputsValidationCss[`${TYPE}__hover-active`]}`;\n }\n }, []);\n const removeActive = useCallback(() => {\n if ($itemsWrapper && $itemsWrapper.current && $itemsWrapper.current.children) {\n const $children = $itemsWrapper.current.children;\n for (let i = 0; i < $children.length; i += 1) {\n $children[i].className = $children[i].className.replace(reactInputsValidationCss[`${TYPE}__hover-active`], '');\n }\n }\n }, []);\n const getDirection = useCallback(keyCode => {\n switch (keyCode) {\n case keyCodeUp:\n return 'up';\n case keyCodeDown:\n return 'down';\n default:\n return undefined;\n }\n }, []);\n const handleOnKeyDown = useCallback(\n keyCode => {\n if (keyCode === keyCodeEsc) {\n setShow(false);\n resetCurrentFocus();\n return;\n }\n if (keyCode === keyCodeDown) {\n globalVariableCurrentFocus += 1;\n if (globalVariableCurrentFocus > filteredOptionList.length - 1) {\n globalVariableCurrentFocus = 0;\n scroll('up');\n }\n addActive();\n } else if (keyCode === keyCodeUp) {\n globalVariableCurrentFocus -= 1;\n if (globalVariableCurrentFocus < 0) {\n globalVariableCurrentFocus = filteredOptionList.length - 1;\n scroll('loop');\n }\n addActive();\n } else if (keyCode === keyCodeEnter) {\n if (globalVariableCurrentFocus > -1) {\n if ($itemsWrapper && $itemsWrapper.current && $itemsWrapper.current.children) {\n const $children = $itemsWrapper.current.children;\n if ($children[globalVariableCurrentFocus]) {\n $children[globalVariableCurrentFocus].click();\n } else {\n return;\n }\n }\n }\n }\n },\n [filteredOptionList],\n );\n /* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */\n const onKeyDown = useCallback(\n (e: any) => {\n if (showSearch) {\n return;\n }\n setIsTyping(true);\n if (e.preventDefault) {\n e.preventDefault();\n }\n if (!show) {\n return;\n }\n globalVariableCurrentFocus = globalVariableCurrentFocus === null ? getIndex(filteredOptionList, String(value)) : globalVariableCurrentFocus;\n const { keyCode } = e;\n const direction = getDirection(keyCode);\n if (selectKeyList.indexOf(keyCode) !== -1) {\n handleOnKeyDown(keyCode);\n } else {\n setTimeoutTyping();\n const newkeyCodeList = [...keycodeList, keyCode];\n const str = String.fromCharCode(...newkeyCodeList).toLowerCase();\n let index = -1;\n filteredOptionList.forEach((i, k) => {\n const { name } = i;\n if (name.toLowerCase().startsWith(str)) {\n if (index === -1) {\n index = k;\n }\n }\n });\n if (index !== -1) {\n globalVariableCurrentFocus = index;\n addActive();\n }\n setKeycodeList(newkeyCodeList);\n }\n scroll(direction);\n return globalVariableCurrentFocus;\n },\n [show, value, keycodeList],\n );\n useEffect(() => {\n if (show && $elWrapper) {\n document.addEventListener('keydown', onKeyDown);\n }\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n };\n }, [show, value, keycodeList]);\n useEffect(() => {\n if (validate) {\n check();\n }\n }, [validate]);\n useEffect(() => {\n if (!(!isValidValue(filteredOptionList, internalValue) || internalValue === '' || internalValue === 'null' || internalValue === 'undefined')) {\n setErr(false);\n } else {\n setSuccessMsg('');\n }\n }, [internalValue]);\n useEffect(() => {\n setInternalValue(String(value));\n }, [value]);\n useEffect(() => {\n if (prevOptionList && prevOptionList && !utils.arraysEqual(prevOptionList, optionList)) {\n setInternalValue(String(optionList[0].id));\n }\n }, [optionList]);\n useEffect(() => {\n if (typeof prevInternalValue !== 'undefined' && prevInternalValue !== internalValue) {\n check();\n }\n }, [prevInternalValue, internalValue]);\n useEffect(() => {\n if (asyncObj) {\n if (asyncObj.message) {\n if (asyncObj.showOnError) {\n handleCheckEnd(asyncObj.error, asyncObj.message);\n }\n if (!asyncObj.error && asyncObj.showOnSuccess) {\n setSuccessMsg(asyncObj.message);\n }\n }\n }\n }, [asyncMsgObj]);\n useEffect(() => {\n if (show) {\n if (showSearch) {\n $searchInput.current.focus();\n }\n globalVariableCurrentFocus = globalVariableCurrentFocus === null ? getIndex(filteredOptionList, String(value)) : globalVariableCurrentFocus;\n $itemsRef[globalVariableCurrentFocus] && $itemsRef[globalVariableCurrentFocus].current.focus();\n }\n if (prevShow === true && show === false) {\n $elButton.current.focus();\n }\n resetCurrentFocus();\n }, [show]);\n const wrapperClass = `${WRAPPER_CLASS_IDENTITIFIER} ${classNameWrapper} ${reactInputsValidationCss[`${TYPE}__wrapper`]} ${err && reactInputsValidationCss['error']} ${successMsg !== '' &&\n !err &&\n reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const containerClass = `${CONTAINER_CLASS_IDENTITIFIER} ${classNameContainer} ${reactInputsValidationCss[`${TYPE}__container`]} ${err && reactInputsValidationCss['error']} ${show &&\n reactInputsValidationCss['show']} ${successMsg !== '' && !err && reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const inputClass = `${reactInputsValidationCss[`${TYPE}__input`]} ${err && reactInputsValidationCss['error']} ${successMsg !== '' && !err && reactInputsValidationCss['success']} ${disabled &&\n reactInputsValidationCss['disabled']}`;\n const selectClass = `${classNameSelect} ${reactInputsValidationCss['ellipsis']} ${err && reactInputsValidationCss['error']} ${successMsg !== '' &&\n !err &&\n reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const selectOptionListContainerClass = `${classNameOptionListContainer} ${reactInputsValidationCss[`${TYPE}__options-container`]} ${err && reactInputsValidationCss['error']} ${show &&\n reactInputsValidationCss['show']} ${successMsg !== '' && !err && reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const selectOptionListItemClass = `${reactInputsValidationCss[`button`]} ${!isTyping && reactInputsValidationCss[`${TYPE}__options-item-show-cursor`]} ${classNameOptionListItem} ${\n reactInputsValidationCss[`${TYPE}__options-item`]\n } ${err && reactInputsValidationCss['error']} ${successMsg !== '' && !err && reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const dropdownIconClass = `${classNameDropdownIconOptionListItem} ${reactInputsValidationCss[`${TYPE}__dropdown-icon`]} ${showArrow && reactInputsValidationCss['showArrow']}`;\n const errMsgClass = `${MSG_CLASS_IDENTITIFIER} ${reactInputsValidationCss['msg']} ${err && reactInputsValidationCss['error']}`;\n const successMsgClass = `${MSG_CLASS_IDENTITIFIER} ${reactInputsValidationCss['msg']} ${!err && reactInputsValidationCss['success']}`;\n let msgHtml;\n const { showMsg } = option;\n if (showMsg && err && msg) {\n msgHtml =
{msg}
;\n }\n if (showMsg && !err && successMsg !== '') {\n msgHtml =
{successMsg}
;\n }\n let optionListHtml;\n const item = getItem(optionList, String(value));\n if (filteredOptionList.length) {\n optionListHtml = filteredOptionList.map((i, k) => (\n \n ));\n } else {\n if (showSearch) {\n optionListHtml = (\n
\n \n \n \n \n
\n );\n }\n }\n const selectorHtml = (\n
\n
{item ? item.name : ''}
\n
\n
\n );\n return (\n {\n handleOnClick(e);\n if (!disabled) {\n if ($searchInputWrapper.current) {\n if ($searchInputWrapper.current.contains(e.target)) {\n setShow(true);\n return;\n }\n }\n setShow(!show);\n }\n }}\n onFocus={handleOnFocus}\n onBlur={handleOnBlur}\n {...attributesWrapper}\n >\n
\n
\n {}} {...attributesInput} />\n
\n {selectorHtml}\n
\n
\n {showSearch && (\n
\n
\n \n \n \n \n \n {stateKeyword[0] && (\n {\n stateKeyword[1]('');\n $searchInput.current.focus();\n }}\n >\n \n \n \n )}\n
\n
\n )}\n
\n {optionListHtml}\n
\n
\n
\n {msgHtml}\n
\n \n );\n};\ninterface OptionProps {\n index?: number;\n id?: string;\n className?: string;\n item?: OptionListItem;\n customStyleOptionListItem?: object;\n onClick?: (res: object, e: React.MouseEvent) => void;\n onMouseOver?: (res: number) => void;\n onMouseMove?: () => void;\n onMouseOut?: () => void;\n}\nexport const Option: React.FC = memo(\n ({ index = -1, id = '', className = '', item = { id: '', name: '' }, customStyleOptionListItem = {}, onClick = () => {}, onMouseOver = () => {}, onMouseMove = () => {}, onMouseOut = () => {} }) => {\n const handleOnClick = useCallback(\n (e: React.MouseEvent) => {\n onClick(item, e);\n },\n [item],\n );\n const handleOnMouseOver = useCallback(() => {\n onMouseOver(index);\n }, []);\n const handleOnMouseMove = useCallback(() => {\n onMouseMove();\n }, []);\n const handleOnMouseOut = useCallback(() => {\n onMouseOut();\n }, []);\n return (\n \n {item.name}\n \n );\n },\n);\nexport default memo(component);\n","import * as React from 'react';\nconst { useState, useEffect, useCallback, useRef, memo } = React;\nimport message from './message';\nimport { REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE, DEFAULT_LOCALE, WRAPPER_CLASS_IDENTITIFIER, MSG_CLASS_IDENTITIFIER, usePrevious } from './const';\nimport utils from './utils';\nimport reactInputsValidationCss from './react-inputs-validation.css';\nconst TYPE = 'checkbox';\ninterface DefaultValidationOption {\n name?: string;\n check?: boolean;\n showMsg?: boolean;\n required?: boolean;\n locale?: string;\n msgOnError?: string;\n msgOnSuccess?: string;\n}\nconst getDefaultValidationOption = (obj: DefaultValidationOption) => {\n let { name, check, required, showMsg, locale, msgOnError, msgOnSuccess } = obj;\n locale = typeof locale !== 'undefined' ? locale : DEFAULT_LOCALE;\n name = typeof name !== 'undefined' ? name : '';\n check = typeof check !== 'undefined' ? check : true;\n showMsg = typeof showMsg !== 'undefined' ? showMsg : true;\n required = typeof required !== 'undefined' ? required : true;\n msgOnSuccess = typeof msgOnSuccess !== 'undefined' ? msgOnSuccess : '';\n msgOnError = typeof msgOnError !== 'undefined' ? msgOnError : '';\n return {\n name,\n check,\n showMsg,\n required,\n locale,\n msgOnError,\n msgOnSuccess,\n };\n};\ninterface DefaultAsyncMsgObj {\n error?: boolean;\n message?: string;\n showOnError?: boolean;\n showOnSuccess?: boolean;\n}\nconst getDefaultAsyncObj = (obj: DefaultAsyncMsgObj) => {\n let { error, message, showOnError, showOnSuccess } = obj;\n error = typeof error !== 'undefined' ? error : false;\n message = typeof message !== 'undefined' ? message : '';\n showOnError = typeof showOnError !== 'undefined' ? showOnError : true;\n showOnSuccess = typeof showOnSuccess !== 'undefined' ? showOnSuccess : false;\n return {\n error,\n message,\n showOnError,\n showOnSuccess,\n };\n};\ninterface Props {\n attributesWrapper?: object;\n attributesInput?: object;\n value?: string | boolean;\n checked?: boolean;\n disabled?: boolean;\n labelHtml?: React.ReactNode;\n validate?: boolean;\n onChange: (res: boolean, e: React.ChangeEvent | React.MouseEvent) => void;\n onBlur?: (e: React.FocusEvent) => void;\n onFocus?: (e: React.FocusEvent) => void;\n onClick?: (e: React.MouseEvent) => void;\n validationOption?: object;\n asyncMsgObj?: object;\n classNameInput?: string;\n classNameWrapper?: string;\n classNameInputBox?: string;\n classNameContainer?: string;\n customStyleInput?: object;\n customStyleWrapper?: object;\n customStyleContainer?: object;\n customStyleInputBox?: object;\n validationCallback?: (res: boolean) => void;\n}\nconst component: React.FC = ({\n attributesWrapper = {},\n attributesInput = {},\n value = '',\n checked = false,\n disabled = false,\n validate = false,\n labelHtml = null,\n classNameInput = '',\n classNameWrapper = '',\n classNameInputBox = '',\n classNameContainer = '',\n customStyleInput = {},\n customStyleWrapper = {},\n customStyleInputBox = {},\n customStyleContainer = {},\n validationOption = {},\n asyncMsgObj = {},\n onChange = () => {},\n onBlur = null,\n onFocus = null,\n onClick = null,\n validationCallback = null,\n}) => {\n const [err, setErr] = useState(false);\n const [msg, setMsg] = useState('');\n const [successMsg, setSuccessMsg] = useState('');\n const [internalChecked, setInternalChecked] = useState(checked);\n const prevInternalChecked = usePrevious(internalChecked);\n const option = getDefaultValidationOption(validationOption);\n const asyncObj = getDefaultAsyncObj(asyncMsgObj);\n const $input = useRef(null);\n const $el: { [key: string]: any } | null = $input;\n const handleOnBlur = useCallback(\n (e: React.FocusEvent) => {\n if (onBlur) {\n check();\n onBlur(e);\n }\n },\n [internalChecked, option],\n );\n const handleOnFocus = useCallback(\n (e: React.FocusEvent) => {\n if (onFocus) {\n onFocus(e);\n }\n },\n [internalChecked],\n );\n const handleOnClick = useCallback(\n (e: React.MouseEvent) => {\n handleOnChange(e);\n if (onClick) {\n onClick(e);\n }\n },\n [err, internalChecked, disabled],\n );\n const handleOnChange = useCallback(\n (e: React.ChangeEvent | React.MouseEvent) => {\n if (disabled || $el === null) {\n return;\n }\n setInternalChecked(!internalChecked);\n onChange && onChange(!internalChecked, e);\n if (err) {\n setErr(false);\n } else {\n setSuccessMsg('');\n }\n },\n [err, internalChecked, disabled],\n );\n const check = useCallback(\n () => {\n const { name, check, locale, required, msgOnSuccess } = option;\n if (!check) {\n return;\n }\n if (!message[locale] || !message[locale][TYPE]) {\n console.error(REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE);\n return;\n }\n if (required) {\n const msg = message[locale][TYPE];\n const nameText = name ? name : '';\n if (!internalChecked) {\n handleCheckEnd(true, msg.unchecked(nameText));\n return;\n }\n }\n if (msgOnSuccess) {\n setSuccessMsg(msgOnSuccess);\n }\n handleCheckEnd(false, msgOnSuccess);\n },\n [internalChecked, option],\n );\n const handleCheckEnd = useCallback((err: boolean, message: string) => {\n let msg = message;\n const { msgOnError } = option;\n if (err && msgOnError) {\n msg = msgOnError;\n }\n setErr(err);\n setMsg(msg);\n validationCallback && validationCallback(err);\n }, [option.msgOnError]);\n useEffect(\n () => {\n if (validate) {\n check();\n }\n },\n [validate, internalChecked],\n );\n useEffect(\n () => {\n setInternalChecked(checked);\n },\n [checked],\n );\n useEffect(\n () => {\n if (typeof prevInternalChecked !== 'undefined' && prevInternalChecked !== internalChecked) {\n check();\n }\n },\n [prevInternalChecked, internalChecked],\n );\n useEffect(\n () => {\n if (asyncObj) {\n if (asyncObj.message) {\n if (asyncObj.showOnError) {\n handleCheckEnd(asyncObj.error, asyncObj.message);\n }\n if (!asyncObj.error && asyncObj.showOnSuccess) {\n setSuccessMsg(asyncObj.message);\n }\n }\n }\n },\n [asyncMsgObj],\n );\n const wrapperClass = `${reactInputsValidationCss['button']} ${WRAPPER_CLASS_IDENTITIFIER} ${classNameWrapper} ${reactInputsValidationCss[`${TYPE}__wrapper`]} ${internalChecked && reactInputsValidationCss['checked']} ${err &&\n reactInputsValidationCss['error']} ${successMsg !== '' && !err && reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const containerClass = `${classNameContainer} ${reactInputsValidationCss[`${TYPE}__container`]} ${internalChecked && reactInputsValidationCss['checked']} ${err &&\n reactInputsValidationCss['error']} ${successMsg !== '' && !err && reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const boxClass = `${classNameInputBox} ${reactInputsValidationCss[`${TYPE}__box`]} ${err && reactInputsValidationCss['error']} ${internalChecked &&\n reactInputsValidationCss['checked']} ${successMsg !== '' && !err && reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const labelClass = `${internalChecked && reactInputsValidationCss['checked']} ${err && reactInputsValidationCss['error']} ${successMsg !== '' &&\n !err &&\n reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const errMsgClass = `${MSG_CLASS_IDENTITIFIER} ${reactInputsValidationCss['msg']} ${err && reactInputsValidationCss['error']}`;\n const successMsgClass = `${MSG_CLASS_IDENTITIFIER} ${reactInputsValidationCss['msg']} ${!err && reactInputsValidationCss['success']}`;\n let msgHtml;\n const { showMsg } = option;\n if (showMsg && err && msg) {\n msgHtml =
{msg}
;\n }\n if (showMsg && !err && successMsg !== '') {\n msgHtml =
{successMsg}
;\n }\n return (\n \n );\n};\nexport default memo(component);\n","import * as React from 'react';\nconst { useState, useEffect, useCallback, useRef, memo } = React;\nimport message from './message';\nimport { REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE, DEFAULT_LOCALE, WRAPPER_CLASS_IDENTITIFIER, OPTION_LIST_ITEM_IDENTITIFIER, MSG_CLASS_IDENTITIFIER, usePrevious } from './const';\nimport utils from './utils';\nimport reactInputsValidationCss from './react-inputs-validation.css';\nconst TYPE = 'radiobox';\ninterface DefaultValidationOption {\n name?: string;\n check?: boolean;\n showMsg?: boolean;\n required?: boolean;\n locale?: string;\n msgOnError?: string;\n msgOnSuccess?: string;\n}\nconst getDefaultValidationOption = (obj: DefaultValidationOption) => {\n let { name, check, required, showMsg, locale, msgOnError, msgOnSuccess } = obj;\n locale = typeof locale !== 'undefined' ? locale : DEFAULT_LOCALE;\n name = typeof name !== 'undefined' ? name : '';\n check = typeof check !== 'undefined' ? check : true;\n showMsg = typeof showMsg !== 'undefined' ? showMsg : true;\n required = typeof required !== 'undefined' ? required : true;\n msgOnSuccess = typeof msgOnSuccess !== 'undefined' ? msgOnSuccess : '';\n msgOnError = typeof msgOnError !== 'undefined' ? msgOnError : '';\n return {\n name,\n check,\n showMsg,\n required,\n locale,\n msgOnError,\n msgOnSuccess,\n };\n};\ninterface DefaultAsyncMsgObj {\n error?: boolean;\n message?: string;\n showOnError?: boolean;\n showOnSuccess?: boolean;\n}\nconst getDefaultAsyncObj = (obj: DefaultAsyncMsgObj) => {\n let { error, message, showOnError, showOnSuccess } = obj;\n error = typeof error !== 'undefined' ? error : false;\n message = typeof message !== 'undefined' ? message : '';\n showOnError = typeof showOnError !== 'undefined' ? showOnError : true;\n showOnSuccess = typeof showOnSuccess !== 'undefined' ? showOnSuccess : false;\n return {\n error,\n message,\n showOnError,\n showOnSuccess,\n };\n};\nexport const isValidValue = (list: OptionListItem[], value: any) => {\n let res = false;\n if (list.length) {\n for (let i = 0; i < list.length; i += 1) {\n if (list[i].id === value) {\n res = true;\n break;\n }\n }\n }\n return res;\n};\ninterface OptionListItem {\n id: string;\n name: string;\n}\ninterface AttributesInput {}\ninterface Props {\n attributesWrapper: object;\n attributesInputs: AttributesInput[];\n value?: string | number;\n disabled?: boolean;\n validate?: boolean;\n optionList?: OptionListItem[];\n onChange: (res: string, e: React.ChangeEvent) => void;\n onBlur?: (e: React.FocusEvent) => void;\n onFocus?: (e: React.FocusEvent) => void;\n onClick?: (e: React.MouseEvent) => void;\n validationOption?: object;\n asyncMsgObj?: object;\n classNameWrapper?: string;\n classNameInput?: string;\n classNameContainer?: string;\n classNameOptionListItem?: string;\n customStyleWrapper?: object;\n customStyleContainer?: object;\n customStyleInput?: object;\n customStyleOptionListItem?: object;\n validationCallback?: (res: boolean) => void;\n}\nconst component: React.FC = ({\n attributesWrapper = {},\n attributesInputs = [],\n value = '',\n disabled = false,\n validate = false,\n optionList = [],\n classNameWrapper = '',\n classNameInput = '',\n classNameContainer = '',\n classNameOptionListItem = '',\n customStyleWrapper = {},\n customStyleContainer = {},\n customStyleInput = {},\n customStyleOptionListItem = {},\n validationOption = {},\n asyncMsgObj = {},\n onChange = () => {},\n onBlur = null,\n onFocus = null,\n onClick = null,\n validationCallback = null,\n}) => {\n const [err, setErr] = useState(false);\n const [msg, setMsg] = useState('');\n const [successMsg, setSuccessMsg] = useState('');\n const [internalValue, setInternalValue] = useState(String(value));\n const prevInternalValue = usePrevious(internalValue);\n const option = getDefaultValidationOption(validationOption);\n const asyncObj = getDefaultAsyncObj(asyncMsgObj);\n const $input = useRef(null);\n const $el: { [key: string]: any } | null = $input;\n const handleOnBlur = useCallback(\n (e: React.FocusEvent) => {\n if (onBlur && !disabled) {\n check();\n onBlur(e);\n }\n },\n [internalValue, option, disabled],\n );\n const handleOnFocus = useCallback((e: React.FocusEvent) => {\n if (onFocus) {\n onFocus(e);\n }\n }, []);\n const handleOnClick = useCallback((e: React.MouseEvent) => {\n if (onClick) {\n onClick(e);\n }\n }, []);\n const handleOnChange = useCallback((val: string, e: React.ChangeEvent) => {\n if (disabled || $el === null) {\n return;\n }\n setInternalValue(val);\n onChange && onChange(val, e);\n }, [disabled]);\n const check = useCallback(\n () => {\n const { name, check, locale, required, msgOnSuccess } = option;\n if (!check) {\n return;\n }\n if (!message[locale] || !message[locale][TYPE]) {\n console.error(REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE);\n return;\n }\n if (required) {\n const msg = message[locale][TYPE];\n const nameText = name ? name : '';\n if (!isValidValue(optionList, internalValue)) {\n handleCheckEnd(true, msg.empty(nameText));\n return;\n }\n }\n if (msgOnSuccess) {\n setSuccessMsg(msgOnSuccess);\n }\n handleCheckEnd(false, msgOnSuccess);\n },\n [internalValue, option],\n );\n const handleCheckEnd = useCallback((err: boolean, message: string) => {\n let msg = message;\n const { msgOnError } = option;\n if (err && msgOnError) {\n msg = msgOnError;\n }\n setErr(err);\n setMsg(msg);\n validationCallback && validationCallback(err);\n }, [option.msgOnError]);\n useEffect(\n () => {\n if (validate) {\n check();\n }\n },\n [validate],\n );\n useEffect(\n () => {\n if (internalValue && isValidValue(optionList, internalValue)) {\n setErr(false);\n } else {\n setSuccessMsg('');\n }\n },\n [internalValue],\n );\n useEffect(\n () => {\n setInternalValue(String(value));\n },\n [value],\n );\n useEffect(\n () => {\n if (typeof prevInternalValue !== 'undefined' && prevInternalValue !== internalValue) {\n check();\n }\n },\n [prevInternalValue, internalValue],\n );\n useEffect(\n () => {\n if (asyncObj) {\n if (asyncObj.message) {\n if (asyncObj.showOnError) {\n handleCheckEnd(asyncObj.error, asyncObj.message);\n }\n if (!asyncObj.error && asyncObj.showOnSuccess) {\n setSuccessMsg(asyncObj.message);\n }\n }\n }\n },\n [asyncMsgObj],\n );\n const wrapperClass = `${WRAPPER_CLASS_IDENTITIFIER} ${classNameWrapper} ${err && reactInputsValidationCss['error']} ${successMsg !== '' && !err && reactInputsValidationCss['success']} ${\n reactInputsValidationCss[`${TYPE}__wrapper`]\n } ${disabled && reactInputsValidationCss['disabled']}`;\n const containerClass = `${classNameContainer} ${err && reactInputsValidationCss['error']} ${successMsg !== '' && !err && reactInputsValidationCss['success']} ${\n reactInputsValidationCss[`${TYPE}__container`]\n } ${disabled && reactInputsValidationCss['disabled']}`;\n const inputClass = `${classNameInput} ${err && reactInputsValidationCss['error']} ${successMsg !== '' && !err && reactInputsValidationCss['success']} ${\n reactInputsValidationCss[`${TYPE}__input`]\n } ${disabled && reactInputsValidationCss['disabled']}`;\n const labelClass = `${err && reactInputsValidationCss['error']} ${successMsg !== '' && !err && reactInputsValidationCss['success']} ${reactInputsValidationCss[`${TYPE}__label`]} ${disabled &&\n reactInputsValidationCss['disabled']}`;\n const optionListItemClass = `${reactInputsValidationCss['button']} ${OPTION_LIST_ITEM_IDENTITIFIER} ${classNameOptionListItem} ${err && reactInputsValidationCss['error']} ${successMsg !== '' &&\n !err &&\n reactInputsValidationCss['success']} ${reactInputsValidationCss[`${TYPE}__item`]} ${disabled && reactInputsValidationCss['disabled']}`;\n const errMsgClass = `${MSG_CLASS_IDENTITIFIER} ${reactInputsValidationCss['msg']} ${err && reactInputsValidationCss['error']}`;\n const successMsgClass = `${MSG_CLASS_IDENTITIFIER} ${reactInputsValidationCss['msg']} ${!err && reactInputsValidationCss['success']}`;\n let msgHtml;\n const { showMsg } = option;\n if (showMsg && err && msg) {\n msgHtml =
{msg}
;\n }\n if (showMsg && !err && successMsg !== '') {\n msgHtml =
{successMsg}
;\n }\n let optionHtml;\n if (optionList.length) {\n optionHtml = optionList.map((i, k) => {\n const checked = String(i.id) === String(internalValue) ? true : false;\n return (\n \n );\n });\n }\n return (\n
\n
\n {optionHtml}\n
\n {msgHtml}\n
\n );\n};\ninterface AttributesInput {\n id?: string;\n}\ninterface OptionProps {\n checked?: boolean;\n id?: string;\n optionListItemClass?: string;\n labelClass?: string;\n inputClass?: string;\n value?: string | number;\n disabled?: boolean;\n item?: OptionListItem;\n customStyleOptionListItem?: object;\n customStyleInput?: object;\n attributesInput: AttributesInput;\n onChange?: (res: string, e: React.ChangeEvent) => void;\n}\nexport const Option: React.FC = memo(\n ({\n checked = false,\n id = '',\n optionListItemClass = '',\n labelClass = '',\n inputClass = '',\n value = '',\n disabled = false,\n item = { id: '', name: '' },\n customStyleOptionListItem = {},\n customStyleInput = {},\n attributesInput = {},\n onChange = () => {},\n }) => {\n const handleOnChange = useCallback(e => {\n onChange(item.id, e);\n }, [item, disabled]);\n return (\n \n );\n },\n);\nexport default memo(component);\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://react-inputs-validation/webpack/universalModuleDefinition","webpack://react-inputs-validation/webpack/bootstrap","webpack://react-inputs-validation/external \"React\"","webpack://react-inputs-validation/./src/js/Inputs/const.ts","webpack://react-inputs-validation/./src/js/Inputs/message.ts","webpack://react-inputs-validation/./src/js/Inputs/react-inputs-validation.css?df4a","webpack://react-inputs-validation/./src/js/Inputs/utils.ts","webpack://react-inputs-validation/./src/js/Inputs/validator.ts","webpack://react-inputs-validation/./src/js/Inputs/index.global.ts","webpack://react-inputs-validation/./src/js/Inputs/Textbox.tsx","webpack://react-inputs-validation/./src/js/Inputs/Textarea.tsx","webpack://react-inputs-validation/./src/js/Inputs/Select.tsx","webpack://react-inputs-validation/./src/js/Inputs/Checkbox.tsx","webpack://react-inputs-validation/./src/js/Inputs/Radiobox.tsx"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE__0__","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","useEffect","useRef","LOCALE_OPTION_LIST","REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE","DEFAULT_LOCALE","WRAPPER_CLASS_IDENTITIFIER","CONTAINER_CLASS_IDENTITIFIER","OPTION_LIST_ITEM_IDENTITIFIER","MSG_CLASS_IDENTITIFIER","usePrevious","ref","current","getEnglishName","res","message","textbox","empty","invalid","invalidFormat","inBetween","min","max","lessThan","greaterThan","lengthEqual","length","twoInputsNotEqual","radiobox","checkbox","unchecked","select","textarea","getCustomErrorMessage","constructor","keys","map","j","k","console","error","handleCustomErrorMessage","w","REACT_INPUTS_VALIDATION","window","camelize","str","replace","match","index","toLowerCase","toUpperCase","utils","toCamelCase","capitalLize","substr","getRandomId","Math","random","toString","slice","getAlphanumeric","v","String","split","forEach","charCode","charCodeAt","getAlpha","getNumeric","arraysEqual","arr1","arr2","JSON","stringify","isNumeric","isNaN","parseFloat","isFinite","validator","reg","err","test","number","Textbox","Textarea","Select","Checkbox","Radiobox","useState","useCallback","memo","TYPE","VALIDATE_OPTION_TYPE_LIST","VALIDATE_NUMBER_TYPE_LIST","obj","showOnError","showOnSuccess","attributesWrapper","attributesInput","label","disabled","validate","classNameInput","classNameWrapper","classNameContainer","customStyleInput","customStyleWrapper","customStyleContainer","validationOption","asyncMsgObj","onChange","onBlur","onFocus","onClick","onKeyUp","validationCallback","setErr","msg","setMsg","successMsg","setSuccessMsg","internalValue","setInternalValue","prevInternalValue","option","type","numberType","mantissa","check","regMsg","compare","required","showMsg","locale","msgOnError","msgOnSuccess","customFunc","undefined","getDefaultValidationOption","asyncObj","$input","$el","handleOnBlur","e","handleOnFocus","handleOnClick","handleOnKeyUp","keyCode","handleOnChange","maxLength","Number","hasDot","splitStr","shift","resArr","join","autoFormatNumber","indexOf","nameText","handleCheckEnd","customFuncResult","fromCustomFunc","msgHtml","wrapperClass","containerClass","inputClass","errMsgClass","successMsgClass","className","style","id","htmlFor","useMemo","selectKeyList","startsWith","searchString","position","isValidValue","list","getItem","getIndex","globalVariableIsFocusing","globalVariableIsCorrected","globalVariableCurrentFocus","globalVariableTypingTimeout","Option","item","customStyleOptionListItem","onMouseOver","onMouseMove","onMouseOut","handleOnMouseOver","handleOnMouseMove","handleOnMouseOut","showSearch","showArrow","keyword","optionList","classNameSelect","classNameOptionListItem","classNameOptionListContainer","classNameDropdownIconOptionListItem","customStyleSelect","customStyleOptionListContainer","customStyleDropdownIcon","stateKeyword","prevOptionList","show","setShow","prevShow","isTyping","setIsTyping","keycodeList","setKeycodeList","$button","$wrapper","$itemsWrapper","$searchInputWrapper","$searchInput","$elButton","$elWrapper","$elItemsWrapper","$itemsRef","filteredOptionList","filter","includes","handleOnSearch","target","handleOnSearchKeyDown","direction","getDirection","preventDefault","handleOnKeyDown","scroll","addActive","addEventListener","pageClick","removeEventListener","onKeyDown","contains","resetCurrentFocus","setTimeoutTyping","clearTimeout","setTimeout","children","$children","containerHeight","offsetHeight","containerScrollTop","scrollTop","itemHeight","heightItems","heightContainer","offset","abs","handleOnItemClick","handleOnItemMouseOver","handleOnItemMouseMove","handleOnItemMouseOut","removeActive","click","newkeyCodeList","fromCharCode","document","focus","optionListHtml","selectClass","selectOptionListContainerClass","selectOptionListItemClass","dropdownIconClass","background","textAlign","padding","xmlns","width","height","viewBox","fill","selectorHtml","checked","labelHtml","classNameInputBox","customStyleInputBox","internalChecked","setInternalChecked","prevInternalChecked","boxClass","labelClass","defaultChecked","optionListItemClass","attributesInputs","val","optionHtml"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,UACR,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,CAAC,SAAUJ,GACQ,iBAAZC,QACdA,QAAQ,2BAA6BD,EAAQG,QAAQ,UAErDJ,EAAK,2BAA6BC,EAAQD,EAAY,OARxD,CASGO,MAAM,SAASC,GAClB,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUT,QAGnC,IAAIC,EAASM,EAAiBE,GAAY,CACzCC,EAAGD,EACHE,GAAG,EACHX,QAAS,IAUV,OANAY,EAAQH,GAAUI,KAAKZ,EAAOD,QAASC,EAAQA,EAAOD,QAASQ,GAG/DP,EAAOU,GAAI,EAGJV,EAAOD,QA0Df,OArDAQ,EAAoBM,EAAIF,EAGxBJ,EAAoBO,EAAIR,EAGxBC,EAAoBQ,EAAI,SAAShB,EAASiB,EAAMC,GAC3CV,EAAoBW,EAAEnB,EAASiB,IAClCG,OAAOC,eAAerB,EAASiB,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEV,EAAoBgB,EAAI,SAASxB,GACX,oBAAXyB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAerB,EAASyB,OAAOC,YAAa,CAAEC,MAAO,WAE7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,IAAIgM,EAAuB,KAAIvH,IAAO,UAAgC,OAAC,KAAmB,KAAfuC,KAC1KvC,IACD,UAAkC,SAAC,IAAI,UAA4BW,EAAI,UAAS,KAAIS,GAAY,UAAmC,UAC/HkE,GAAiB,EAAA9J,uBAAsB,IAAI,UAA8B,IAAC,KAAIwE,IAAO,UAAgC,OACrHuF,GAAqB,EAAA/J,uBAAsB,IAAI,UAA8B,IAAC,MAAKwE,IAAO,UAAkC,SAE1HoD,GAAA,GAAAA,QA8BR,OA7BIA,IAAWpD,IAAOqC,KACpB6C,GAAU,uBAAKM,UAAWF,IAAcjD,KAEtCe,KAAYpD,IAAsB,KAAfuC,KACrB2C,GAAU,uBAAKM,UAAWD,IAAkBhD,KAG1C8E,EAAW5K,SACb2Q,GAAa/F,EAAWlK,KAAI,SAACnE,EAAGqE,GAC9B,IAAMkP,EAAUzN,OAAO9F,EAAE0M,MAAQ5G,OAAO2D,IACxC,OACE,gBAAC,EAAAgE,OAAM,CACLlM,IAAK8C,EACLkP,QAASA,EACT7G,GAAI,4CAA4C1M,EAAE0M,GAClDgB,KAAM1N,EACNqM,WAAYA,GACZpL,MAAOwI,GACPrB,SAAUA,EACV6L,oBAAqBA,GACrBtG,0BAA2BA,EAC3BlF,iBAAkBA,EAClBsL,WAAYA,GACZjL,SAAUsC,GACVlD,gBAAiBgM,EAAiB7P,GAAK6P,EAAiB7P,GAAK,SAMnE,yBAAK3B,IAAKkI,GAAQ4B,UAAWL,GAAcM,MAAO/D,EAAoBO,QAASgC,GAAelC,OAAQ+B,GAAc9B,QAASgC,IAAmB/C,GAC9I,uBAAKuE,UAAWJ,GAAgBK,MAAO9D,GACpCyL,IAEFlI","file":"react-inputs-validation.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"React\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"React\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"react-inputs-validation\"] = factory(require(\"React\"));\n\telse\n\t\troot[\"react-inputs-validation\"] = factory(root[\"React\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE__0__) {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n","module.exports = __WEBPACK_EXTERNAL_MODULE__0__;","import * as React from 'react';\nconst { useEffect, useRef } = React;\nexport const LOCALE_OPTION_LIST = ['en-US', 'zh-CN'];\nexport const REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE =\n \"Invalid window.REACT_INPUTS_VALIDATION['customErrorMessage']. EXAMPLE: window.REACT_INPUTS_VALIDATION={customErrorMessage:{'en-US':{textbox:{empty:function empty(name){return getEnglishName(name)+'cannot be empty'},invalid:function invalid(name){return getEnglishName(name)+'invalid format'},invalidFormat:function invalidFormat(name){return getEnglishName(name)+'is not a number'},inBetween:function inBetween(name){return function(min){return function(max){return getEnglishName(name)+'must be '+min+'-'+max}}},lessThan:function lessThan(name){return function(min){return getEnglishName(name)+'cannot less than '+min}},greaterThan:function greaterThan(name){return function(max){return getEnglishName(name)+'cannot greater than '+max}},lengthEqual:function lengthEqual(name){return function(length){return getEnglishName(name)+'length must be '+length}},twoInputsNotEqual:function twoInputsNotEqual(){return'two inputs are not equal'}},radiobox:{empty:function empty(name){return'Please choose one '+getEnglishName(name)}},checkbox:{unchecked:function unchecked(name){return getEnglishName(name)+'must be checked'}},select:{empty:function empty(name){return'Please select a '+getEnglishName(name)}},textarea:{empty:function empty(name){return getEnglishName(name)+'cannot be empty'},invalid:function invalid(name){return getEnglishName(name)+'invalid format'},invalidFormat:function invalidFormat(name){return getEnglishName(name)+'is not a number'},inBetween:function inBetween(name){return function(min){return function(max){return getEnglishName(name)+'must be '+min+'-'+max}}},lessThan:function lessThan(name){return function(min){return getEnglishName(name)+'cannot less than '+min}},greaterThan:function greaterThan(name){return function(max){return getEnglishName(name)+'cannot greater than '+max}},lengthEqual:function lengthEqual(name){return function(length){return getEnglishName(name)+'length must be '+length}},twoInputsNotEqual:function twoInputsNotEqual(){return'two inputs are not equal'}}}}};\";\nexport const DEFAULT_LOCALE = 'en-US';\nexport const WRAPPER_CLASS_IDENTITIFIER = 'react-inputs-validation__wrapper_identifier';\nexport const CONTAINER_CLASS_IDENTITIFIER = 'react-inputs-validation__container_identifier';\nexport const OPTION_LIST_ITEM_IDENTITIFIER = 'react-inputs-validation__option-list-item_identifier';\nexport const MSG_CLASS_IDENTITIFIER = 'react-inputs-validation__msg_identifier';\nexport const usePrevious = (value: any) => {\n const ref = useRef();\n useEffect(() => {\n ref.current = value;\n });\n return ref.current;\n};\n","import { REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE } from './const';\n\nconst getEnglishName = (name: string) => {\n let res = '';\n if (name) {\n res = `${name} `;\n }\n return res;\n};\n\nconst TEXT_BOX_VALIDATION_ZH_CN = {\n empty: (name: string) => `${name}不能为空`,\n invalid: (name: string) => `${name}格式有误`,\n invalidFormat: (name: string) => `${name}不是数字`,\n inBetween: (name: string) => (min: number) => (max: number) => `${name}必须在${min}-${max}之间`,\n lessThan: (name: string) => (min: number) => `${name}不可少于${min}`,\n greaterThan: (name: string) => (max: number) => `${name}不可大于${max}`,\n lengthEqual: (name: string) => (length: number) => `${name}长度必须为${length}`,\n twoInputsNotEqual: () => `两次输入不一致`,\n};\n\nconst TEXT_BOX_VALIDATION_EN_US = {\n empty: (name: string) => `${getEnglishName(name)}cannot be empty`,\n invalid: (name: string) => `${getEnglishName(name)}invalid format`,\n invalidFormat: (name: string) => `${getEnglishName(name)}is not a number`,\n inBetween: (name: string) => (min: number) => (max: number) => `${getEnglishName(name)}must be ${min}-${max}`,\n lessThan: (name: string) => (min: number) => `${getEnglishName(name)}cannot less than ${min}`,\n greaterThan: (name: string) => (max: number) => `${getEnglishName(name)}cannot greater than ${max}`,\n lengthEqual: (name: string) => (length: number) => `${getEnglishName(name)}length must be ${length}`,\n twoInputsNotEqual: () => `two inputs are not equal`,\n};\n\nconst TEXT_AREA_VALIDATION_ZH_CN = {\n empty: (name: string) => `${name}不能为空`,\n invalid: (name: string) => `${name}格式有误`,\n invalidFormat: (name: string) => `${name}不是数字`,\n inBetween: (name: string) => (min: number) => (max: number) => `${name}必须在${min}-${max}之间`,\n lessThan: (name: string) => (min: number) => `${name}不可少于${min}`,\n greaterThan: (name: string) => (max: number) => `${name}不可大于${max}`,\n lengthEqual: (name: string) => (length: number) => `${name}长度必须为${length}`,\n twoInputsNotEqual: () => `两次输入不一致`,\n};\n\nconst TEXT_AREA_VALIDATION_EN_US = {\n empty: (name: string) => `${getEnglishName(name)}cannot be empty`,\n invalid: (name: string) => `${getEnglishName(name)}invalid format`,\n invalidFormat: (name: string) => `${getEnglishName(name)}is not a number`,\n inBetween: (name: string) => (min: number) => (max: number) => `${getEnglishName(name)}must be ${min}-${max}`,\n lessThan: (name: string) => (min: number) => `${getEnglishName(name)}cannot less than ${min}`,\n greaterThan: (name: string) => (max: number) => `${getEnglishName(name)}cannot greater than ${max}`,\n lengthEqual: (name: string) => (length: number) => `${getEnglishName(name)}length must be ${length}`,\n twoInputsNotEqual: () => `two inputs are not equal`,\n};\n\nconst SELECT_VALIDATION_ZH_CN = {\n empty: (name: string) => `请选择一个${name}`,\n};\n\nconst SELECT_VALIDATION_EN_US = {\n empty: (name: string) => `Please select a ${getEnglishName(name)}`,\n};\n\nconst CHECK_BOX_VALIDATION_ZH_CN = {\n unchecked: (name: string) => `${name}必须勾选`,\n};\n\nconst CHECK_BOX_VALIDATION_EN_US = {\n unchecked: (name: string) => `${getEnglishName(name)}must be checked`,\n};\n\nconst RADIO_BOX_VALIDATION_ZH_CN = {\n empty: (name: string) => `必须勾选一个${name}`,\n};\n\nconst RADIO_BOX_VALIDATION_EN_US = {\n empty: (name: string) => `Please choose one ${getEnglishName(name)}`,\n};\n\ninterface Message {\n [key: string]: Key;\n}\n\ninterface Key {\n [key: string]: Func;\n}\n\ninterface Func {\n [key: string]: Function;\n}\n\nlet message: Message = {\n 'zh-CN': {\n textbox: TEXT_BOX_VALIDATION_ZH_CN,\n radiobox: RADIO_BOX_VALIDATION_ZH_CN,\n checkbox: CHECK_BOX_VALIDATION_ZH_CN,\n select: SELECT_VALIDATION_ZH_CN,\n textarea: TEXT_AREA_VALIDATION_ZH_CN,\n },\n 'en-US': {\n textbox: TEXT_BOX_VALIDATION_EN_US,\n radiobox: RADIO_BOX_VALIDATION_EN_US,\n checkbox: CHECK_BOX_VALIDATION_EN_US,\n select: SELECT_VALIDATION_EN_US,\n textarea: TEXT_AREA_VALIDATION_EN_US,\n },\n};\n\n// TODO: find a rewire way to handle non-export function\nexport const getCustomErrorMessage = (o: any, m: any) => {\n if (!o || typeof o !== 'object' || o.constructor !== Object || !Object.keys(o).length) {\n console.error(REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE);\n return false;\n }\n Object.keys(o).map(i => {\n if (!m[i]) {\n m[i] = o[i];\n } else {\n if (Object.keys(o[i]).length) {\n Object.keys(o[i]).map(j => {\n if (Object.keys(o[i][j]).length) {\n Object.keys(o[i][j]).map(k => {\n m[i][j][k] = o[i][j][k];\n });\n }\n });\n }\n }\n });\n return m;\n};\n\ndeclare global {\n interface Window {\n REACT_INPUTS_VALIDATION: any;\n }\n}\n\n// TODO: find a rewire way to handle non-export function\nexport const handleCustomErrorMessage = (message: any, w: Window) => {\n let res;\n if (typeof w !== 'undefined') {\n if (w.REACT_INPUTS_VALIDATION && w.REACT_INPUTS_VALIDATION['customErrorMessage']) {\n res = getCustomErrorMessage(w.REACT_INPUTS_VALIDATION['customErrorMessage'], message);\n }\n }\n if (typeof res === 'undefined' || res === false) {\n return message;\n }\n return res;\n};\n\n/* istanbul ignore else */\nif (typeof window !== 'undefined') {\n window.REACT_INPUTS_VALIDATION = window.REACT_INPUTS_VALIDATION || {};\n message = handleCustomErrorMessage(message, window);\n}\n\nexport default message;\n","// extracted by mini-css-extract-plugin\nmodule.exports = {\"ellipsis\":\"react-inputs-validation__ellipsis___3-Api\",\"textbox__wrapper\":\"react-inputs-validation__textbox__wrapper___3tnXv\",\"disabled\":\"react-inputs-validation__disabled___1-57g\",\"textbox__input\":\"react-inputs-validation__textbox__input___20hDL\",\"error\":\"react-inputs-validation__error___2aXSp\",\"success\":\"react-inputs-validation__success___3TpwE\",\"msg\":\"react-inputs-validation__msg___pxv8o\",\"textarea__wrapper\":\"react-inputs-validation__textarea__wrapper___35GhF\",\"textarea__input\":\"react-inputs-validation__textarea__input___1CFm_\",\"radiobox__wrapper\":\"react-inputs-validation__radiobox__wrapper___1zZ30\",\"radiobox__container\":\"react-inputs-validation__radiobox__container___FD4vb\",\"radiobox__input\":\"react-inputs-validation__radiobox__input___2uX2-\",\"radiobox__label\":\"react-inputs-validation__radiobox__label___2tQsB\",\"checked\":\"react-inputs-validation__checked___2O0Ju\",\"button\":\"react-inputs-validation__button___9JBRL\",\"radiobox__item\":\"react-inputs-validation__radiobox__item___ejuz1\",\"checkbox__wrapper\":\"react-inputs-validation__checkbox__wrapper___1c1rD\",\"checkbox__input\":\"react-inputs-validation__checkbox__input___1yF4X\",\"checkbox__container\":\"react-inputs-validation__checkbox__container___3I1rX\",\"checkbox__box\":\"react-inputs-validation__checkbox__box___1uj8A\",\"box\":\"react-inputs-validation__box___3E9nu\",\"select__wrapper\":\"react-inputs-validation__select__wrapper___1B4OH\",\"select__input\":\"react-inputs-validation__select__input___3h-P7\",\"select__container\":\"react-inputs-validation__select__container___3jgUR\",\"select__button\":\"react-inputs-validation__select__button___vEDoq\",\"select__options-item\":\"react-inputs-validation__select__options-item___30yY4\",\"select__options-item-show-cursor\":\"react-inputs-validation__select__options-item-show-cursor___1ZT3b\",\"select__searchInputWrapper\":\"react-inputs-validation__select__searchInputWrapper___3R5P_\",\"select__searchInputSearchIcon\":\"react-inputs-validation__select__searchInputSearchIcon___1Q8xX\",\"select__searchInputRemoveIcon\":\"react-inputs-validation__select__searchInputRemoveIcon___1A1tR\",\"select__searchInput\":\"react-inputs-validation__select__searchInput___1lN24\",\"select__no-mouse\":\"react-inputs-validation__select__no-mouse___2uRg6\",\"select__hover-active\":\"react-inputs-validation__select__hover-active___2z1MQ\",\"active\":\"react-inputs-validation__active___3eZBB\",\"select__options-container-animate\":\"react-inputs-validation__select__options-container-animate___2Rm--\",\"show\":\"react-inputs-validation__show___2NI3u\",\"select__options-container\":\"react-inputs-validation__select__options-container___d54qE\",\"select__dropdown\":\"react-inputs-validation__select__dropdown___11yDr\",\"select__dropdown-icon\":\"react-inputs-validation__select__dropdown-icon___1T5r2\",\"select__dropdown-name\":\"react-inputs-validation__select__dropdown-name___3hghL\",\"showArrow\":\"react-inputs-validation__showArrow___3puk1\",\"select__dropdown-icon-container\":\"react-inputs-validation__select__dropdown-icon-container___2ild-\"};","const camelize = (str: string) => {\n return str.replace(/(?:^\\w|[A-Z]|\\b\\w|\\s+)/g, (match, index) => {\n if (+match === 0) return '';\n return index === 0 ? match.toLowerCase() : match.toUpperCase();\n });\n};\n\nconst toCamelCase = (str: string) => (capitalLize: boolean = false) => {\n const res = camelize(str);\n return capitalLize ? res.substr(0, 1).toUpperCase() + res.substr(1, res.length) : res;\n};\n\ninterface Utils {\n [key: string]: Function;\n}\n\nconst getRandomId = () => {\n return Math.random()\n .toString(36)\n .slice(-8);\n};\n\nconst getAlphanumeric = (v: string) => {\n let res = '';\n String(v)\n .split('')\n .forEach(i => {\n const charCode = i.toLowerCase().charCodeAt(0);\n if ((charCode >= 48 && charCode <= 57) || (charCode >= 97 && charCode <= 122)) {\n res += i;\n }\n });\n return res;\n};\n\nconst getAlpha = (v: string) => {\n let res = '';\n String(v)\n .split('')\n .forEach(i => {\n const charCode = i.toLowerCase().charCodeAt(0);\n if (charCode >= 97 && charCode <= 122) {\n res += i;\n }\n });\n return res;\n};\n\nconst getNumeric = (v: string) => {\n let res = '';\n String(v)\n .split('')\n .forEach(i => {\n const charCode = i.toLowerCase().charCodeAt(0);\n if (charCode >= 48 && charCode <= 57) {\n res += i;\n }\n });\n return res;\n};\n\nconst arraysEqual = (arr1: any, arr2: any) => {\n if (arr1.length !== arr2.length) return false;\n for (let i = arr1.length; (i -= 1); ) {\n if (JSON.stringify(arr1[i]) !== JSON.stringify(arr2[i])) return false;\n }\n return true;\n};\n\nconst utils: Utils = {\n camelize,\n toCamelCase,\n getRandomId,\n getAlphanumeric,\n getAlpha,\n getNumeric,\n arraysEqual,\n};\nexport default utils;\n","const empty = (v: string) => (v.replace(/\\s/g, '').length ? false : true);\nconst number = (v: number, min: any, max: any) => {\n if (min === null && max === null){\n return true\n }\n if (!isNumeric(v)) {\n return false;\n }\n return v < min || v > max ? false : true;\n};\n// TODO: find a better type for regex\nconst reg = (reg: any, v: string) => {\n let err = true;\n if (reg.test(v)) {\n err = false;\n }\n return err;\n};\nconst isNumeric = (v: any) => {\n return !isNaN(parseFloat(v)) && isFinite(v);\n};\n\ninterface Validator {\n [key: string]: Function;\n}\n\nconst validator: Validator = {\n reg,\n empty,\n number,\n};\nexport default validator;\n","import Textbox from './Textbox';\nimport Textarea from './Textarea';\nimport Select from './Select';\nimport Checkbox from './Checkbox';\nimport Radiobox from './Radiobox';\n\nif (typeof window !== 'undefined') {\n (window).Textbox = Textbox;\n (window).Textarea = Textarea;\n (window).Radiobox = Radiobox;\n (window).Checkbox = Checkbox;\n (window).Select = Select;\n}\n\nexport { Textbox, Textarea, Select, Checkbox, Radiobox };\n","import * as React from 'react';\nconst { useState, useEffect, useCallback, useRef, memo } = React;\nimport message from './message';\nimport validator from './validator';\nimport utils from './utils';\nimport { REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE, DEFAULT_LOCALE, MSG_CLASS_IDENTITIFIER, usePrevious } from './const';\nimport reactInputsValidationCss from './react-inputs-validation.css';\nconst TYPE = 'textbox';\nconst VALIDATE_OPTION_TYPE_LIST = ['string', 'number', 'alphanumeric', 'alpha'];\nconst VALIDATE_NUMBER_TYPE_LIST = ['decimal', 'int', 'price'];\ninterface DefaultValidationOption {\n locale?: string;\n reg?: string;\n min?: number;\n max?: number;\n type?: string;\n numberType?: string;\n mantissa?: number;\n name?: string;\n check?: boolean;\n showMsg?: boolean;\n length?: number;\n regMsg?: string;\n compare?: string;\n required?: boolean;\n msgOnError?: string;\n msgOnSuccess?: string;\n customFunc?: Function | undefined;\n}\nconst getDefaultValidationOption = (obj: DefaultValidationOption) => {\n let { reg, min, max, type, numberType, mantissa, name, check, length, regMsg, compare, required, showMsg, locale, msgOnError, msgOnSuccess, customFunc } = obj;\n locale = typeof locale !== 'undefined' ? locale : DEFAULT_LOCALE;\n reg = typeof reg !== 'undefined' ? reg : '';\n min = typeof min !== 'undefined' ? min : 0;\n max = typeof max !== 'undefined' ? max : 0;\n type = typeof type !== 'undefined' ? type : 'string';\n numberType = typeof numberType !== 'undefined' ? numberType : 'string';\n mantissa = typeof mantissa !== 'undefined' ? mantissa : -1;\n name = typeof name !== 'undefined' ? name : '';\n check = typeof check !== 'undefined' ? check : true;\n showMsg = typeof showMsg !== 'undefined' ? showMsg : true;\n length = typeof length !== 'undefined' ? length : 0;\n regMsg = typeof regMsg !== 'undefined' ? regMsg : '';\n compare = typeof compare !== 'undefined' ? compare : '';\n required = typeof required !== 'undefined' ? required : true;\n msgOnError = typeof msgOnError !== 'undefined' ? msgOnError : '';\n msgOnSuccess = typeof msgOnSuccess !== 'undefined' ? msgOnSuccess : '';\n customFunc = typeof customFunc !== 'undefined' ? customFunc : undefined;\n return {\n reg,\n min,\n max,\n type,\n numberType,\n mantissa,\n name,\n check,\n length,\n regMsg,\n locale,\n compare,\n required,\n showMsg,\n msgOnError,\n msgOnSuccess,\n customFunc,\n };\n};\ninterface DefaultAsyncMsgObj {\n error?: boolean;\n message?: string;\n showOnError?: boolean;\n showOnSuccess?: boolean;\n}\nconst getDefaultAsyncObj = (obj: DefaultAsyncMsgObj) => {\n let { error, message, showOnError, showOnSuccess } = obj;\n error = typeof error !== 'undefined' ? error : false;\n message = typeof message !== 'undefined' ? message : '';\n showOnError = typeof showOnError !== 'undefined' ? showOnError : true;\n showOnSuccess = typeof showOnSuccess !== 'undefined' ? showOnSuccess : false;\n return {\n error,\n message,\n showOnError,\n showOnSuccess,\n };\n};\ninterface AttributesInputObj {\n id?: string;\n maxLength?: number;\n}\ninterface Props {\n attributesWrapper?: object;\n attributesInput?: AttributesInputObj;\n value?: string;\n label?: string;\n disabled?: boolean;\n validate?: boolean;\n classNameInput?: string;\n classNameWrapper?: string;\n classNameContainer?: string;\n customStyleInput?: object;\n customStyleWrapper?: object;\n customStyleContainer?: object;\n validationOption?: object;\n asyncMsgObj?: object;\n onChange: (res: string, e: React.ChangeEvent) => void;\n onBlur?: (e: React.FocusEvent) => void;\n onFocus?: (e: React.FocusEvent) => void;\n onClick?: (e: React.MouseEvent) => void;\n onKeyUp?: (e: React.KeyboardEvent) => void;\n validationCallback?: (res: boolean) => void;\n}\nconst autoFormatNumber = (v: number | string, numberType: string, mantissa: number) => {\n const DOT = '.';\n const ZERO = '0';\n let res = '';\n let hasDot = false;\n const splitStr = String(v).split('');\n const startedWithZero = splitStr[0] === '0';\n if (numberType === VALIDATE_NUMBER_TYPE_LIST[2] && splitStr[0] === ZERO && splitStr[1] === ZERO) {\n splitStr.shift();\n }\n splitStr.forEach(i => {\n const charCode = i.toLowerCase().charCodeAt(0);\n if ((charCode >= 48 && charCode <= 57) || (charCode === 46 && !hasDot)) {\n if (charCode === 46) {\n if (numberType === VALIDATE_NUMBER_TYPE_LIST[1]) {\n return;\n }\n hasDot = true;\n }\n res += i;\n }\n });\n if (hasDot && mantissa >= 0) {\n const resArr = res.split(DOT);\n if (mantissa === 0) {\n res = resArr[0];\n } else {\n resArr[1] = resArr[1].slice(0, mantissa);\n res = resArr.join('.');\n }\n }\n if (numberType === VALIDATE_NUMBER_TYPE_LIST[0] || numberType === VALIDATE_NUMBER_TYPE_LIST[2]) {\n if (res.length && res[0] === DOT) {\n res = `0${res}`;\n }\n }\n // if (numberType === VALIDATE_NUMBER_TYPE_LIST[2]) {\n // if (startedWithZero) {\n // if (hasDot) {\n // const resArr = res.split(DOT);\n // res = `${Number(resArr[0])}${DOT}${resArr[1]}`;\n // }\n // }\n // }\n return res;\n};\nconst component: React.FC = ({\n attributesWrapper = {},\n attributesInput = {},\n value = '',\n label = '',\n disabled = false,\n validate = false,\n classNameInput = '',\n classNameWrapper = '',\n classNameContainer = '',\n customStyleInput = {},\n customStyleWrapper = {},\n customStyleContainer = {},\n validationOption = {},\n asyncMsgObj = {},\n onChange = (v: string, e: React.ChangeEvent) => {},\n onBlur = null,\n onFocus = null,\n onClick = null,\n onKeyUp = null,\n validationCallback = null,\n}) => {\n const [err, setErr] = useState(false);\n const [msg, setMsg] = useState('');\n const [successMsg, setSuccessMsg] = useState('');\n const [internalValue, setInternalValue] = useState(String(value));\n const prevInternalValue = usePrevious(internalValue);\n const option = getDefaultValidationOption(validationOption);\n const asyncObj = getDefaultAsyncObj(asyncMsgObj);\n const $input = useRef(null);\n const $el: { [key: string]: any } | null = $input;\n const handleOnBlur = useCallback(\n (e: React.FocusEvent) => {\n if (onBlur) {\n check();\n onBlur(e);\n }\n },\n [internalValue, option],\n );\n const handleOnFocus = useCallback((e: React.FocusEvent) => {\n if (onFocus) {\n onFocus(e);\n }\n }, []);\n const handleOnClick = useCallback((e: React.MouseEvent) => {\n if (onClick) {\n onClick(e);\n }\n }, []);\n const handleOnKeyUp = useCallback(\n (e: React.KeyboardEvent) => {\n if (onKeyUp) {\n const { keyCode } = e;\n const keyCodeTab = 9;\n if (keyCode !== keyCodeTab) {\n check();\n }\n onKeyUp(e);\n }\n },\n [internalValue, option],\n );\n const handleOnChange = useCallback(\n (e: React.ChangeEvent) => {\n if (disabled || $el === null) {\n return;\n }\n let v = $el.current.value;\n if (typeof attributesInput.maxLength !== 'undefined') {\n if ((typeof attributesInput.maxLength === 'string' && attributesInput.maxLength !== '') || (typeof attributesInput.maxLength === 'number' && attributesInput.maxLength !== 0)) {\n if (v.length > Number(attributesInput.maxLength)) {\n return;\n }\n }\n }\n const { type, numberType, mantissa } = option;\n if (type === VALIDATE_OPTION_TYPE_LIST[1]) {\n v = String(autoFormatNumber(v, VALIDATE_NUMBER_TYPE_LIST.indexOf(numberType) >= 0 ? numberType : VALIDATE_NUMBER_TYPE_LIST[0], mantissa));\n }\n if (type === VALIDATE_OPTION_TYPE_LIST[2]) {\n v = utils.getAlphanumeric(v);\n }\n if (type === VALIDATE_OPTION_TYPE_LIST[3]) {\n v = utils.getAlpha(v);\n }\n setInternalValue(v);\n onChange && onChange(v, e);\n if (err) {\n setErr(false);\n } else {\n setSuccessMsg('');\n }\n },\n [err, attributesInput, option],\n );\n const check = useCallback(async () => {\n const { reg, min, max, type, name, check, length, regMsg, locale, compare, required, msgOnSuccess, customFunc } = option;\n if (!check) {\n return;\n }\n if (type) {\n if (VALIDATE_OPTION_TYPE_LIST.indexOf(type) !== -1) {\n if (!message[locale] || !message[locale][TYPE]) {\n console.error(REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE);\n return;\n }\n const msg = message[locale][TYPE];\n const nameText = name ? name : '';\n if (required) {\n if (validator.empty(internalValue)) {\n handleCheckEnd(true, msg.empty(nameText));\n return;\n }\n }\n if (String(internalValue) !== '') {\n if (reg) {\n if (validator['reg'](reg, internalValue)) {\n handleCheckEnd(true, regMsg !== '' ? regMsg : msg.invalid(nameText));\n return;\n }\n }\n if (type === VALIDATE_OPTION_TYPE_LIST[0]) {\n if (min || max) {\n if (min && max) {\n if (String(internalValue).length < min || String(internalValue).length > max) {\n handleCheckEnd(true, msg.inBetween(nameText)(min)(max));\n return;\n }\n } else {\n if (min) {\n if (String(internalValue).length < min) {\n handleCheckEnd(true, msg.lessThan(nameText)(min));\n return;\n }\n }\n if (max) {\n if (String(internalValue).length > max) {\n handleCheckEnd(true, msg.greaterThan(nameText)(max));\n return;\n }\n }\n }\n }\n if (length) {\n if (String(internalValue).length !== length) {\n handleCheckEnd(true, msg.lengthEqual(nameText)(length));\n return;\n }\n }\n }\n if (type === VALIDATE_OPTION_TYPE_LIST[1]) {\n if (!validator[type](internalValue, null, null)) {\n handleCheckEnd(true, msg.invalid(nameText));\n return;\n }\n if (min || max) {\n if (min && max) {\n if (!validator[type](internalValue, min, max)) {\n handleCheckEnd(true, msg.inBetween(nameText)(min)(max));\n return;\n }\n } else {\n if (min) {\n if (!validator[type](internalValue, min)) {\n handleCheckEnd(true, msg.lessThan(nameText)(min));\n return;\n }\n }\n if (max) {\n if (!validator[type](internalValue, 0, max)) {\n handleCheckEnd(true, msg.greaterThan(nameText)(max));\n return;\n }\n }\n }\n }\n if (length) {\n if (String(internalValue).length !== length) {\n handleCheckEnd(true, msg.lengthEqual(nameText)(length));\n return;\n }\n }\n }\n if (compare && compare !== '') {\n if (internalValue !== compare) {\n handleCheckEnd(true, msg.twoInputsNotEqual());\n return;\n }\n }\n }\n if (customFunc && typeof customFunc === 'function') {\n const customFuncResult = await customFunc(internalValue);\n if (!($input && $input.current)) {\n return;\n }\n /* istanbul ignore next because of async problem */\n if (typeof customFuncResult === 'object') {\n if (typeof customFuncResult.error === 'boolean' && typeof customFuncResult.message === 'string') {\n if (customFuncResult.error === false && customFuncResult.showOnSuccess === true) {\n setSuccessMsg(customFuncResult.message);\n }\n handleCheckEnd(customFuncResult.error, customFuncResult.message, true);\n }\n return;\n }\n /* istanbul ignore next because of async problem */\n if (customFuncResult !== true) {\n handleCheckEnd(true, customFuncResult, true);\n return;\n }\n }\n if (msgOnSuccess) {\n setSuccessMsg(msgOnSuccess);\n }\n handleCheckEnd(false, msgOnSuccess);\n } else {\n console.error(`The valid ${utils.toCamelCase(TYPE)(true)} \"type\" options in validationOption are [${VALIDATE_OPTION_TYPE_LIST.map(i => i)}]`);\n }\n } else {\n console.error('Please provide \"type\" in validationOption');\n }\n }, [internalValue, option]);\n const handleCheckEnd = useCallback(\n (err: boolean, message: string, fromCustomFunc: boolean = false) => {\n let msg = message;\n const { msgOnError } = option;\n if (err && msgOnError && !fromCustomFunc) {\n msg = msgOnError;\n }\n setErr(err);\n setMsg(msg);\n validationCallback && validationCallback(err);\n },\n [option.msgOnError],\n );\n useEffect(() => {\n if (validate) {\n check();\n }\n }, [validate]);\n useEffect(() => {\n setInternalValue(String(value));\n }, [value]);\n useEffect(() => {\n /* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */\n if (typeof prevInternalValue !== 'undefined' && prevInternalValue !== internalValue) {\n if (option.customFunc && onKeyUp) {\n check();\n }\n }\n }, [internalValue]);\n useEffect(() => {\n if (asyncObj) {\n if (asyncObj.message) {\n if (asyncObj.showOnError) {\n handleCheckEnd(asyncObj.error, asyncObj.message);\n }\n if (!asyncObj.error && asyncObj.showOnSuccess) {\n setSuccessMsg(asyncObj.message);\n }\n }\n }\n }, [asyncMsgObj]);\n const wrapperClass = `${classNameWrapper} ${reactInputsValidationCss[`${TYPE}__wrapper`]} ${err && reactInputsValidationCss['error']} ${successMsg !== '' &&\n !err &&\n reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const containerClass = `${classNameContainer} ${reactInputsValidationCss[`${TYPE}__container`]} ${err && reactInputsValidationCss['error']} ${successMsg !== '' &&\n !err &&\n reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const inputClass = `${classNameInput} ${reactInputsValidationCss[`${TYPE}__input`]} ${err && reactInputsValidationCss['error']} ${successMsg !== '' &&\n !err &&\n reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const errMsgClass = `${MSG_CLASS_IDENTITIFIER} ${reactInputsValidationCss['msg']} ${err && reactInputsValidationCss['error']}`;\n const successMsgClass = `${MSG_CLASS_IDENTITIFIER} ${reactInputsValidationCss['msg']} ${!err && reactInputsValidationCss['success']}`;\n let msgHtml;\n const { showMsg } = option;\n if (showMsg && err && msg) {\n msgHtml =
{msg}
;\n }\n if (showMsg && !err && successMsg !== '') {\n msgHtml =
{successMsg}
;\n }\n return (\n
\n
\n \n {label && attributesInput.id && }\n
\n {msgHtml}\n
\n );\n};\nexport default memo(component);\n","import * as React from 'react';\nconst { useState, useEffect, useCallback, useRef, memo } = React;\nimport message from './message';\nimport validator from './validator';\nimport utils from './utils';\nimport { REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE, DEFAULT_LOCALE, MSG_CLASS_IDENTITIFIER, usePrevious } from './const';\nimport reactInputsValidationCss from './react-inputs-validation.css';\nconst TYPE = 'textarea';\nconst VALIDATE_OPTION_TYPE_LIST = ['string'];\ninterface DefaultValidationOption {\n locale?: string;\n reg?: string;\n min?: number;\n max?: number;\n type?: string;\n name?: string;\n check?: boolean;\n showMsg?: boolean;\n length?: number;\n regMsg?: string;\n required?: boolean;\n msgOnError?: string;\n msgOnSuccess?: string;\n customFunc?: Function | undefined;\n}\nconst getDefaultValidationOption = (obj: DefaultValidationOption) => {\n let { reg, min, max, type, name, check, length, regMsg, required, showMsg, locale, msgOnError, msgOnSuccess, customFunc } = obj;\n locale = typeof locale !== 'undefined' ? locale : DEFAULT_LOCALE;\n reg = typeof reg !== 'undefined' ? reg : '';\n min = typeof min !== 'undefined' ? min : 0;\n max = typeof max !== 'undefined' ? max : 0;\n type = typeof type !== 'undefined' ? type : 'string';\n name = typeof name !== 'undefined' ? name : '';\n check = typeof check !== 'undefined' ? check : true;\n showMsg = typeof showMsg !== 'undefined' ? showMsg : true;\n length = typeof length !== 'undefined' ? length : 0;\n regMsg = typeof regMsg !== 'undefined' ? regMsg : '';\n required = typeof required !== 'undefined' ? required : true;\n msgOnError = typeof msgOnError !== 'undefined' ? msgOnError : '';\n msgOnSuccess = typeof msgOnSuccess !== 'undefined' ? msgOnSuccess : '';\n customFunc = typeof customFunc !== 'undefined' ? customFunc : undefined;\n return {\n reg,\n min,\n max,\n type,\n name,\n check,\n length,\n regMsg,\n locale,\n required,\n showMsg,\n msgOnError,\n msgOnSuccess,\n customFunc,\n };\n};\ninterface DefaultAsyncMsgObj {\n error?: boolean;\n message?: string;\n showOnError?: boolean;\n showOnSuccess?: boolean;\n}\nconst getDefaultAsyncObj = (obj: DefaultAsyncMsgObj) => {\n let { error, message, showOnError, showOnSuccess } = obj;\n error = typeof error !== 'undefined' ? error : false;\n message = typeof message !== 'undefined' ? message : '';\n showOnError = typeof showOnError !== 'undefined' ? showOnError : true;\n showOnSuccess = typeof showOnSuccess !== 'undefined' ? showOnSuccess : false;\n return {\n error,\n message,\n showOnError,\n showOnSuccess,\n };\n};\ninterface AttributesInputObj {\n maxLength?: number;\n}\ninterface Props {\n attributesWrapper?: object;\n attributesInput?: AttributesInputObj;\n value?: string;\n disabled?: boolean;\n validate?: boolean;\n classNameInput?: string;\n classNameWrapper?: string;\n classNameContainer?: string;\n customStyleInput?: object;\n customStyleWrapper?: object;\n customStyleContainer?: object;\n validationOption?: object;\n asyncMsgObj?: object;\n onChange: (res: string, e: React.ChangeEvent) => void;\n onBlur?: (e: React.FocusEvent) => void;\n onFocus?: (e: React.FocusEvent) => void;\n onClick?: (e: React.MouseEvent) => void;\n onKeyUp?: (e: React.KeyboardEvent) => void;\n validationCallback?: (res: boolean) => void;\n}\n\nconst component: React.FC = ({\n attributesWrapper = {},\n attributesInput = {},\n value = '',\n disabled = false,\n validate = false,\n classNameInput = '',\n classNameWrapper = '',\n classNameContainer = '',\n customStyleInput = {},\n customStyleWrapper = {},\n customStyleContainer = {},\n validationOption = {},\n asyncMsgObj = {},\n onChange = () => {},\n onBlur = null,\n onFocus = null,\n onClick = null,\n onKeyUp = null,\n validationCallback = null,\n}) => {\n const [err, setErr] = useState(false);\n const [msg, setMsg] = useState('');\n const [successMsg, setSuccessMsg] = useState('');\n const [internalValue, setInternalValue] = useState(String(value));\n const prevInternalValue = usePrevious(internalValue);\n const option = getDefaultValidationOption(validationOption);\n const asyncObj = getDefaultAsyncObj(asyncMsgObj);\n const $input = useRef(null);\n const $el: { [key: string]: any } | null = $input;\n const handleOnBlur = useCallback(\n (e: React.FocusEvent) => {\n if (onBlur) {\n check();\n onBlur(e);\n }\n },\n [internalValue, option],\n );\n const handleOnFocus = useCallback((e: React.FocusEvent) => {\n if (onFocus) {\n onFocus(e);\n }\n }, []);\n const handleOnClick = useCallback((e: React.MouseEvent) => {\n if (onClick) {\n onClick(e);\n }\n }, []);\n const handleOnKeyUp = useCallback(\n (e: React.KeyboardEvent) => {\n if (onKeyUp) {\n const { keyCode } = e;\n const keyCodeTab = 9;\n if (keyCode !== keyCodeTab) {\n check();\n }\n onKeyUp(e);\n }\n },\n [internalValue, option],\n );\n const handleOnChange = useCallback(\n (e: React.ChangeEvent) => {\n if (disabled || $el === null) {\n return;\n }\n const v = $el.current.value;\n if (typeof attributesInput.maxLength !== 'undefined') {\n if ((typeof attributesInput.maxLength === 'string' && attributesInput.maxLength !== '') || (typeof attributesInput.maxLength === 'number' && attributesInput.maxLength !== 0)) {\n if (v.length > Number(attributesInput.maxLength)) {\n return;\n }\n }\n }\n setInternalValue(v);\n onChange && onChange(v, e);\n if (err) {\n setErr(false);\n } else {\n setSuccessMsg('');\n }\n },\n [err],\n );\n const check = useCallback(\n async () => {\n const { reg, min, max, type, name, check, length, regMsg, locale, required, msgOnSuccess, customFunc } = option;\n if (!check) {\n return;\n }\n if (type) {\n if (VALIDATE_OPTION_TYPE_LIST.indexOf(type) !== -1) {\n if (!message[locale] || !message[locale][TYPE]) {\n console.error(REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE);\n return;\n }\n const msg = message[locale][TYPE];\n const nameText = name ? name : '';\n if (required) {\n if (validator.empty(internalValue)) {\n handleCheckEnd(true, msg.empty(nameText));\n return;\n }\n }\n if (String(internalValue) !== '') {\n if (reg) {\n if (validator['reg'](reg, internalValue)) {\n handleCheckEnd(true, regMsg !== '' ? regMsg : msg.invalid(nameText));\n return;\n }\n }\n if (min || max) {\n if (min && max) {\n if (String(internalValue).length < min || String(internalValue).length > max) {\n handleCheckEnd(true, msg.inBetween(nameText)(min)(max));\n return;\n }\n } else {\n if (min) {\n if (String(internalValue).length < min) {\n handleCheckEnd(true, msg.lessThan(nameText)(min));\n return;\n }\n }\n if (max) {\n if (String(internalValue).length > max) {\n handleCheckEnd(true, msg.greaterThan(nameText)(max));\n return;\n }\n }\n }\n }\n if (length) {\n if (String(internalValue).length !== length) {\n handleCheckEnd(true, msg.lengthEqual(nameText)(length));\n return;\n }\n }\n }\n if (customFunc && typeof customFunc === 'function') {\n const customFuncResult = await customFunc(internalValue);\n /* istanbul ignore next because of async problem */\n if (typeof customFuncResult === 'object') {\n if (typeof customFuncResult.error === 'boolean' && typeof customFuncResult.message === 'string') {\n if (customFuncResult.error === false && customFuncResult.showOnSuccess === true) {\n setSuccessMsg(customFuncResult.message);\n }\n handleCheckEnd(customFuncResult.error, customFuncResult.message, true);\n }\n return;\n }\n /* istanbul ignore next because of async problem */\n if (customFuncResult !== true) {\n handleCheckEnd(true, customFuncResult, true);\n return;\n }\n }\n if (msgOnSuccess) {\n setSuccessMsg(msgOnSuccess);\n }\n handleCheckEnd(false, msgOnSuccess);\n } else {\n console.error(`The valid ${utils.toCamelCase(TYPE)(true)} \"type\" options in validationOption are [${VALIDATE_OPTION_TYPE_LIST.map(i => i)}]`);\n }\n } else {\n console.error('Please provide \"type\" in validationOption');\n }\n },\n [internalValue, option],\n );\n const handleCheckEnd = useCallback((err: boolean, message: string, fromCustomFunc: boolean = false) => {\n let msg = message;\n const { msgOnError } = option;\n if (err && msgOnError && !fromCustomFunc) {\n msg = msgOnError;\n }\n setErr(err);\n setMsg(msg);\n validationCallback && validationCallback(err);\n }, [option.msgOnError]);\n useEffect(\n () => {\n if (validate) {\n check();\n }\n },\n [validate],\n );\n useEffect(\n () => {\n setInternalValue(String(value));\n },\n [value],\n );\n useEffect(\n () => {\n /* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */\n if (typeof prevInternalValue !== 'undefined' && prevInternalValue !== internalValue) {\n if (option.customFunc && onKeyUp) {\n check();\n }\n }\n },\n [internalValue],\n );\n useEffect(\n () => {\n if (asyncObj) {\n if (asyncObj.message) {\n if (asyncObj.showOnError) {\n handleCheckEnd(asyncObj.error, asyncObj.message);\n }\n if (!asyncObj.error && asyncObj.showOnSuccess) {\n setSuccessMsg(asyncObj.message);\n }\n }\n }\n },\n [asyncMsgObj],\n );\n const wrapperClass = `${classNameWrapper} ${reactInputsValidationCss[`${TYPE}__wrapper`]} ${err && reactInputsValidationCss['error']} ${successMsg !== '' &&\n !err &&\n reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const containerClass = `${classNameContainer} ${reactInputsValidationCss[`${TYPE}__container`]} ${err && reactInputsValidationCss['error']} ${successMsg !== '' &&\n !err &&\n reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const inputClass = `${classNameInput} ${reactInputsValidationCss[`${TYPE}__input`]} ${err && reactInputsValidationCss['error']} ${successMsg !== '' &&\n !err &&\n reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const errMsgClass = `${MSG_CLASS_IDENTITIFIER} ${reactInputsValidationCss['msg']} ${err && reactInputsValidationCss['error']}`;\n const successMsgClass = `${MSG_CLASS_IDENTITIFIER} ${reactInputsValidationCss['msg']} ${!err && reactInputsValidationCss['success']}`;\n let msgHtml;\n const { showMsg } = option;\n if (showMsg && err && msg) {\n msgHtml =
{msg}
;\n }\n if (showMsg && !err && successMsg !== '') {\n msgHtml =
{successMsg}
;\n }\n return (\n
\n
\n \n
\n {msgHtml}\n
\n );\n};\nexport default memo(component);\n","import * as React from 'react';\nconst { useState, useEffect, useCallback, useRef, useMemo, memo } = React;\nimport message from './message';\nimport { REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE, DEFAULT_LOCALE, WRAPPER_CLASS_IDENTITIFIER, CONTAINER_CLASS_IDENTITIFIER, MSG_CLASS_IDENTITIFIER, usePrevious } from './const';\nimport utils from './utils';\nimport reactInputsValidationCss from './react-inputs-validation.css';\nconst TYPE = 'select';\nconst keyCodeEsc = 27;\nconst keyCodeDown = 40;\nconst keyCodeUp = 38;\nconst keyCodeEnter = 13;\nconst selectKeyList = [keyCodeEsc, keyCodeDown, keyCodeUp, keyCodeEnter];\n/* istanbul ignore next */\nif (!String.prototype.startsWith) {\n String.prototype.startsWith = function(searchString, position) {\n const p = position || 0;\n return this.indexOf(searchString, p) === p;\n };\n}\ninterface DefaultValidationOption {\n name?: string;\n check?: boolean;\n showMsg?: boolean;\n required?: boolean;\n locale?: string;\n msgOnError?: string;\n msgOnSuccess?: string;\n}\nconst getDefaultValidationOption = (obj: DefaultValidationOption) => {\n let { name, check, required, showMsg, locale, msgOnError, msgOnSuccess } = obj;\n locale = typeof locale !== 'undefined' ? locale : DEFAULT_LOCALE;\n name = typeof name !== 'undefined' ? name : '';\n check = typeof check !== 'undefined' ? check : true;\n showMsg = typeof showMsg !== 'undefined' ? showMsg : true;\n required = typeof required !== 'undefined' ? required : true;\n msgOnSuccess = typeof msgOnSuccess !== 'undefined' ? msgOnSuccess : '';\n msgOnError = typeof msgOnError !== 'undefined' ? msgOnError : '';\n return {\n name,\n check,\n showMsg,\n required,\n locale,\n msgOnError,\n msgOnSuccess,\n };\n};\ninterface DefaultAsyncMsgObj {\n error?: boolean;\n message?: string;\n showOnError?: boolean;\n showOnSuccess?: boolean;\n}\nconst getDefaultAsyncObj = (obj: DefaultAsyncMsgObj) => {\n let { error, message, showOnError, showOnSuccess } = obj;\n error = typeof error !== 'undefined' ? error : false;\n message = typeof message !== 'undefined' ? message : '';\n showOnError = typeof showOnError !== 'undefined' ? showOnError : true;\n showOnSuccess = typeof showOnSuccess !== 'undefined' ? showOnSuccess : false;\n return {\n error,\n message,\n showOnError,\n showOnSuccess,\n };\n};\nexport const isValidValue = (list: OptionListItem[], value: any) => {\n let res = false;\n if (list.length) {\n for (let i = 0; i < list.length; i += 1) {\n if (list[i].id === value) {\n res = true;\n break;\n }\n }\n }\n return res;\n};\nexport const getItem = (list: OptionListItem[], value: any) => {\n let res = null;\n if (list.length) {\n for (let i = 0; i < list.length; i += 1) {\n if (list[i].id === value) {\n res = list[i];\n break;\n }\n }\n }\n return res;\n};\nexport const getIndex = (list: OptionListItem[], value: string) => {\n let key = -1;\n for (let i = 0; i < list.length; i += 1) {\n if (list[i].id === value) {\n key = i;\n break;\n }\n }\n return key;\n};\ninterface OptionListItem {\n id: string;\n name: string;\n}\ninterface Props {\n attributesWrapper?: object;\n attributesInput?: object;\n value?: string | number;\n disabled?: boolean;\n validate?: boolean;\n showSearch?: boolean;\n showArrow?: boolean;\n keyword?: string;\n optionList: OptionListItem[];\n onChange: (res: object, e: React.MouseEvent) => void;\n onBlur?: (e: React.FocusEvent | Event) => void;\n onFocus?: (e: React.FocusEvent) => void;\n onClick?: (e: React.MouseEvent) => void;\n validationOption?: object;\n asyncMsgObj?: object;\n classNameWrapper?: string;\n classNameContainer?: string;\n classNameSelect?: string;\n classNameOptionListContainer?: string;\n classNameDropdownIconOptionListItem?: string;\n classNameOptionListItem?: string;\n customStyleWrapper?: object;\n customStyleContainer?: object;\n customStyleSelect?: object;\n customStyleOptionListContainer?: object;\n customStyleDropdownIcon?: object;\n customStyleOptionListItem?: object;\n validationCallback?: (res: boolean) => void;\n}\ninterface Node {\n [key: string]: any;\n}\nlet globalVariableIsFocusing: boolean = false;\nlet globalVariableIsCorrected: boolean = false;\nlet globalVariableCurrentFocus: any | null = null;\nlet globalVariableTypingTimeout: any | null = null;\nconst component: React.FC = ({\n attributesWrapper = {},\n attributesInput = {},\n value = '',\n disabled = false,\n validate = false,\n showSearch = false,\n showArrow = true,\n keyword = '',\n optionList = [],\n classNameWrapper = '',\n classNameContainer = '',\n classNameSelect = '',\n classNameOptionListItem = '',\n classNameOptionListContainer = '',\n classNameDropdownIconOptionListItem = '',\n customStyleWrapper = {},\n customStyleContainer = {},\n customStyleSelect = {},\n customStyleOptionListItem = {},\n customStyleOptionListContainer = {},\n customStyleDropdownIcon = {},\n validationOption = {},\n asyncMsgObj = {},\n onChange = () => {},\n onBlur = null,\n onFocus = null,\n onClick = null,\n validationCallback = null,\n}) => {\n const [err, setErr] = useState(false);\n const [msg, setMsg] = useState('');\n const [successMsg, setSuccessMsg] = useState('');\n const [internalValue, setInternalValue] = useState(String(value));\n const stateKeyword = useState(keyword);\n const prevKeyword = usePrevious(stateKeyword[0]);\n const prevInternalValue = usePrevious(internalValue);\n const prevOptionList = usePrevious(optionList);\n const [show, setShow] = useState(false);\n const prevShow = usePrevious(show);\n const [isTyping, setIsTyping] = useState(false);\n const initKeycodeList: number[] = [];\n const [keycodeList, setKeycodeList] = useState(initKeycodeList);\n const option = getDefaultValidationOption(validationOption);\n const asyncObj = getDefaultAsyncObj(asyncMsgObj);\n const $button = useRef(null);\n const $wrapper = useRef(null);\n const $itemsWrapper = useRef(null);\n const $searchInputWrapper = useRef(null);\n const $searchInput = useRef(null);\n const $elButton: { [key: string]: any } | null = $button;\n const $elWrapper: { [key: string]: any } | null = $wrapper;\n const $elItemsWrapper: { [key: string]: any } | null = $itemsWrapper;\n const $itemsRef: { [key: string]: any } = [];\n const filteredOptionList = useMemo(() => {\n let res = optionList;\n if (res.length) {\n if (stateKeyword[0]) {\n res = optionList.filter(i => i.name.toLowerCase().includes(stateKeyword[0].toLowerCase()));\n }\n }\n return res;\n }, [stateKeyword[0], optionList]);\n const handleOnSearch = useCallback((e: any) => {\n stateKeyword[1](e.target.value);\n }, []);\n const handleOnSearchKeyDown = useCallback(\n (e: any) => {\n const { keyCode } = e;\n const direction = getDirection(keyCode);\n if (selectKeyList.indexOf(keyCode) !== -1) {\n e.preventDefault();\n handleOnKeyDown(keyCode);\n } else if (keyCode === 32) {\n // space\n stateKeyword[1](`${stateKeyword[0]} `);\n e.preventDefault();\n }\n scroll(direction);\n },\n [filteredOptionList],\n );\n useEffect(() => {\n if (show && showSearch) {\n globalVariableCurrentFocus = 0;\n scroll('up');\n addActive();\n }\n }, [stateKeyword[0]]);\n const handleOnBlur = useCallback(\n (e: React.FocusEvent | Event) => {\n if (onBlur) {\n check();\n onBlur(e);\n }\n },\n [internalValue, option],\n );\n const handleOnFocus = useCallback((e: React.FocusEvent) => {\n if (onFocus) {\n onFocus(e);\n }\n }, []);\n const handleOnClick = useCallback((e: React.MouseEvent) => {\n if (onClick) {\n onClick(e);\n }\n }, []);\n const handleOnChange = useCallback((item: object, e: React.MouseEvent) => {\n if (disabled) {\n return;\n }\n onChange && onChange(item, e);\n }, []);\n const check = useCallback(() => {\n const { name, check, locale, required, msgOnSuccess } = option;\n if (!check) {\n return;\n }\n if (!message[locale] || !message[locale][TYPE]) {\n console.error(REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE);\n return;\n }\n if (required) {\n const msg = message[locale][TYPE];\n const nameText = name ? name : '';\n if (!isValidValue(optionList, internalValue) || internalValue === '' || internalValue === 'null' || internalValue === 'undefined') {\n handleCheckEnd(true, msg.empty(nameText));\n return;\n }\n }\n if (msgOnSuccess) {\n setSuccessMsg(msgOnSuccess);\n }\n handleCheckEnd(false, msgOnSuccess);\n }, [internalValue, option]);\n const handleCheckEnd = useCallback(\n (err: boolean, message: string) => {\n let msg = message;\n const { msgOnError } = option;\n if (err && msgOnError) {\n msg = msgOnError;\n }\n setErr(err);\n setMsg(msg);\n validationCallback && validationCallback(err);\n },\n [option.msgOnError],\n );\n /* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */\n useEffect(() => {\n if (typeof window !== 'undefined') {\n window.addEventListener('mousedown', pageClick);\n window.addEventListener('touchstart', pageClick);\n return () => {\n window.removeEventListener('mousedown', pageClick);\n window.removeEventListener('touchstart', pageClick);\n $elWrapper.current.removeEventListener('keydown', onKeyDown);\n };\n }\n }, []);\n /* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */\n const pageClick = useCallback((e: Event) => {\n if ($elWrapper.current.contains(e.target)) {\n return;\n }\n if (globalVariableIsFocusing) {\n handleOnBlur(e);\n globalVariableIsFocusing = false;\n }\n setShow(false);\n }, []);\n /* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */\n const resetCurrentFocus = useCallback(() => {\n globalVariableCurrentFocus = getIndex(filteredOptionList, internalValue);\n scroll();\n }, [internalValue]);\n /* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */\n const setTimeoutTyping = useCallback(() => {\n if (globalVariableTypingTimeout) {\n clearTimeout(globalVariableTypingTimeout);\n }\n globalVariableTypingTimeout = setTimeout(() => {\n setKeycodeList([]);\n }, 250);\n }, []);\n /* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */\n const scroll = useCallback((direction: undefined | string = undefined) => {\n if ($itemsWrapper && $itemsWrapper.current && $itemsWrapper.current.children) {\n const $children = $itemsWrapper.current.children;\n const containerHeight = $elItemsWrapper.current.offsetHeight;\n const containerScrollTop = $elItemsWrapper.current.scrollTop;\n if (!$children[globalVariableCurrentFocus]) {\n return;\n }\n const itemHeight = $children[globalVariableCurrentFocus].offsetHeight;\n if (direction) {\n if (direction === 'loop') {\n $elItemsWrapper.current.scrollTop = $children.length * itemHeight;\n return;\n }\n if (direction === 'down') {\n const bound = containerScrollTop + containerHeight;\n const heightItems = globalVariableCurrentFocus * itemHeight;\n const heightContainer = bound - itemHeight;\n if (heightItems >= heightContainer) {\n const offset = Math.abs(heightItems - heightContainer - itemHeight);\n if (offset >= 0 && !globalVariableIsCorrected) {\n $elItemsWrapper.current.scrollTop = containerScrollTop + itemHeight - offset;\n globalVariableIsCorrected = true;\n } else {\n $elItemsWrapper.current.scrollTop = containerScrollTop + itemHeight;\n }\n }\n }\n if (direction === 'up') {\n globalVariableIsCorrected = false;\n if (globalVariableCurrentFocus * itemHeight <= containerScrollTop) {\n $elItemsWrapper.current.scrollTop = globalVariableCurrentFocus * itemHeight;\n }\n }\n } else {\n globalVariableIsCorrected = false;\n $elItemsWrapper.current.scrollTop = globalVariableCurrentFocus * itemHeight;\n }\n }\n }, []);\n const handleOnItemClick = useCallback((item: object, e: React.MouseEvent) => {\n handleOnChange(item, e);\n stateKeyword[1]('');\n }, []);\n const handleOnItemMouseOver = useCallback((index: number) => {\n globalVariableCurrentFocus = index;\n addActive();\n }, []);\n const handleOnItemMouseMove = useCallback(() => {\n setIsTyping(false);\n }, []);\n const handleOnItemMouseOut = useCallback(() => {\n removeActive();\n }, []);\n const addActive = useCallback(() => {\n if ($itemsWrapper && $itemsWrapper.current && $itemsWrapper.current.children) {\n const $children = $itemsWrapper.current.children;\n removeActive();\n if (globalVariableCurrentFocus === null) return;\n if (globalVariableCurrentFocus >= $children.length) globalVariableCurrentFocus = 0;\n if (globalVariableCurrentFocus < 0) globalVariableCurrentFocus = $children.length - 1;\n if ($children[globalVariableCurrentFocus]) $children[globalVariableCurrentFocus].className += ` ${reactInputsValidationCss[`${TYPE}__hover-active`]}`;\n }\n }, []);\n const removeActive = useCallback(() => {\n if ($itemsWrapper && $itemsWrapper.current && $itemsWrapper.current.children) {\n const $children = $itemsWrapper.current.children;\n for (let i = 0; i < $children.length; i += 1) {\n $children[i].className = $children[i].className.replace(reactInputsValidationCss[`${TYPE}__hover-active`], '');\n }\n }\n }, []);\n const getDirection = useCallback(keyCode => {\n switch (keyCode) {\n case keyCodeUp:\n return 'up';\n case keyCodeDown:\n return 'down';\n default:\n return undefined;\n }\n }, []);\n const handleOnKeyDown = useCallback(\n keyCode => {\n if (keyCode === keyCodeEsc) {\n setShow(false);\n resetCurrentFocus();\n return;\n }\n if (keyCode === keyCodeDown) {\n globalVariableCurrentFocus += 1;\n if (globalVariableCurrentFocus > filteredOptionList.length - 1) {\n globalVariableCurrentFocus = 0;\n scroll('up');\n }\n addActive();\n } else if (keyCode === keyCodeUp) {\n globalVariableCurrentFocus -= 1;\n if (globalVariableCurrentFocus < 0) {\n globalVariableCurrentFocus = filteredOptionList.length - 1;\n scroll('loop');\n }\n addActive();\n } else if (keyCode === keyCodeEnter) {\n if (globalVariableCurrentFocus > -1) {\n if ($itemsWrapper && $itemsWrapper.current && $itemsWrapper.current.children) {\n const $children = $itemsWrapper.current.children;\n if ($children[globalVariableCurrentFocus]) {\n $children[globalVariableCurrentFocus].click();\n } else {\n return;\n }\n }\n }\n }\n },\n [filteredOptionList],\n );\n /* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */\n const onKeyDown = useCallback(\n (e: any) => {\n if (showSearch) {\n return;\n }\n setIsTyping(true);\n if (e.preventDefault) {\n e.preventDefault();\n }\n if (!show) {\n return;\n }\n globalVariableCurrentFocus = globalVariableCurrentFocus === null ? getIndex(filteredOptionList, String(value)) : globalVariableCurrentFocus;\n const { keyCode } = e;\n const direction = getDirection(keyCode);\n if (selectKeyList.indexOf(keyCode) !== -1) {\n handleOnKeyDown(keyCode);\n } else {\n setTimeoutTyping();\n const newkeyCodeList = [...keycodeList, keyCode];\n const str = String.fromCharCode(...newkeyCodeList).toLowerCase();\n let index = -1;\n filteredOptionList.forEach((i, k) => {\n const { name } = i;\n if (name.toLowerCase().startsWith(str)) {\n if (index === -1) {\n index = k;\n }\n }\n });\n if (index !== -1) {\n globalVariableCurrentFocus = index;\n addActive();\n }\n setKeycodeList(newkeyCodeList);\n }\n scroll(direction);\n return globalVariableCurrentFocus;\n },\n [show, value, keycodeList],\n );\n useEffect(() => {\n if (show && $elWrapper) {\n document.addEventListener('keydown', onKeyDown);\n }\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n };\n }, [show, value, keycodeList]);\n useEffect(() => {\n if (validate) {\n check();\n }\n }, [validate]);\n useEffect(() => {\n if (!(!isValidValue(filteredOptionList, internalValue) || internalValue === '' || internalValue === 'null' || internalValue === 'undefined')) {\n setErr(false);\n } else {\n setSuccessMsg('');\n }\n }, [internalValue]);\n useEffect(() => {\n setInternalValue(String(value));\n }, [value]);\n useEffect(() => {\n if (prevOptionList && prevOptionList && !utils.arraysEqual(prevOptionList, optionList)) {\n setInternalValue(String(optionList[0].id));\n }\n }, [optionList]);\n useEffect(() => {\n if (typeof prevInternalValue !== 'undefined' && prevInternalValue !== internalValue) {\n check();\n }\n }, [prevInternalValue, internalValue]);\n useEffect(() => {\n if (asyncObj) {\n if (asyncObj.message) {\n if (asyncObj.showOnError) {\n handleCheckEnd(asyncObj.error, asyncObj.message);\n }\n if (!asyncObj.error && asyncObj.showOnSuccess) {\n setSuccessMsg(asyncObj.message);\n }\n }\n }\n }, [asyncMsgObj]);\n useEffect(() => {\n if (show) {\n if (showSearch) {\n $searchInput.current.focus();\n }\n globalVariableCurrentFocus = globalVariableCurrentFocus === null ? getIndex(filteredOptionList, String(value)) : globalVariableCurrentFocus;\n $itemsRef[globalVariableCurrentFocus] && $itemsRef[globalVariableCurrentFocus].current.focus();\n }\n if (prevShow === true && show === false) {\n $elButton.current.focus();\n }\n resetCurrentFocus();\n }, [show]);\n const wrapperClass = `${WRAPPER_CLASS_IDENTITIFIER} ${classNameWrapper} ${reactInputsValidationCss[`${TYPE}__wrapper`]} ${err && reactInputsValidationCss['error']} ${successMsg !== '' &&\n !err &&\n reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const containerClass = `${CONTAINER_CLASS_IDENTITIFIER} ${classNameContainer} ${reactInputsValidationCss[`${TYPE}__container`]} ${err && reactInputsValidationCss['error']} ${show &&\n reactInputsValidationCss['show']} ${successMsg !== '' && !err && reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const inputClass = `${reactInputsValidationCss[`${TYPE}__input`]} ${err && reactInputsValidationCss['error']} ${successMsg !== '' && !err && reactInputsValidationCss['success']} ${disabled &&\n reactInputsValidationCss['disabled']}`;\n const selectClass = `${classNameSelect} ${reactInputsValidationCss['ellipsis']} ${err && reactInputsValidationCss['error']} ${successMsg !== '' &&\n !err &&\n reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const selectOptionListContainerClass = `${classNameOptionListContainer} ${reactInputsValidationCss[`${TYPE}__options-container`]} ${err && reactInputsValidationCss['error']} ${show &&\n reactInputsValidationCss['show']} ${successMsg !== '' && !err && reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const selectOptionListItemClass = `${reactInputsValidationCss[`button`]} ${!isTyping && reactInputsValidationCss[`${TYPE}__options-item-show-cursor`]} ${classNameOptionListItem} ${\n reactInputsValidationCss[`${TYPE}__options-item`]\n } ${err && reactInputsValidationCss['error']} ${successMsg !== '' && !err && reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const dropdownIconClass = `${classNameDropdownIconOptionListItem} ${reactInputsValidationCss[`${TYPE}__dropdown-icon`]} ${showArrow && reactInputsValidationCss['showArrow']}`;\n const errMsgClass = `${MSG_CLASS_IDENTITIFIER} ${reactInputsValidationCss['msg']} ${err && reactInputsValidationCss['error']}`;\n const successMsgClass = `${MSG_CLASS_IDENTITIFIER} ${reactInputsValidationCss['msg']} ${!err && reactInputsValidationCss['success']}`;\n let msgHtml;\n const { showMsg } = option;\n if (showMsg && err && msg) {\n msgHtml =
{msg}
;\n }\n if (showMsg && !err && successMsg !== '') {\n msgHtml =
{successMsg}
;\n }\n let optionListHtml;\n const item = getItem(optionList, String(value));\n if (filteredOptionList.length) {\n optionListHtml = filteredOptionList.map((i, k) => (\n \n ));\n } else {\n if (showSearch) {\n optionListHtml = (\n
\n \n \n \n \n
\n );\n }\n }\n const selectorHtml = (\n
\n
{item ? item.name : ''}
\n
\n
\n );\n return (\n {\n handleOnClick(e);\n if (!disabled) {\n if ($searchInputWrapper.current) {\n if ($searchInputWrapper.current.contains(e.target)) {\n setShow(true);\n return;\n }\n }\n setShow(!show);\n }\n }}\n onFocus={handleOnFocus}\n onBlur={handleOnBlur}\n {...attributesWrapper}\n >\n
\n
\n {}} {...attributesInput} />\n
\n {selectorHtml}\n
\n
\n {showSearch && (\n
\n
\n \n \n \n \n \n {stateKeyword[0] && (\n {\n stateKeyword[1]('');\n $searchInput.current.focus();\n }}\n >\n \n \n \n )}\n
\n
\n )}\n
\n {optionListHtml}\n
\n
\n
\n {msgHtml}\n
\n \n );\n};\ninterface OptionProps {\n index?: number;\n id?: string;\n className?: string;\n item?: OptionListItem;\n customStyleOptionListItem?: object;\n onClick?: (res: object, e: React.MouseEvent) => void;\n onMouseOver?: (res: number) => void;\n onMouseMove?: () => void;\n onMouseOut?: () => void;\n}\nexport const Option: React.FC = memo(\n ({ index = -1, id = '', className = '', item = { id: '', name: '' }, customStyleOptionListItem = {}, onClick = () => {}, onMouseOver = () => {}, onMouseMove = () => {}, onMouseOut = () => {} }) => {\n const handleOnClick = useCallback(\n (e: React.MouseEvent) => {\n onClick(item, e);\n },\n [item],\n );\n const handleOnMouseOver = useCallback(() => {\n onMouseOver(index);\n }, []);\n const handleOnMouseMove = useCallback(() => {\n onMouseMove();\n }, []);\n const handleOnMouseOut = useCallback(() => {\n onMouseOut();\n }, []);\n return (\n \n {item.name}\n \n );\n },\n);\nexport default memo(component);\n","import * as React from 'react';\nconst { useState, useEffect, useCallback, useRef, memo } = React;\nimport message from './message';\nimport { REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE, DEFAULT_LOCALE, WRAPPER_CLASS_IDENTITIFIER, MSG_CLASS_IDENTITIFIER, usePrevious } from './const';\nimport utils from './utils';\nimport reactInputsValidationCss from './react-inputs-validation.css';\nconst TYPE = 'checkbox';\ninterface DefaultValidationOption {\n name?: string;\n check?: boolean;\n showMsg?: boolean;\n required?: boolean;\n locale?: string;\n msgOnError?: string;\n msgOnSuccess?: string;\n}\nconst getDefaultValidationOption = (obj: DefaultValidationOption) => {\n let { name, check, required, showMsg, locale, msgOnError, msgOnSuccess } = obj;\n locale = typeof locale !== 'undefined' ? locale : DEFAULT_LOCALE;\n name = typeof name !== 'undefined' ? name : '';\n check = typeof check !== 'undefined' ? check : true;\n showMsg = typeof showMsg !== 'undefined' ? showMsg : true;\n required = typeof required !== 'undefined' ? required : true;\n msgOnSuccess = typeof msgOnSuccess !== 'undefined' ? msgOnSuccess : '';\n msgOnError = typeof msgOnError !== 'undefined' ? msgOnError : '';\n return {\n name,\n check,\n showMsg,\n required,\n locale,\n msgOnError,\n msgOnSuccess,\n };\n};\ninterface DefaultAsyncMsgObj {\n error?: boolean;\n message?: string;\n showOnError?: boolean;\n showOnSuccess?: boolean;\n}\nconst getDefaultAsyncObj = (obj: DefaultAsyncMsgObj) => {\n let { error, message, showOnError, showOnSuccess } = obj;\n error = typeof error !== 'undefined' ? error : false;\n message = typeof message !== 'undefined' ? message : '';\n showOnError = typeof showOnError !== 'undefined' ? showOnError : true;\n showOnSuccess = typeof showOnSuccess !== 'undefined' ? showOnSuccess : false;\n return {\n error,\n message,\n showOnError,\n showOnSuccess,\n };\n};\ninterface Props {\n attributesWrapper?: object;\n attributesInput?: object;\n value?: string | boolean;\n checked?: boolean;\n disabled?: boolean;\n labelHtml?: React.ReactNode;\n validate?: boolean;\n onChange: (res: boolean, e: React.ChangeEvent | React.MouseEvent) => void;\n onBlur?: (e: React.FocusEvent) => void;\n onFocus?: (e: React.FocusEvent) => void;\n onClick?: (e: React.MouseEvent) => void;\n validationOption?: object;\n asyncMsgObj?: object;\n classNameInput?: string;\n classNameWrapper?: string;\n classNameInputBox?: string;\n classNameContainer?: string;\n customStyleInput?: object;\n customStyleWrapper?: object;\n customStyleContainer?: object;\n customStyleInputBox?: object;\n validationCallback?: (res: boolean) => void;\n}\nconst component: React.FC = ({\n attributesWrapper = {},\n attributesInput = {},\n value = '',\n checked = false,\n disabled = false,\n validate = false,\n labelHtml = null,\n classNameInput = '',\n classNameWrapper = '',\n classNameInputBox = '',\n classNameContainer = '',\n customStyleInput = {},\n customStyleWrapper = {},\n customStyleInputBox = {},\n customStyleContainer = {},\n validationOption = {},\n asyncMsgObj = {},\n onChange = () => {},\n onBlur = null,\n onFocus = null,\n onClick = null,\n validationCallback = null,\n}) => {\n const [err, setErr] = useState(false);\n const [msg, setMsg] = useState('');\n const [successMsg, setSuccessMsg] = useState('');\n const [internalChecked, setInternalChecked] = useState(checked);\n const prevInternalChecked = usePrevious(internalChecked);\n const option = getDefaultValidationOption(validationOption);\n const asyncObj = getDefaultAsyncObj(asyncMsgObj);\n const $input = useRef(null);\n const $el: { [key: string]: any } | null = $input;\n const handleOnBlur = useCallback(\n (e: React.FocusEvent) => {\n if (onBlur) {\n check();\n onBlur(e);\n }\n },\n [internalChecked, option],\n );\n const handleOnFocus = useCallback(\n (e: React.FocusEvent) => {\n if (onFocus) {\n onFocus(e);\n }\n },\n [internalChecked],\n );\n const handleOnClick = useCallback(\n (e: React.MouseEvent) => {\n handleOnChange(e);\n if (onClick) {\n onClick(e);\n }\n },\n [err, internalChecked, disabled],\n );\n const handleOnChange = useCallback(\n (e: React.ChangeEvent | React.MouseEvent) => {\n if (disabled || $el === null) {\n return;\n }\n setInternalChecked(!internalChecked);\n onChange && onChange(!internalChecked, e);\n if (err) {\n setErr(false);\n } else {\n setSuccessMsg('');\n }\n },\n [err, internalChecked, disabled],\n );\n const check = useCallback(\n () => {\n const { name, check, locale, required, msgOnSuccess } = option;\n if (!check) {\n return;\n }\n if (!message[locale] || !message[locale][TYPE]) {\n console.error(REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE);\n return;\n }\n if (required) {\n const msg = message[locale][TYPE];\n const nameText = name ? name : '';\n if (!internalChecked) {\n handleCheckEnd(true, msg.unchecked(nameText));\n return;\n }\n }\n if (msgOnSuccess) {\n setSuccessMsg(msgOnSuccess);\n }\n handleCheckEnd(false, msgOnSuccess);\n },\n [internalChecked, option],\n );\n const handleCheckEnd = useCallback((err: boolean, message: string) => {\n let msg = message;\n const { msgOnError } = option;\n if (err && msgOnError) {\n msg = msgOnError;\n }\n setErr(err);\n setMsg(msg);\n validationCallback && validationCallback(err);\n }, [option.msgOnError]);\n useEffect(\n () => {\n if (validate) {\n check();\n }\n },\n [validate, internalChecked],\n );\n useEffect(\n () => {\n setInternalChecked(checked);\n },\n [checked],\n );\n useEffect(\n () => {\n if (typeof prevInternalChecked !== 'undefined' && prevInternalChecked !== internalChecked) {\n check();\n }\n },\n [prevInternalChecked, internalChecked],\n );\n useEffect(\n () => {\n if (asyncObj) {\n if (asyncObj.message) {\n if (asyncObj.showOnError) {\n handleCheckEnd(asyncObj.error, asyncObj.message);\n }\n if (!asyncObj.error && asyncObj.showOnSuccess) {\n setSuccessMsg(asyncObj.message);\n }\n }\n }\n },\n [asyncMsgObj],\n );\n const wrapperClass = `${reactInputsValidationCss['button']} ${WRAPPER_CLASS_IDENTITIFIER} ${classNameWrapper} ${reactInputsValidationCss[`${TYPE}__wrapper`]} ${internalChecked && reactInputsValidationCss['checked']} ${err &&\n reactInputsValidationCss['error']} ${successMsg !== '' && !err && reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const containerClass = `${classNameContainer} ${reactInputsValidationCss[`${TYPE}__container`]} ${internalChecked && reactInputsValidationCss['checked']} ${err &&\n reactInputsValidationCss['error']} ${successMsg !== '' && !err && reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const boxClass = `${classNameInputBox} ${reactInputsValidationCss[`${TYPE}__box`]} ${err && reactInputsValidationCss['error']} ${internalChecked &&\n reactInputsValidationCss['checked']} ${successMsg !== '' && !err && reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const labelClass = `${internalChecked && reactInputsValidationCss['checked']} ${err && reactInputsValidationCss['error']} ${successMsg !== '' &&\n !err &&\n reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;\n const errMsgClass = `${MSG_CLASS_IDENTITIFIER} ${reactInputsValidationCss['msg']} ${err && reactInputsValidationCss['error']}`;\n const successMsgClass = `${MSG_CLASS_IDENTITIFIER} ${reactInputsValidationCss['msg']} ${!err && reactInputsValidationCss['success']}`;\n let msgHtml;\n const { showMsg } = option;\n if (showMsg && err && msg) {\n msgHtml =
{msg}
;\n }\n if (showMsg && !err && successMsg !== '') {\n msgHtml =
{successMsg}
;\n }\n return (\n \n );\n};\nexport default memo(component);\n","import * as React from 'react';\nconst { useState, useEffect, useCallback, useRef, memo } = React;\nimport message from './message';\nimport { REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE, DEFAULT_LOCALE, WRAPPER_CLASS_IDENTITIFIER, OPTION_LIST_ITEM_IDENTITIFIER, MSG_CLASS_IDENTITIFIER, usePrevious } from './const';\nimport utils from './utils';\nimport reactInputsValidationCss from './react-inputs-validation.css';\nconst TYPE = 'radiobox';\ninterface DefaultValidationOption {\n name?: string;\n check?: boolean;\n showMsg?: boolean;\n required?: boolean;\n locale?: string;\n msgOnError?: string;\n msgOnSuccess?: string;\n}\nconst getDefaultValidationOption = (obj: DefaultValidationOption) => {\n let { name, check, required, showMsg, locale, msgOnError, msgOnSuccess } = obj;\n locale = typeof locale !== 'undefined' ? locale : DEFAULT_LOCALE;\n name = typeof name !== 'undefined' ? name : '';\n check = typeof check !== 'undefined' ? check : true;\n showMsg = typeof showMsg !== 'undefined' ? showMsg : true;\n required = typeof required !== 'undefined' ? required : true;\n msgOnSuccess = typeof msgOnSuccess !== 'undefined' ? msgOnSuccess : '';\n msgOnError = typeof msgOnError !== 'undefined' ? msgOnError : '';\n return {\n name,\n check,\n showMsg,\n required,\n locale,\n msgOnError,\n msgOnSuccess,\n };\n};\ninterface DefaultAsyncMsgObj {\n error?: boolean;\n message?: string;\n showOnError?: boolean;\n showOnSuccess?: boolean;\n}\nconst getDefaultAsyncObj = (obj: DefaultAsyncMsgObj) => {\n let { error, message, showOnError, showOnSuccess } = obj;\n error = typeof error !== 'undefined' ? error : false;\n message = typeof message !== 'undefined' ? message : '';\n showOnError = typeof showOnError !== 'undefined' ? showOnError : true;\n showOnSuccess = typeof showOnSuccess !== 'undefined' ? showOnSuccess : false;\n return {\n error,\n message,\n showOnError,\n showOnSuccess,\n };\n};\nexport const isValidValue = (list: OptionListItem[], value: any) => {\n let res = false;\n if (list.length) {\n for (let i = 0; i < list.length; i += 1) {\n if (list[i].id === value) {\n res = true;\n break;\n }\n }\n }\n return res;\n};\ninterface OptionListItem {\n id: string;\n name: string;\n}\ninterface AttributesInput {}\ninterface Props {\n attributesWrapper: object;\n attributesInputs: AttributesInput[];\n value?: string | number;\n disabled?: boolean;\n validate?: boolean;\n optionList?: OptionListItem[];\n onChange: (res: string, e: React.ChangeEvent) => void;\n onBlur?: (e: React.FocusEvent) => void;\n onFocus?: (e: React.FocusEvent) => void;\n onClick?: (e: React.MouseEvent) => void;\n validationOption?: object;\n asyncMsgObj?: object;\n classNameWrapper?: string;\n classNameInput?: string;\n classNameContainer?: string;\n classNameOptionListItem?: string;\n customStyleWrapper?: object;\n customStyleContainer?: object;\n customStyleInput?: object;\n customStyleOptionListItem?: object;\n validationCallback?: (res: boolean) => void;\n}\nconst component: React.FC = ({\n attributesWrapper = {},\n attributesInputs = [],\n value = '',\n disabled = false,\n validate = false,\n optionList = [],\n classNameWrapper = '',\n classNameInput = '',\n classNameContainer = '',\n classNameOptionListItem = '',\n customStyleWrapper = {},\n customStyleContainer = {},\n customStyleInput = {},\n customStyleOptionListItem = {},\n validationOption = {},\n asyncMsgObj = {},\n onChange = () => {},\n onBlur = null,\n onFocus = null,\n onClick = null,\n validationCallback = null,\n}) => {\n const [err, setErr] = useState(false);\n const [msg, setMsg] = useState('');\n const [successMsg, setSuccessMsg] = useState('');\n const [internalValue, setInternalValue] = useState(String(value));\n const prevInternalValue = usePrevious(internalValue);\n const option = getDefaultValidationOption(validationOption);\n const asyncObj = getDefaultAsyncObj(asyncMsgObj);\n const $input = useRef(null);\n const $el: { [key: string]: any } | null = $input;\n const handleOnBlur = useCallback(\n (e: React.FocusEvent) => {\n if (onBlur && !disabled) {\n check();\n onBlur(e);\n }\n },\n [internalValue, option, disabled],\n );\n const handleOnFocus = useCallback((e: React.FocusEvent) => {\n if (onFocus) {\n onFocus(e);\n }\n }, []);\n const handleOnClick = useCallback((e: React.MouseEvent) => {\n if (onClick) {\n onClick(e);\n }\n }, []);\n const handleOnChange = useCallback((val: string, e: React.ChangeEvent) => {\n if (disabled || $el === null) {\n return;\n }\n setInternalValue(val);\n onChange && onChange(val, e);\n }, [disabled]);\n const check = useCallback(\n () => {\n const { name, check, locale, required, msgOnSuccess } = option;\n if (!check) {\n return;\n }\n if (!message[locale] || !message[locale][TYPE]) {\n console.error(REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE);\n return;\n }\n if (required) {\n const msg = message[locale][TYPE];\n const nameText = name ? name : '';\n if (!isValidValue(optionList, internalValue)) {\n handleCheckEnd(true, msg.empty(nameText));\n return;\n }\n }\n if (msgOnSuccess) {\n setSuccessMsg(msgOnSuccess);\n }\n handleCheckEnd(false, msgOnSuccess);\n },\n [internalValue, option],\n );\n const handleCheckEnd = useCallback((err: boolean, message: string) => {\n let msg = message;\n const { msgOnError } = option;\n if (err && msgOnError) {\n msg = msgOnError;\n }\n setErr(err);\n setMsg(msg);\n validationCallback && validationCallback(err);\n }, [option.msgOnError]);\n useEffect(\n () => {\n if (validate) {\n check();\n }\n },\n [validate],\n );\n useEffect(\n () => {\n if (internalValue && isValidValue(optionList, internalValue)) {\n setErr(false);\n } else {\n setSuccessMsg('');\n }\n },\n [internalValue],\n );\n useEffect(\n () => {\n setInternalValue(String(value));\n },\n [value],\n );\n useEffect(\n () => {\n if (typeof prevInternalValue !== 'undefined' && prevInternalValue !== internalValue) {\n check();\n }\n },\n [prevInternalValue, internalValue],\n );\n useEffect(\n () => {\n if (asyncObj) {\n if (asyncObj.message) {\n if (asyncObj.showOnError) {\n handleCheckEnd(asyncObj.error, asyncObj.message);\n }\n if (!asyncObj.error && asyncObj.showOnSuccess) {\n setSuccessMsg(asyncObj.message);\n }\n }\n }\n },\n [asyncMsgObj],\n );\n const wrapperClass = `${WRAPPER_CLASS_IDENTITIFIER} ${classNameWrapper} ${err && reactInputsValidationCss['error']} ${successMsg !== '' && !err && reactInputsValidationCss['success']} ${\n reactInputsValidationCss[`${TYPE}__wrapper`]\n } ${disabled && reactInputsValidationCss['disabled']}`;\n const containerClass = `${classNameContainer} ${err && reactInputsValidationCss['error']} ${successMsg !== '' && !err && reactInputsValidationCss['success']} ${\n reactInputsValidationCss[`${TYPE}__container`]\n } ${disabled && reactInputsValidationCss['disabled']}`;\n const inputClass = `${classNameInput} ${err && reactInputsValidationCss['error']} ${successMsg !== '' && !err && reactInputsValidationCss['success']} ${\n reactInputsValidationCss[`${TYPE}__input`]\n } ${disabled && reactInputsValidationCss['disabled']}`;\n const labelClass = `${err && reactInputsValidationCss['error']} ${successMsg !== '' && !err && reactInputsValidationCss['success']} ${reactInputsValidationCss[`${TYPE}__label`]} ${disabled &&\n reactInputsValidationCss['disabled']}`;\n const optionListItemClass = `${reactInputsValidationCss['button']} ${OPTION_LIST_ITEM_IDENTITIFIER} ${classNameOptionListItem} ${err && reactInputsValidationCss['error']} ${successMsg !== '' &&\n !err &&\n reactInputsValidationCss['success']} ${reactInputsValidationCss[`${TYPE}__item`]} ${disabled && reactInputsValidationCss['disabled']}`;\n const errMsgClass = `${MSG_CLASS_IDENTITIFIER} ${reactInputsValidationCss['msg']} ${err && reactInputsValidationCss['error']}`;\n const successMsgClass = `${MSG_CLASS_IDENTITIFIER} ${reactInputsValidationCss['msg']} ${!err && reactInputsValidationCss['success']}`;\n let msgHtml;\n const { showMsg } = option;\n if (showMsg && err && msg) {\n msgHtml =
{msg}
;\n }\n if (showMsg && !err && successMsg !== '') {\n msgHtml =
{successMsg}
;\n }\n let optionHtml;\n if (optionList.length) {\n optionHtml = optionList.map((i, k) => {\n const checked = String(i.id) === String(internalValue) ? true : false;\n return (\n \n );\n });\n }\n return (\n
\n
\n {optionHtml}\n
\n {msgHtml}\n
\n );\n};\ninterface AttributesInput {\n id?: string;\n}\ninterface OptionProps {\n checked?: boolean;\n id?: string;\n optionListItemClass?: string;\n labelClass?: string;\n inputClass?: string;\n value?: string | number;\n disabled?: boolean;\n item?: OptionListItem;\n customStyleOptionListItem?: object;\n customStyleInput?: object;\n attributesInput: AttributesInput;\n onChange?: (res: string, e: React.ChangeEvent) => void;\n}\nexport const Option: React.FC = memo(\n ({\n checked = false,\n id = '',\n optionListItemClass = '',\n labelClass = '',\n inputClass = '',\n value = '',\n disabled = false,\n item = { id: '', name: '' },\n customStyleOptionListItem = {},\n customStyleInput = {},\n attributesInput = {},\n onChange = () => {},\n }) => {\n const handleOnChange = useCallback(e => {\n onChange(item.id, e);\n }, [item, disabled]);\n return (\n \n );\n },\n);\nexport default memo(component);\n"],"sourceRoot":""} \ No newline at end of file diff --git a/lib/react-inputs-validation.min.js b/lib/react-inputs-validation.min.js index 39e901c..80946cf 100644 --- a/lib/react-inputs-validation.min.js +++ b/lib/react-inputs-validation.min.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React")):"function"==typeof define&&define.amd?define(["React"],t):"object"==typeof exports?exports["react-inputs-validation"]=t(require("React")):e["react-inputs-validation"]=t(e.React)}(this,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=6)}([function(t,n){t.exports=e},function(e,t,n){"use strict";var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(0)),i=o.useEffect,a=o.useRef;t.LOCALE_OPTION_LIST=["en-US","zh-CN"],t.REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE="Invalid window.REACT_INPUTS_VALIDATION['customErrorMessage']. EXAMPLE: window.REACT_INPUTS_VALIDATION={customErrorMessage:{'en-US':{textbox:{empty:function empty(name){return getEnglishName(name)+'cannot be empty'},invalid:function invalid(name){return getEnglishName(name)+'invalid format'},invalidFormat:function invalidFormat(name){return getEnglishName(name)+'is not a number'},inBetween:function inBetween(name){return function(min){return function(max){return getEnglishName(name)+'must be '+min+'-'+max}}},lessThan:function lessThan(name){return function(min){return getEnglishName(name)+'cannot less than '+min}},greaterThan:function greaterThan(name){return function(max){return getEnglishName(name)+'cannot greater than '+max}},lengthEqual:function lengthEqual(name){return function(length){return getEnglishName(name)+'length must be '+length}},twoInputsNotEqual:function twoInputsNotEqual(){return'two inputs are not equal'}},radiobox:{empty:function empty(name){return'Please choose one '+getEnglishName(name)}},checkbox:{unchecked:function unchecked(name){return getEnglishName(name)+'must be checked'}},select:{empty:function empty(name){return'Please select a '+getEnglishName(name)}},textarea:{empty:function empty(name){return getEnglishName(name)+'cannot be empty'},invalid:function invalid(name){return getEnglishName(name)+'invalid format'},invalidFormat:function invalidFormat(name){return getEnglishName(name)+'is not a number'},inBetween:function inBetween(name){return function(min){return function(max){return getEnglishName(name)+'must be '+min+'-'+max}}},lessThan:function lessThan(name){return function(min){return getEnglishName(name)+'cannot less than '+min}},greaterThan:function greaterThan(name){return function(max){return getEnglishName(name)+'cannot greater than '+max}},lengthEqual:function lengthEqual(name){return function(length){return getEnglishName(name)+'length must be '+length}},twoInputsNotEqual:function twoInputsNotEqual(){return'two inputs are not equal'}}}}};",t.DEFAULT_LOCALE="en-US",t.WRAPPER_CLASS_IDENTITIFIER="react-inputs-validation__wrapper_identifier",t.CONTAINER_CLASS_IDENTITIFIER="react-inputs-validation__container_identifier",t.OPTION_LIST_ITEM_IDENTITIFIER="react-inputs-validation__option-list-item_identifier",t.MSG_CLASS_IDENTITIFIER="react-inputs-validation__msg_identifier",t.usePrevious=function(e){var t=a();return i((function(){t.current=e})),t.current}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=function(e){var t="";return e&&(t=e+" "),t},i={"zh-CN":{textbox:{empty:function(e){return e+"不能为空"},invalid:function(e){return e+"格式有误"},invalidFormat:function(e){return e+"不是数字"},inBetween:function(e){return function(t){return function(n){return e+"必须在"+t+"-"+n+"之间"}}},lessThan:function(e){return function(t){return e+"不可少于"+t}},greaterThan:function(e){return function(t){return e+"不可大于"+t}},lengthEqual:function(e){return function(t){return e+"长度必须为"+t}},twoInputsNotEqual:function(){return"两次输入不一致"}},radiobox:{empty:function(e){return"必须勾选一个"+e}},checkbox:{unchecked:function(e){return e+"必须勾选"}},select:{empty:function(e){return"请选择一个"+e}},textarea:{empty:function(e){return e+"不能为空"},invalid:function(e){return e+"格式有误"},invalidFormat:function(e){return e+"不是数字"},inBetween:function(e){return function(t){return function(n){return e+"必须在"+t+"-"+n+"之间"}}},lessThan:function(e){return function(t){return e+"不可少于"+t}},greaterThan:function(e){return function(t){return e+"不可大于"+t}},lengthEqual:function(e){return function(t){return e+"长度必须为"+t}},twoInputsNotEqual:function(){return"两次输入不一致"}}},"en-US":{textbox:{empty:function(e){return o(e)+"cannot be empty"},invalid:function(e){return o(e)+"invalid format"},invalidFormat:function(e){return o(e)+"is not a number"},inBetween:function(e){return function(t){return function(n){return o(e)+"must be "+t+"-"+n}}},lessThan:function(e){return function(t){return o(e)+"cannot less than "+t}},greaterThan:function(e){return function(t){return o(e)+"cannot greater than "+t}},lengthEqual:function(e){return function(t){return o(e)+"length must be "+t}},twoInputsNotEqual:function(){return"two inputs are not equal"}},radiobox:{empty:function(e){return"Please choose one "+o(e)}},checkbox:{unchecked:function(e){return o(e)+"must be checked"}},select:{empty:function(e){return"Please select a "+o(e)}},textarea:{empty:function(e){return o(e)+"cannot be empty"},invalid:function(e){return o(e)+"invalid format"},invalidFormat:function(e){return o(e)+"is not a number"},inBetween:function(e){return function(t){return function(n){return o(e)+"must be "+t+"-"+n}}},lessThan:function(e){return function(t){return o(e)+"cannot less than "+t}},greaterThan:function(e){return function(t){return o(e)+"cannot greater than "+t}},lengthEqual:function(e){return function(t){return o(e)+"length must be "+t}},twoInputsNotEqual:function(){return"two inputs are not equal"}}}};t.getCustomErrorMessage=function(e,t){return e&&"object"==typeof e&&e.constructor===Object&&Object.keys(e).length?(Object.keys(e).map((function(n){t[n]?Object.keys(e[n]).length&&Object.keys(e[n]).map((function(r){Object.keys(e[n][r]).length&&Object.keys(e[n][r]).map((function(o){t[n][r][o]=e[n][r][o]}))})):t[n]=e[n]})),t):(console.error(r.REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE),!1)},t.handleCustomErrorMessage=function(e,n){var r;return void 0!==n&&n.REACT_INPUTS_VALIDATION&&n.REACT_INPUTS_VALIDATION.customErrorMessage&&(r=t.getCustomErrorMessage(n.REACT_INPUTS_VALIDATION.customErrorMessage,e)),void 0===r||!1===r?e:r},"undefined"!=typeof window&&(window.REACT_INPUTS_VALIDATION=window.REACT_INPUTS_VALIDATION||{},i=t.handleCustomErrorMessage(i,window)),t.default=i},function(e,t,n){e.exports={ellipsis:"react-inputs-validation__ellipsis___3-Api",textbox__wrapper:"react-inputs-validation__textbox__wrapper___3tnXv",disabled:"react-inputs-validation__disabled___1-57g",textbox__input:"react-inputs-validation__textbox__input___20hDL",error:"react-inputs-validation__error___2aXSp",success:"react-inputs-validation__success___3TpwE",msg:"react-inputs-validation__msg___pxv8o",textarea__wrapper:"react-inputs-validation__textarea__wrapper___35GhF",textarea__input:"react-inputs-validation__textarea__input___1CFm_",radiobox__wrapper:"react-inputs-validation__radiobox__wrapper___1zZ30",radiobox__container:"react-inputs-validation__radiobox__container___FD4vb",radiobox__input:"react-inputs-validation__radiobox__input___2uX2-",radiobox__label:"react-inputs-validation__radiobox__label___2tQsB",checked:"react-inputs-validation__checked___2O0Ju",button:"react-inputs-validation__button___9JBRL",radiobox__item:"react-inputs-validation__radiobox__item___ejuz1",checkbox__wrapper:"react-inputs-validation__checkbox__wrapper___1c1rD",checkbox__input:"react-inputs-validation__checkbox__input___1yF4X",checkbox__container:"react-inputs-validation__checkbox__container___3I1rX",checkbox__box:"react-inputs-validation__checkbox__box___1uj8A",box:"react-inputs-validation__box___3E9nu",select__wrapper:"react-inputs-validation__select__wrapper___1B4OH",select__input:"react-inputs-validation__select__input___3h-P7",select__container:"react-inputs-validation__select__container___3jgUR",select__button:"react-inputs-validation__select__button___vEDoq","select__options-item":"react-inputs-validation__select__options-item___30yY4","select__options-item-show-cursor":"react-inputs-validation__select__options-item-show-cursor___1ZT3b",select__searchInputWrapper:"react-inputs-validation__select__searchInputWrapper___3R5P_",select__searchInputSearchIcon:"react-inputs-validation__select__searchInputSearchIcon___1Q8xX",select__searchInputRemoveIcon:"react-inputs-validation__select__searchInputRemoveIcon___1A1tR",select__searchInput:"react-inputs-validation__select__searchInput___1lN24","select__no-mouse":"react-inputs-validation__select__no-mouse___2uRg6","select__hover-active":"react-inputs-validation__select__hover-active___2z1MQ",active:"react-inputs-validation__active___3eZBB","select__options-container-animate":"react-inputs-validation__select__options-container-animate___2Rm--",show:"react-inputs-validation__show___2NI3u","select__options-container":"react-inputs-validation__select__options-container___d54qE",select__dropdown:"react-inputs-validation__select__dropdown___11yDr","select__dropdown-icon":"react-inputs-validation__select__dropdown-icon___1T5r2","select__dropdown-name":"react-inputs-validation__select__dropdown-name___3hghL",showArrow:"react-inputs-validation__showArrow___3puk1","select__dropdown-icon-container":"react-inputs-validation__select__dropdown-icon-container___2ild-"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){return e.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g,(function(e,t){return 0==+e?"":0===t?e.toLowerCase():e.toUpperCase()}))},o={camelize:r,toCamelCase:function(e){return function(t){void 0===t&&(t=!1);var n=r(e);return t?n.substr(0,1).toUpperCase()+n.substr(1,n.length):n}},getRandomId:function(){return Math.random().toString(36).slice(-8)},getAlphanumeric:function(e){var t="";return String(e).split("").forEach((function(e){var n=e.toLowerCase().charCodeAt(0);(n>=48&&n<=57||n>=97&&n<=122)&&(t+=e)})),t},getAlpha:function(e){var t="";return String(e).split("").forEach((function(e){var n=e.toLowerCase().charCodeAt(0);n>=97&&n<=122&&(t+=e)})),t},getNumeric:function(e){var t="";return String(e).split("").forEach((function(e){var n=e.toLowerCase().charCodeAt(0);n>=48&&n<=57&&(t+=e)})),t},arraysEqual:function(e,t){if(e.length!==t.length)return!1;for(var n=e.length;n-=1;)if(JSON.stringify(e[n])!==JSON.stringify(t[n]))return!1;return!0}};t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},o={reg:function(e,t){var n=!0;return e.test(t)&&(n=!1),n},empty:function(e){return!e.replace(/\s/g,"").length},number:function(e,t,n){return null===t&&null===n||!!r(e)&&!(en)}};t.default=o},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(7));t.Textbox=o.default;var i=r(n(8));t.Textarea=i.default;var a=r(n(9));t.Select=a.default;var u=r(n(10));t.Checkbox=u.default;var s=r(n(11));t.Radiobox=s.default,"undefined"!=typeof window&&(window.Textbox=o.default,window.Textarea=i.default,window.Radiobox=s.default,window.Checkbox=u.default,window.Select=a.default)},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]Number(I.maxLength))){var n=we.type,r=we.numberType,o=we.mantissa;n===b[1]&&(t=String(function(e,t,n){var r="",o=!1,i=String(e).split("");i[0];if(t===w[2]&&"0"===i[0]&&"0"===i[1]&&i.shift(),i.forEach((function(e){var n=e.toLowerCase().charCodeAt(0);if(n>=48&&n<=57||46===n&&!o){if(46===n){if(t===w[1])return;o=!0}r+=e}})),o&&n>=0){var a=r.split(".");0===n?r=a[0]:(a[1]=a[1].slice(0,n),r=a.join("."))}return t!==w[0]&&t!==w[2]||r.length&&"."===r[0]&&(r="0"+r),r}(t,w.indexOf(r)>=0?r:w[0],o))),n===b[2]&&(t=p.default.getAlphanumeric(t)),n===b[3]&&(t=p.default.getAlpha(t)),Ee(t),Q&&Q(t,e),le?ce(!1):pe("")}}}),[le,I,we]),Me=d((function(){return o(void 0,void 0,void 0,(function(){var e,t,n,r,o,a,u,s,l,c,d,f,_,g,w,y;return i(this,(function(i){switch(i.label){case 0:if(e=we.reg,t=we.min,n=we.max,r=we.type,o=we.name,a=we.check,u=we.length,s=we.regMsg,l=we.locale,c=we.compare,d=we.required,f=we.msgOnSuccess,_=we.customFunc,!a)return[2];if(!r)return[3,5];if(-1===b.indexOf(r))return[3,3];if(!v.default[l]||!v.default[l][E])return console.error(h.REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE),[2];if(g=v.default[l][E],w=o||"",d&&m.default.empty(ge))return Ae(!0,g.empty(w)),[2];if(""!==String(ge)){if(e&&m.default.reg(e,ge))return Ae(!0,""!==s?s:g.invalid(w)),[2];if(r===b[0]){if(t||n)if(t&&n){if(String(ge).lengthn)return Ae(!0,g.inBetween(w)(t)(n)),[2]}else{if(t&&String(ge).lengthn)return Ae(!0,g.greaterThan(w)(n)),[2]}if(u&&String(ge).length!==u)return Ae(!0,g.lengthEqual(w)(u)),[2]}if(r===b[1]){if(!m.default[r](ge,null,null))return Ae(!0,g.invalid(w)),[2];if(t||n)if(t&&n){if(!m.default[r](ge,t,n))return Ae(!0,g.inBetween(w)(t)(n)),[2]}else{if(t&&!m.default[r](ge,t))return Ae(!0,g.lessThan(w)(t)),[2];if(n&&!m.default[r](ge,0,n))return Ae(!0,g.greaterThan(w)(n)),[2]}if(u&&String(ge).length!==u)return Ae(!0,g.lengthEqual(w)(u)),[2]}if(c&&""!==c&&ge!==c)return Ae(!0,g.twoInputsNotEqual()),[2]}return _&&"function"==typeof _?[4,_(ge)]:[3,2];case 1:if("object"==typeof(y=i.sent()))return"boolean"==typeof y.error&&"string"==typeof y.message&&(!1===y.error&&!0===y.showOnSuccess&&pe(y.message),Ae(y.error,y.message,!0)),[2];if(!0!==y)return Ae(!0,y,!0),[2];i.label=2;case 2:return f&&pe(f),Ae(!1,f),[3,4];case 3:console.error("The valid "+p.default.toCamelCase(E)(!0)+' "type" options in validationOption are ['+b.map((function(e){return e}))+"]"),i.label=4;case 4:return[3,6];case 5:console.error('Please provide "type" in validationOption'),i.label=6;case 6:return[2]}}))}))}),[ge,we]),Ae=d((function(e,t,n){void 0===n&&(n=!1);var r=t,o=we.msgOnError;e&&o&&!n&&(r=o),ce(e),_e(r),ue&&ue(e)}),[we.msgOnError]);c((function(){k&&Me()}),[k]),c((function(){Ee(String(T))}),[T]),c((function(){void 0!==be&&be!==ge&&we.customFunc&&ie&&Me()}),[ge]),c((function(){ye&&ye.message&&(ye.showOnError&&Ae(ye.error,ye.message),!ye.error&&ye.showOnSuccess&&pe(ye.message))}),[J]);var Le,ke=D+" "+g.default[E+"__wrapper"]+" "+(le&&g.default.error)+" "+(""!==me&&!le&&g.default.success)+" "+(A&&g.default.disabled),Re=q+" "+g.default[E+"__container"]+" "+(le&&g.default.error)+" "+(""!==me&&!le&&g.default.success)+" "+(A&&g.default.disabled),Pe=P+" "+g.default[E+"__input"]+" "+(le&&g.default.error)+" "+(""!==me&&!le&&g.default.success)+" "+(A&&g.default.disabled),Fe=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(le&&g.default.error),De=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(!le&&g.default.success),je=we.showMsg;return je&&le&&fe&&(Le=s.createElement("div",{className:Fe},fe)),je&&!le&&""!==me&&(Le=s.createElement("div",{className:De},me)),s.createElement("div",r({className:ke,style:W},S),s.createElement("div",{className:Re,style:z},s.createElement("input",r({type:"text",value:ge,disabled:A,onBlur:Ie,onKeyUp:Ce,onFocus:Ne,onClick:Te,className:Pe,onChange:xe,style:B,ref:Se},I)),x&&I.id&&s.createElement("label",{htmlFor:I.id},x)),Le)}))},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]Number(O.maxLength)||(pe(t),K&&K(t,e),ae?ue(!1):_e(""))}}),[ae]),Te=d((function(){return o(void 0,void 0,void 0,(function(){var e,t,n,r,o,a,u,s,l,c,d,f,_,g,w;return i(this,(function(i){switch(i.label){case 0:if(e=ge.reg,t=ge.min,n=ge.max,r=ge.type,o=ge.name,a=ge.check,u=ge.length,s=ge.regMsg,l=ge.locale,c=ge.required,d=ge.msgOnSuccess,f=ge.customFunc,!a)return[2];if(!r)return[3,5];if(-1===b.indexOf(r))return[3,3];if(!v.default[l]||!v.default[l][E])return console.error(h.REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE),[2];if(_=v.default[l][E],g=o||"",c&&m.default.empty(me))return Ce(!0,_.empty(g)),[2];if(""!==String(me)){if(e&&m.default.reg(e,me))return Ce(!0,""!==s?s:_.invalid(g)),[2];if(t||n)if(t&&n){if(String(me).lengthn)return Ce(!0,_.inBetween(g)(t)(n)),[2]}else{if(t&&String(me).lengthn)return Ce(!0,_.greaterThan(g)(n)),[2]}if(u&&String(me).length!==u)return Ce(!0,_.lengthEqual(g)(u)),[2]}return f&&"function"==typeof f?[4,f(me)]:[3,2];case 1:if("object"==typeof(w=i.sent()))return"boolean"==typeof w.error&&"string"==typeof w.message&&(!1===w.error&&!0===w.showOnSuccess&&_e(w.message),Ce(w.error,w.message,!0)),[2];if(!0!==w)return Ce(!0,w,!0),[2];i.label=2;case 2:return d&&_e(d),Ce(!1,d),[3,4];case 3:console.error("The valid "+p.default.toCamelCase(E)(!0)+' "type" options in validationOption are ['+b.map((function(e){return e}))+"]"),i.label=4;case 4:return[3,6];case 5:console.error('Please provide "type" in validationOption'),i.label=6;case 6:return[2]}}))}))}),[me,ge]),Ce=d((function(e,t,n){void 0===n&&(n=!1);var r=t,o=ge.msgOnError;e&&o&&!n&&(r=o),ue(e),ce(r),oe&&oe(e)}),[ge.msgOnError]);c((function(){M&&Te()}),[M]),c((function(){pe(String(N))}),[N]),c((function(){void 0!==he&&he!==me&&ge.customFunc&&ne&&Te()}),[me]),c((function(){Ee&&Ee.message&&(Ee.showOnError&&Ce(Ee.error,Ee.message),!Ee.error&&Ee.showOnSuccess&&_e(Ee.message))}),[X]);var xe,Me=R+" "+g.default[E+"__wrapper"]+" "+(ae&&g.default.error)+" "+(""!==fe&&!ae&&g.default.success)+" "+(C&&g.default.disabled),Ae=F+" "+g.default[E+"__container"]+" "+(ae&&g.default.error)+" "+(""!==fe&&!ae&&g.default.success)+" "+(C&&g.default.disabled),Le=L+" "+g.default[E+"__input"]+" "+(ae&&g.default.error)+" "+(""!==fe&&!ae&&g.default.success)+" "+(C&&g.default.disabled),ke=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(ae&&g.default.error),Re=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(!ae&&g.default.success),Pe=ge.showMsg;return Pe&&ae&&le&&(xe=s.createElement("div",{className:ke},le)),Pe&&!ae&&""!==fe&&(xe=s.createElement("div",{className:Re},fe)),s.createElement("div",r({className:Me,style:U},y),s.createElement("div",{className:Ae,style:V},s.createElement("textarea",r({value:me,disabled:C,onBlur:ye,onKeyUp:Ie,onFocus:Se,onClick:Oe,className:Le,onChange:Ne,style:j,ref:be},O))),xe)}))},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=a){var u=Math.abs(i-a-o);u>=0&&!w?(it.current.scrollTop=r+o-u,w=!0):it.current.scrollTop=r+o}}"up"===e&&(w=!1,y*o<=r&&(it.current.scrollTop=y*o))}else w=!1,it.current.scrollTop=y*o}}),[]),bt=c((function(e,t){_t(e,t),De[1]("")}),[]),wt=c((function(e){y=e,Ot()}),[]),yt=c((function(){Xe(!1)}),[]),St=c((function(){It()}),[]),Ot=c((function(){if(et&&et.current&&et.current.children){var e=et.current.children;if(It(),null===y)return;y>=e.length&&(y=0),y<0&&(y=e.length-1),e[y]&&(e[y].className+=" "+h.default[g+"__hover-active"])}}),[]),It=c((function(){if(et&&et.current&&et.current.children)for(var e=et.current.children,t=0;tut.length-1&&(y=0,Et("up")),Ot();else if(38===e)(y-=1)<0&&(y=ut.length-1,Et("loop")),Ot();else if(13===e&&y>-1&&et&&et.current&&et.current.children){var t=et.current.children;if(!t[y])return;t[y].click()}}),[ut]),Ct=c((function(e){if(!F&&(Xe(!0),e.preventDefault&&e.preventDefault(),Be)){y=null===y?t.getIndex(ut,String(M)):y;var n=e.keyCode,r=Nt(n);if(-1!==E.indexOf(n))Tt(n);else{gt();var i=o(Ke,[n]),a=String.fromCharCode.apply(String,i).toLowerCase(),u=-1;ut.forEach((function(e,t){e.name.toLowerCase().startsWith(a)&&-1===u&&(u=t)})),-1!==u&&(y=u,Ot()),Je(i)}return Et(r),y}}),[Be,M,Ke]);l((function(){return Be&&ot&&document.addEventListener("keydown",Ct),function(){document.removeEventListener("keydown",Ct)}}),[Be,M,Ke]),l((function(){R&&vt()}),[R]),l((function(){t.isValidValue(ut,Pe)&&""!==Pe&&"null"!==Pe&&"undefined"!==Pe?Te(!1):ke("")}),[Pe]),l((function(){Fe(String(M))}),[M]),l((function(){qe&&qe&&!p.default.arraysEqual(qe,V)&&Fe(String(V[0].id))}),[V]),l((function(){void 0!==je&&je!==Pe&&vt()}),[je,Pe]),l((function(){Qe&&Qe.message&&(Qe.showOnError&&mt(Qe.error,Qe.message),!Qe.error&&Qe.showOnSuccess&&ke(Qe.message))}),[ve]),l((function(){Be&&(F&&nt.current.focus(),y=null===y?t.getIndex(ut,String(M)):y,at[y]&&at[y].current.focus()),!0===We&&!1===Be&&rt.current.focus(),ht()}),[Be]);var xt,Mt,At=m.WRAPPER_CLASS_IDENTITIFIER+" "+G+" "+h.default.select__wrapper+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Lt=m.CONTAINER_CLASS_IDENTITIFIER+" "+X+" "+h.default.select__container+" "+(Ne&&h.default.error)+" "+(Be&&h.default.show)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),kt=h.default.select__input+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Rt=K+" "+h.default.ellipsis+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Pt=Y+" "+h.default[g+"__options-container"]+" "+(Ne&&h.default.error)+" "+(Be&&h.default.show)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Ft=h.default.button+" "+(!ze&&h.default[g+"__options-item-show-cursor"])+" "+Z+" "+h.default[g+"__options-item"]+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Dt=ee+" "+h.default[g+"__dropdown-icon"]+" "+(j&&h.default.showArrow),jt=m.MSG_CLASS_IDENTITIFIER+" "+h.default.msg+" "+(Ne&&h.default.error),qt=m.MSG_CLASS_IDENTITIFIER+" "+h.default.msg+" "+(!Ne&&h.default.success),Ut=Ze.showMsg;Ut&&Ne&&xe&&(xt=u.createElement("div",{className:jt},xe)),Ut&&!Ne&&""!==Le&&(xt=u.createElement("div",{className:qt},Le));var Bt=t.getItem(V,String(M));ut.length?Mt=ut.map((function(e,n){return u.createElement(t.Option,{key:n,index:n,id:"react-inputs-validation__select_option-"+e.id,className:String(e.id)===String(M)?Ft+" "+h.default.active:""+Ft,item:e,customStyleOptionListItem:se,onClick:bt,onMouseOver:wt,onMouseMove:yt,onMouseOut:St})})):F&&(Mt=u.createElement("div",{style:{background:"#fff",textAlign:"center",padding:"20px"}},u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},u.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),u.createElement("path",{fill:"#cdcdcd",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12zm8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8z"}))));var Vt=u.createElement("div",{className:h.default.select__dropdown},u.createElement("div",{className:h.default[g+"__dropdown-name"]+" "+h.default.ellipsis},Bt?Bt.name:""),u.createElement("div",{className:Dt}));return u.createElement("button",r({ref:Ye,type:"button",className:h.default.button,onClick:function(e){if(ft(e),!L){if(tt.current&&tt.current.contains(e.target))return void Ve(!0);Ve(!Be)}},onFocus:dt,onBlur:ct},N),u.createElement("div",{ref:$e,className:At,style:ne},u.createElement("div",{className:Lt,style:oe},u.createElement("input",r({type:"hidden",value:Pe,className:kt,onChange:function(){}},C)),u.createElement("div",{className:Rt,style:ae},Vt),u.createElement("div",{className:Pt},F&&u.createElement("div",{ref:tt},u.createElement("div",{className:h.default.select__searchInputWrapper},u.createElement("svg",{className:h.default.select__searchInputSearchIcon,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},u.createElement("path",{fill:"#cdcdcd",d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),u.createElement("path",{d:"M0 0h24v24H0z",fill:"none"})),u.createElement("input",{className:h.default.select__searchInput,ref:nt,value:De[0],onChange:st,onKeyDown:lt}),De[0]&&u.createElement("svg",{className:h.default.select__searchInputRemoveIcon,xmlns:"http://www.w3.org/2000/svg",width:"15",height:"15",viewBox:"0 0 24 24",onClick:function(){De[1](""),nt.current.focus()}},u.createElement("path",{fill:"#cdcdcd",d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}),u.createElement("path",{d:"M0 0h24v24H0z",fill:"none"})))),u.createElement("div",{ref:et,style:ce},Mt))),xt))}))},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=48&&n<=57||n>=97&&n<=122)&&(t+=e)})),t},getAlpha:function(e){var t="";return String(e).split("").forEach((function(e){var n=e.toLowerCase().charCodeAt(0);n>=97&&n<=122&&(t+=e)})),t},getNumeric:function(e){var t="";return String(e).split("").forEach((function(e){var n=e.toLowerCase().charCodeAt(0);n>=48&&n<=57&&(t+=e)})),t},arraysEqual:function(e,t){if(e.length!==t.length)return!1;for(var n=e.length;n-=1;)if(JSON.stringify(e[n])!==JSON.stringify(t[n]))return!1;return!0}};t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},o={reg:function(e,t){var n=!0;return e.test(t)&&(n=!1),n},empty:function(e){return!e.replace(/\s/g,"").length},number:function(e,t,n){return null===t&&null===n||!!r(e)&&!(en)}};t.default=o},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(7));t.Textbox=o.default;var i=r(n(8));t.Textarea=i.default;var a=r(n(9));t.Select=a.default;var u=r(n(10));t.Checkbox=u.default;var s=r(n(11));t.Radiobox=s.default,"undefined"!=typeof window&&(window.Textbox=o.default,window.Textarea=i.default,window.Radiobox=s.default,window.Checkbox=u.default,window.Select=a.default)},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]Number(I.maxLength))){var n=we.type,r=we.numberType,o=we.mantissa;n===b[1]&&(t=String(function(e,t,n){var r="",o=!1,i=String(e).split("");i[0];if(t===w[2]&&"0"===i[0]&&"0"===i[1]&&i.shift(),i.forEach((function(e){var n=e.toLowerCase().charCodeAt(0);if(n>=48&&n<=57||46===n&&!o){if(46===n){if(t===w[1])return;o=!0}r+=e}})),o&&n>=0){var a=r.split(".");0===n?r=a[0]:(a[1]=a[1].slice(0,n),r=a.join("."))}return t!==w[0]&&t!==w[2]||r.length&&"."===r[0]&&(r="0"+r),r}(t,w.indexOf(r)>=0?r:w[0],o))),n===b[2]&&(t=p.default.getAlphanumeric(t)),n===b[3]&&(t=p.default.getAlpha(t)),Ee(t),Q&&Q(t,e),le?ce(!1):pe("")}}}),[le,I,we]),Me=d((function(){return o(void 0,void 0,void 0,(function(){var e,t,n,r,o,a,u,s,l,c,d,f,_,g,w,y;return i(this,(function(i){switch(i.label){case 0:if(e=we.reg,t=we.min,n=we.max,r=we.type,o=we.name,a=we.check,u=we.length,s=we.regMsg,l=we.locale,c=we.compare,d=we.required,f=we.msgOnSuccess,_=we.customFunc,!a)return[2];if(!r)return[3,5];if(-1===b.indexOf(r))return[3,3];if(!v.default[l]||!v.default[l][E])return console.error(h.REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE),[2];if(g=v.default[l][E],w=o||"",d&&m.default.empty(ge))return Ae(!0,g.empty(w)),[2];if(""!==String(ge)){if(e&&m.default.reg(e,ge))return Ae(!0,""!==s?s:g.invalid(w)),[2];if(r===b[0]){if(t||n)if(t&&n){if(String(ge).lengthn)return Ae(!0,g.inBetween(w)(t)(n)),[2]}else{if(t&&String(ge).lengthn)return Ae(!0,g.greaterThan(w)(n)),[2]}if(u&&String(ge).length!==u)return Ae(!0,g.lengthEqual(w)(u)),[2]}if(r===b[1]){if(!m.default[r](ge,null,null))return Ae(!0,g.invalid(w)),[2];if(t||n)if(t&&n){if(!m.default[r](ge,t,n))return Ae(!0,g.inBetween(w)(t)(n)),[2]}else{if(t&&!m.default[r](ge,t))return Ae(!0,g.lessThan(w)(t)),[2];if(n&&!m.default[r](ge,0,n))return Ae(!0,g.greaterThan(w)(n)),[2]}if(u&&String(ge).length!==u)return Ae(!0,g.lengthEqual(w)(u)),[2]}if(c&&""!==c&&ge!==c)return Ae(!0,g.twoInputsNotEqual()),[2]}return _&&"function"==typeof _?[4,_(ge)]:[3,2];case 1:if(y=i.sent(),!Se||!Se.current)return[2];if("object"==typeof y)return"boolean"==typeof y.error&&"string"==typeof y.message&&(!1===y.error&&!0===y.showOnSuccess&&pe(y.message),Ae(y.error,y.message,!0)),[2];if(!0!==y)return Ae(!0,y,!0),[2];i.label=2;case 2:return f&&pe(f),Ae(!1,f),[3,4];case 3:console.error("The valid "+p.default.toCamelCase(E)(!0)+' "type" options in validationOption are ['+b.map((function(e){return e}))+"]"),i.label=4;case 4:return[3,6];case 5:console.error('Please provide "type" in validationOption'),i.label=6;case 6:return[2]}}))}))}),[ge,we]),Ae=d((function(e,t,n){void 0===n&&(n=!1);var r=t,o=we.msgOnError;e&&o&&!n&&(r=o),ce(e),_e(r),ue&&ue(e)}),[we.msgOnError]);c((function(){k&&Me()}),[k]),c((function(){Ee(String(T))}),[T]),c((function(){void 0!==be&&be!==ge&&we.customFunc&&ie&&Me()}),[ge]),c((function(){ye&&ye.message&&(ye.showOnError&&Ae(ye.error,ye.message),!ye.error&&ye.showOnSuccess&&pe(ye.message))}),[J]);var Le,ke=D+" "+g.default[E+"__wrapper"]+" "+(le&&g.default.error)+" "+(""!==me&&!le&&g.default.success)+" "+(A&&g.default.disabled),Re=q+" "+g.default[E+"__container"]+" "+(le&&g.default.error)+" "+(""!==me&&!le&&g.default.success)+" "+(A&&g.default.disabled),Pe=P+" "+g.default[E+"__input"]+" "+(le&&g.default.error)+" "+(""!==me&&!le&&g.default.success)+" "+(A&&g.default.disabled),Fe=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(le&&g.default.error),De=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(!le&&g.default.success),je=we.showMsg;return je&&le&&fe&&(Le=s.createElement("div",{className:Fe},fe)),je&&!le&&""!==me&&(Le=s.createElement("div",{className:De},me)),s.createElement("div",r({className:ke,style:W},S),s.createElement("div",{className:Re,style:z},s.createElement("input",r({type:"text",value:ge,disabled:A,onBlur:Ie,onKeyUp:Ce,onFocus:Ne,onClick:Te,className:Pe,onChange:xe,style:B,ref:Se},I)),x&&I.id&&s.createElement("label",{htmlFor:I.id},x)),Le)}))},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]Number(O.maxLength)||(pe(t),K&&K(t,e),ae?ue(!1):_e(""))}}),[ae]),Te=d((function(){return o(void 0,void 0,void 0,(function(){var e,t,n,r,o,a,u,s,l,c,d,f,_,g,w;return i(this,(function(i){switch(i.label){case 0:if(e=ge.reg,t=ge.min,n=ge.max,r=ge.type,o=ge.name,a=ge.check,u=ge.length,s=ge.regMsg,l=ge.locale,c=ge.required,d=ge.msgOnSuccess,f=ge.customFunc,!a)return[2];if(!r)return[3,5];if(-1===b.indexOf(r))return[3,3];if(!v.default[l]||!v.default[l][E])return console.error(h.REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE),[2];if(_=v.default[l][E],g=o||"",c&&m.default.empty(me))return Ce(!0,_.empty(g)),[2];if(""!==String(me)){if(e&&m.default.reg(e,me))return Ce(!0,""!==s?s:_.invalid(g)),[2];if(t||n)if(t&&n){if(String(me).lengthn)return Ce(!0,_.inBetween(g)(t)(n)),[2]}else{if(t&&String(me).lengthn)return Ce(!0,_.greaterThan(g)(n)),[2]}if(u&&String(me).length!==u)return Ce(!0,_.lengthEqual(g)(u)),[2]}return f&&"function"==typeof f?[4,f(me)]:[3,2];case 1:if("object"==typeof(w=i.sent()))return"boolean"==typeof w.error&&"string"==typeof w.message&&(!1===w.error&&!0===w.showOnSuccess&&_e(w.message),Ce(w.error,w.message,!0)),[2];if(!0!==w)return Ce(!0,w,!0),[2];i.label=2;case 2:return d&&_e(d),Ce(!1,d),[3,4];case 3:console.error("The valid "+p.default.toCamelCase(E)(!0)+' "type" options in validationOption are ['+b.map((function(e){return e}))+"]"),i.label=4;case 4:return[3,6];case 5:console.error('Please provide "type" in validationOption'),i.label=6;case 6:return[2]}}))}))}),[me,ge]),Ce=d((function(e,t,n){void 0===n&&(n=!1);var r=t,o=ge.msgOnError;e&&o&&!n&&(r=o),ue(e),ce(r),oe&&oe(e)}),[ge.msgOnError]);c((function(){M&&Te()}),[M]),c((function(){pe(String(N))}),[N]),c((function(){void 0!==he&&he!==me&&ge.customFunc&&ne&&Te()}),[me]),c((function(){Ee&&Ee.message&&(Ee.showOnError&&Ce(Ee.error,Ee.message),!Ee.error&&Ee.showOnSuccess&&_e(Ee.message))}),[X]);var xe,Me=R+" "+g.default[E+"__wrapper"]+" "+(ae&&g.default.error)+" "+(""!==fe&&!ae&&g.default.success)+" "+(C&&g.default.disabled),Ae=F+" "+g.default[E+"__container"]+" "+(ae&&g.default.error)+" "+(""!==fe&&!ae&&g.default.success)+" "+(C&&g.default.disabled),Le=L+" "+g.default[E+"__input"]+" "+(ae&&g.default.error)+" "+(""!==fe&&!ae&&g.default.success)+" "+(C&&g.default.disabled),ke=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(ae&&g.default.error),Re=h.MSG_CLASS_IDENTITIFIER+" "+g.default.msg+" "+(!ae&&g.default.success),Pe=ge.showMsg;return Pe&&ae&&le&&(xe=s.createElement("div",{className:ke},le)),Pe&&!ae&&""!==fe&&(xe=s.createElement("div",{className:Re},fe)),s.createElement("div",r({className:Me,style:U},y),s.createElement("div",{className:Ae,style:V},s.createElement("textarea",r({value:me,disabled:C,onBlur:ye,onKeyUp:Ie,onFocus:Se,onClick:Oe,className:Le,onChange:Ne,style:j,ref:be},O))),xe)}))},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=a){var u=Math.abs(i-a-o);u>=0&&!w?(it.current.scrollTop=r+o-u,w=!0):it.current.scrollTop=r+o}}"up"===e&&(w=!1,y*o<=r&&(it.current.scrollTop=y*o))}else w=!1,it.current.scrollTop=y*o}}),[]),bt=c((function(e,t){_t(e,t),De[1]("")}),[]),wt=c((function(e){y=e,Ot()}),[]),yt=c((function(){Xe(!1)}),[]),St=c((function(){It()}),[]),Ot=c((function(){if(et&&et.current&&et.current.children){var e=et.current.children;if(It(),null===y)return;y>=e.length&&(y=0),y<0&&(y=e.length-1),e[y]&&(e[y].className+=" "+h.default[g+"__hover-active"])}}),[]),It=c((function(){if(et&&et.current&&et.current.children)for(var e=et.current.children,t=0;tut.length-1&&(y=0,Et("up")),Ot();else if(38===e)(y-=1)<0&&(y=ut.length-1,Et("loop")),Ot();else if(13===e&&y>-1&&et&&et.current&&et.current.children){var t=et.current.children;if(!t[y])return;t[y].click()}}),[ut]),Ct=c((function(e){if(!F&&(Xe(!0),e.preventDefault&&e.preventDefault(),Be)){y=null===y?t.getIndex(ut,String(M)):y;var n=e.keyCode,r=Nt(n);if(-1!==E.indexOf(n))Tt(n);else{gt();var i=o(Ke,[n]),a=String.fromCharCode.apply(String,i).toLowerCase(),u=-1;ut.forEach((function(e,t){e.name.toLowerCase().startsWith(a)&&-1===u&&(u=t)})),-1!==u&&(y=u,Ot()),Je(i)}return Et(r),y}}),[Be,M,Ke]);l((function(){return Be&&ot&&document.addEventListener("keydown",Ct),function(){document.removeEventListener("keydown",Ct)}}),[Be,M,Ke]),l((function(){R&&vt()}),[R]),l((function(){t.isValidValue(ut,Pe)&&""!==Pe&&"null"!==Pe&&"undefined"!==Pe?Te(!1):ke("")}),[Pe]),l((function(){Fe(String(M))}),[M]),l((function(){qe&&qe&&!p.default.arraysEqual(qe,V)&&Fe(String(V[0].id))}),[V]),l((function(){void 0!==je&&je!==Pe&&vt()}),[je,Pe]),l((function(){Qe&&Qe.message&&(Qe.showOnError&&mt(Qe.error,Qe.message),!Qe.error&&Qe.showOnSuccess&&ke(Qe.message))}),[ve]),l((function(){Be&&(F&&nt.current.focus(),y=null===y?t.getIndex(ut,String(M)):y,at[y]&&at[y].current.focus()),!0===We&&!1===Be&&rt.current.focus(),ht()}),[Be]);var xt,Mt,At=m.WRAPPER_CLASS_IDENTITIFIER+" "+G+" "+h.default.select__wrapper+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Lt=m.CONTAINER_CLASS_IDENTITIFIER+" "+X+" "+h.default.select__container+" "+(Ne&&h.default.error)+" "+(Be&&h.default.show)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),kt=h.default.select__input+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Rt=K+" "+h.default.ellipsis+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Pt=Y+" "+h.default[g+"__options-container"]+" "+(Ne&&h.default.error)+" "+(Be&&h.default.show)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Ft=h.default.button+" "+(!ze&&h.default[g+"__options-item-show-cursor"])+" "+Z+" "+h.default[g+"__options-item"]+" "+(Ne&&h.default.error)+" "+(""!==Le&&!Ne&&h.default.success)+" "+(L&&h.default.disabled),Dt=ee+" "+h.default[g+"__dropdown-icon"]+" "+(j&&h.default.showArrow),jt=m.MSG_CLASS_IDENTITIFIER+" "+h.default.msg+" "+(Ne&&h.default.error),qt=m.MSG_CLASS_IDENTITIFIER+" "+h.default.msg+" "+(!Ne&&h.default.success),Ut=Ze.showMsg;Ut&&Ne&&xe&&(xt=u.createElement("div",{className:jt},xe)),Ut&&!Ne&&""!==Le&&(xt=u.createElement("div",{className:qt},Le));var Bt=t.getItem(V,String(M));ut.length?Mt=ut.map((function(e,n){return u.createElement(t.Option,{key:n,index:n,id:"react-inputs-validation__select_option-"+e.id,className:String(e.id)===String(M)?Ft+" "+h.default.active:""+Ft,item:e,customStyleOptionListItem:se,onClick:bt,onMouseOver:wt,onMouseMove:yt,onMouseOut:St})})):F&&(Mt=u.createElement("div",{style:{background:"#fff",textAlign:"center",padding:"20px"}},u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},u.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),u.createElement("path",{fill:"#cdcdcd",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12zm8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8z"}))));var Vt=u.createElement("div",{className:h.default.select__dropdown},u.createElement("div",{className:h.default[g+"__dropdown-name"]+" "+h.default.ellipsis},Bt?Bt.name:""),u.createElement("div",{className:Dt}));return u.createElement("button",r({ref:Ye,type:"button",className:h.default.button,onClick:function(e){if(ft(e),!L){if(tt.current&&tt.current.contains(e.target))return void Ve(!0);Ve(!Be)}},onFocus:dt,onBlur:ct},N),u.createElement("div",{ref:$e,className:At,style:ne},u.createElement("div",{className:Lt,style:oe},u.createElement("input",r({type:"hidden",value:Pe,className:kt,onChange:function(){}},C)),u.createElement("div",{className:Rt,style:ae},Vt),u.createElement("div",{className:Pt},F&&u.createElement("div",{ref:tt},u.createElement("div",{className:h.default.select__searchInputWrapper},u.createElement("svg",{className:h.default.select__searchInputSearchIcon,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},u.createElement("path",{fill:"#cdcdcd",d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),u.createElement("path",{d:"M0 0h24v24H0z",fill:"none"})),u.createElement("input",{className:h.default.select__searchInput,ref:nt,value:De[0],onChange:st,onKeyDown:lt}),De[0]&&u.createElement("svg",{className:h.default.select__searchInputRemoveIcon,xmlns:"http://www.w3.org/2000/svg",width:"15",height:"15",viewBox:"0 0 24 24",onClick:function(){De[1](""),nt.current.focus()}},u.createElement("path",{fill:"#cdcdcd",d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}),u.createElement("path",{d:"M0 0h24v24H0z",fill:"none"})))),u.createElement("div",{ref:et,style:ce},Mt))),xt))}))},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n = ({ }, [err, attributesInput, option], ); - const check = useCallback( - async () => { - const { reg, min, max, type, name, check, length, regMsg, locale, compare, required, msgOnSuccess, customFunc } = option; - if (!check) { - return; - } - if (type) { - if (VALIDATE_OPTION_TYPE_LIST.indexOf(type) !== -1) { - if (!message[locale] || !message[locale][TYPE]) { - console.error(REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE); + const check = useCallback(async () => { + const { reg, min, max, type, name, check, length, regMsg, locale, compare, required, msgOnSuccess, customFunc } = option; + if (!check) { + return; + } + if (type) { + if (VALIDATE_OPTION_TYPE_LIST.indexOf(type) !== -1) { + if (!message[locale] || !message[locale][TYPE]) { + console.error(REACT_INPUTS_VALIDATION_CUSTOM_ERROR_MESSAGE_EXAMPLE); + return; + } + const msg = message[locale][TYPE]; + const nameText = name ? name : ''; + if (required) { + if (validator.empty(internalValue)) { + handleCheckEnd(true, msg.empty(nameText)); return; } - const msg = message[locale][TYPE]; - const nameText = name ? name : ''; - if (required) { - if (validator.empty(internalValue)) { - handleCheckEnd(true, msg.empty(nameText)); + } + if (String(internalValue) !== '') { + if (reg) { + if (validator['reg'](reg, internalValue)) { + handleCheckEnd(true, regMsg !== '' ? regMsg : msg.invalid(nameText)); return; } } - if (String(internalValue) !== '') { - if (reg) { - if (validator['reg'](reg, internalValue)) { - handleCheckEnd(true, regMsg !== '' ? regMsg : msg.invalid(nameText)); - return; - } - } - if (type === VALIDATE_OPTION_TYPE_LIST[0]) { - if (min || max) { - if (min && max) { - if (String(internalValue).length < min || String(internalValue).length > max) { - handleCheckEnd(true, msg.inBetween(nameText)(min)(max)); + if (type === VALIDATE_OPTION_TYPE_LIST[0]) { + if (min || max) { + if (min && max) { + if (String(internalValue).length < min || String(internalValue).length > max) { + handleCheckEnd(true, msg.inBetween(nameText)(min)(max)); + return; + } + } else { + if (min) { + if (String(internalValue).length < min) { + handleCheckEnd(true, msg.lessThan(nameText)(min)); return; } - } else { - if (min) { - if (String(internalValue).length < min) { - handleCheckEnd(true, msg.lessThan(nameText)(min)); - return; - } - } - if (max) { - if (String(internalValue).length > max) { - handleCheckEnd(true, msg.greaterThan(nameText)(max)); - return; - } - } } - } - if (length) { - if (String(internalValue).length !== length) { - handleCheckEnd(true, msg.lengthEqual(nameText)(length)); - return; + if (max) { + if (String(internalValue).length > max) { + handleCheckEnd(true, msg.greaterThan(nameText)(max)); + return; + } } } } - if (type === VALIDATE_OPTION_TYPE_LIST[1]) { - if (!validator[type](internalValue, null, null)) { - handleCheckEnd(true, msg.invalid(nameText)); + if (length) { + if (String(internalValue).length !== length) { + handleCheckEnd(true, msg.lengthEqual(nameText)(length)); return; } - if (min || max) { - if (min && max) { - if (!validator[type](internalValue, min, max)) { - handleCheckEnd(true, msg.inBetween(nameText)(min)(max)); + } + } + if (type === VALIDATE_OPTION_TYPE_LIST[1]) { + if (!validator[type](internalValue, null, null)) { + handleCheckEnd(true, msg.invalid(nameText)); + return; + } + if (min || max) { + if (min && max) { + if (!validator[type](internalValue, min, max)) { + handleCheckEnd(true, msg.inBetween(nameText)(min)(max)); + return; + } + } else { + if (min) { + if (!validator[type](internalValue, min)) { + handleCheckEnd(true, msg.lessThan(nameText)(min)); return; } - } else { - if (min) { - if (!validator[type](internalValue, min)) { - handleCheckEnd(true, msg.lessThan(nameText)(min)); - return; - } - } - if (max) { - if (!validator[type](internalValue, 0, max)) { - handleCheckEnd(true, msg.greaterThan(nameText)(max)); - return; - } - } } - } - if (length) { - if (String(internalValue).length !== length) { - handleCheckEnd(true, msg.lengthEqual(nameText)(length)); - return; + if (max) { + if (!validator[type](internalValue, 0, max)) { + handleCheckEnd(true, msg.greaterThan(nameText)(max)); + return; + } } } } - if (compare && compare !== '') { - if (internalValue !== compare) { - handleCheckEnd(true, msg.twoInputsNotEqual()); + if (length) { + if (String(internalValue).length !== length) { + handleCheckEnd(true, msg.lengthEqual(nameText)(length)); return; } } } - if (customFunc && typeof customFunc === 'function') { - const customFuncResult = await customFunc(internalValue); - /* istanbul ignore next because of async problem */ - if (typeof customFuncResult === 'object') { - if (typeof customFuncResult.error === 'boolean' && typeof customFuncResult.message === 'string') { - if (customFuncResult.error === false && customFuncResult.showOnSuccess === true) { - setSuccessMsg(customFuncResult.message); - } - handleCheckEnd(customFuncResult.error, customFuncResult.message, true); - } + if (compare && compare !== '') { + if (internalValue !== compare) { + handleCheckEnd(true, msg.twoInputsNotEqual()); return; } - /* istanbul ignore next because of async problem */ - if (customFuncResult !== true) { - handleCheckEnd(true, customFuncResult, true); - return; + } + } + if (customFunc && typeof customFunc === 'function') { + const customFuncResult = await customFunc(internalValue); + if (!($input && $input.current)) { + return; + } + /* istanbul ignore next because of async problem */ + if (typeof customFuncResult === 'object') { + if (typeof customFuncResult.error === 'boolean' && typeof customFuncResult.message === 'string') { + if (customFuncResult.error === false && customFuncResult.showOnSuccess === true) { + setSuccessMsg(customFuncResult.message); + } + handleCheckEnd(customFuncResult.error, customFuncResult.message, true); } + return; } - if (msgOnSuccess) { - setSuccessMsg(msgOnSuccess); + /* istanbul ignore next because of async problem */ + if (customFuncResult !== true) { + handleCheckEnd(true, customFuncResult, true); + return; } - handleCheckEnd(false, msgOnSuccess); - } else { - console.error(`The valid ${utils.toCamelCase(TYPE)(true)} "type" options in validationOption are [${VALIDATE_OPTION_TYPE_LIST.map(i => i)}]`); } + if (msgOnSuccess) { + setSuccessMsg(msgOnSuccess); + } + handleCheckEnd(false, msgOnSuccess); } else { - console.error('Please provide "type" in validationOption'); + console.error(`The valid ${utils.toCamelCase(TYPE)(true)} "type" options in validationOption are [${VALIDATE_OPTION_TYPE_LIST.map(i => i)}]`); } + } else { + console.error('Please provide "type" in validationOption'); + } + }, [internalValue, option]); + const handleCheckEnd = useCallback( + (err: boolean, message: string, fromCustomFunc: boolean = false) => { + let msg = message; + const { msgOnError } = option; + if (err && msgOnError && !fromCustomFunc) { + msg = msgOnError; + } + setErr(err); + setMsg(msg); + validationCallback && validationCallback(err); }, - [internalValue, option], + [option.msgOnError], ); - const handleCheckEnd = useCallback((err: boolean, message: string, fromCustomFunc: boolean = false) => { - let msg = message; - const { msgOnError } = option; - if (err && msgOnError && !fromCustomFunc) { - msg = msgOnError; + useEffect(() => { + if (validate) { + check(); } - setErr(err); - setMsg(msg); - validationCallback && validationCallback(err); - }, [option.msgOnError]); - useEffect( - () => { - if (validate) { + }, [validate]); + useEffect(() => { + setInternalValue(String(value)); + }, [value]); + useEffect(() => { + /* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */ + if (typeof prevInternalValue !== 'undefined' && prevInternalValue !== internalValue) { + if (option.customFunc && onKeyUp) { check(); } - }, - [validate], - ); - useEffect( - () => { - setInternalValue(String(value)); - }, - [value], - ); - useEffect( - () => { - /* istanbul ignore next because of https://github.com/airbnb/enzyme/issues/441 && https://github.com/airbnb/enzyme/blob/master/docs/future.md */ - if (typeof prevInternalValue !== 'undefined' && prevInternalValue !== internalValue) { - if (option.customFunc && onKeyUp) { - check(); + } + }, [internalValue]); + useEffect(() => { + if (asyncObj) { + if (asyncObj.message) { + if (asyncObj.showOnError) { + handleCheckEnd(asyncObj.error, asyncObj.message); } - } - }, - [internalValue], - ); - useEffect( - () => { - if (asyncObj) { - if (asyncObj.message) { - if (asyncObj.showOnError) { - handleCheckEnd(asyncObj.error, asyncObj.message); - } - if (!asyncObj.error && asyncObj.showOnSuccess) { - setSuccessMsg(asyncObj.message); - } + if (!asyncObj.error && asyncObj.showOnSuccess) { + setSuccessMsg(asyncObj.message); } } - }, - [asyncMsgObj], - ); + } + }, [asyncMsgObj]); const wrapperClass = `${classNameWrapper} ${reactInputsValidationCss[`${TYPE}__wrapper`]} ${err && reactInputsValidationCss['error']} ${successMsg !== '' && !err && reactInputsValidationCss['success']} ${disabled && reactInputsValidationCss['disabled']}`;