{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "input18",
  "title": "Input",
  "description": "Input built with shadcn/ui.",
  "dependencies": [
    "lucide-react@0",
    "react-phone-number-input@3"
  ],
  "registryDependencies": [
    "input",
    "label"
  ],
  "files": [
    {
      "path": "contents/components/input/18/index.tsx",
      "content": "\"use client\";\n\nimport { ChevronDownIcon, PhoneIcon } from \"lucide-react\";\nimport type React from \"react\";\nimport { useId, useState } from \"react\";\nimport * as RPNInput from \"react-phone-number-input\";\nimport flags from \"react-phone-number-input/flags\";\n\nimport { cn } from \"@/lib/utils\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\n\nexport default function Component() {\n  const id = useId();\n  const [value, setValue] = useState(\"\");\n\n  return (\n    <div className=\"w-full max-w-sm *:not-first:mt-2\" dir=\"ltr\">\n      <Label htmlFor={id}>PhoneIcon number input</Label>\n      <RPNInput.default\n        className=\"flex rounded-md shadow-xs\"\n        countrySelectComponent={CountrySelect}\n        flagComponent={FlagComponent}\n        id={id}\n        inputComponent={PhoneInput}\n        international\n        onChange={(newValue) => setValue(newValue ?? \"\")}\n        placeholder=\"Enter phone number\"\n        value={value}\n      />\n    </div>\n  );\n}\n\nconst PhoneInput = ({ className, ...props }: React.ComponentProps<\"input\">) => {\n  return (\n    <Input\n      className={cn(\"-ms-px rounded-s-none shadow-none focus-visible:z-10\", className)}\n      data-slot=\"phone-input\"\n      {...props}\n    />\n  );\n};\n\nPhoneInput.displayName = \"PhoneInput\";\n\ntype CountrySelectProps = {\n  disabled?: boolean;\n  value: RPNInput.Country;\n  onChange: (value: RPNInput.Country) => void;\n  options: { label: string; value: RPNInput.Country | undefined }[];\n};\n\nconst CountrySelect = ({ disabled, value, onChange, options }: CountrySelectProps) => {\n  const handleSelect = (event: React.ChangeEvent<HTMLSelectElement>) => {\n    onChange(event.target.value as RPNInput.Country);\n  };\n\n  return (\n    <div className=\"border-input bg-background text-muted-foreground focus-within:border-ring focus-within:ring-ring/50 hover:bg-accent hover:text-foreground has-aria-invalid:border-destructive/60 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40 relative inline-flex items-center self-stretch rounded-s-md border py-2 ps-3 pe-2 transition-[color,box-shadow] outline-none focus-within:z-10 focus-within:ring-[3px] has-disabled:pointer-events-none has-disabled:opacity-50\">\n      <div aria-hidden=\"true\" className=\"inline-flex items-center gap-1\">\n        <FlagComponent aria-hidden=\"true\" country={value} countryName={value} />\n        <span className=\"text-muted-foreground/80\">\n          <ChevronDownIcon aria-hidden=\"true\" size={16} />\n        </span>\n      </div>\n      <select\n        aria-label=\"Select country\"\n        className=\"absolute inset-0 text-sm opacity-0\"\n        disabled={disabled}\n        onChange={handleSelect}\n        value={value}>\n        <option key=\"default\" value=\"\">\n          Select a country\n        </option>\n        {options\n          .filter((x) => x.value)\n          .map((option, i) => (\n            <option key={option.value ?? `empty-${i}`} value={option.value}>\n              {option.label} {option.value && `+${RPNInput.getCountryCallingCode(option.value)}`}\n            </option>\n          ))}\n      </select>\n    </div>\n  );\n};\n\nconst FlagComponent = ({ country, countryName }: RPNInput.FlagProps) => {\n  const Flag = flags[country];\n\n  return (\n    <span className=\"w-5 overflow-hidden rounded-sm\">\n      {Flag ? <Flag title={countryName} /> : <PhoneIcon aria-hidden=\"true\" size={16} />}\n    </span>\n  );\n};\n",
      "type": "registry:component",
      "target": "components/input18.tsx"
    }
  ],
  "type": "registry:component"
}