@ebay/ui-core-react 8.17.1 → 8.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"countries.d.ts","sourceRoot":"","sources":["../../src/ebay-phone-input/countries.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,gBAAgB;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IAC/B,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,CAAC;CACrC;AAED,QAAA,MAAM,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"countries.d.ts","sourceRoot":"","sources":["../../src/ebay-phone-input/countries.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,gBAAgB;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IAC/B,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,CAAC;CACrC;AAED,QAAA,MAAM,SAAS,EAAE,kBAsPhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const X=require("../tslib.es6-C4EgNkz1.js"),z=require("classnames"),l=require("react"),N=require("../listbox-button-lokrqNk6.js"),w=require("../textbox-5DvabGMY.js");require("../icon-I30uh1Ov.js");require("../icon-button-AJ6dtyvc.js");const $=require("../flag-DU-1tRv6.js"),v={US:{countryCode:"US",callingCode:"1",mask:"(000) 000-0000"},CA:{countryCode:"CA",callingCode:"1",mask:"(000) 000-0000"},GB:{countryCode:"GB",callingCode:"44",mask:"0000 000 0000"},AU:{countryCode:"AU",callingCode:"61",mask:"0 0000 0000"},DE:{countryCode:"DE",callingCode:"49",mask:"000 00000000"},FR:{countryCode:"FR",callingCode:"33",mask:"0 00 00 00 00"},IT:{countryCode:"IT",callingCode:"39",mask:"000 000 0000"},ES:{countryCode:"ES",callingCode:"34",mask:"000 00 00 00"},IN:{countryCode:"IN",callingCode:"91",mask:"00000 00000"},JP:{countryCode:"JP",callingCode:"81",mask:"000-0000-0000"},CN:{countryCode:"CN",callingCode:"86",mask:"000 0000 0000"},BR:{countryCode:"BR",callingCode:"55",mask:"(00) 00000-0000"},MX:{countryCode:"MX",callingCode:"52",mask:"000 000 0000"}};function H(n,r){let t=r;const a=s=>{B(n,t,n.value,s.inputType)};return n.addEventListener("input",a),{update(s,c){t=c,B(n,t,s,"")},destroy(){n.removeEventListener("input",a)},get value(){return n.value}}}function B(n,r,t,a){const s=/delete.*Backwards/.test(a),c=n.selectionStart||0,u=Q(t,r);if(t!==u){n.value=u;const C=Y(u,t,c,s);C!==void 0&&n.setSelectionRange(C,C)}}function U(n){return n.replace(/\D+/g,"")}function Q(n,r){const t=U(n);let a="",s=0;if(t.length){for(const c of r)if(c==="0"){if(a+=t[s++],s===t.length)break}else a+=c;s<t.length&&(a+=" "+t.slice(s))}return a}function Y(n,r,t,a){const s=t===r.length;if(a||!s){const c=r.slice(0,t),u=r.slice(t);if(n.startsWith(c))return t;if(n.endsWith(u))return n.length-u.length;{const C=P(c);let p=0,m=0;for(;m<C.length;)P(n[p])&&m++,p++;return p}}}function P(n){return n.replace(/[.,\\/#!$%^&*;:{}=+\-_`~()\s]/g,"")}const Z=n=>n||(typeof navigator<"u"?navigator.language:"en-US"),V=n=>{var{countryCode:r,value:t,locale:a,floatingLabel:s,disabled:c,readonly:u,invalid:C,className:p,onFocus:m,onBlur:k,onChange:x,onInputChange:E,onKeyDown:I,onKeyPress:T,onKeyUp:D,onExpand:L,onCollapse:R}=n,q=X.__rest(n,["countryCode","value","locale","floatingLabel","disabled","readonly","invalid","className","onFocus","onBlur","onChange","onInputChange","onKeyDown","onKeyPress","onKeyUp","onExpand","onCollapse"]);const h=l.useMemo(()=>{const e=Z(a),o=new Intl.DisplayNames([e],{type:"region"});return Object.keys(v).map(i=>{var d;return[i,(d=o.of(i))!==null&&d!==void 0?d:""]}).sort(([,i],[,d])=>i.localeCompare(d))},[a]),[S,K]=l.useState(()=>{if(r){const e=h.findIndex(([o])=>o===r.toUpperCase());return e!==-1?e:0}return 0}),b=l.useRef(null),f=l.useRef(null);l.useEffect(()=>{if(r){const e=h.findIndex(([o])=>o===r.toUpperCase());K(e!==-1?e:0)}},[r,h]);const y=(e=S)=>{const[o]=h[e];return v[o]};l.useEffect(()=>{b.current&&y()&&(f.current||(f.current=H(b.current,y().mask)),f.current.update(b.current.value,y().mask))},[y().mask]),l.useEffect(()=>()=>{f.current&&f.current.destroy()},[]);const g=e=>{var o,i;return{value:((o=f.current)===null||o===void 0?void 0:o.value)||"",rawValue:U(((i=f.current)===null||i===void 0?void 0:i.value)||""),callingCode:y(e).callingCode,countryCode:y(e).countryCode}},F=(e,{index:o})=>{K(o),x&&x(e,g(o))},A=e=>{m&&m(e,g())},O=e=>{k&&k(e,g())},_=e=>{x&&x(e,g())},M=e=>{E&&E(e,g())},j=e=>{I&&I(e,g())},G=e=>{T&&T(e,g())},J=e=>{D&&D(e,g())},W=h.map(([e,o],i)=>{const d=v[e];return l.createElement(N.ListboxOption,{key:e,value:d.callingCode,selected:i===S,icon:l.createElement($.EbayFlagIcon,{flag:d.countryCode.toLowerCase()})},l.createElement("span",null,o," ( + ",d.callingCode," )"))});return l.createElement("span",Object.assign({},q,{className:z("phone-input",p,{"phone-input--disabled":c,"phone-input--readonly":u,"phone-input--error":C})}),l.createElement(N.ListboxButton,{split:"start",disabled:u||c,onChange:F,onExpand:L,onCollapse:R},W),l.createElement(w.EbayTextbox,{type:"tel",value:t,disabled:c,floatingLabel:s,floatingLabelStatic:!0,readOnly:u,invalid:C,onBlur:O,onFocus:A,onKeyDown:j,onKeyPress:G,onKeyUp:J,onChange:_,onInputChange:M,ref:b},l.createElement(w.EbayTextboxPrefixText,{id:"phone-prefix"},"+ ",y().callingCode)))};exports.EbayPhoneInput=V;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("../tslib.es6-C4EgNkz1.js"),Q=require("classnames"),d=require("react"),p=require("../listbox-button-lokrqNk6.js"),P=require("../textbox-5DvabGMY.js");require("../icon-I30uh1Ov.js");require("../icon-button-AJ6dtyvc.js");const X=require("../flag-DU-1tRv6.js"),G={AC:{countryCode:"AC",callingCode:"247",mask:"00000"},AD:{countryCode:"AD",callingCode:"376",mask:"000 000"},AE:{countryCode:"AE",callingCode:"971",mask:"000 000 0000"},AF:{countryCode:"AF",callingCode:"93",mask:"000 000 0000"},AG:{countryCode:"AG",callingCode:"1",mask:"(000) 000-0000"},AI:{countryCode:"AI",callingCode:"1",mask:"(000) 000-0000"},AL:{countryCode:"AL",callingCode:"355",mask:"000 000 0000"},AM:{countryCode:"AM",callingCode:"374",mask:"000 000000"},AO:{countryCode:"AO",callingCode:"244",mask:"000 000 000"},AR:{countryCode:"AR",callingCode:"54",mask:"000 00-0000-0000"},AS:{countryCode:"AS",callingCode:"1",mask:"(000) 000-0000"},AT:{countryCode:"AT",callingCode:"43",mask:"0000 000000"},AU:{countryCode:"AU",callingCode:"61",mask:"0000 000 000"},AW:{countryCode:"AW",callingCode:"297",mask:"000 0000"},AX:{countryCode:"AX",callingCode:"358",mask:"000 0000000"},AZ:{countryCode:"AZ",callingCode:"994",mask:"000 000 00 00"},BA:{countryCode:"BA",callingCode:"387",mask:"000 000 000"},BB:{countryCode:"BB",callingCode:"1",mask:"(000) 000-0000"},BD:{countryCode:"BD",callingCode:"880",mask:"00000-000000"},BE:{countryCode:"BE",callingCode:"32",mask:"0000 00 00 00"},BF:{countryCode:"BF",callingCode:"226",mask:"00 00 00 00"},BG:{countryCode:"BG",callingCode:"359",mask:"000 000 000"},BH:{countryCode:"BH",callingCode:"973",mask:"0000 0000"},BI:{countryCode:"BI",callingCode:"257",mask:"00 00 00 00"},BJ:{countryCode:"BJ",callingCode:"229",mask:"00 00 00 00 00"},BL:{countryCode:"BL",callingCode:"590",mask:"0000 00 00 00"},BM:{countryCode:"BM",callingCode:"1",mask:"(000) 000-0000"},BN:{countryCode:"BN",callingCode:"673",mask:"000 0000"},BO:{countryCode:"BO",callingCode:"591",mask:"00000000"},BQ:{countryCode:"BQ",callingCode:"599",mask:"000 0000"},BR:{countryCode:"BR",callingCode:"55",mask:"(00) 00000-0000"},BS:{countryCode:"BS",callingCode:"1",mask:"(000) 000-0000"},BT:{countryCode:"BT",callingCode:"975",mask:"00 00 00 00"},BW:{countryCode:"BW",callingCode:"267",mask:"00 000 000"},BY:{countryCode:"BY",callingCode:"375",mask:"0 000 000-00-00"},BZ:{countryCode:"BZ",callingCode:"501",mask:"000-0000"},CA:{countryCode:"CA",callingCode:"1",mask:"(000) 000-0000"},CC:{countryCode:"CC",callingCode:"61",mask:"0000 000 000"},CD:{countryCode:"CD",callingCode:"243",mask:"0000 000 000"},CF:{countryCode:"CF",callingCode:"236",mask:"00 00 00 00"},CG:{countryCode:"CG",callingCode:"242",mask:"00 000 0000"},CH:{countryCode:"CH",callingCode:"41",mask:"000 000 00 00"},CI:{countryCode:"CI",callingCode:"225",mask:"00 00 00 0000"},CK:{countryCode:"CK",callingCode:"682",mask:"00 000"},CL:{countryCode:"CL",callingCode:"56",mask:"(0) 0000 0000"},CM:{countryCode:"CM",callingCode:"237",mask:"0 00 00 00 00"},CN:{countryCode:"CN",callingCode:"86",mask:"000 0000 0000"},CO:{countryCode:"CO",callingCode:"57",mask:"000 0000000"},CR:{countryCode:"CR",callingCode:"506",mask:"0000 0000"},CU:{countryCode:"CU",callingCode:"53",mask:"00 0000000"},CV:{countryCode:"CV",callingCode:"238",mask:"000 00 00"},CW:{countryCode:"CW",callingCode:"599",mask:"0 000 0000"},CX:{countryCode:"CX",callingCode:"61",mask:"0000 000 000"},CY:{countryCode:"CY",callingCode:"357",mask:"00 000000"},CZ:{countryCode:"CZ",callingCode:"420",mask:"000 000 000"},DE:{countryCode:"DE",callingCode:"49",mask:"00000 0000000"},DJ:{countryCode:"DJ",callingCode:"253",mask:"00 00 00 00"},DK:{countryCode:"DK",callingCode:"45",mask:"00 00 00 00"},DM:{countryCode:"DM",callingCode:"1",mask:"(000) 000-0000"},DO:{countryCode:"DO",callingCode:"1",mask:"(000) 000-0000"},DZ:{countryCode:"DZ",callingCode:"213",mask:"0000 00 00 00"},EC:{countryCode:"EC",callingCode:"593",mask:"000 000 0000"},EE:{countryCode:"EE",callingCode:"372",mask:"0000 0000"},EG:{countryCode:"EG",callingCode:"20",mask:"000 00000000"},EH:{countryCode:"EH",callingCode:"212",mask:"0000-000000"},ER:{countryCode:"ER",callingCode:"291",mask:"00 000 000"},ES:{countryCode:"ES",callingCode:"34",mask:"000 00 00 00"},ET:{countryCode:"ET",callingCode:"251",mask:"000 000 0000"},FI:{countryCode:"FI",callingCode:"358",mask:"000 0000000"},FJ:{countryCode:"FJ",callingCode:"679",mask:"000 0000"},FK:{countryCode:"FK",callingCode:"500",mask:"00000"},FM:{countryCode:"FM",callingCode:"691",mask:"000 0000"},FO:{countryCode:"FO",callingCode:"298",mask:"000000"},FR:{countryCode:"FR",callingCode:"33",mask:"00 00 00 00 00"},GA:{countryCode:"GA",callingCode:"241",mask:"00 00 00 00"},GB:{countryCode:"GB",callingCode:"44",mask:"00000 000000"},GD:{countryCode:"GD",callingCode:"1",mask:"(000) 000-0000"},GE:{countryCode:"GE",callingCode:"995",mask:"000 00 00 00"},GF:{countryCode:"GF",callingCode:"594",mask:"0000 00 00 00"},GG:{countryCode:"GG",callingCode:"44",mask:"00000 000000"},GH:{countryCode:"GH",callingCode:"233",mask:"000 000 0000"},GI:{countryCode:"GI",callingCode:"350",mask:"00000000"},GL:{countryCode:"GL",callingCode:"299",mask:"00 00 00"},GM:{countryCode:"GM",callingCode:"220",mask:"000 0000"},GN:{countryCode:"GN",callingCode:"224",mask:"000 00 00 00"},GP:{countryCode:"GP",callingCode:"590",mask:"0000 00 00 00"},GQ:{countryCode:"GQ",callingCode:"240",mask:"000 000 000"},GR:{countryCode:"GR",callingCode:"30",mask:"000 000 0000"},GT:{countryCode:"GT",callingCode:"502",mask:"0000 0000"},GU:{countryCode:"GU",callingCode:"1",mask:"(000) 000-0000"},GW:{countryCode:"GW",callingCode:"245",mask:"000 000 000"},GY:{countryCode:"GY",callingCode:"592",mask:"000 0000"},HK:{countryCode:"HK",callingCode:"852",mask:"0000 0000"},HN:{countryCode:"HN",callingCode:"504",mask:"0000-0000"},HR:{countryCode:"HR",callingCode:"385",mask:"000 000 0000"},HT:{countryCode:"HT",callingCode:"509",mask:"00 00 0000"},HU:{countryCode:"HU",callingCode:"36",mask:"00 00 000 0000"},ID:{countryCode:"ID",callingCode:"62",mask:"0000-000-000"},IE:{countryCode:"IE",callingCode:"353",mask:"000 000 0000"},IL:{countryCode:"IL",callingCode:"972",mask:"000-000-0000"},IM:{countryCode:"IM",callingCode:"44",mask:"00000 000000"},IN:{countryCode:"IN",callingCode:"91",mask:"000000 00000"},IO:{countryCode:"IO",callingCode:"246",mask:"000 0000"},IQ:{countryCode:"IQ",callingCode:"964",mask:"0000 000 0000"},IR:{countryCode:"IR",callingCode:"98",mask:"0000 000 0000"},IS:{countryCode:"IS",callingCode:"354",mask:"000 0000"},IT:{countryCode:"IT",callingCode:"39",mask:"000 000 0000"},JE:{countryCode:"JE",callingCode:"44",mask:"00000 000000"},JM:{countryCode:"JM",callingCode:"1",mask:"(000) 000-0000"},JO:{countryCode:"JO",callingCode:"962",mask:"00 0000 0000"},JP:{countryCode:"JP",callingCode:"81",mask:"000-0000-0000"},KE:{countryCode:"KE",callingCode:"254",mask:"0000 000000"},KG:{countryCode:"KG",callingCode:"996",mask:"0000 000 000"},KH:{countryCode:"KH",callingCode:"855",mask:"000 000 000"},KI:{countryCode:"KI",callingCode:"686",mask:"00000000"},KM:{countryCode:"KM",callingCode:"269",mask:"000 00 00"},KN:{countryCode:"KN",callingCode:"1",mask:"(000) 000-0000"},KP:{countryCode:"KP",callingCode:"850",mask:"0000 000 0000"},KR:{countryCode:"KR",callingCode:"82",mask:"000-0000-0000"},KW:{countryCode:"KW",callingCode:"965",mask:"000 00000"},KY:{countryCode:"KY",callingCode:"1",mask:"(000) 000-0000"},KZ:{countryCode:"KZ",callingCode:"7",mask:"0 (000) 000 0000"},LA:{countryCode:"LA",callingCode:"856",mask:"000 00 000 000"},LB:{countryCode:"LB",callingCode:"961",mask:"00 000 000"},LC:{countryCode:"LC",callingCode:"1",mask:"(000) 000-0000"},LI:{countryCode:"LI",callingCode:"423",mask:"000 000 000"},LK:{countryCode:"LK",callingCode:"94",mask:"000 000 0000"},LR:{countryCode:"LR",callingCode:"231",mask:"000 000 0000"},LS:{countryCode:"LS",callingCode:"266",mask:"0000 0000"},LT:{countryCode:"LT",callingCode:"370",mask:"(0-000) 00000"},LU:{countryCode:"LU",callingCode:"352",mask:"000 000 000"},LV:{countryCode:"LV",callingCode:"371",mask:"00 000 000"},LY:{countryCode:"LY",callingCode:"218",mask:"000-0000000"},MA:{countryCode:"MA",callingCode:"212",mask:"0000-000000"},MC:{countryCode:"MC",callingCode:"377",mask:"00 00 00 00 00"},MD:{countryCode:"MD",callingCode:"373",mask:"0000 00 000"},ME:{countryCode:"ME",callingCode:"382",mask:"000 000 000"},MF:{countryCode:"MF",callingCode:"590",mask:"0000 00 00 00"},MG:{countryCode:"MG",callingCode:"261",mask:"000 00 000 00"},MH:{countryCode:"MH",callingCode:"692",mask:"000-0000"},MK:{countryCode:"MK",callingCode:"389",mask:"000 000 000"},ML:{countryCode:"ML",callingCode:"223",mask:"00 00 00 00"},MM:{countryCode:"MM",callingCode:"95",mask:"00 000 0000"},MN:{countryCode:"MN",callingCode:"976",mask:"0000 0000"},MO:{countryCode:"MO",callingCode:"853",mask:"0000 0000"},MP:{countryCode:"MP",callingCode:"1",mask:"(000) 000-0000"},MQ:{countryCode:"MQ",callingCode:"596",mask:"0000 00 00 00"},MR:{countryCode:"MR",callingCode:"222",mask:"00 00 00 00"},MS:{countryCode:"MS",callingCode:"1",mask:"(000) 000-0000"},MT:{countryCode:"MT",callingCode:"356",mask:"0000 0000"},MU:{countryCode:"MU",callingCode:"230",mask:"0000 0000"},MV:{countryCode:"MV",callingCode:"960",mask:"000-0000"},MW:{countryCode:"MW",callingCode:"265",mask:"0000 00 00 00"},MX:{countryCode:"MX",callingCode:"52",mask:"000 000 0000"},MY:{countryCode:"MY",callingCode:"60",mask:"000-000 0000"},MZ:{countryCode:"MZ",callingCode:"258",mask:"00 000 0000"},NA:{countryCode:"NA",callingCode:"264",mask:"000 000 0000"},NC:{countryCode:"NC",callingCode:"687",mask:"00.00.00"},NE:{countryCode:"NE",callingCode:"227",mask:"00 00 00 00"},NF:{countryCode:"NF",callingCode:"672",mask:"0 00000"},NG:{countryCode:"NG",callingCode:"234",mask:"0000 000 0000"},NI:{countryCode:"NI",callingCode:"505",mask:"0000 0000"},NL:{countryCode:"NL",callingCode:"31",mask:"00 00000000"},NO:{countryCode:"NO",callingCode:"47",mask:"00 00 00 00"},NP:{countryCode:"NP",callingCode:"977",mask:"000-0000000"},NR:{countryCode:"NR",callingCode:"674",mask:"000 0000"},NU:{countryCode:"NU",callingCode:"683",mask:"000 0000"},NZ:{countryCode:"NZ",callingCode:"64",mask:"000 000 0000"},OM:{countryCode:"OM",callingCode:"968",mask:"0000 0000"},PA:{countryCode:"PA",callingCode:"507",mask:"0000-0000"},PE:{countryCode:"PE",callingCode:"51",mask:"000 000 000"},PF:{countryCode:"PF",callingCode:"689",mask:"00 00 00 00"},PG:{countryCode:"PG",callingCode:"675",mask:"0000 0000"},PH:{countryCode:"PH",callingCode:"63",mask:"0000 000 0000"},PK:{countryCode:"PK",callingCode:"92",mask:"0000 0000000"},PL:{countryCode:"PL",callingCode:"48",mask:"000 000 000"},PM:{countryCode:"PM",callingCode:"508",mask:"000 00 00"},PR:{countryCode:"PR",callingCode:"1",mask:"(000) 000-0000"},PS:{countryCode:"PS",callingCode:"970",mask:"0000 000 000"},PT:{countryCode:"PT",callingCode:"351",mask:"000 000 000"},PW:{countryCode:"PW",callingCode:"680",mask:"000 0000"},PY:{countryCode:"PY",callingCode:"595",mask:"0000 000000"},QA:{countryCode:"QA",callingCode:"974",mask:"0000 0000"},RE:{countryCode:"RE",callingCode:"262",mask:"0000 00 00 00"},RO:{countryCode:"RO",callingCode:"40",mask:"0000 000 000"},RS:{countryCode:"RS",callingCode:"381",mask:"000 0000000"},RU:{countryCode:"RU",callingCode:"7",mask:"0 (000) 000-00-00"},RW:{countryCode:"RW",callingCode:"250",mask:"0000 000 000"},SA:{countryCode:"SA",callingCode:"966",mask:"000 000 0000"},SB:{countryCode:"SB",callingCode:"677",mask:"00 00000"},SC:{countryCode:"SC",callingCode:"248",mask:"0 000 000"},SD:{countryCode:"SD",callingCode:"249",mask:"000 000 0000"},SE:{countryCode:"SE",callingCode:"46",mask:"000-000 00 00"},SG:{countryCode:"SG",callingCode:"65",mask:"0000 0000"},SH:{countryCode:"SH",callingCode:"290",mask:"00000"},SI:{countryCode:"SI",callingCode:"386",mask:"000 000 000"},SJ:{countryCode:"SJ",callingCode:"47",mask:"00 00 00 00"},SK:{countryCode:"SK",callingCode:"421",mask:"0000 000 000"},SL:{countryCode:"SL",callingCode:"232",mask:"(000) 000000"},SM:{countryCode:"SM",callingCode:"378",mask:"00 00 00 00"},SN:{countryCode:"SN",callingCode:"221",mask:"00 000 00 00"},SO:{countryCode:"SO",callingCode:"252",mask:"0 0000000"},SR:{countryCode:"SR",callingCode:"597",mask:"000-0000"},SS:{countryCode:"SS",callingCode:"211",mask:"0000 000 000"},ST:{countryCode:"ST",callingCode:"239",mask:"000 0000"},SV:{countryCode:"SV",callingCode:"503",mask:"0000 0000"},SX:{countryCode:"SX",callingCode:"1",mask:"(000) 000-0000"},SY:{countryCode:"SY",callingCode:"963",mask:"0000 000 000"},SZ:{countryCode:"SZ",callingCode:"268",mask:"0000 0000"},TA:{countryCode:"TA",callingCode:"290",mask:"0000"},TC:{countryCode:"TC",callingCode:"1",mask:"(000) 000-0000"},TD:{countryCode:"TD",callingCode:"235",mask:"00 00 00 00"},TG:{countryCode:"TG",callingCode:"228",mask:"00 00 00 00"},TH:{countryCode:"TH",callingCode:"66",mask:"000 000 0000"},TJ:{countryCode:"TJ",callingCode:"992",mask:"00 000 0000"},TK:{countryCode:"TK",callingCode:"690",mask:"0000"},TL:{countryCode:"TL",callingCode:"670",mask:"0000 0000"},TM:{countryCode:"TM",callingCode:"993",mask:"0 00 000000"},TN:{countryCode:"TN",callingCode:"216",mask:"00 000 000"},TO:{countryCode:"TO",callingCode:"676",mask:"000 0000"},TR:{countryCode:"TR",callingCode:"90",mask:"0000 000 00 00"},TT:{countryCode:"TT",callingCode:"1",mask:"(000) 000-0000"},TV:{countryCode:"TV",callingCode:"688",mask:"00 0000"},TW:{countryCode:"TW",callingCode:"886",mask:"0000 000 000"},TZ:{countryCode:"TZ",callingCode:"255",mask:"0000 000 000"},UA:{countryCode:"UA",callingCode:"380",mask:"000 000 0000"},UG:{countryCode:"UG",callingCode:"256",mask:"0000 000000"},US:{countryCode:"US",callingCode:"1",mask:"(000) 000-0000"},UY:{countryCode:"UY",callingCode:"598",mask:"000 000 000"},UZ:{countryCode:"UZ",callingCode:"998",mask:"00 000 00 00"},VA:{countryCode:"VA",callingCode:"39",mask:"000 000 0000"},VC:{countryCode:"VC",callingCode:"1",mask:"(000) 000-0000"},VE:{countryCode:"VE",callingCode:"58",mask:"0000-0000000"},VG:{countryCode:"VG",callingCode:"1",mask:"(000) 000-0000"},VI:{countryCode:"VI",callingCode:"1",mask:"(000) 000-0000"},VN:{countryCode:"VN",callingCode:"84",mask:"0000 000 000"},VU:{countryCode:"VU",callingCode:"678",mask:"000 0000"},WF:{countryCode:"WF",callingCode:"681",mask:"00 00 00"},WS:{countryCode:"WS",callingCode:"685",mask:"00 00000"},XK:{countryCode:"XK",callingCode:"383",mask:"000 000 000"},YE:{countryCode:"YE",callingCode:"967",mask:"0000 000 000"},YT:{countryCode:"YT",callingCode:"262",mask:"0000 00 00 00"},ZA:{countryCode:"ZA",callingCode:"27",mask:"000 000 0000"},ZM:{countryCode:"ZM",callingCode:"260",mask:"000 0000000"},ZW:{countryCode:"ZW",callingCode:"263",mask:"000 000 0000"}};function q(e,l){let n=l;const c=C=>{R(e,n,e.value,C.inputType)};return e.addEventListener("input",c),{update(C,t){n=t,R(e,n,C,"")},destroy(){e.removeEventListener("input",c)},get value(){return e.value}}}function R(e,l,n,c){const C=/delete.*Backwards/.test(c),t=e.selectionStart||0,r=_(n,l);if(n!==r){e.value=r;const i=j(r,n,t,C);i!==void 0&&e.setSelectionRange(i,i)}}function h(e){return e.replace(/\D+/g,"")}function _(e,l){const n=h(e);let c="",C=0;if(n.length){for(const t of l)if(t==="0"){if(c+=n[C++],C===n.length)break}else c+=t;C<n.length&&(c+=" "+n.slice(C))}return c}function j(e,l,n,c){const C=n===l.length;if(c||!C){const t=l.slice(0,n),r=l.slice(n);if(e.startsWith(t))return n;if(e.endsWith(r))return e.length-r.length;{const i=D(t);let k=0,M=0;for(;M<i.length;)D(e[k])&&M++,k++;return k}}}function D(e){return e.replace(/[.,\\/#!$%^&*;:{}=+\-_`~()\s]/g,"")}const $=e=>e||(typeof navigator<"u"?navigator.language:"en-US"),z=e=>{var{countryCode:l,value:n,locale:c,floatingLabel:C,disabled:t,readonly:r,invalid:i,className:k,onFocus:M,onBlur:A,onChange:T,onInputChange:f,onKeyDown:I,onKeyPress:B,onKeyUp:K,onExpand:x,onCollapse:b}=e,U=w.__rest(e,["countryCode","value","locale","floatingLabel","disabled","readonly","invalid","className","onFocus","onBlur","onChange","onInputChange","onKeyDown","onKeyPress","onKeyUp","onExpand","onCollapse"]);const S=d.useMemo(()=>{const o=$(c),a=new Intl.DisplayNames([o],{type:"region"});return Object.keys(G).map(s=>{var u;return[s,(u=a.of(s))!==null&&u!==void 0?u:""]}).sort(([,s],[,u])=>s.localeCompare(u))},[c]),[L,N]=d.useState(()=>{if(l){const o=S.findIndex(([a])=>a===l.toUpperCase());return o!==-1?o:0}return 0}),E=d.useRef(null),y=d.useRef(null);d.useEffect(()=>{if(l){const o=S.findIndex(([a])=>a===l.toUpperCase());N(o!==-1?o:0)}},[l,S]);const m=(o=L)=>{const[a]=S[o];return G[a]};d.useEffect(()=>{E.current&&m()&&(y.current||(y.current=q(E.current,m().mask)),y.current.update(E.current.value,m().mask))},[m().mask]),d.useEffect(()=>()=>{y.current&&y.current.destroy()},[]);const g=o=>{var a,s;return{value:((a=y.current)===null||a===void 0?void 0:a.value)||"",rawValue:h(((s=y.current)===null||s===void 0?void 0:s.value)||""),callingCode:m(o).callingCode,countryCode:m(o).countryCode}},F=(o,{index:a})=>{N(a),T&&T(o,g(a))},O=o=>{M&&M(o,g())},v=o=>{A&&A(o,g())},H=o=>{T&&T(o,g())},W=o=>{f&&f(o,g())},Z=o=>{I&&I(o,g())},V=o=>{B&&B(o,g())},Y=o=>{K&&K(o,g())},J=S.map(([o,a],s)=>{const u=G[o];return d.createElement(p.ListboxOption,{key:o,value:`${a}-${u.callingCode}`,selected:s===L,icon:d.createElement(X.EbayFlagIcon,{flag:u.countryCode.toLowerCase()})},d.createElement("span",null,a," ( + ",u.callingCode," )"))});return d.createElement("span",Object.assign({},U,{className:Q("phone-input",k,{"phone-input--disabled":t,"phone-input--readonly":r,"phone-input--error":i})}),d.createElement(p.ListboxButton,{split:"start",disabled:r||t,onChange:F,onExpand:x,onCollapse:b},J),d.createElement(P.EbayTextbox,{type:"tel",value:n,disabled:t,floatingLabel:C,floatingLabelStatic:!0,readOnly:r,invalid:i,onBlur:v,onFocus:O,onKeyDown:Z,onKeyPress:V,onKeyUp:Y,onChange:H,onInputChange:W,ref:E},d.createElement(P.EbayTextboxPrefixText,{id:"phone-prefix"},"+ ",m().callingCode)))};exports.EbayPhoneInput=z;
|