Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-country-state-city

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-country-state-city - npm Package Compare versions

Comparing version 1.1.6 to 1.1.7

2

dist/cjs/index.js

@@ -1,2 +0,2 @@

"use strict";var e=require("react"),n=function(){return n=Object.assign||function(e){for(var n,t=1,a=arguments.length;t<a;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},n.apply(this,arguments)};function t(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)n.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(t[a[o]]=e[a[o]])}return t}function a(e,n,t,a){return new(t||(t=Promise))((function(o,r){function i(e){try{s(a.next(e))}catch(e){r(e)}}function c(e){try{s(a.throw(e))}catch(e){r(e)}}function s(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,c)}s((a=a.apply(e,n||[])).next())}))}function o(e,n){var t,a,o,r,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function c(c){return function(s){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;r&&(r=0,c[0]&&(i=0)),i;)try{if(t=1,a&&(o=2&c[0]?a.return:c[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,c[1])).done)return o;switch(a=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,a=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=n.call(e,i)}catch(e){c=[6,e],a=0}finally{t=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}var r=function(e){return a(void 0,void 0,void 0,(function(){var n;return o(this,(function(t){switch(t.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/regionsminified.json",e&&(n=e+"/regionsminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return[2,t.sent()]}}))}))},i=function(e,n){return a(void 0,void 0,void 0,(function(){var t,a,r;return o(this,(function(o){switch(o.label){case 0:return t="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",n&&(t=n+"/countriesminified.json"),[4,fetch(t).then((function(e){return e.json()}))];case 1:return a=o.sent(),r=a,e&&(r=r.filter((function(n){return n.region===e}))),[2,r]}}))}))},c=function(e){return a(void 0,void 0,void 0,(function(){var n;return o(this,(function(t){switch(t.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",e&&(n=e+"/countriesminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return[2,t.sent()]}}))}))},s=function(e){return a(void 0,void 0,void 0,(function(){var n;return o(this,(function(t){switch(t.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/languagesminified.json",e&&(n=e+"/languagesminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return[2,t.sent()]}}))}))},u=function(e,n){return a(void 0,void 0,void 0,(function(){var t,a,r;return o(this,(function(o){switch(o.label){case 0:return t="https://venkatmcajj.github.io/react-country-state-city/data/statesminified.json",n&&(t=n+"/languagesminified.json"),[4,fetch(t).then((function(e){return e.json()}))];case 1:return a=o.sent(),r=a.find((function(n){return n.id===e})),[2,r&&r.states?r.states:[]]}}))}))},l=function(e,n,t){return a(void 0,void 0,void 0,(function(){var a,r,i,c,s;return o(this,(function(o){switch(o.label){case 0:return a="https://venkatmcajj.github.io/react-country-state-city/data/citiesminified.json",t&&(a=t+"/citiesminified.json"),[4,fetch(a).then((function(e){return e.json()}))];case 1:return r=o.sent(),(i=r.find((function(n){return n.id===e})))?(c=i&&i.states?i.states:[],[2,(s=c.find((function(e){return e.id===n})))&&s.cities?s.cities:[]]):[2,[]]}}))}))},f=function(){return e.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},e.createElement("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},d=function(a){var o=a.placeHolder,r=a.options,i=a.onChange,c=a.inputClassName,s=a.onTextChange,u=a.defaultValue,l=a.showFlag,d=void 0===l||l,m=t(a,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","showFlag"]),p=e.useState(!1),h=p[0],v=p[1],g=e.useState(),C=g[0],w=g[1],E=e.useState(""),N=E[0],y=E[1],x=e.useRef(null),j=e.useRef(null);e.useEffect((function(){u&&w(u)}),[u]),e.useEffect((function(){y(""),h&&x.current&&x.current.focus()}),[h]),e.useEffect((function(){var e=function(e){j.current&&!j.current.contains(e.target)&&v(!1)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}));var b=function(e){return!!C&&C.id===e.id};return e.createElement("div",{className:"stdropdown-container"},e.createElement("div",{ref:j,onClick:function(){v(!0)},className:"stdropdown-input stsearch-box"},e.createElement("input",n({},m,{className:c,onChange:function(e){y(e.target.value),w(void 0),s&&s(e)},value:C?"".concat(d&&"emoji"in C?C.emoji:""," ").concat(C.name):N||"",placeholder:o,ref:x})),e.createElement("div",{className:"stdropdown-tools"},e.createElement("div",{className:"stdropdown-tool"},e.createElement(f,null)))),h&&e.createElement("div",{className:"stdropdown-menu"},(N?r.filter((function(e){return e.name.toLowerCase().indexOf(N.toLowerCase())>=0})):r).map((function(n){return e.createElement("div",{onClick:function(){return function(e){w(e),i(e)}(n)},key:n.id,className:"".concat("stdropdown-item"," ").concat(b(n)&&"selected")},d&&e.createElement("span",{className:"stdropdown-flag"},"emoji"in n?n.emoji:""," "),n.name)}))))},m=function(){return e.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},e.createElement("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},p=function(a){var o=a.placeHolder,r=a.options,i=a.onChange,c=a.inputClassName,s=a.onTextChange,u=a.defaultValue,l=a.displayNative,f=t(a,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","displayNative"]),d=e.useState(!1),p=d[0],h=d[1],v=e.useState(),g=v[0],C=v[1],w=e.useState(""),E=w[0],N=w[1],y=e.useRef(null),x=e.useRef(null);e.useEffect((function(){u&&C(u)}),[u]),e.useEffect((function(){N(""),p&&y.current&&y.current.focus()}),[p]),e.useEffect((function(){var e=function(e){x.current&&!x.current.contains(e.target)&&h(!1)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}));var j=function(e){return!!g&&g.code===e.code};return e.createElement("div",{className:"stdropdown-container"},e.createElement("div",{ref:x,onClick:function(){h(!0)},className:"stdropdown-input stsearch-box"},e.createElement("input",n({},f,{className:c,onChange:function(e){N(e.target.value),C(void 0),s&&s(e)},value:g?"".concat(l?g.native:g.name):E||"",placeholder:o,ref:y})),e.createElement("div",{className:"stdropdown-tools"},e.createElement("div",{className:"stdropdown-tool"},e.createElement(m,null)))),p&&e.createElement("div",{className:"stdropdown-menu"},(E?r.filter((function(e){return e.name.toLowerCase().indexOf(E.toLowerCase())>=0||e.native.toLowerCase().indexOf(E.toLowerCase())>=0})):r).map((function(n){return e.createElement("div",{onClick:function(){return function(e){C(e),i(e)}(n)},key:n.code,className:"".concat("stdropdown-item"," ").concat(j(n)&&"selected")},l?n.native:n.name)}))))},h=function(){return e.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},e.createElement("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},v=function(a){var o=a.placeHolder,r=a.options,i=a.onChange,c=a.inputClassName,s=a.onTextChange,u=a.defaultValue,l=a.showFlag,f=void 0===l||l,d=t(a,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","showFlag"]),m=e.useState(!1),p=m[0],v=m[1],g=e.useState(),C=g[0],w=g[1],E=e.useState(""),N=E[0],y=E[1],x=e.useRef(null),j=e.useRef(null);e.useEffect((function(){u&&w(u)}),[u]),e.useEffect((function(){y(""),p&&x.current&&x.current.focus()}),[p]),e.useEffect((function(){var e=function(e){j.current&&!j.current.contains(e.target)&&v(!1)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}));var b=function(e){return!!C&&C.id===e.id};return e.createElement("div",{className:"stdropdown-container"},e.createElement("div",{ref:j,onClick:function(){v(!0)},className:"stdropdown-input stsearch-box"},e.createElement("input",n({},d,{className:c,onChange:function(e){y(e.target.value),w(void 0),s&&s(e)},value:C?"".concat(f&&"emoji"in C?C.emoji:""," +").concat(C.phone_code):N||"",placeholder:o,ref:x})),e.createElement("div",{className:"stdropdown-tools"},e.createElement("div",{className:"stdropdown-tool"},e.createElement(h,null)))),p&&e.createElement("div",{className:"stdropdown-menu"},(N?r.filter((function(e){return e.name.toLowerCase().indexOf(N.toLowerCase())>=0||e.phone_code.indexOf(N)>=0||("+"+e.phone_code).indexOf(N)>=0})):r).map((function(n){return e.createElement("div",{onClick:function(){return function(e){w(e),i(e)}(n)},key:n.id,className:"".concat("stdropdown-item"," ").concat(b(n)&&"selected")},f&&e.createElement("span",{className:"stdropdown-flag"},"emoji"in n?n.emoji:""," "),"+",n.phone_code)}))))};exports.CitySelect=function(a){var o=a.containerClassName,r=a.inputClassName,i=a.onTextChange,c=a.defaultValue,s=a.onChange,u=a.countryid,f=a.stateid,m=a.placeHolder,p=a.src,h=t(a,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","countryid","stateid","placeHolder","src"]),v=e.useState([]),g=v[0],C=v[1];return e.useEffect((function(){u&&l(u,f,p).then((function(e){C(e)}))}),[u,f,p]),e.createElement(e.Fragment,null,e.createElement("div",{className:o,style:{position:"relative"}},e.createElement(d,n({},h,{placeHolder:m,options:g,onChange:function(e){s&&s(e)},onTextChange:i,defaultValue:c,inputClassName:r}))))},exports.CountrySelect=function(a){var o=a.containerClassName,r=a.inputClassName,s=a.onTextChange,u=a.defaultValue,l=a.onChange,f=a.placeHolder,m=a.showFlag,p=a.region,h=a.src,v=t(a,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","showFlag","region","src"]),g=e.useState([]),C=g[0],w=g[1];return e.useEffect((function(){p?i(p,h).then((function(e){w(e)})):c(h).then((function(e){w(e)}))}),[p,h]),e.createElement(e.Fragment,null,e.createElement("div",{className:o,style:{position:"relative"}},e.createElement(d,n({},v,{placeHolder:f,options:C,onChange:function(e){l&&l(e)},showFlag:m,onTextChange:s,defaultValue:u,inputClassName:r}))))},exports.GetCity=l,exports.GetCountries=c,exports.GetCountriesByRegion=i,exports.GetLanguages=s,exports.GetPhonecodes=function(e){return a(void 0,void 0,void 0,(function(){var n,t;return o(this,(function(a){switch(a.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",e&&(n=e+"/countriesminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return t=a.sent(),[2,t.map((function(e){return{id:e.id,name:e.name,phone_code:e.phone_code,region:e.region}}))]}}))}))},exports.GetPhonecodesByRegion=function(e,n){return a(void 0,void 0,void 0,(function(){var t,a,r;return o(this,(function(o){switch(o.label){case 0:return t="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",n&&(t=n+"/countriesminified.json"),[4,fetch(t).then((function(e){return e.json()}))];case 1:return a=o.sent(),r=a,e&&(r=r.filter((function(n){return n.region===e}))),[2,r.map((function(e){return{id:e.id,name:e.name,phone_code:e.phone_code,region:e.region}}))]}}))}))},exports.GetRegions=r,exports.GetState=u,exports.LanguageSelect=function(a){var o=a.containerClassName,r=a.inputClassName,i=a.onTextChange,c=a.defaultValue,u=a.onChange,l=a.placeHolder,f=a.displayNative,d=a.src,m=t(a,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","displayNative","src"]),h=e.useState([]),v=h[0],g=h[1];return e.useEffect((function(){s(d).then((function(e){g(e)}))}),[d]),e.createElement(e.Fragment,null,e.createElement("div",{className:o,style:{position:"relative"}},e.createElement(p,n({},m,{placeHolder:l,options:v,onChange:function(e){u&&u(e)},displayNative:f,onTextChange:i,defaultValue:c,inputClassName:r}))))},exports.PhonecodeSelect=function(a){var o=a.containerClassName,r=a.inputClassName,s=a.onTextChange,u=a.defaultValue,l=a.onChange,f=a.placeHolder,d=a.showFlag,m=a.region,p=a.src,h=t(a,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","showFlag","region","src"]),g=e.useState([]),C=g[0],w=g[1];return e.useEffect((function(){m?i(m,p).then((function(e){w(e)})):c(p).then((function(e){w(e)}))}),[m,p]),e.createElement(e.Fragment,null,e.createElement("div",{className:o,style:{position:"relative"}},e.createElement(v,n({},h,{placeHolder:f,options:C,onChange:function(e){l&&l(e)},showFlag:d,onTextChange:s,defaultValue:u,inputClassName:r}))))},exports.RegionSelect=function(a){var o=a.containerClassName,i=a.inputClassName,c=a.onTextChange,s=a.defaultValue,u=a.onChange,l=a.placeHolder,f=a.src,m=t(a,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","src"]),p=e.useState([]),h=p[0],v=p[1];return e.useEffect((function(){r(f).then((function(e){v(e)}))}),[f]),e.createElement(e.Fragment,null,e.createElement("div",{className:o,style:{position:"relative"}},e.createElement(d,n({},m,{placeHolder:l,options:h,onChange:function(e){u&&u(e)},onTextChange:c,defaultValue:s,inputClassName:i}))))},exports.StateSelect=function(a){var o=a.containerClassName,r=a.inputClassName,i=a.onTextChange,c=a.defaultValue,s=a.onChange,l=a.countryid,f=a.placeHolder,m=a.src,p=t(a,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","countryid","placeHolder","src"]),h=e.useState([]),v=h[0],g=h[1];return e.useEffect((function(){l&&u(l,m).then((function(e){g(e)}))}),[l,m]),e.createElement(e.Fragment,null,e.createElement("div",{className:o,style:{position:"relative"}},e.createElement(d,n({},p,{placeHolder:f,options:v,onChange:function(e){s&&s(e)},onTextChange:i,defaultValue:c,inputClassName:r}))))};
"use strict";var e=require("react"),t=function(){return t=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},t.apply(this,arguments)};function n(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n}function a(e,t,n,a){return new(n||(n=Promise))((function(o,r){function i(e){try{s(a.next(e))}catch(e){r(e)}}function c(e){try{s(a.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,c)}s((a=a.apply(e,t||[])).next())}))}function o(e,t){var n,a,o,r,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;r&&(r=0,c[0]&&(i=0)),i;)try{if(n=1,a&&(o=2&c[0]?a.return:c[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,c[1])).done)return o;switch(a=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,a=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],a=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}var r=function(e){return a(void 0,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return t="https://venkatmcajj.github.io/react-country-state-city/data/regionsminified.json",e&&(t=e+"/regionsminified.json"),[4,fetch(t).then((function(e){return e.json()}))];case 1:return[2,n.sent()]}}))}))},i=function(e,t){return a(void 0,void 0,void 0,(function(){var n,a,r;return o(this,(function(o){switch(o.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",t&&(n=t+"/countriesminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return a=o.sent(),r=a,e&&(r=r.filter((function(t){return t.region===e}))),[2,r]}}))}))},c=function(e){return a(void 0,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return t="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",e&&(t=e+"/countriesminified.json"),[4,fetch(t).then((function(e){return e.json()}))];case 1:return[2,n.sent()]}}))}))},s=function(e){return a(void 0,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return t="https://venkatmcajj.github.io/react-country-state-city/data/languagesminified.json",e&&(t=e+"/languagesminified.json"),[4,fetch(t).then((function(e){return e.json()}))];case 1:return[2,n.sent()]}}))}))},u=function(e,t){return a(void 0,void 0,void 0,(function(){var n,a,r;return o(this,(function(o){switch(o.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/statesminified.json",t&&(n=t+"/statesminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return a=o.sent(),r=a.find((function(t){return t.id===e})),[2,r&&r.states?r.states:[]]}}))}))},l=function(e,t,n){return a(void 0,void 0,void 0,(function(){var a,r,i,c,s;return o(this,(function(o){switch(o.label){case 0:return a="https://venkatmcajj.github.io/react-country-state-city/data/citiesminified.json",n&&(a=n+"/citiesminified.json"),[4,fetch(a).then((function(e){return e.json()}))];case 1:return r=o.sent(),(i=r.find((function(t){return t.id===e})))?(c=i&&i.states?i.states:[],[2,(s=c.find((function(e){return e.id===t})))&&s.cities?s.cities:[]]):[2,[]]}}))}))},f=function(){return e.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},e.createElement("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},d=function(a){var o=a.placeHolder,r=a.options,i=a.onChange,c=a.inputClassName,s=a.onTextChange,u=a.defaultValue,l=a.showFlag,d=void 0===l||l,m=n(a,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","showFlag"]),p=e.useState(!1),h=p[0],v=p[1],g=e.useState(),C=g[0],w=g[1],E=e.useState(""),N=E[0],y=E[1],x=e.useRef(null),j=e.useRef(null);e.useEffect((function(){u&&w(u)}),[u]),e.useEffect((function(){y(""),h&&x.current&&x.current.focus()}),[h]),e.useEffect((function(){var e=function(e){j.current&&!j.current.contains(e.target)&&v(!1)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}));var b=function(e){return!!C&&C.id===e.id};return e.createElement("div",{className:"stdropdown-container"},e.createElement("div",{ref:j,onClick:function(){v(!0)},className:"stdropdown-input stsearch-box"},e.createElement("input",t({},m,{className:c,onChange:function(e){y(e.target.value),w(void 0),s&&s(e)},value:C?"".concat(d&&"emoji"in C?C.emoji:""," ").concat(C.name):N||"",placeholder:o,ref:x})),e.createElement("div",{className:"stdropdown-tools"},e.createElement("div",{className:"stdropdown-tool"},e.createElement(f,null)))),h&&e.createElement("div",{className:"stdropdown-menu"},(N?r.filter((function(e){return e.name.toLowerCase().indexOf(N.toLowerCase())>=0})):r).map((function(t){return e.createElement("div",{onClick:function(){return function(e){w(e),i(e)}(t)},key:t.id,className:"".concat("stdropdown-item"," ").concat(b(t)&&"selected")},d&&e.createElement("span",{className:"stdropdown-flag"},"emoji"in t?t.emoji:""," "),t.name)}))))},m=function(){return e.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},e.createElement("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},p=function(a){var o=a.placeHolder,r=a.options,i=a.onChange,c=a.inputClassName,s=a.onTextChange,u=a.defaultValue,l=a.displayNative,f=n(a,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","displayNative"]),d=e.useState(!1),p=d[0],h=d[1],v=e.useState(),g=v[0],C=v[1],w=e.useState(""),E=w[0],N=w[1],y=e.useRef(null),x=e.useRef(null);e.useEffect((function(){u&&C(u)}),[u]),e.useEffect((function(){N(""),p&&y.current&&y.current.focus()}),[p]),e.useEffect((function(){var e=function(e){x.current&&!x.current.contains(e.target)&&h(!1)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}));var j=function(e){return!!g&&g.code===e.code};return e.createElement("div",{className:"stdropdown-container"},e.createElement("div",{ref:x,onClick:function(){h(!0)},className:"stdropdown-input stsearch-box"},e.createElement("input",t({},f,{className:c,onChange:function(e){N(e.target.value),C(void 0),s&&s(e)},value:g?"".concat(l?g.native:g.name):E||"",placeholder:o,ref:y})),e.createElement("div",{className:"stdropdown-tools"},e.createElement("div",{className:"stdropdown-tool"},e.createElement(m,null)))),p&&e.createElement("div",{className:"stdropdown-menu"},(E?r.filter((function(e){return e.name.toLowerCase().indexOf(E.toLowerCase())>=0||e.native.toLowerCase().indexOf(E.toLowerCase())>=0})):r).map((function(t){return e.createElement("div",{onClick:function(){return function(e){C(e),i(e)}(t)},key:t.code,className:"".concat("stdropdown-item"," ").concat(j(t)&&"selected")},l?t.native:t.name)}))))},h=function(){return e.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},e.createElement("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},v=function(a){var o=a.placeHolder,r=a.options,i=a.onChange,c=a.inputClassName,s=a.onTextChange,u=a.defaultValue,l=a.showFlag,f=void 0===l||l,d=n(a,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","showFlag"]),m=e.useState(!1),p=m[0],v=m[1],g=e.useState(),C=g[0],w=g[1],E=e.useState(""),N=E[0],y=E[1],x=e.useRef(null),j=e.useRef(null);e.useEffect((function(){u&&w(u)}),[u]),e.useEffect((function(){y(""),p&&x.current&&x.current.focus()}),[p]),e.useEffect((function(){var e=function(e){j.current&&!j.current.contains(e.target)&&v(!1)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}));var b=function(e){return!!C&&C.id===e.id};return e.createElement("div",{className:"stdropdown-container"},e.createElement("div",{ref:j,onClick:function(){v(!0)},className:"stdropdown-input stsearch-box"},e.createElement("input",t({},d,{className:c,onChange:function(e){y(e.target.value),w(void 0),s&&s(e)},value:C?"".concat(f&&"emoji"in C?C.emoji:""," +").concat(C.phone_code):N||"",placeholder:o,ref:x})),e.createElement("div",{className:"stdropdown-tools"},e.createElement("div",{className:"stdropdown-tool"},e.createElement(h,null)))),p&&e.createElement("div",{className:"stdropdown-menu"},(N?r.filter((function(e){return e.name.toLowerCase().indexOf(N.toLowerCase())>=0||e.phone_code.indexOf(N)>=0||("+"+e.phone_code).indexOf(N)>=0})):r).map((function(t){return e.createElement("div",{onClick:function(){return function(e){w(e),i(e)}(t)},key:t.id,className:"".concat("stdropdown-item"," ").concat(b(t)&&"selected")},f&&e.createElement("span",{className:"stdropdown-flag"},"emoji"in t?t.emoji:""," "),"+",t.phone_code)}))))};exports.CitySelect=function(a){var o=a.containerClassName,r=a.inputClassName,i=a.onTextChange,c=a.defaultValue,s=a.onChange,u=a.countryid,f=a.stateid,m=a.placeHolder,p=a.src,h=n(a,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","countryid","stateid","placeHolder","src"]),v=e.useState([]),g=v[0],C=v[1];return e.useEffect((function(){u&&l(u,f,p).then((function(e){C(e)}))}),[u,f,p]),e.createElement(e.Fragment,null,e.createElement("div",{className:o,style:{position:"relative"}},e.createElement(d,t({},h,{placeHolder:m,options:g,onChange:function(e){s&&s(e)},onTextChange:i,defaultValue:c,inputClassName:r}))))},exports.CountrySelect=function(a){var o=a.containerClassName,r=a.inputClassName,s=a.onTextChange,u=a.defaultValue,l=a.onChange,f=a.placeHolder,m=a.showFlag,p=a.region,h=a.src,v=n(a,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","showFlag","region","src"]),g=e.useState([]),C=g[0],w=g[1];return e.useEffect((function(){p?i(p,h).then((function(e){w(e)})):c(h).then((function(e){w(e)}))}),[p,h]),e.createElement(e.Fragment,null,e.createElement("div",{className:o,style:{position:"relative"}},e.createElement(d,t({},v,{placeHolder:f,options:C,onChange:function(e){l&&l(e)},showFlag:m,onTextChange:s,defaultValue:u,inputClassName:r}))))},exports.GetCity=l,exports.GetCountries=c,exports.GetCountriesByRegion=i,exports.GetLanguages=s,exports.GetPhonecodes=function(e){return a(void 0,void 0,void 0,(function(){var t,n;return o(this,(function(a){switch(a.label){case 0:return t="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",e&&(t=e+"/countriesminified.json"),[4,fetch(t).then((function(e){return e.json()}))];case 1:return n=a.sent(),[2,n.map((function(e){return{id:e.id,name:e.name,phone_code:e.phone_code,region:e.region}}))]}}))}))},exports.GetPhonecodesByRegion=function(e,t){return a(void 0,void 0,void 0,(function(){var n,a,r;return o(this,(function(o){switch(o.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",t&&(n=t+"/countriesminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return a=o.sent(),r=a,e&&(r=r.filter((function(t){return t.region===e}))),[2,r.map((function(e){return{id:e.id,name:e.name,phone_code:e.phone_code,region:e.region}}))]}}))}))},exports.GetRegions=r,exports.GetState=u,exports.LanguageSelect=function(a){var o=a.containerClassName,r=a.inputClassName,i=a.onTextChange,c=a.defaultValue,u=a.onChange,l=a.placeHolder,f=a.displayNative,d=a.src,m=n(a,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","displayNative","src"]),h=e.useState([]),v=h[0],g=h[1];return e.useEffect((function(){s(d).then((function(e){g(e)}))}),[d]),e.createElement(e.Fragment,null,e.createElement("div",{className:o,style:{position:"relative"}},e.createElement(p,t({},m,{placeHolder:l,options:v,onChange:function(e){u&&u(e)},displayNative:f,onTextChange:i,defaultValue:c,inputClassName:r}))))},exports.PhonecodeSelect=function(a){var o=a.containerClassName,r=a.inputClassName,s=a.onTextChange,u=a.defaultValue,l=a.onChange,f=a.placeHolder,d=a.showFlag,m=a.region,p=a.src,h=n(a,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","showFlag","region","src"]),g=e.useState([]),C=g[0],w=g[1];return e.useEffect((function(){m?i(m,p).then((function(e){w(e)})):c(p).then((function(e){w(e)}))}),[m,p]),e.createElement(e.Fragment,null,e.createElement("div",{className:o,style:{position:"relative"}},e.createElement(v,t({},h,{placeHolder:f,options:C,onChange:function(e){l&&l(e)},showFlag:d,onTextChange:s,defaultValue:u,inputClassName:r}))))},exports.RegionSelect=function(a){var o=a.containerClassName,i=a.inputClassName,c=a.onTextChange,s=a.defaultValue,u=a.onChange,l=a.placeHolder,f=a.src,m=n(a,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","src"]),p=e.useState([]),h=p[0],v=p[1];return e.useEffect((function(){r(f).then((function(e){v(e)}))}),[f]),e.createElement(e.Fragment,null,e.createElement("div",{className:o,style:{position:"relative"}},e.createElement(d,t({},m,{placeHolder:l,options:h,onChange:function(e){u&&u(e)},onTextChange:c,defaultValue:s,inputClassName:i}))))},exports.StateSelect=function(a){var o=a.containerClassName,r=a.inputClassName,i=a.onTextChange,c=a.defaultValue,s=a.onChange,l=a.countryid,f=a.placeHolder,m=a.src,p=n(a,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","countryid","placeHolder","src"]),h=e.useState([]),v=h[0],g=h[1];return e.useEffect((function(){l&&u(l,m).then((function(e){g(e)}))}),[l,m]),e.createElement(e.Fragment,null,e.createElement("div",{className:o,style:{position:"relative"}},e.createElement(d,t({},p,{placeHolder:f,options:v,onChange:function(e){s&&s(e)},onTextChange:i,defaultValue:c,inputClassName:r}))))};
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import e,{useState as n,useRef as t,useEffect as a}from"react";var o=function(){return o=Object.assign||function(e){for(var n,t=1,a=arguments.length;t<a;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},o.apply(this,arguments)};function r(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)n.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(t[a[o]]=e[a[o]])}return t}function i(e,n,t,a){return new(t||(t=Promise))((function(o,r){function i(e){try{s(a.next(e))}catch(e){r(e)}}function c(e){try{s(a.throw(e))}catch(e){r(e)}}function s(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,c)}s((a=a.apply(e,n||[])).next())}))}function c(e,n){var t,a,o,r,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function c(c){return function(s){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;r&&(r=0,c[0]&&(i=0)),i;)try{if(t=1,a&&(o=2&c[0]?a.return:c[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,c[1])).done)return o;switch(a=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,a=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=n.call(e,i)}catch(e){c=[6,e],a=0}finally{t=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}var s=function(e){return i(void 0,void 0,void 0,(function(){var n;return c(this,(function(t){switch(t.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/regionsminified.json",e&&(n=e+"/regionsminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return[2,t.sent()]}}))}))},l=function(e,n){return i(void 0,void 0,void 0,(function(){var t,a,o;return c(this,(function(r){switch(r.label){case 0:return t="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",n&&(t=n+"/countriesminified.json"),[4,fetch(t).then((function(e){return e.json()}))];case 1:return a=r.sent(),o=a,e&&(o=o.filter((function(n){return n.region===e}))),[2,o.map((function(e){return{id:e.id,name:e.name,phone_code:e.phone_code,region:e.region}}))]}}))}))},u=function(e){return i(void 0,void 0,void 0,(function(){var n,t;return c(this,(function(a){switch(a.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",e&&(n=e+"/countriesminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return t=a.sent(),[2,t.map((function(e){return{id:e.id,name:e.name,phone_code:e.phone_code,region:e.region}}))]}}))}))},d=function(e,n){return i(void 0,void 0,void 0,(function(){var t,a,o;return c(this,(function(r){switch(r.label){case 0:return t="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",n&&(t=n+"/countriesminified.json"),[4,fetch(t).then((function(e){return e.json()}))];case 1:return a=r.sent(),o=a,e&&(o=o.filter((function(n){return n.region===e}))),[2,o]}}))}))},f=function(e){return i(void 0,void 0,void 0,(function(){var n;return c(this,(function(t){switch(t.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",e&&(n=e+"/countriesminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return[2,t.sent()]}}))}))},m=function(e){return i(void 0,void 0,void 0,(function(){var n;return c(this,(function(t){switch(t.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/languagesminified.json",e&&(n=e+"/languagesminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return[2,t.sent()]}}))}))},h=function(e,n){return i(void 0,void 0,void 0,(function(){var t,a,o;return c(this,(function(r){switch(r.label){case 0:return t="https://venkatmcajj.github.io/react-country-state-city/data/statesminified.json",n&&(t=n+"/languagesminified.json"),[4,fetch(t).then((function(e){return e.json()}))];case 1:return a=r.sent(),o=a.find((function(n){return n.id===e})),[2,o&&o.states?o.states:[]]}}))}))},p=function(e,n,t){return i(void 0,void 0,void 0,(function(){var a,o,r,i,s;return c(this,(function(c){switch(c.label){case 0:return a="https://venkatmcajj.github.io/react-country-state-city/data/citiesminified.json",t&&(a=t+"/citiesminified.json"),[4,fetch(a).then((function(e){return e.json()}))];case 1:return o=c.sent(),(r=o.find((function(n){return n.id===e})))?(i=r&&r.states?r.states:[],[2,(s=i.find((function(e){return e.id===n})))&&s.cities?s.cities:[]]):[2,[]]}}))}))},v=function(){return e.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},e.createElement("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},g=function(i){var c=i.placeHolder,s=i.options,l=i.onChange,u=i.inputClassName,d=i.onTextChange,f=i.defaultValue,m=i.showFlag,h=void 0===m||m,p=r(i,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","showFlag"]),g=n(!1),C=g[0],w=g[1],N=n(),y=N[0],E=N[1],j=n(""),x=j[0],b=j[1],k=t(null),T=t(null);a((function(){f&&E(f)}),[f]),a((function(){b(""),C&&k.current&&k.current.focus()}),[C]),a((function(){var e=function(e){T.current&&!T.current.contains(e.target)&&w(!1)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}));var H=function(e){return!!y&&y.id===e.id};return e.createElement("div",{className:"stdropdown-container"},e.createElement("div",{ref:T,onClick:function(){w(!0)},className:"stdropdown-input stsearch-box"},e.createElement("input",o({},p,{className:u,onChange:function(e){b(e.target.value),E(void 0),d&&d(e)},value:y?"".concat(h&&"emoji"in y?y.emoji:""," ").concat(y.name):x||"",placeholder:c,ref:k})),e.createElement("div",{className:"stdropdown-tools"},e.createElement("div",{className:"stdropdown-tool"},e.createElement(v,null)))),C&&e.createElement("div",{className:"stdropdown-menu"},(x?s.filter((function(e){return e.name.toLowerCase().indexOf(x.toLowerCase())>=0})):s).map((function(n){return e.createElement("div",{onClick:function(){return function(e){E(e),l(e)}(n)},key:n.id,className:"".concat("stdropdown-item"," ").concat(H(n)&&"selected")},h&&e.createElement("span",{className:"stdropdown-flag"},"emoji"in n?n.emoji:""," "),n.name)}))))},C=function(t){var i=t.containerClassName,c=t.inputClassName,s=t.onTextChange,l=t.defaultValue,u=t.onChange,m=t.placeHolder,h=t.showFlag,p=t.region,v=t.src,C=r(t,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","showFlag","region","src"]),w=n([]),N=w[0],y=w[1];return a((function(){p?d(p,v).then((function(e){y(e)})):f(v).then((function(e){y(e)}))}),[p,v]),e.createElement(e.Fragment,null,e.createElement("div",{className:i,style:{position:"relative"}},e.createElement(g,o({},C,{placeHolder:m,options:N,onChange:function(e){u&&u(e)},showFlag:h,onTextChange:s,defaultValue:l,inputClassName:c}))))},w=function(t){var i=t.containerClassName,c=t.inputClassName,s=t.onTextChange,l=t.defaultValue,u=t.onChange,d=t.countryid,f=t.placeHolder,m=t.src,p=r(t,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","countryid","placeHolder","src"]),v=n([]),C=v[0],w=v[1];return a((function(){d&&h(d,m).then((function(e){w(e)}))}),[d,m]),e.createElement(e.Fragment,null,e.createElement("div",{className:i,style:{position:"relative"}},e.createElement(g,o({},p,{placeHolder:f,options:C,onChange:function(e){u&&u(e)},onTextChange:s,defaultValue:l,inputClassName:c}))))},N=function(t){var i=t.containerClassName,c=t.inputClassName,s=t.onTextChange,l=t.defaultValue,u=t.onChange,d=t.countryid,f=t.stateid,m=t.placeHolder,h=t.src,v=r(t,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","countryid","stateid","placeHolder","src"]),C=n([]),w=C[0],N=C[1];return a((function(){d&&p(d,f,h).then((function(e){N(e)}))}),[d,f,h]),e.createElement(e.Fragment,null,e.createElement("div",{className:i,style:{position:"relative"}},e.createElement(g,o({},v,{placeHolder:m,options:w,onChange:function(e){u&&u(e)},onTextChange:s,defaultValue:l,inputClassName:c}))))},y=function(){return e.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},e.createElement("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},E=function(i){var c=i.placeHolder,s=i.options,l=i.onChange,u=i.inputClassName,d=i.onTextChange,f=i.defaultValue,m=i.displayNative,h=r(i,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","displayNative"]),p=n(!1),v=p[0],g=p[1],C=n(),w=C[0],N=C[1],E=n(""),j=E[0],x=E[1],b=t(null),k=t(null);a((function(){f&&N(f)}),[f]),a((function(){x(""),v&&b.current&&b.current.focus()}),[v]),a((function(){var e=function(e){k.current&&!k.current.contains(e.target)&&g(!1)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}));var T=function(e){return!!w&&w.code===e.code};return e.createElement("div",{className:"stdropdown-container"},e.createElement("div",{ref:k,onClick:function(){g(!0)},className:"stdropdown-input stsearch-box"},e.createElement("input",o({},h,{className:u,onChange:function(e){x(e.target.value),N(void 0),d&&d(e)},value:w?"".concat(m?w.native:w.name):j||"",placeholder:c,ref:b})),e.createElement("div",{className:"stdropdown-tools"},e.createElement("div",{className:"stdropdown-tool"},e.createElement(y,null)))),v&&e.createElement("div",{className:"stdropdown-menu"},(j?s.filter((function(e){return e.name.toLowerCase().indexOf(j.toLowerCase())>=0||e.native.toLowerCase().indexOf(j.toLowerCase())>=0})):s).map((function(n){return e.createElement("div",{onClick:function(){return function(e){N(e),l(e)}(n)},key:n.code,className:"".concat("stdropdown-item"," ").concat(T(n)&&"selected")},m?n.native:n.name)}))))},j=function(t){var i=t.containerClassName,c=t.inputClassName,s=t.onTextChange,l=t.defaultValue,u=t.onChange,d=t.placeHolder,f=t.displayNative,h=t.src,p=r(t,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","displayNative","src"]),v=n([]),g=v[0],C=v[1];return a((function(){m(h).then((function(e){C(e)}))}),[h]),e.createElement(e.Fragment,null,e.createElement("div",{className:i,style:{position:"relative"}},e.createElement(E,o({},p,{placeHolder:d,options:g,onChange:function(e){u&&u(e)},displayNative:f,onTextChange:s,defaultValue:l,inputClassName:c}))))},x=function(t){var i=t.containerClassName,c=t.inputClassName,l=t.onTextChange,u=t.defaultValue,d=t.onChange,f=t.placeHolder,m=t.src,h=r(t,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","src"]),p=n([]),v=p[0],C=p[1];return a((function(){s(m).then((function(e){C(e)}))}),[m]),e.createElement(e.Fragment,null,e.createElement("div",{className:i,style:{position:"relative"}},e.createElement(g,o({},h,{placeHolder:f,options:v,onChange:function(e){d&&d(e)},onTextChange:l,defaultValue:u,inputClassName:c}))))},b=function(){return e.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},e.createElement("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},k=function(i){var c=i.placeHolder,s=i.options,l=i.onChange,u=i.inputClassName,d=i.onTextChange,f=i.defaultValue,m=i.showFlag,h=void 0===m||m,p=r(i,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","showFlag"]),v=n(!1),g=v[0],C=v[1],w=n(),N=w[0],y=w[1],E=n(""),j=E[0],x=E[1],k=t(null),T=t(null);a((function(){f&&y(f)}),[f]),a((function(){x(""),g&&k.current&&k.current.focus()}),[g]),a((function(){var e=function(e){T.current&&!T.current.contains(e.target)&&C(!1)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}));var H=function(e){return!!N&&N.id===e.id};return e.createElement("div",{className:"stdropdown-container"},e.createElement("div",{ref:T,onClick:function(){C(!0)},className:"stdropdown-input stsearch-box"},e.createElement("input",o({},p,{className:u,onChange:function(e){x(e.target.value),y(void 0),d&&d(e)},value:N?"".concat(h&&"emoji"in N?N.emoji:""," +").concat(N.phone_code):j||"",placeholder:c,ref:k})),e.createElement("div",{className:"stdropdown-tools"},e.createElement("div",{className:"stdropdown-tool"},e.createElement(b,null)))),g&&e.createElement("div",{className:"stdropdown-menu"},(j?s.filter((function(e){return e.name.toLowerCase().indexOf(j.toLowerCase())>=0||e.phone_code.indexOf(j)>=0||("+"+e.phone_code).indexOf(j)>=0})):s).map((function(n){return e.createElement("div",{onClick:function(){return function(e){y(e),l(e)}(n)},key:n.id,className:"".concat("stdropdown-item"," ").concat(H(n)&&"selected")},h&&e.createElement("span",{className:"stdropdown-flag"},"emoji"in n?n.emoji:""," "),"+",n.phone_code)}))))},T=function(t){var i=t.containerClassName,c=t.inputClassName,s=t.onTextChange,l=t.defaultValue,u=t.onChange,m=t.placeHolder,h=t.showFlag,p=t.region,v=t.src,g=r(t,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","showFlag","region","src"]),C=n([]),w=C[0],N=C[1];return a((function(){p?d(p,v).then((function(e){N(e)})):f(v).then((function(e){N(e)}))}),[p,v]),e.createElement(e.Fragment,null,e.createElement("div",{className:i,style:{position:"relative"}},e.createElement(k,o({},g,{placeHolder:m,options:w,onChange:function(e){u&&u(e)},showFlag:h,onTextChange:s,defaultValue:l,inputClassName:c}))))};export{N as CitySelect,C as CountrySelect,p as GetCity,f as GetCountries,d as GetCountriesByRegion,m as GetLanguages,u as GetPhonecodes,l as GetPhonecodesByRegion,s as GetRegions,h as GetState,j as LanguageSelect,T as PhonecodeSelect,x as RegionSelect,w as StateSelect};
import e,{useState as n,useRef as t,useEffect as a}from"react";var o=function(){return o=Object.assign||function(e){for(var n,t=1,a=arguments.length;t<a;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},o.apply(this,arguments)};function r(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)n.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(t[a[o]]=e[a[o]])}return t}function i(e,n,t,a){return new(t||(t=Promise))((function(o,r){function i(e){try{s(a.next(e))}catch(e){r(e)}}function c(e){try{s(a.throw(e))}catch(e){r(e)}}function s(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,c)}s((a=a.apply(e,n||[])).next())}))}function c(e,n){var t,a,o,r,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function c(c){return function(s){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;r&&(r=0,c[0]&&(i=0)),i;)try{if(t=1,a&&(o=2&c[0]?a.return:c[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,c[1])).done)return o;switch(a=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,a=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=n.call(e,i)}catch(e){c=[6,e],a=0}finally{t=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}var s=function(e){return i(void 0,void 0,void 0,(function(){var n;return c(this,(function(t){switch(t.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/regionsminified.json",e&&(n=e+"/regionsminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return[2,t.sent()]}}))}))},l=function(e,n){return i(void 0,void 0,void 0,(function(){var t,a,o;return c(this,(function(r){switch(r.label){case 0:return t="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",n&&(t=n+"/countriesminified.json"),[4,fetch(t).then((function(e){return e.json()}))];case 1:return a=r.sent(),o=a,e&&(o=o.filter((function(n){return n.region===e}))),[2,o.map((function(e){return{id:e.id,name:e.name,phone_code:e.phone_code,region:e.region}}))]}}))}))},u=function(e){return i(void 0,void 0,void 0,(function(){var n,t;return c(this,(function(a){switch(a.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",e&&(n=e+"/countriesminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return t=a.sent(),[2,t.map((function(e){return{id:e.id,name:e.name,phone_code:e.phone_code,region:e.region}}))]}}))}))},d=function(e,n){return i(void 0,void 0,void 0,(function(){var t,a,o;return c(this,(function(r){switch(r.label){case 0:return t="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",n&&(t=n+"/countriesminified.json"),[4,fetch(t).then((function(e){return e.json()}))];case 1:return a=r.sent(),o=a,e&&(o=o.filter((function(n){return n.region===e}))),[2,o]}}))}))},f=function(e){return i(void 0,void 0,void 0,(function(){var n;return c(this,(function(t){switch(t.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",e&&(n=e+"/countriesminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return[2,t.sent()]}}))}))},m=function(e){return i(void 0,void 0,void 0,(function(){var n;return c(this,(function(t){switch(t.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/languagesminified.json",e&&(n=e+"/languagesminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return[2,t.sent()]}}))}))},h=function(e,n){return i(void 0,void 0,void 0,(function(){var t,a,o;return c(this,(function(r){switch(r.label){case 0:return t="https://venkatmcajj.github.io/react-country-state-city/data/statesminified.json",n&&(t=n+"/statesminified.json"),[4,fetch(t).then((function(e){return e.json()}))];case 1:return a=r.sent(),o=a.find((function(n){return n.id===e})),[2,o&&o.states?o.states:[]]}}))}))},p=function(e,n,t){return i(void 0,void 0,void 0,(function(){var a,o,r,i,s;return c(this,(function(c){switch(c.label){case 0:return a="https://venkatmcajj.github.io/react-country-state-city/data/citiesminified.json",t&&(a=t+"/citiesminified.json"),[4,fetch(a).then((function(e){return e.json()}))];case 1:return o=c.sent(),(r=o.find((function(n){return n.id===e})))?(i=r&&r.states?r.states:[],[2,(s=i.find((function(e){return e.id===n})))&&s.cities?s.cities:[]]):[2,[]]}}))}))},v=function(){return e.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},e.createElement("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},g=function(i){var c=i.placeHolder,s=i.options,l=i.onChange,u=i.inputClassName,d=i.onTextChange,f=i.defaultValue,m=i.showFlag,h=void 0===m||m,p=r(i,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","showFlag"]),g=n(!1),C=g[0],w=g[1],N=n(),y=N[0],E=N[1],j=n(""),x=j[0],b=j[1],k=t(null),T=t(null);a((function(){f&&E(f)}),[f]),a((function(){b(""),C&&k.current&&k.current.focus()}),[C]),a((function(){var e=function(e){T.current&&!T.current.contains(e.target)&&w(!1)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}));var H=function(e){return!!y&&y.id===e.id};return e.createElement("div",{className:"stdropdown-container"},e.createElement("div",{ref:T,onClick:function(){w(!0)},className:"stdropdown-input stsearch-box"},e.createElement("input",o({},p,{className:u,onChange:function(e){b(e.target.value),E(void 0),d&&d(e)},value:y?"".concat(h&&"emoji"in y?y.emoji:""," ").concat(y.name):x||"",placeholder:c,ref:k})),e.createElement("div",{className:"stdropdown-tools"},e.createElement("div",{className:"stdropdown-tool"},e.createElement(v,null)))),C&&e.createElement("div",{className:"stdropdown-menu"},(x?s.filter((function(e){return e.name.toLowerCase().indexOf(x.toLowerCase())>=0})):s).map((function(n){return e.createElement("div",{onClick:function(){return function(e){E(e),l(e)}(n)},key:n.id,className:"".concat("stdropdown-item"," ").concat(H(n)&&"selected")},h&&e.createElement("span",{className:"stdropdown-flag"},"emoji"in n?n.emoji:""," "),n.name)}))))},C=function(t){var i=t.containerClassName,c=t.inputClassName,s=t.onTextChange,l=t.defaultValue,u=t.onChange,m=t.placeHolder,h=t.showFlag,p=t.region,v=t.src,C=r(t,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","showFlag","region","src"]),w=n([]),N=w[0],y=w[1];return a((function(){p?d(p,v).then((function(e){y(e)})):f(v).then((function(e){y(e)}))}),[p,v]),e.createElement(e.Fragment,null,e.createElement("div",{className:i,style:{position:"relative"}},e.createElement(g,o({},C,{placeHolder:m,options:N,onChange:function(e){u&&u(e)},showFlag:h,onTextChange:s,defaultValue:l,inputClassName:c}))))},w=function(t){var i=t.containerClassName,c=t.inputClassName,s=t.onTextChange,l=t.defaultValue,u=t.onChange,d=t.countryid,f=t.placeHolder,m=t.src,p=r(t,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","countryid","placeHolder","src"]),v=n([]),C=v[0],w=v[1];return a((function(){d&&h(d,m).then((function(e){w(e)}))}),[d,m]),e.createElement(e.Fragment,null,e.createElement("div",{className:i,style:{position:"relative"}},e.createElement(g,o({},p,{placeHolder:f,options:C,onChange:function(e){u&&u(e)},onTextChange:s,defaultValue:l,inputClassName:c}))))},N=function(t){var i=t.containerClassName,c=t.inputClassName,s=t.onTextChange,l=t.defaultValue,u=t.onChange,d=t.countryid,f=t.stateid,m=t.placeHolder,h=t.src,v=r(t,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","countryid","stateid","placeHolder","src"]),C=n([]),w=C[0],N=C[1];return a((function(){d&&p(d,f,h).then((function(e){N(e)}))}),[d,f,h]),e.createElement(e.Fragment,null,e.createElement("div",{className:i,style:{position:"relative"}},e.createElement(g,o({},v,{placeHolder:m,options:w,onChange:function(e){u&&u(e)},onTextChange:s,defaultValue:l,inputClassName:c}))))},y=function(){return e.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},e.createElement("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},E=function(i){var c=i.placeHolder,s=i.options,l=i.onChange,u=i.inputClassName,d=i.onTextChange,f=i.defaultValue,m=i.displayNative,h=r(i,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","displayNative"]),p=n(!1),v=p[0],g=p[1],C=n(),w=C[0],N=C[1],E=n(""),j=E[0],x=E[1],b=t(null),k=t(null);a((function(){f&&N(f)}),[f]),a((function(){x(""),v&&b.current&&b.current.focus()}),[v]),a((function(){var e=function(e){k.current&&!k.current.contains(e.target)&&g(!1)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}));var T=function(e){return!!w&&w.code===e.code};return e.createElement("div",{className:"stdropdown-container"},e.createElement("div",{ref:k,onClick:function(){g(!0)},className:"stdropdown-input stsearch-box"},e.createElement("input",o({},h,{className:u,onChange:function(e){x(e.target.value),N(void 0),d&&d(e)},value:w?"".concat(m?w.native:w.name):j||"",placeholder:c,ref:b})),e.createElement("div",{className:"stdropdown-tools"},e.createElement("div",{className:"stdropdown-tool"},e.createElement(y,null)))),v&&e.createElement("div",{className:"stdropdown-menu"},(j?s.filter((function(e){return e.name.toLowerCase().indexOf(j.toLowerCase())>=0||e.native.toLowerCase().indexOf(j.toLowerCase())>=0})):s).map((function(n){return e.createElement("div",{onClick:function(){return function(e){N(e),l(e)}(n)},key:n.code,className:"".concat("stdropdown-item"," ").concat(T(n)&&"selected")},m?n.native:n.name)}))))},j=function(t){var i=t.containerClassName,c=t.inputClassName,s=t.onTextChange,l=t.defaultValue,u=t.onChange,d=t.placeHolder,f=t.displayNative,h=t.src,p=r(t,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","displayNative","src"]),v=n([]),g=v[0],C=v[1];return a((function(){m(h).then((function(e){C(e)}))}),[h]),e.createElement(e.Fragment,null,e.createElement("div",{className:i,style:{position:"relative"}},e.createElement(E,o({},p,{placeHolder:d,options:g,onChange:function(e){u&&u(e)},displayNative:f,onTextChange:s,defaultValue:l,inputClassName:c}))))},x=function(t){var i=t.containerClassName,c=t.inputClassName,l=t.onTextChange,u=t.defaultValue,d=t.onChange,f=t.placeHolder,m=t.src,h=r(t,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","src"]),p=n([]),v=p[0],C=p[1];return a((function(){s(m).then((function(e){C(e)}))}),[m]),e.createElement(e.Fragment,null,e.createElement("div",{className:i,style:{position:"relative"}},e.createElement(g,o({},h,{placeHolder:f,options:v,onChange:function(e){d&&d(e)},onTextChange:l,defaultValue:u,inputClassName:c}))))},b=function(){return e.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},e.createElement("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},k=function(i){var c=i.placeHolder,s=i.options,l=i.onChange,u=i.inputClassName,d=i.onTextChange,f=i.defaultValue,m=i.showFlag,h=void 0===m||m,p=r(i,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","showFlag"]),v=n(!1),g=v[0],C=v[1],w=n(),N=w[0],y=w[1],E=n(""),j=E[0],x=E[1],k=t(null),T=t(null);a((function(){f&&y(f)}),[f]),a((function(){x(""),g&&k.current&&k.current.focus()}),[g]),a((function(){var e=function(e){T.current&&!T.current.contains(e.target)&&C(!1)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}));var H=function(e){return!!N&&N.id===e.id};return e.createElement("div",{className:"stdropdown-container"},e.createElement("div",{ref:T,onClick:function(){C(!0)},className:"stdropdown-input stsearch-box"},e.createElement("input",o({},p,{className:u,onChange:function(e){x(e.target.value),y(void 0),d&&d(e)},value:N?"".concat(h&&"emoji"in N?N.emoji:""," +").concat(N.phone_code):j||"",placeholder:c,ref:k})),e.createElement("div",{className:"stdropdown-tools"},e.createElement("div",{className:"stdropdown-tool"},e.createElement(b,null)))),g&&e.createElement("div",{className:"stdropdown-menu"},(j?s.filter((function(e){return e.name.toLowerCase().indexOf(j.toLowerCase())>=0||e.phone_code.indexOf(j)>=0||("+"+e.phone_code).indexOf(j)>=0})):s).map((function(n){return e.createElement("div",{onClick:function(){return function(e){y(e),l(e)}(n)},key:n.id,className:"".concat("stdropdown-item"," ").concat(H(n)&&"selected")},h&&e.createElement("span",{className:"stdropdown-flag"},"emoji"in n?n.emoji:""," "),"+",n.phone_code)}))))},T=function(t){var i=t.containerClassName,c=t.inputClassName,s=t.onTextChange,l=t.defaultValue,u=t.onChange,m=t.placeHolder,h=t.showFlag,p=t.region,v=t.src,g=r(t,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","showFlag","region","src"]),C=n([]),w=C[0],N=C[1];return a((function(){p?d(p,v).then((function(e){N(e)})):f(v).then((function(e){N(e)}))}),[p,v]),e.createElement(e.Fragment,null,e.createElement("div",{className:i,style:{position:"relative"}},e.createElement(k,o({},g,{placeHolder:m,options:w,onChange:function(e){u&&u(e)},showFlag:h,onTextChange:s,defaultValue:l,inputClassName:c}))))};export{N as CitySelect,C as CountrySelect,p as GetCity,f as GetCountries,d as GetCountriesByRegion,m as GetLanguages,u as GetPhonecodes,l as GetPhonecodesByRegion,s as GetRegions,h as GetState,j as LanguageSelect,T as PhonecodeSelect,x as RegionSelect,w as StateSelect};
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).ReactCountryStateCity={},e.React)}(this,(function(e,n){"use strict";var t=function(){return t=Object.assign||function(e){for(var n,t=1,a=arguments.length;t<a;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},t.apply(this,arguments)};function a(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)n.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(t[a[o]]=e[a[o]])}return t}function o(e,n,t,a){return new(t||(t=Promise))((function(o,i){function r(e){try{s(a.next(e))}catch(e){i(e)}}function c(e){try{s(a.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(r,c)}s((a=a.apply(e,n||[])).next())}))}function i(e,n){var t,a,o,i,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(r=0)),r;)try{if(t=1,a&&(o=2&c[0]?a.return:c[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,c[1])).done)return o;switch(a=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,a=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){r=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){r.label=c[1];break}if(6===c[0]&&r.label<o[1]){r.label=o[1],o=c;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(c);break}o[2]&&r.ops.pop(),r.trys.pop();continue}c=n.call(e,r)}catch(e){c=[6,e],a=0}finally{t=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}var r=function(e){return o(void 0,void 0,void 0,(function(){var n;return i(this,(function(t){switch(t.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/regionsminified.json",e&&(n=e+"/regionsminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return[2,t.sent()]}}))}))},c=function(e,n){return o(void 0,void 0,void 0,(function(){var t,a,o;return i(this,(function(i){switch(i.label){case 0:return t="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",n&&(t=n+"/countriesminified.json"),[4,fetch(t).then((function(e){return e.json()}))];case 1:return a=i.sent(),o=a,e&&(o=o.filter((function(n){return n.region===e}))),[2,o]}}))}))},s=function(e){return o(void 0,void 0,void 0,(function(){var n;return i(this,(function(t){switch(t.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",e&&(n=e+"/countriesminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return[2,t.sent()]}}))}))},u=function(e){return o(void 0,void 0,void 0,(function(){var n;return i(this,(function(t){switch(t.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/languagesminified.json",e&&(n=e+"/languagesminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return[2,t.sent()]}}))}))},l=function(e,n){return o(void 0,void 0,void 0,(function(){var t,a,o;return i(this,(function(i){switch(i.label){case 0:return t="https://venkatmcajj.github.io/react-country-state-city/data/statesminified.json",n&&(t=n+"/languagesminified.json"),[4,fetch(t).then((function(e){return e.json()}))];case 1:return a=i.sent(),o=a.find((function(n){return n.id===e})),[2,o&&o.states?o.states:[]]}}))}))},f=function(e,n,t){return o(void 0,void 0,void 0,(function(){var a,o,r,c,s;return i(this,(function(i){switch(i.label){case 0:return a="https://venkatmcajj.github.io/react-country-state-city/data/citiesminified.json",t&&(a=t+"/citiesminified.json"),[4,fetch(a).then((function(e){return e.json()}))];case 1:return o=i.sent(),(r=o.find((function(n){return n.id===e})))?(c=r&&r.states?r.states:[],[2,(s=c.find((function(e){return e.id===n})))&&s.cities?s.cities:[]]):[2,[]]}}))}))},d=function(){return n.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},n.createElement("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},m=function(e){var o=e.placeHolder,i=e.options,r=e.onChange,c=e.inputClassName,s=e.onTextChange,u=e.defaultValue,l=e.showFlag,f=void 0===l||l,m=a(e,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","showFlag"]),h=n.useState(!1),p=h[0],v=h[1],g=n.useState(),C=g[0],w=g[1],E=n.useState(""),y=E[0],N=E[1],j=n.useRef(null),x=n.useRef(null);n.useEffect((function(){u&&w(u)}),[u]),n.useEffect((function(){N(""),p&&j.current&&j.current.focus()}),[p]),n.useEffect((function(){var e=function(e){x.current&&!x.current.contains(e.target)&&v(!1)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}));var b=function(e){return!!C&&C.id===e.id};return n.createElement("div",{className:"stdropdown-container"},n.createElement("div",{ref:x,onClick:function(){v(!0)},className:"stdropdown-input stsearch-box"},n.createElement("input",t({},m,{className:c,onChange:function(e){N(e.target.value),w(void 0),s&&s(e)},value:C?"".concat(f&&"emoji"in C?C.emoji:""," ").concat(C.name):y||"",placeholder:o,ref:j})),n.createElement("div",{className:"stdropdown-tools"},n.createElement("div",{className:"stdropdown-tool"},n.createElement(d,null)))),p&&n.createElement("div",{className:"stdropdown-menu"},(y?i.filter((function(e){return e.name.toLowerCase().indexOf(y.toLowerCase())>=0})):i).map((function(e){return n.createElement("div",{onClick:function(){return function(e){w(e),r(e)}(e)},key:e.id,className:"".concat("stdropdown-item"," ").concat(b(e)&&"selected")},f&&n.createElement("span",{className:"stdropdown-flag"},"emoji"in e?e.emoji:""," "),e.name)}))))},h=function(){return n.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},n.createElement("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},p=function(e){var o=e.placeHolder,i=e.options,r=e.onChange,c=e.inputClassName,s=e.onTextChange,u=e.defaultValue,l=e.displayNative,f=a(e,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","displayNative"]),d=n.useState(!1),m=d[0],p=d[1],v=n.useState(),g=v[0],C=v[1],w=n.useState(""),E=w[0],y=w[1],N=n.useRef(null),j=n.useRef(null);n.useEffect((function(){u&&C(u)}),[u]),n.useEffect((function(){y(""),m&&N.current&&N.current.focus()}),[m]),n.useEffect((function(){var e=function(e){j.current&&!j.current.contains(e.target)&&p(!1)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}));var x=function(e){return!!g&&g.code===e.code};return n.createElement("div",{className:"stdropdown-container"},n.createElement("div",{ref:j,onClick:function(){p(!0)},className:"stdropdown-input stsearch-box"},n.createElement("input",t({},f,{className:c,onChange:function(e){y(e.target.value),C(void 0),s&&s(e)},value:g?"".concat(l?g.native:g.name):E||"",placeholder:o,ref:N})),n.createElement("div",{className:"stdropdown-tools"},n.createElement("div",{className:"stdropdown-tool"},n.createElement(h,null)))),m&&n.createElement("div",{className:"stdropdown-menu"},(E?i.filter((function(e){return e.name.toLowerCase().indexOf(E.toLowerCase())>=0||e.native.toLowerCase().indexOf(E.toLowerCase())>=0})):i).map((function(e){return n.createElement("div",{onClick:function(){return function(e){C(e),r(e)}(e)},key:e.code,className:"".concat("stdropdown-item"," ").concat(x(e)&&"selected")},l?e.native:e.name)}))))},v=function(){return n.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},n.createElement("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},g=function(e){var o=e.placeHolder,i=e.options,r=e.onChange,c=e.inputClassName,s=e.onTextChange,u=e.defaultValue,l=e.showFlag,f=void 0===l||l,d=a(e,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","showFlag"]),m=n.useState(!1),h=m[0],p=m[1],g=n.useState(),C=g[0],w=g[1],E=n.useState(""),y=E[0],N=E[1],j=n.useRef(null),x=n.useRef(null);n.useEffect((function(){u&&w(u)}),[u]),n.useEffect((function(){N(""),h&&j.current&&j.current.focus()}),[h]),n.useEffect((function(){var e=function(e){x.current&&!x.current.contains(e.target)&&p(!1)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}));var b=function(e){return!!C&&C.id===e.id};return n.createElement("div",{className:"stdropdown-container"},n.createElement("div",{ref:x,onClick:function(){p(!0)},className:"stdropdown-input stsearch-box"},n.createElement("input",t({},d,{className:c,onChange:function(e){N(e.target.value),w(void 0),s&&s(e)},value:C?"".concat(f&&"emoji"in C?C.emoji:""," +").concat(C.phone_code):y||"",placeholder:o,ref:j})),n.createElement("div",{className:"stdropdown-tools"},n.createElement("div",{className:"stdropdown-tool"},n.createElement(v,null)))),h&&n.createElement("div",{className:"stdropdown-menu"},(y?i.filter((function(e){return e.name.toLowerCase().indexOf(y.toLowerCase())>=0||e.phone_code.indexOf(y)>=0||("+"+e.phone_code).indexOf(y)>=0})):i).map((function(e){return n.createElement("div",{onClick:function(){return function(e){w(e),r(e)}(e)},key:e.id,className:"".concat("stdropdown-item"," ").concat(b(e)&&"selected")},f&&n.createElement("span",{className:"stdropdown-flag"},"emoji"in e?e.emoji:""," "),"+",e.phone_code)}))))};e.CitySelect=function(e){var o=e.containerClassName,i=e.inputClassName,r=e.onTextChange,c=e.defaultValue,s=e.onChange,u=e.countryid,l=e.stateid,d=e.placeHolder,h=e.src,p=a(e,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","countryid","stateid","placeHolder","src"]),v=n.useState([]),g=v[0],C=v[1];return n.useEffect((function(){u&&f(u,l,h).then((function(e){C(e)}))}),[u,l,h]),n.createElement(n.Fragment,null,n.createElement("div",{className:o,style:{position:"relative"}},n.createElement(m,t({},p,{placeHolder:d,options:g,onChange:function(e){s&&s(e)},onTextChange:r,defaultValue:c,inputClassName:i}))))},e.CountrySelect=function(e){var o=e.containerClassName,i=e.inputClassName,r=e.onTextChange,u=e.defaultValue,l=e.onChange,f=e.placeHolder,d=e.showFlag,h=e.region,p=e.src,v=a(e,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","showFlag","region","src"]),g=n.useState([]),C=g[0],w=g[1];return n.useEffect((function(){h?c(h,p).then((function(e){w(e)})):s(p).then((function(e){w(e)}))}),[h,p]),n.createElement(n.Fragment,null,n.createElement("div",{className:o,style:{position:"relative"}},n.createElement(m,t({},v,{placeHolder:f,options:C,onChange:function(e){l&&l(e)},showFlag:d,onTextChange:r,defaultValue:u,inputClassName:i}))))},e.GetCity=f,e.GetCountries=s,e.GetCountriesByRegion=c,e.GetLanguages=u,e.GetPhonecodes=function(e){return o(void 0,void 0,void 0,(function(){var n,t;return i(this,(function(a){switch(a.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",e&&(n=e+"/countriesminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return t=a.sent(),[2,t.map((function(e){return{id:e.id,name:e.name,phone_code:e.phone_code,region:e.region}}))]}}))}))},e.GetPhonecodesByRegion=function(e,n){return o(void 0,void 0,void 0,(function(){var t,a,o;return i(this,(function(i){switch(i.label){case 0:return t="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",n&&(t=n+"/countriesminified.json"),[4,fetch(t).then((function(e){return e.json()}))];case 1:return a=i.sent(),o=a,e&&(o=o.filter((function(n){return n.region===e}))),[2,o.map((function(e){return{id:e.id,name:e.name,phone_code:e.phone_code,region:e.region}}))]}}))}))},e.GetRegions=r,e.GetState=l,e.LanguageSelect=function(e){var o=e.containerClassName,i=e.inputClassName,r=e.onTextChange,c=e.defaultValue,s=e.onChange,l=e.placeHolder,f=e.displayNative,d=e.src,m=a(e,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","displayNative","src"]),h=n.useState([]),v=h[0],g=h[1];return n.useEffect((function(){u(d).then((function(e){g(e)}))}),[d]),n.createElement(n.Fragment,null,n.createElement("div",{className:o,style:{position:"relative"}},n.createElement(p,t({},m,{placeHolder:l,options:v,onChange:function(e){s&&s(e)},displayNative:f,onTextChange:r,defaultValue:c,inputClassName:i}))))},e.PhonecodeSelect=function(e){var o=e.containerClassName,i=e.inputClassName,r=e.onTextChange,u=e.defaultValue,l=e.onChange,f=e.placeHolder,d=e.showFlag,m=e.region,h=e.src,p=a(e,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","showFlag","region","src"]),v=n.useState([]),C=v[0],w=v[1];return n.useEffect((function(){m?c(m,h).then((function(e){w(e)})):s(h).then((function(e){w(e)}))}),[m,h]),n.createElement(n.Fragment,null,n.createElement("div",{className:o,style:{position:"relative"}},n.createElement(g,t({},p,{placeHolder:f,options:C,onChange:function(e){l&&l(e)},showFlag:d,onTextChange:r,defaultValue:u,inputClassName:i}))))},e.RegionSelect=function(e){var o=e.containerClassName,i=e.inputClassName,c=e.onTextChange,s=e.defaultValue,u=e.onChange,l=e.placeHolder,f=e.src,d=a(e,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","src"]),h=n.useState([]),p=h[0],v=h[1];return n.useEffect((function(){r(f).then((function(e){v(e)}))}),[f]),n.createElement(n.Fragment,null,n.createElement("div",{className:o,style:{position:"relative"}},n.createElement(m,t({},d,{placeHolder:l,options:p,onChange:function(e){u&&u(e)},onTextChange:c,defaultValue:s,inputClassName:i}))))},e.StateSelect=function(e){var o=e.containerClassName,i=e.inputClassName,r=e.onTextChange,c=e.defaultValue,s=e.onChange,u=e.countryid,f=e.placeHolder,d=e.src,h=a(e,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","countryid","placeHolder","src"]),p=n.useState([]),v=p[0],g=p[1];return n.useEffect((function(){u&&l(u,d).then((function(e){g(e)}))}),[u,d]),n.createElement(n.Fragment,null,n.createElement("div",{className:o,style:{position:"relative"}},n.createElement(m,t({},h,{placeHolder:f,options:v,onChange:function(e){s&&s(e)},onTextChange:r,defaultValue:c,inputClassName:i}))))}}));
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).ReactCountryStateCity={},e.React)}(this,(function(e,n){"use strict";var t=function(){return t=Object.assign||function(e){for(var n,t=1,a=arguments.length;t<a;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},t.apply(this,arguments)};function a(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)n.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(t[a[o]]=e[a[o]])}return t}function o(e,n,t,a){return new(t||(t=Promise))((function(o,i){function r(e){try{s(a.next(e))}catch(e){i(e)}}function c(e){try{s(a.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(r,c)}s((a=a.apply(e,n||[])).next())}))}function i(e,n){var t,a,o,i,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(r=0)),r;)try{if(t=1,a&&(o=2&c[0]?a.return:c[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,c[1])).done)return o;switch(a=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,a=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){r=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){r.label=c[1];break}if(6===c[0]&&r.label<o[1]){r.label=o[1],o=c;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(c);break}o[2]&&r.ops.pop(),r.trys.pop();continue}c=n.call(e,r)}catch(e){c=[6,e],a=0}finally{t=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}var r=function(e){return o(void 0,void 0,void 0,(function(){var n;return i(this,(function(t){switch(t.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/regionsminified.json",e&&(n=e+"/regionsminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return[2,t.sent()]}}))}))},c=function(e,n){return o(void 0,void 0,void 0,(function(){var t,a,o;return i(this,(function(i){switch(i.label){case 0:return t="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",n&&(t=n+"/countriesminified.json"),[4,fetch(t).then((function(e){return e.json()}))];case 1:return a=i.sent(),o=a,e&&(o=o.filter((function(n){return n.region===e}))),[2,o]}}))}))},s=function(e){return o(void 0,void 0,void 0,(function(){var n;return i(this,(function(t){switch(t.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",e&&(n=e+"/countriesminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return[2,t.sent()]}}))}))},u=function(e){return o(void 0,void 0,void 0,(function(){var n;return i(this,(function(t){switch(t.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/languagesminified.json",e&&(n=e+"/languagesminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return[2,t.sent()]}}))}))},l=function(e,n){return o(void 0,void 0,void 0,(function(){var t,a,o;return i(this,(function(i){switch(i.label){case 0:return t="https://venkatmcajj.github.io/react-country-state-city/data/statesminified.json",n&&(t=n+"/statesminified.json"),[4,fetch(t).then((function(e){return e.json()}))];case 1:return a=i.sent(),o=a.find((function(n){return n.id===e})),[2,o&&o.states?o.states:[]]}}))}))},f=function(e,n,t){return o(void 0,void 0,void 0,(function(){var a,o,r,c,s;return i(this,(function(i){switch(i.label){case 0:return a="https://venkatmcajj.github.io/react-country-state-city/data/citiesminified.json",t&&(a=t+"/citiesminified.json"),[4,fetch(a).then((function(e){return e.json()}))];case 1:return o=i.sent(),(r=o.find((function(n){return n.id===e})))?(c=r&&r.states?r.states:[],[2,(s=c.find((function(e){return e.id===n})))&&s.cities?s.cities:[]]):[2,[]]}}))}))},d=function(){return n.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},n.createElement("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},m=function(e){var o=e.placeHolder,i=e.options,r=e.onChange,c=e.inputClassName,s=e.onTextChange,u=e.defaultValue,l=e.showFlag,f=void 0===l||l,m=a(e,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","showFlag"]),h=n.useState(!1),p=h[0],v=h[1],g=n.useState(),C=g[0],w=g[1],E=n.useState(""),y=E[0],N=E[1],j=n.useRef(null),x=n.useRef(null);n.useEffect((function(){u&&w(u)}),[u]),n.useEffect((function(){N(""),p&&j.current&&j.current.focus()}),[p]),n.useEffect((function(){var e=function(e){x.current&&!x.current.contains(e.target)&&v(!1)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}));var b=function(e){return!!C&&C.id===e.id};return n.createElement("div",{className:"stdropdown-container"},n.createElement("div",{ref:x,onClick:function(){v(!0)},className:"stdropdown-input stsearch-box"},n.createElement("input",t({},m,{className:c,onChange:function(e){N(e.target.value),w(void 0),s&&s(e)},value:C?"".concat(f&&"emoji"in C?C.emoji:""," ").concat(C.name):y||"",placeholder:o,ref:j})),n.createElement("div",{className:"stdropdown-tools"},n.createElement("div",{className:"stdropdown-tool"},n.createElement(d,null)))),p&&n.createElement("div",{className:"stdropdown-menu"},(y?i.filter((function(e){return e.name.toLowerCase().indexOf(y.toLowerCase())>=0})):i).map((function(e){return n.createElement("div",{onClick:function(){return function(e){w(e),r(e)}(e)},key:e.id,className:"".concat("stdropdown-item"," ").concat(b(e)&&"selected")},f&&n.createElement("span",{className:"stdropdown-flag"},"emoji"in e?e.emoji:""," "),e.name)}))))},h=function(){return n.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},n.createElement("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},p=function(e){var o=e.placeHolder,i=e.options,r=e.onChange,c=e.inputClassName,s=e.onTextChange,u=e.defaultValue,l=e.displayNative,f=a(e,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","displayNative"]),d=n.useState(!1),m=d[0],p=d[1],v=n.useState(),g=v[0],C=v[1],w=n.useState(""),E=w[0],y=w[1],N=n.useRef(null),j=n.useRef(null);n.useEffect((function(){u&&C(u)}),[u]),n.useEffect((function(){y(""),m&&N.current&&N.current.focus()}),[m]),n.useEffect((function(){var e=function(e){j.current&&!j.current.contains(e.target)&&p(!1)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}));var x=function(e){return!!g&&g.code===e.code};return n.createElement("div",{className:"stdropdown-container"},n.createElement("div",{ref:j,onClick:function(){p(!0)},className:"stdropdown-input stsearch-box"},n.createElement("input",t({},f,{className:c,onChange:function(e){y(e.target.value),C(void 0),s&&s(e)},value:g?"".concat(l?g.native:g.name):E||"",placeholder:o,ref:N})),n.createElement("div",{className:"stdropdown-tools"},n.createElement("div",{className:"stdropdown-tool"},n.createElement(h,null)))),m&&n.createElement("div",{className:"stdropdown-menu"},(E?i.filter((function(e){return e.name.toLowerCase().indexOf(E.toLowerCase())>=0||e.native.toLowerCase().indexOf(E.toLowerCase())>=0})):i).map((function(e){return n.createElement("div",{onClick:function(){return function(e){C(e),r(e)}(e)},key:e.code,className:"".concat("stdropdown-item"," ").concat(x(e)&&"selected")},l?e.native:e.name)}))))},v=function(){return n.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},n.createElement("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},g=function(e){var o=e.placeHolder,i=e.options,r=e.onChange,c=e.inputClassName,s=e.onTextChange,u=e.defaultValue,l=e.showFlag,f=void 0===l||l,d=a(e,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","showFlag"]),m=n.useState(!1),h=m[0],p=m[1],g=n.useState(),C=g[0],w=g[1],E=n.useState(""),y=E[0],N=E[1],j=n.useRef(null),x=n.useRef(null);n.useEffect((function(){u&&w(u)}),[u]),n.useEffect((function(){N(""),h&&j.current&&j.current.focus()}),[h]),n.useEffect((function(){var e=function(e){x.current&&!x.current.contains(e.target)&&p(!1)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}));var b=function(e){return!!C&&C.id===e.id};return n.createElement("div",{className:"stdropdown-container"},n.createElement("div",{ref:x,onClick:function(){p(!0)},className:"stdropdown-input stsearch-box"},n.createElement("input",t({},d,{className:c,onChange:function(e){N(e.target.value),w(void 0),s&&s(e)},value:C?"".concat(f&&"emoji"in C?C.emoji:""," +").concat(C.phone_code):y||"",placeholder:o,ref:j})),n.createElement("div",{className:"stdropdown-tools"},n.createElement("div",{className:"stdropdown-tool"},n.createElement(v,null)))),h&&n.createElement("div",{className:"stdropdown-menu"},(y?i.filter((function(e){return e.name.toLowerCase().indexOf(y.toLowerCase())>=0||e.phone_code.indexOf(y)>=0||("+"+e.phone_code).indexOf(y)>=0})):i).map((function(e){return n.createElement("div",{onClick:function(){return function(e){w(e),r(e)}(e)},key:e.id,className:"".concat("stdropdown-item"," ").concat(b(e)&&"selected")},f&&n.createElement("span",{className:"stdropdown-flag"},"emoji"in e?e.emoji:""," "),"+",e.phone_code)}))))};e.CitySelect=function(e){var o=e.containerClassName,i=e.inputClassName,r=e.onTextChange,c=e.defaultValue,s=e.onChange,u=e.countryid,l=e.stateid,d=e.placeHolder,h=e.src,p=a(e,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","countryid","stateid","placeHolder","src"]),v=n.useState([]),g=v[0],C=v[1];return n.useEffect((function(){u&&f(u,l,h).then((function(e){C(e)}))}),[u,l,h]),n.createElement(n.Fragment,null,n.createElement("div",{className:o,style:{position:"relative"}},n.createElement(m,t({},p,{placeHolder:d,options:g,onChange:function(e){s&&s(e)},onTextChange:r,defaultValue:c,inputClassName:i}))))},e.CountrySelect=function(e){var o=e.containerClassName,i=e.inputClassName,r=e.onTextChange,u=e.defaultValue,l=e.onChange,f=e.placeHolder,d=e.showFlag,h=e.region,p=e.src,v=a(e,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","showFlag","region","src"]),g=n.useState([]),C=g[0],w=g[1];return n.useEffect((function(){h?c(h,p).then((function(e){w(e)})):s(p).then((function(e){w(e)}))}),[h,p]),n.createElement(n.Fragment,null,n.createElement("div",{className:o,style:{position:"relative"}},n.createElement(m,t({},v,{placeHolder:f,options:C,onChange:function(e){l&&l(e)},showFlag:d,onTextChange:r,defaultValue:u,inputClassName:i}))))},e.GetCity=f,e.GetCountries=s,e.GetCountriesByRegion=c,e.GetLanguages=u,e.GetPhonecodes=function(e){return o(void 0,void 0,void 0,(function(){var n,t;return i(this,(function(a){switch(a.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",e&&(n=e+"/countriesminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return t=a.sent(),[2,t.map((function(e){return{id:e.id,name:e.name,phone_code:e.phone_code,region:e.region}}))]}}))}))},e.GetPhonecodesByRegion=function(e,n){return o(void 0,void 0,void 0,(function(){var t,a,o;return i(this,(function(i){switch(i.label){case 0:return t="https://venkatmcajj.github.io/react-country-state-city/data/countriesminified.json",n&&(t=n+"/countriesminified.json"),[4,fetch(t).then((function(e){return e.json()}))];case 1:return a=i.sent(),o=a,e&&(o=o.filter((function(n){return n.region===e}))),[2,o.map((function(e){return{id:e.id,name:e.name,phone_code:e.phone_code,region:e.region}}))]}}))}))},e.GetRegions=r,e.GetState=l,e.LanguageSelect=function(e){var o=e.containerClassName,i=e.inputClassName,r=e.onTextChange,c=e.defaultValue,s=e.onChange,l=e.placeHolder,f=e.displayNative,d=e.src,m=a(e,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","displayNative","src"]),h=n.useState([]),v=h[0],g=h[1];return n.useEffect((function(){u(d).then((function(e){g(e)}))}),[d]),n.createElement(n.Fragment,null,n.createElement("div",{className:o,style:{position:"relative"}},n.createElement(p,t({},m,{placeHolder:l,options:v,onChange:function(e){s&&s(e)},displayNative:f,onTextChange:r,defaultValue:c,inputClassName:i}))))},e.PhonecodeSelect=function(e){var o=e.containerClassName,i=e.inputClassName,r=e.onTextChange,u=e.defaultValue,l=e.onChange,f=e.placeHolder,d=e.showFlag,m=e.region,h=e.src,p=a(e,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","showFlag","region","src"]),v=n.useState([]),C=v[0],w=v[1];return n.useEffect((function(){m?c(m,h).then((function(e){w(e)})):s(h).then((function(e){w(e)}))}),[m,h]),n.createElement(n.Fragment,null,n.createElement("div",{className:o,style:{position:"relative"}},n.createElement(g,t({},p,{placeHolder:f,options:C,onChange:function(e){l&&l(e)},showFlag:d,onTextChange:r,defaultValue:u,inputClassName:i}))))},e.RegionSelect=function(e){var o=e.containerClassName,i=e.inputClassName,c=e.onTextChange,s=e.defaultValue,u=e.onChange,l=e.placeHolder,f=e.src,d=a(e,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","src"]),h=n.useState([]),p=h[0],v=h[1];return n.useEffect((function(){r(f).then((function(e){v(e)}))}),[f]),n.createElement(n.Fragment,null,n.createElement("div",{className:o,style:{position:"relative"}},n.createElement(m,t({},d,{placeHolder:l,options:p,onChange:function(e){u&&u(e)},onTextChange:c,defaultValue:s,inputClassName:i}))))},e.StateSelect=function(e){var o=e.containerClassName,i=e.inputClassName,r=e.onTextChange,c=e.defaultValue,s=e.onChange,u=e.countryid,f=e.placeHolder,d=e.src,h=a(e,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","countryid","placeHolder","src"]),p=n.useState([]),v=p[0],g=p[1];return n.useEffect((function(){u&&l(u,d).then((function(e){g(e)}))}),[u,d]),n.createElement(n.Fragment,null,n.createElement("div",{className:o,style:{position:"relative"}},n.createElement(m,t({},h,{placeHolder:f,options:v,onChange:function(e){s&&s(e)},onTextChange:r,defaultValue:c,inputClassName:i}))))}}));
//# sourceMappingURL=index.js.map
{
"name": "react-country-state-city",
"version": "1.1.6",
"description": "A lightweight and easy-to-use React library that provides a comprehensive list of regions or continents, countries, states, cities and languages for creating dynamic and searchable dropdowns. Ideal for building forms and input fields that require accurate and up-to-date geographical selections, with seamless integration for improved user experience.",
"version": "1.1.7",
"description": "A lightweight and easy-to-use React library that provides a comprehensive list of regions or continents, countries, states, cities languages, and country phone codes for creating dynamic and searchable dropdowns. Ideal for building forms and input fields that require accurate and up-to-date geographical selections, with seamless integration for improved user experience.",
"main": "dist/cjs/index.js",

@@ -6,0 +6,0 @@ "module": "dist/esm/index.js",

# React-country-state-city
React-country-state-city allows you to create a responsive country, state, city dropdown with search options. And also provide the option to create a language select dropdown to list all Languages.
A lightweight and easy-to-use React library that provides a comprehensive list of regions or continents, countries, states, cities, languages, and country phone codes for creating dynamic and searchable dropdowns. Ideal for building forms and input fields that require accurate and up-to-date geographical selections, with seamless integration for improved user experience.

@@ -5,0 +5,0 @@ ## Installation

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc