UNPKG

@nexusui/components

Version:

These are custom components specially-developed for NexusUI applications. They will make your life easier by giving you out-of-the-box implementations for various high-level UI elements that you can drop directly into your application.

2 lines (1 loc) 1.15 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),a=require("@mui/material/MenuItem"),r=require("country-flag-icons/react/3x2"),u=require("@mui/material/Box"),o=require("clsx"),d=require("./PhoneNumber.styles.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=s(a),l=s(r),i=s(u),c=s(o);const f="NexusCountryItem";var m=t.forwardRef(((t,a)=>{const{name:r,iso2:u,dialCode:o,localization:s,...m}=t,x=l.default[u.toUpperCase()];return e.jsxs(n.default,{ref:a,className:c.default(`${f}-root`,"country"),"data-testid":`${f}-root`,"data-dial-code":"1","data-country-code":u,...m,children:[Boolean(x)&&e.jsx(i.default,{sx:d.default.flagIcon,"data-testid":"NexusPhoneNumber-country-flag",children:e.jsx(x,{"data-testid":`NexusPhoneNumber-country-flag-${u}`})}),e.jsx(i.default,{className:c.default(`${f}-countryName`,"NexusPhoneNumber-country-name"),"data-testid":"NexusPhoneNumber-country-name",children:s||r}),e.jsxs(i.default,{sx:d.default.dialCode,"data-testid":"NexusPhoneNumber-country-dial-code",children:["(",`+${o}`,")"]})]})}));exports.default=m;