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
0
Versions
19
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.8 to 1.1.9

2

dist/cjs/index.js

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

"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,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 t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,c)}s((a=a.apply(e,t||[])).next())}))}function o(e,t){var n,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(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(r=0)),r;)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 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=t.call(e,r)}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 i=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()]}}))}))},r=function(e,t){return a(void 0,void 0,void 0,(function(){var n,a,i;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(),i=a,e&&(i=i.filter((function(t){return t.region===e}))),[2,i]}}))}))},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,i;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(),i=a.find((function(t){return t.id===e})),[2,i&&i.states?i.states:[]]}}))}))},l=function(e,t,n){return a(void 0,void 0,void 0,(function(){var a,i,r,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 i=o.sent(),(r=i.find((function(t){return t.id===e})))?(c=r&&r.states?r.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,i=a.options,r=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],j=e.useRef(null),x=e.useRef(null);e.useEffect((function(){u&&w(u)}),[u]),e.useEffect((function(){y(""),h&&j.current&&j.current.focus()}),[h]),e.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 e.createElement("div",{className:"stdropdown-container"},e.createElement("div",{ref:x,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:j})),e.createElement("div",{className:"stdropdown-tools"},e.createElement("div",{className:"stdropdown-tool"},e.createElement(f,null)))),h&&e.createElement("div",{className:"stdropdown-menu"},(N?i.filter((function(e){return e.name.toLowerCase().indexOf(N.toLowerCase())>=0})):i).map((function(t){return e.createElement("div",{onClick:function(){return function(e){w(e),r(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,i=a.options,r=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),j=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){j.current&&!j.current.contains(e.target)&&h(!1)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}));var x=function(e){return!!g&&g.code===e.code};return e.createElement("div",{className:"stdropdown-container"},e.createElement("div",{ref:j,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?i.filter((function(e){return e.name.toLowerCase().indexOf(E.toLowerCase())>=0||e.native.toLowerCase().indexOf(E.toLowerCase())>=0})):i).map((function(t){return e.createElement("div",{onClick:function(){return function(e){C(e),r(e)}(t)},key:t.code,className:"".concat("stdropdown-item"," ").concat(x(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,i=a.options,r=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],j=e.useRef(null),x=e.useRef(null);e.useEffect((function(){u&&w(u)}),[u]),e.useEffect((function(){y(""),p&&j.current&&j.current.focus()}),[p]),e.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 e.createElement("div",{className:"stdropdown-container"},e.createElement("div",{ref:x,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:j})),e.createElement("div",{className:"stdropdown-tools"},e.createElement("div",{className:"stdropdown-tool"},e.createElement(h,null)))),p&&e.createElement("div",{className:"stdropdown-menu"},(N?i.filter((function(e){return e.name.toLowerCase().indexOf(N.toLowerCase())>=0||e.phone_code.indexOf(N)>=0||("+"+e.phone_code).indexOf(N)>=0})):i).map((function(t){return e.createElement("div",{onClick:function(){return function(e){w(e),r(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,i=a.inputClassName,r=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:r,defaultValue:c,inputClassName:i}))))},exports.CountrySelect=function(a){var o=a.containerClassName,i=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?r(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:i}))))},exports.GetAllCities=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/citiesminified.json",e&&(t=e+"/citiesminified.json"),[4,fetch(t).then((function(e){return e.json()}))];case 1:return n=a.sent(),[2,n.flatMap((function(e){return e.states.flatMap((function(e){return e.cities}))}))]}}))}))},exports.GetCity=l,exports.GetCountries=c,exports.GetCountriesByRegion=r,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,i;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(),i=a,e&&(i=i.filter((function(t){return t.region===e}))),[2,i.map((function(e){return{id:e.id,name:e.name,phone_code:e.phone_code,region:e.region}}))]}}))}))},exports.GetRegions=i,exports.GetState=u,exports.LanguageSelect=function(a){var o=a.containerClassName,i=a.inputClassName,r=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:r,defaultValue:c,inputClassName:i}))))},exports.PhonecodeSelect=function(a){var o=a.containerClassName,i=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?r(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:i}))))},exports.RegionSelect=function(a){var o=a.containerClassName,r=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(){i(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:r}))))},exports.StateSelect=function(a){var o=a.containerClassName,i=a.inputClassName,r=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:r,defaultValue:c,inputClassName:i}))))};
"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"]),h=e.useState(!1),p=h[0],v=h[1],g=e.useState(),C=g[0],w=g[1],E=e.useState(""),N=E[0],y=E[1],j=e.useRef(null),x=e.useRef(null);e.useEffect((function(){u&&w(u)}),[u]),e.useEffect((function(){y(""),p&&j.current&&j.current.focus()}),[p]),e.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 e.createElement("div",{className:"stdropdown-container"},e.createElement("div",{ref:x,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:j})),e.createElement("div",{className:"stdropdown-tools"},e.createElement("div",{className:"stdropdown-tool"},e.createElement(f,null)))),p&&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"}))},h=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),h=d[0],p=d[1],v=e.useState(),g=v[0],C=v[1],w=e.useState(""),E=w[0],N=w[1],y=e.useRef(null),j=e.useRef(null);e.useEffect((function(){u&&C(u)}),[u]),e.useEffect((function(){N(""),h&&y.current&&y.current.focus()}),[h]),e.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 e.createElement("div",{className:"stdropdown-container"},e.createElement("div",{ref:j,onClick:function(){p(!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)))),h&&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(x(t)&&"selected")},l?t.native:t.name)}))))},p=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),h=m[0],v=m[1],g=e.useState(),C=g[0],w=g[1],E=e.useState(""),N=E[0],y=E[1],j=e.useRef(null),x=e.useRef(null);e.useEffect((function(){u&&w(u)}),[u]),e.useEffect((function(){y(""),h&&j.current&&j.current.focus()}),[h]),e.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 e.createElement("div",{className:"stdropdown-container"},e.createElement("div",{ref:x,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:j})),e.createElement("div",{className:"stdropdown-tools"},e.createElement("div",{className:"stdropdown-tool"},e.createElement(p,null)))),h&&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,h=a.src,p=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,h).then((function(e){C(e)}))}),[u,f,h]),e.createElement(e.Fragment,null,e.createElement("div",{className:o,style:{position:"relative"}},e.createElement(d,t({},p,{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,h=a.region,p=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(){h?i(h,p).then((function(e){w(e)})):c(p).then((function(e){w(e)}))}),[h,p]),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.GetAllCities=function(e){return a(void 0,void 0,void 0,(function(){var t,n,a,r,i,c,s,u,l,f,d,m;return o(this,(function(o){switch(o.label){case 0:return t="https://venkatmcajj.github.io/react-country-state-city/data/citiesminified.json",e&&(t=e+"/citiesminified.json"),[4,fetch(t).then((function(e){return e.json()}))];case 1:for(n=o.sent(),a=[],r=0,i=n;r<i.length;r++)for(c=i[r],s=0,u=c.states;s<u.length;s++)for(l=u[s],f=0,d=l.cities;f<d.length;f++)m=d[f],a.push(m);return[2,a]}}))}))},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"]),p=e.useState([]),v=p[0],g=p[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(h,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,h=a.src,p=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,h).then((function(e){w(e)})):c(h).then((function(e){w(e)}))}),[m,h]),e.createElement(e.Fragment,null,e.createElement("div",{className:o,style:{position:"relative"}},e.createElement(v,t({},p,{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"]),h=e.useState([]),p=h[0],v=h[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:p,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,h=n(a,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","countryid","placeHolder","src"]),p=e.useState([]),v=p[0],g=p[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({},h,{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 i(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 r(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 c(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 s=function(e){return r(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()]}}))}))},u=function(e,n){return r(void 0,void 0,void 0,(function(){var t,a,o;return c(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}}))]}}))}))},l=function(e){return r(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 r(void 0,void 0,void 0,(function(){var t,a,o;return c(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]}}))}))},f=function(e){return r(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 r(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 r(void 0,void 0,void 0,(function(){var t,a,o;return c(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:[]]}}))}))},p=function(e,n,t){return r(void 0,void 0,void 0,(function(){var a,o,i,r,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(),(i=o.find((function(n){return n.id===e})))?(r=i&&i.states?i.states:[],[2,(s=r.find((function(e){return e.id===n})))&&s.cities?s.cities:[]]):[2,[]]}}))}))},v=function(e){return r(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/citiesminified.json",e&&(n=e+"/citiesminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:return t=a.sent(),[2,t.flatMap((function(e){return e.states.flatMap((function(e){return e.cities}))}))]}}))}))},g=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"}))},C=function(r){var c=r.placeHolder,s=r.options,u=r.onChange,l=r.inputClassName,d=r.onTextChange,f=r.defaultValue,m=r.showFlag,h=void 0===m||m,p=i(r,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","showFlag"]),v=n(!1),C=v[0],w=v[1],N=n(),y=N[0],j=N[1],E=n(""),b=E[0],x=E[1],k=t(null),T=t(null);a((function(){f&&j(f)}),[f]),a((function(){x(""),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:l,onChange:function(e){x(e.target.value),j(void 0),d&&d(e)},value:y?"".concat(h&&"emoji"in y?y.emoji:""," ").concat(y.name):b||"",placeholder:c,ref:k})),e.createElement("div",{className:"stdropdown-tools"},e.createElement("div",{className:"stdropdown-tool"},e.createElement(g,null)))),C&&e.createElement("div",{className:"stdropdown-menu"},(b?s.filter((function(e){return e.name.toLowerCase().indexOf(b.toLowerCase())>=0})):s).map((function(n){return e.createElement("div",{onClick:function(){return function(e){j(e),u(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)}))))},w=function(t){var r=t.containerClassName,c=t.inputClassName,s=t.onTextChange,u=t.defaultValue,l=t.onChange,m=t.placeHolder,h=t.showFlag,p=t.region,v=t.src,g=i(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:r,style:{position:"relative"}},e.createElement(C,o({},g,{placeHolder:m,options:N,onChange:function(e){l&&l(e)},showFlag:h,onTextChange:s,defaultValue:u,inputClassName:c}))))},N=function(t){var r=t.containerClassName,c=t.inputClassName,s=t.onTextChange,u=t.defaultValue,l=t.onChange,d=t.countryid,f=t.placeHolder,m=t.src,p=i(t,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","countryid","placeHolder","src"]),v=n([]),g=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:r,style:{position:"relative"}},e.createElement(C,o({},p,{placeHolder:f,options:g,onChange:function(e){l&&l(e)},onTextChange:s,defaultValue:u,inputClassName:c}))))},y=function(t){var r=t.containerClassName,c=t.inputClassName,s=t.onTextChange,u=t.defaultValue,l=t.onChange,d=t.countryid,f=t.stateid,m=t.placeHolder,h=t.src,v=i(t,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","countryid","stateid","placeHolder","src"]),g=n([]),w=g[0],N=g[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:r,style:{position:"relative"}},e.createElement(C,o({},v,{placeHolder:m,options:w,onChange:function(e){l&&l(e)},onTextChange:s,defaultValue:u,inputClassName:c}))))},j=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(r){var c=r.placeHolder,s=r.options,u=r.onChange,l=r.inputClassName,d=r.onTextChange,f=r.defaultValue,m=r.displayNative,h=i(r,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","displayNative"]),p=n(!1),v=p[0],g=p[1],C=n(),w=C[0],N=C[1],y=n(""),E=y[0],b=y[1],x=t(null),k=t(null);a((function(){f&&N(f)}),[f]),a((function(){b(""),v&&x.current&&x.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:l,onChange:function(e){b(e.target.value),N(void 0),d&&d(e)},value:w?"".concat(m?w.native:w.name):E||"",placeholder:c,ref:x})),e.createElement("div",{className:"stdropdown-tools"},e.createElement("div",{className:"stdropdown-tool"},e.createElement(j,null)))),v&&e.createElement("div",{className:"stdropdown-menu"},(E?s.filter((function(e){return e.name.toLowerCase().indexOf(E.toLowerCase())>=0||e.native.toLowerCase().indexOf(E.toLowerCase())>=0})):s).map((function(n){return e.createElement("div",{onClick:function(){return function(e){N(e),u(e)}(n)},key:n.code,className:"".concat("stdropdown-item"," ").concat(T(n)&&"selected")},m?n.native:n.name)}))))},b=function(t){var r=t.containerClassName,c=t.inputClassName,s=t.onTextChange,u=t.defaultValue,l=t.onChange,d=t.placeHolder,f=t.displayNative,h=t.src,p=i(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:r,style:{position:"relative"}},e.createElement(E,o({},p,{placeHolder:d,options:g,onChange:function(e){l&&l(e)},displayNative:f,onTextChange:s,defaultValue:u,inputClassName:c}))))},x=function(t){var r=t.containerClassName,c=t.inputClassName,u=t.onTextChange,l=t.defaultValue,d=t.onChange,f=t.placeHolder,m=t.src,h=i(t,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","src"]),p=n([]),v=p[0],g=p[1];return a((function(){s(m).then((function(e){g(e)}))}),[m]),e.createElement(e.Fragment,null,e.createElement("div",{className:r,style:{position:"relative"}},e.createElement(C,o({},h,{placeHolder:f,options:v,onChange:function(e){d&&d(e)},onTextChange:u,defaultValue:l,inputClassName:c}))))},k=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"}))},T=function(r){var c=r.placeHolder,s=r.options,u=r.onChange,l=r.inputClassName,d=r.onTextChange,f=r.defaultValue,m=r.showFlag,h=void 0===m||m,p=i(r,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","showFlag"]),v=n(!1),g=v[0],C=v[1],w=n(),N=w[0],y=w[1],j=n(""),E=j[0],b=j[1],x=t(null),T=t(null);a((function(){f&&y(f)}),[f]),a((function(){b(""),g&&x.current&&x.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:l,onChange:function(e){b(e.target.value),y(void 0),d&&d(e)},value:N?"".concat(h&&"emoji"in N?N.emoji:""," +").concat(N.phone_code):E||"",placeholder:c,ref:x})),e.createElement("div",{className:"stdropdown-tools"},e.createElement("div",{className:"stdropdown-tool"},e.createElement(k,null)))),g&&e.createElement("div",{className:"stdropdown-menu"},(E?s.filter((function(e){return e.name.toLowerCase().indexOf(E.toLowerCase())>=0||e.phone_code.indexOf(E)>=0||("+"+e.phone_code).indexOf(E)>=0})):s).map((function(n){return e.createElement("div",{onClick:function(){return function(e){y(e),u(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)}))))},H=function(t){var r=t.containerClassName,c=t.inputClassName,s=t.onTextChange,u=t.defaultValue,l=t.onChange,m=t.placeHolder,h=t.showFlag,p=t.region,v=t.src,g=i(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:r,style:{position:"relative"}},e.createElement(T,o({},g,{placeHolder:m,options:w,onChange:function(e){l&&l(e)},showFlag:h,onTextChange:s,defaultValue:u,inputClassName:c}))))};export{y as CitySelect,w as CountrySelect,v as GetAllCities,p as GetCity,f as GetCountries,d as GetCountriesByRegion,m as GetLanguages,l as GetPhonecodes,u as GetPhonecodesByRegion,s as GetRegions,h as GetState,b as LanguageSelect,H as PhonecodeSelect,x as RegionSelect,N 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 i(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 r(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 c(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 s=function(e){return r(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()]}}))}))},u=function(e,n){return r(void 0,void 0,void 0,(function(){var t,a,o;return c(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}}))]}}))}))},l=function(e){return r(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 r(void 0,void 0,void 0,(function(){var t,a,o;return c(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]}}))}))},f=function(e){return r(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 r(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 r(void 0,void 0,void 0,(function(){var t,a,o;return c(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:[]]}}))}))},p=function(e,n,t){return r(void 0,void 0,void 0,(function(){var a,o,i,r,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(),(i=o.find((function(n){return n.id===e})))?(r=i&&i.states?i.states:[],[2,(s=r.find((function(e){return e.id===n})))&&s.cities?s.cities:[]]):[2,[]]}}))}))},v=function(e){return r(void 0,void 0,void 0,(function(){var n,t,a,o,i,r,s,u,l,d,f,m;return c(this,(function(c){switch(c.label){case 0:return n="https://venkatmcajj.github.io/react-country-state-city/data/citiesminified.json",e&&(n=e+"/citiesminified.json"),[4,fetch(n).then((function(e){return e.json()}))];case 1:for(t=c.sent(),a=[],o=0,i=t;o<i.length;o++)for(r=i[o],s=0,u=r.states;s<u.length;s++)for(l=u[s],d=0,f=l.cities;d<f.length;d++)m=f[d],a.push(m);return[2,a]}}))}))},g=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"}))},C=function(r){var c=r.placeHolder,s=r.options,u=r.onChange,l=r.inputClassName,d=r.onTextChange,f=r.defaultValue,m=r.showFlag,h=void 0===m||m,p=i(r,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","showFlag"]),v=n(!1),C=v[0],w=v[1],N=n(),y=N[0],j=N[1],E=n(""),b=E[0],x=E[1],k=t(null),T=t(null);a((function(){f&&j(f)}),[f]),a((function(){x(""),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:l,onChange:function(e){x(e.target.value),j(void 0),d&&d(e)},value:y?"".concat(h&&"emoji"in y?y.emoji:""," ").concat(y.name):b||"",placeholder:c,ref:k})),e.createElement("div",{className:"stdropdown-tools"},e.createElement("div",{className:"stdropdown-tool"},e.createElement(g,null)))),C&&e.createElement("div",{className:"stdropdown-menu"},(b?s.filter((function(e){return e.name.toLowerCase().indexOf(b.toLowerCase())>=0})):s).map((function(n){return e.createElement("div",{onClick:function(){return function(e){j(e),u(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)}))))},w=function(t){var r=t.containerClassName,c=t.inputClassName,s=t.onTextChange,u=t.defaultValue,l=t.onChange,m=t.placeHolder,h=t.showFlag,p=t.region,v=t.src,g=i(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:r,style:{position:"relative"}},e.createElement(C,o({},g,{placeHolder:m,options:N,onChange:function(e){l&&l(e)},showFlag:h,onTextChange:s,defaultValue:u,inputClassName:c}))))},N=function(t){var r=t.containerClassName,c=t.inputClassName,s=t.onTextChange,u=t.defaultValue,l=t.onChange,d=t.countryid,f=t.placeHolder,m=t.src,p=i(t,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","countryid","placeHolder","src"]),v=n([]),g=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:r,style:{position:"relative"}},e.createElement(C,o({},p,{placeHolder:f,options:g,onChange:function(e){l&&l(e)},onTextChange:s,defaultValue:u,inputClassName:c}))))},y=function(t){var r=t.containerClassName,c=t.inputClassName,s=t.onTextChange,u=t.defaultValue,l=t.onChange,d=t.countryid,f=t.stateid,m=t.placeHolder,h=t.src,v=i(t,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","countryid","stateid","placeHolder","src"]),g=n([]),w=g[0],N=g[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:r,style:{position:"relative"}},e.createElement(C,o({},v,{placeHolder:m,options:w,onChange:function(e){l&&l(e)},onTextChange:s,defaultValue:u,inputClassName:c}))))},j=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(r){var c=r.placeHolder,s=r.options,u=r.onChange,l=r.inputClassName,d=r.onTextChange,f=r.defaultValue,m=r.displayNative,h=i(r,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","displayNative"]),p=n(!1),v=p[0],g=p[1],C=n(),w=C[0],N=C[1],y=n(""),E=y[0],b=y[1],x=t(null),k=t(null);a((function(){f&&N(f)}),[f]),a((function(){b(""),v&&x.current&&x.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:l,onChange:function(e){b(e.target.value),N(void 0),d&&d(e)},value:w?"".concat(m?w.native:w.name):E||"",placeholder:c,ref:x})),e.createElement("div",{className:"stdropdown-tools"},e.createElement("div",{className:"stdropdown-tool"},e.createElement(j,null)))),v&&e.createElement("div",{className:"stdropdown-menu"},(E?s.filter((function(e){return e.name.toLowerCase().indexOf(E.toLowerCase())>=0||e.native.toLowerCase().indexOf(E.toLowerCase())>=0})):s).map((function(n){return e.createElement("div",{onClick:function(){return function(e){N(e),u(e)}(n)},key:n.code,className:"".concat("stdropdown-item"," ").concat(T(n)&&"selected")},m?n.native:n.name)}))))},b=function(t){var r=t.containerClassName,c=t.inputClassName,s=t.onTextChange,u=t.defaultValue,l=t.onChange,d=t.placeHolder,f=t.displayNative,h=t.src,p=i(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:r,style:{position:"relative"}},e.createElement(E,o({},p,{placeHolder:d,options:g,onChange:function(e){l&&l(e)},displayNative:f,onTextChange:s,defaultValue:u,inputClassName:c}))))},x=function(t){var r=t.containerClassName,c=t.inputClassName,u=t.onTextChange,l=t.defaultValue,d=t.onChange,f=t.placeHolder,m=t.src,h=i(t,["containerClassName","inputClassName","onTextChange","defaultValue","onChange","placeHolder","src"]),p=n([]),v=p[0],g=p[1];return a((function(){s(m).then((function(e){g(e)}))}),[m]),e.createElement(e.Fragment,null,e.createElement("div",{className:r,style:{position:"relative"}},e.createElement(C,o({},h,{placeHolder:f,options:v,onChange:function(e){d&&d(e)},onTextChange:u,defaultValue:l,inputClassName:c}))))},k=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"}))},T=function(r){var c=r.placeHolder,s=r.options,u=r.onChange,l=r.inputClassName,d=r.onTextChange,f=r.defaultValue,m=r.showFlag,h=void 0===m||m,p=i(r,["placeHolder","options","onChange","inputClassName","onTextChange","defaultValue","showFlag"]),v=n(!1),g=v[0],C=v[1],w=n(),N=w[0],y=w[1],j=n(""),E=j[0],b=j[1],x=t(null),T=t(null);a((function(){f&&y(f)}),[f]),a((function(){b(""),g&&x.current&&x.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:l,onChange:function(e){b(e.target.value),y(void 0),d&&d(e)},value:N?"".concat(h&&"emoji"in N?N.emoji:""," +").concat(N.phone_code):E||"",placeholder:c,ref:x})),e.createElement("div",{className:"stdropdown-tools"},e.createElement("div",{className:"stdropdown-tool"},e.createElement(k,null)))),g&&e.createElement("div",{className:"stdropdown-menu"},(E?s.filter((function(e){return e.name.toLowerCase().indexOf(E.toLowerCase())>=0||e.phone_code.indexOf(E)>=0||("+"+e.phone_code).indexOf(E)>=0})):s).map((function(n){return e.createElement("div",{onClick:function(){return function(e){y(e),u(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)}))))},H=function(t){var r=t.containerClassName,c=t.inputClassName,s=t.onTextChange,u=t.defaultValue,l=t.onChange,m=t.placeHolder,h=t.showFlag,p=t.region,v=t.src,g=i(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:r,style:{position:"relative"}},e.createElement(T,o({},g,{placeHolder:m,options:w,onChange:function(e){l&&l(e)},showFlag:h,onTextChange:s,defaultValue:u,inputClassName:c}))))};export{y as CitySelect,w as CountrySelect,v as GetAllCities,p as GetCity,f as GetCountries,d as GetCountriesByRegion,m as GetLanguages,l as GetPhonecodes,u as GetPhonecodesByRegion,s as GetRegions,h as GetState,b as LanguageSelect,H as PhonecodeSelect,x as RegionSelect,N as StateSelect};
//# sourceMappingURL=index.js.map

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactCountryStateCity={},e.React)}(this,(function(e,t){"use strict";var n=function(){return n=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},n.apply(this,arguments)};function a(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 o(e,t,n,a){return new(n||(n=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 t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,c)}s((a=a.apply(e,t||[])).next())}))}function i(e,t){var n,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(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(r=0)),r;)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 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=t.call(e,r)}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 o(void 0,void 0,void 0,(function(){var t;return i(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()]}}))}))},c=function(e,t){return o(void 0,void 0,void 0,(function(){var n,a,o;return i(this,(function(i){switch(i.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=i.sent(),o=a,e&&(o=o.filter((function(t){return t.region===e}))),[2,o]}}))}))},s=function(e){return o(void 0,void 0,void 0,(function(){var t;return i(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()]}}))}))},u=function(e){return o(void 0,void 0,void 0,(function(){var t;return i(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()]}}))}))},l=function(e,t){return o(void 0,void 0,void 0,(function(){var n,a,o;return i(this,(function(i){switch(i.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=i.sent(),o=a.find((function(t){return t.id===e})),[2,o&&o.states?o.states:[]]}}))}))},f=function(e,t,n){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",n&&(a=n+"/citiesminified.json"),[4,fetch(a).then((function(e){return e.json()}))];case 1:return o=i.sent(),(r=o.find((function(t){return t.id===e})))?(c=r&&r.states?r.states:[],[2,(s=c.find((function(e){return e.id===t})))&&s.cities?s.cities:[]]):[2,[]]}}))}))},d=function(){return t.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},t.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=t.useState(!1),p=h[0],v=h[1],g=t.useState(),C=g[0],w=g[1],y=t.useState(""),E=y[0],N=y[1],j=t.useRef(null),b=t.useRef(null);t.useEffect((function(){u&&w(u)}),[u]),t.useEffect((function(){N(""),p&&j.current&&j.current.focus()}),[p]),t.useEffect((function(){var e=function(e){b.current&&!b.current.contains(e.target)&&v(!1)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}));var x=function(e){return!!C&&C.id===e.id};return t.createElement("div",{className:"stdropdown-container"},t.createElement("div",{ref:b,onClick:function(){v(!0)},className:"stdropdown-input stsearch-box"},t.createElement("input",n({},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):E||"",placeholder:o,ref:j})),t.createElement("div",{className:"stdropdown-tools"},t.createElement("div",{className:"stdropdown-tool"},t.createElement(d,null)))),p&&t.createElement("div",{className:"stdropdown-menu"},(E?i.filter((function(e){return e.name.toLowerCase().indexOf(E.toLowerCase())>=0})):i).map((function(e){return t.createElement("div",{onClick:function(){return function(e){w(e),r(e)}(e)},key:e.id,className:"".concat("stdropdown-item"," ").concat(x(e)&&"selected")},f&&t.createElement("span",{className:"stdropdown-flag"},"emoji"in e?e.emoji:""," "),e.name)}))))},h=function(){return t.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},t.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=t.useState(!1),m=d[0],p=d[1],v=t.useState(),g=v[0],C=v[1],w=t.useState(""),y=w[0],E=w[1],N=t.useRef(null),j=t.useRef(null);t.useEffect((function(){u&&C(u)}),[u]),t.useEffect((function(){E(""),m&&N.current&&N.current.focus()}),[m]),t.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 b=function(e){return!!g&&g.code===e.code};return t.createElement("div",{className:"stdropdown-container"},t.createElement("div",{ref:j,onClick:function(){p(!0)},className:"stdropdown-input stsearch-box"},t.createElement("input",n({},f,{className:c,onChange:function(e){E(e.target.value),C(void 0),s&&s(e)},value:g?"".concat(l?g.native:g.name):y||"",placeholder:o,ref:N})),t.createElement("div",{className:"stdropdown-tools"},t.createElement("div",{className:"stdropdown-tool"},t.createElement(h,null)))),m&&t.createElement("div",{className:"stdropdown-menu"},(y?i.filter((function(e){return e.name.toLowerCase().indexOf(y.toLowerCase())>=0||e.native.toLowerCase().indexOf(y.toLowerCase())>=0})):i).map((function(e){return t.createElement("div",{onClick:function(){return function(e){C(e),r(e)}(e)},key:e.code,className:"".concat("stdropdown-item"," ").concat(b(e)&&"selected")},l?e.native:e.name)}))))},v=function(){return t.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},t.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=t.useState(!1),h=m[0],p=m[1],g=t.useState(),C=g[0],w=g[1],y=t.useState(""),E=y[0],N=y[1],j=t.useRef(null),b=t.useRef(null);t.useEffect((function(){u&&w(u)}),[u]),t.useEffect((function(){N(""),h&&j.current&&j.current.focus()}),[h]),t.useEffect((function(){var e=function(e){b.current&&!b.current.contains(e.target)&&p(!1)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}));var x=function(e){return!!C&&C.id===e.id};return t.createElement("div",{className:"stdropdown-container"},t.createElement("div",{ref:b,onClick:function(){p(!0)},className:"stdropdown-input stsearch-box"},t.createElement("input",n({},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):E||"",placeholder:o,ref:j})),t.createElement("div",{className:"stdropdown-tools"},t.createElement("div",{className:"stdropdown-tool"},t.createElement(v,null)))),h&&t.createElement("div",{className:"stdropdown-menu"},(E?i.filter((function(e){return e.name.toLowerCase().indexOf(E.toLowerCase())>=0||e.phone_code.indexOf(E)>=0||("+"+e.phone_code).indexOf(E)>=0})):i).map((function(e){return t.createElement("div",{onClick:function(){return function(e){w(e),r(e)}(e)},key:e.id,className:"".concat("stdropdown-item"," ").concat(x(e)&&"selected")},f&&t.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=t.useState([]),g=v[0],C=v[1];return t.useEffect((function(){u&&f(u,l,h).then((function(e){C(e)}))}),[u,l,h]),t.createElement(t.Fragment,null,t.createElement("div",{className:o,style:{position:"relative"}},t.createElement(m,n({},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=t.useState([]),C=g[0],w=g[1];return t.useEffect((function(){h?c(h,p).then((function(e){w(e)})):s(p).then((function(e){w(e)}))}),[h,p]),t.createElement(t.Fragment,null,t.createElement("div",{className:o,style:{position:"relative"}},t.createElement(m,n({},v,{placeHolder:f,options:C,onChange:function(e){l&&l(e)},showFlag:d,onTextChange:r,defaultValue:u,inputClassName:i}))))},e.GetAllCities=function(e){return o(void 0,void 0,void 0,(function(){var t,n;return i(this,(function(a){switch(a.label){case 0:return t="https://venkatmcajj.github.io/react-country-state-city/data/citiesminified.json",e&&(t=e+"/citiesminified.json"),[4,fetch(t).then((function(e){return e.json()}))];case 1:return n=a.sent(),[2,n.flatMap((function(e){return e.states.flatMap((function(e){return e.cities}))}))]}}))}))},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 t,n;return i(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}}))]}}))}))},e.GetPhonecodesByRegion=function(e,t){return o(void 0,void 0,void 0,(function(){var n,a,o;return i(this,(function(i){switch(i.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=i.sent(),o=a,e&&(o=o.filter((function(t){return t.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=t.useState([]),v=h[0],g=h[1];return t.useEffect((function(){u(d).then((function(e){g(e)}))}),[d]),t.createElement(t.Fragment,null,t.createElement("div",{className:o,style:{position:"relative"}},t.createElement(p,n({},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=t.useState([]),C=v[0],w=v[1];return t.useEffect((function(){m?c(m,h).then((function(e){w(e)})):s(h).then((function(e){w(e)}))}),[m,h]),t.createElement(t.Fragment,null,t.createElement("div",{className:o,style:{position:"relative"}},t.createElement(g,n({},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=t.useState([]),p=h[0],v=h[1];return t.useEffect((function(){r(f).then((function(e){v(e)}))}),[f]),t.createElement(t.Fragment,null,t.createElement("div",{className:o,style:{position:"relative"}},t.createElement(m,n({},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=t.useState([]),v=p[0],g=p[1];return t.useEffect((function(){u&&l(u,d).then((function(e){g(e)}))}),[u,d]),t.createElement(t.Fragment,null,t.createElement("div",{className:o,style:{position:"relative"}},t.createElement(m,n({},h,{placeHolder:f,options:v,onChange:function(e){s&&s(e)},onTextChange:r,defaultValue:c,inputClassName:i}))))}}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactCountryStateCity={},e.React)}(this,(function(e,t){"use strict";var n=function(){return n=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},n.apply(this,arguments)};function a(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 o(e,t,n,a){return new(n||(n=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 t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,c)}s((a=a.apply(e,t||[])).next())}))}function i(e,t){var n,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(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(r=0)),r;)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 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=t.call(e,r)}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 o(void 0,void 0,void 0,(function(){var t;return i(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()]}}))}))},c=function(e,t){return o(void 0,void 0,void 0,(function(){var n,a,o;return i(this,(function(i){switch(i.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=i.sent(),o=a,e&&(o=o.filter((function(t){return t.region===e}))),[2,o]}}))}))},s=function(e){return o(void 0,void 0,void 0,(function(){var t;return i(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()]}}))}))},u=function(e){return o(void 0,void 0,void 0,(function(){var t;return i(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()]}}))}))},l=function(e,t){return o(void 0,void 0,void 0,(function(){var n,a,o;return i(this,(function(i){switch(i.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=i.sent(),o=a.find((function(t){return t.id===e})),[2,o&&o.states?o.states:[]]}}))}))},f=function(e,t,n){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",n&&(a=n+"/citiesminified.json"),[4,fetch(a).then((function(e){return e.json()}))];case 1:return o=i.sent(),(r=o.find((function(t){return t.id===e})))?(c=r&&r.states?r.states:[],[2,(s=c.find((function(e){return e.id===t})))&&s.cities?s.cities:[]]):[2,[]]}}))}))},d=function(){return t.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},t.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=t.useState(!1),p=h[0],v=h[1],g=t.useState(),C=g[0],w=g[1],y=t.useState(""),E=y[0],N=y[1],j=t.useRef(null),b=t.useRef(null);t.useEffect((function(){u&&w(u)}),[u]),t.useEffect((function(){N(""),p&&j.current&&j.current.focus()}),[p]),t.useEffect((function(){var e=function(e){b.current&&!b.current.contains(e.target)&&v(!1)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}));var x=function(e){return!!C&&C.id===e.id};return t.createElement("div",{className:"stdropdown-container"},t.createElement("div",{ref:b,onClick:function(){v(!0)},className:"stdropdown-input stsearch-box"},t.createElement("input",n({},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):E||"",placeholder:o,ref:j})),t.createElement("div",{className:"stdropdown-tools"},t.createElement("div",{className:"stdropdown-tool"},t.createElement(d,null)))),p&&t.createElement("div",{className:"stdropdown-menu"},(E?i.filter((function(e){return e.name.toLowerCase().indexOf(E.toLowerCase())>=0})):i).map((function(e){return t.createElement("div",{onClick:function(){return function(e){w(e),r(e)}(e)},key:e.id,className:"".concat("stdropdown-item"," ").concat(x(e)&&"selected")},f&&t.createElement("span",{className:"stdropdown-flag"},"emoji"in e?e.emoji:""," "),e.name)}))))},h=function(){return t.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},t.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=t.useState(!1),m=d[0],p=d[1],v=t.useState(),g=v[0],C=v[1],w=t.useState(""),y=w[0],E=w[1],N=t.useRef(null),j=t.useRef(null);t.useEffect((function(){u&&C(u)}),[u]),t.useEffect((function(){E(""),m&&N.current&&N.current.focus()}),[m]),t.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 b=function(e){return!!g&&g.code===e.code};return t.createElement("div",{className:"stdropdown-container"},t.createElement("div",{ref:j,onClick:function(){p(!0)},className:"stdropdown-input stsearch-box"},t.createElement("input",n({},f,{className:c,onChange:function(e){E(e.target.value),C(void 0),s&&s(e)},value:g?"".concat(l?g.native:g.name):y||"",placeholder:o,ref:N})),t.createElement("div",{className:"stdropdown-tools"},t.createElement("div",{className:"stdropdown-tool"},t.createElement(h,null)))),m&&t.createElement("div",{className:"stdropdown-menu"},(y?i.filter((function(e){return e.name.toLowerCase().indexOf(y.toLowerCase())>=0||e.native.toLowerCase().indexOf(y.toLowerCase())>=0})):i).map((function(e){return t.createElement("div",{onClick:function(){return function(e){C(e),r(e)}(e)},key:e.code,className:"".concat("stdropdown-item"," ").concat(b(e)&&"selected")},l?e.native:e.name)}))))},v=function(){return t.createElement("svg",{height:"20",width:"20",viewBox:"0 0 20 20"},t.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=t.useState(!1),h=m[0],p=m[1],g=t.useState(),C=g[0],w=g[1],y=t.useState(""),E=y[0],N=y[1],j=t.useRef(null),b=t.useRef(null);t.useEffect((function(){u&&w(u)}),[u]),t.useEffect((function(){N(""),h&&j.current&&j.current.focus()}),[h]),t.useEffect((function(){var e=function(e){b.current&&!b.current.contains(e.target)&&p(!1)};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}}));var x=function(e){return!!C&&C.id===e.id};return t.createElement("div",{className:"stdropdown-container"},t.createElement("div",{ref:b,onClick:function(){p(!0)},className:"stdropdown-input stsearch-box"},t.createElement("input",n({},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):E||"",placeholder:o,ref:j})),t.createElement("div",{className:"stdropdown-tools"},t.createElement("div",{className:"stdropdown-tool"},t.createElement(v,null)))),h&&t.createElement("div",{className:"stdropdown-menu"},(E?i.filter((function(e){return e.name.toLowerCase().indexOf(E.toLowerCase())>=0||e.phone_code.indexOf(E)>=0||("+"+e.phone_code).indexOf(E)>=0})):i).map((function(e){return t.createElement("div",{onClick:function(){return function(e){w(e),r(e)}(e)},key:e.id,className:"".concat("stdropdown-item"," ").concat(x(e)&&"selected")},f&&t.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=t.useState([]),g=v[0],C=v[1];return t.useEffect((function(){u&&f(u,l,h).then((function(e){C(e)}))}),[u,l,h]),t.createElement(t.Fragment,null,t.createElement("div",{className:o,style:{position:"relative"}},t.createElement(m,n({},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=t.useState([]),C=g[0],w=g[1];return t.useEffect((function(){h?c(h,p).then((function(e){w(e)})):s(p).then((function(e){w(e)}))}),[h,p]),t.createElement(t.Fragment,null,t.createElement("div",{className:o,style:{position:"relative"}},t.createElement(m,n({},v,{placeHolder:f,options:C,onChange:function(e){l&&l(e)},showFlag:d,onTextChange:r,defaultValue:u,inputClassName:i}))))},e.GetAllCities=function(e){return o(void 0,void 0,void 0,(function(){var t,n,a,o,r,c,s,u,l,f,d,m;return i(this,(function(i){switch(i.label){case 0:return t="https://venkatmcajj.github.io/react-country-state-city/data/citiesminified.json",e&&(t=e+"/citiesminified.json"),[4,fetch(t).then((function(e){return e.json()}))];case 1:for(n=i.sent(),a=[],o=0,r=n;o<r.length;o++)for(c=r[o],s=0,u=c.states;s<u.length;s++)for(l=u[s],f=0,d=l.cities;f<d.length;f++)m=d[f],a.push(m);return[2,a]}}))}))},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 t,n;return i(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}}))]}}))}))},e.GetPhonecodesByRegion=function(e,t){return o(void 0,void 0,void 0,(function(){var n,a,o;return i(this,(function(i){switch(i.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=i.sent(),o=a,e&&(o=o.filter((function(t){return t.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=t.useState([]),v=h[0],g=h[1];return t.useEffect((function(){u(d).then((function(e){g(e)}))}),[d]),t.createElement(t.Fragment,null,t.createElement("div",{className:o,style:{position:"relative"}},t.createElement(p,n({},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=t.useState([]),C=v[0],w=v[1];return t.useEffect((function(){m?c(m,h).then((function(e){w(e)})):s(h).then((function(e){w(e)}))}),[m,h]),t.createElement(t.Fragment,null,t.createElement("div",{className:o,style:{position:"relative"}},t.createElement(g,n({},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=t.useState([]),p=h[0],v=h[1];return t.useEffect((function(){r(f).then((function(e){v(e)}))}),[f]),t.createElement(t.Fragment,null,t.createElement("div",{className:o,style:{position:"relative"}},t.createElement(m,n({},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=t.useState([]),v=p[0],g=p[1];return t.useEffect((function(){u&&l(u,d).then((function(e){g(e)}))}),[u,d]),t.createElement(t.Fragment,null,t.createElement("div",{className:o,style:{position:"relative"}},t.createElement(m,n({},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.8",
"version": "1.1.9",
"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.",

@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js",

@@ -41,401 +41,6 @@ # React-country-state-city

## Documentation
## The gist
[Read Documentation](https://venkatmcajj.github.io/react-country-state-city-docs/)
### Default
```jsx
import {
CitySelect,
CountrySelect,
StateSelect,
LanguageSelect,
RegionSelect,
PhonecodeSelect
} from "react-country-state-city";
import "react-country-state-city/dist/react-country-state-city.css";
function App() {
const [region, setRegion] = useState("");
const [phonecode, setPhoneCode] = useState("");
const [countryid, setCountryid] = useState(0);
const [stateid, setstateid] = useState(0);
return (
<div>
<h6>Region / Continent</h6>
<RegionSelect
onChange={(e) => {
setRegion(e.name);
}}
placeHolder="Select Region"
/>
<h6>Country</h6>
<CountrySelect
onChange={(e) => {
setCountryid(e.id);
}}
placeHolder="Select Country"
region={region}
/>
<h6>All Country</h6>
<CountrySelect
onChange={(e) => {
setCountryid(e.id);
}}
placeHolder="Select Country"
/>
<h6>Phone Code</h6>
<RegionSelect
onChange={(e) => {
setPhoneCode(e.phone_code);
}}
placeHolder="Select Phone Code"
/>
<h6>State</h6>
<StateSelect
countryid={countryid}
onChange={(e) => {
setstateid(e.id);
}}
placeHolder="Select State"
/>
<h6>City</h6>
<CitySelect
countryid={countryid}
stateid={stateid}
onChange={(e) => {
console.log(e);
}}
placeHolder="Select City"
/>
<h6>Language</h6>
<LanguageSelect
onChange={(e) => {
console.log(e);
}}
placeHolder="Select Language"
/>
</div>
);
}
```
### Custom
```jsx
import {
GetCountries,
GetState,
GetCity,
GetLanguages,
GetRegions,
GetPhonecodes //async functions
} from "react-country-state-city";
function App() {
const [region, setRegion] = useState("");
const [countryid, setCountryid] = useState(0);
const [stateid, setStateid] = useState(0);
const [cityid, setCityid] = useState(0);
const [language, setLanguage] = useState(0);
const [phoneCode, setPhoneCode] = useState("");
const [phonecodeList, setPhonecodeList] = useState([]);
const [regionsList, setRegionsList] = useState([]);
const [countriesList, setCountriesList] = useState([]);
const [stateList, setStateList] = useState([]);
const [cityList, setCityList] = useState([]);
const [languageList, setLanguageList] = useState([]);
useEffect(() => {
GetPhonecodes().then((result) => {
setPhonecodeList(result);
});
GetRegions().then((result) => {
setRegionsList(result);
});
GetCountries().then((result) => {
setCountriesList(result);
});
GetLanguages().then((result) => {
setLanguageList(result);
});
}, []);
return (
<div>
<h6>Region</h6>
<select
onChange={(e) => {
const _region = regionsList[e.target.value];
setRegion(_region.name);
}}
value={region}
>
{regionsList.map((item, index) => (
<option key={index} value={index}>
{item.name}
</option>
))}
</select>
<h6>Country</h6>
<select
onChange={(e) => {
const country = countriesList[e.target.value]; //here you will get full country object.
setCountryid(country.id);
GetState(country.id).then((result) => {
setStateList(result);
});
}}
value={countryid}
>
{countriesList.map((item, index) => (
<option key={index} value={index}>
{item.name}
</option>
))}
</select>
<h6>Phone Code</h6>
<select
onChange={(e) => {
setPhoneCode(e.target.value);
}}
value={phoneCode}
>
{phonecodeList.map((item, index) => (
<option key={index} value={item.phone_code}>
+{item.phone_code} - {item.name}
</option>
))}
</select>
<h6>State</h6>
<select
onChange={(e) => {
const state = stateList[e.target.value]; //here you will get full state object.
setStateid(state.id);
GetCity(countryid, state.id).then((result) => {
setCityList(result);
});
}}
value={stateid}
>
{stateList.map((item, index) => (
<option key={index} value={index}>
{item.name}
</option>
))}
</select>
<h6>City</h6>
<select
onChange={(e) => {
const city = cityList[e.target.value]; //here you will get full city object.
setCityid(city.id);
}}
value={cityid}
>
{cityList.map((item, index) => (
<option key={index} value={index}>
{item.name}
</option>
))}
</select>
<h6>Language</h6>
<select
onChange={(e) => {
setLanguage(e);
}}
value={language}
>
{languageList.map((item, index) => (
<option key={index} value={item.id}>
{item.name}
</option>
))}
</select>
</div>
);
}
```
### City Example
<img src="https://raw.githubusercontent.com/venkatmcajj/react-country-state-city/master/example/src/example1.png" alt="React country state city example screenshot"/>
### GetCity - Result
[
{
id: number;
name: string;
latitude: string;
longitude: string;
},
...
]
### State Example
<img src="https://raw.githubusercontent.com/venkatmcajj/react-country-state-city/master/example/src/example2.png" alt="React country state city example screenshot"/>
### GetState - Result
[
{
id: number;
name: string;
state_code: string;
latitude: string;
longitude: string;
},
...
]
### Country Example
<img src="https://raw.githubusercontent.com/venkatmcajj/react-country-state-city/master/example/src/example3.png" alt="React country state city example screenshot"/>
### GetCountries - Result
[
{
id: number;
name: string;
iso3: string;
iso2: string;
numeric_code: string;
phone_code: number;
capital: string;
currency: string;
currency_name: string;
currency_symbol: string;
native: string;
region: string;
subregion: string;
emoji: string;
emojiU: string;
tld: string;
latitude: string;
longitude: string;
},
...
]
### Languages Example
<img src="https://raw.githubusercontent.com/venkatmcajj/react-country-state-city/master/example/src/example4.png" alt="React country state city example screenshot"/>
<img src="https://raw.githubusercontent.com/venkatmcajj/react-country-state-city/master/example/src/example5.png" alt="React country state city example screenshot"/>
### GetLanguages - Result
[
{
code: string;
name: string;
native: string;
},
...
]
### Regions Example
<img src="https://raw.githubusercontent.com/venkatmcajj/react-country-state-city/master/example/src/example6.png" alt="React country state city example screenshot"/>
### GetRegions - Result
[
{
id: string;
name: string;
},
...
]
### Phonecode Example
<img src="https://raw.githubusercontent.com/venkatmcajj/react-country-state-city/master/example/src/example7.png" alt="React country state city example screenshot"/>
### GetPhonecodes - Result
[
{
id: string;
name: string;
region:string;
phone_code:string;
},
...
]
## The Country Select Properties
Properties used to customise the rendering:
| Name | Type | Description |
| ------------------ | -------- | --------------------------------------------------------------------------------------- |
| src | string | `optional` The relative or absolute URL where the data files are hosted. Default is to serve from hosted CDN. e.g., https://venkatmcajj.github.io/react-country-state-city/data |
| defaultValue | Country | `optional` The current value: a country object |
| containerClassName | string | `optional` styles for a container |
| inputClassName | string | `optional` styles for input box |
| onChange | function | `optional` The current value: a country object.The argument is the country object |
| onTextChange | function | `optional` A callback fired when the input text changes. |
| placeHolder | string | `optional` Placeholder text displayed in empty input |
| showFlag | boolean | `optional` Flags are displayed when true and not displayed when false. default is true. |
## State Select Properties
The same country select properties and additionally
| Name | Type | Description |
| --------- | ------ | ------------------------------------------------ |
| src | string | `optional` The relative or absolute URL where the data files are hosted. Default is to serve from hosted CDN. e.g., https://venkatmcajj.github.io/react-country-state-city/data |
| countryid | number | `required` The id of the selected country object |
## City Select Properties
The same country select properties and additionally
| Name | Type | Description |
| --------- | ------ | ------------------------------------------------ |
| src | string | `optional` The relative or absolute URL where the data files are hosted. Default is to serve from hosted CDN. e.g., https://venkatmcajj.github.io/react-country-state-city/data |
| countryid | number | `required` The id of the selected country object |
| stateid | number | `required` The id of the selected state object |
## The Language Select Properties
Properties used to customise the rendering:
| Name | Type | Description |
| ------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| src | string | `optional` The relative or absolute URL where the data files are hosted. Default is to serve from hosted CDN. e.g., https://venkatmcajj.github.io/react-country-state-city/data |
| defaultValue | Country | `optional` The current value: a country object |
| containerClassName | string | `optional` styles for a container |
| inputClassName | string | `optional` styles for input box |
| onChange | function | `optional` The current value: a country object.The argument is the country object |
| onTextChange | function | `optional` A callback fired when the input text changes. |
| placeHolder | string | `optional` Placeholder text displayed in empty input |
| displayNative | boolean | `optional` value are used to display the languages in native language when is true and display in english when is false. default is false. |
## Region Select Properties
The same country select properties
## Phonecode Select Properties
The same country select properties
## Demo
[A demo is worth a thousand words](https://venkatmcajj.github.io/react-country-state-city/example)
## Contribute
Show your ❤️ and support by giving a ⭐. Any suggestions are welcome! venkatmcajj@gmail.com
## Financial Contributors

@@ -446,5 +51,1 @@

Binance Smart Chain or Ethereum - 0x7C6Bfb7f240f6028Fd2a0039924826eD8B879635
## License
Licensed under MIT

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

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