ui-romanian-inputs

Implements Romanian CNP, CUI, and address input components with validation for React forms.

Updated Aug 18, 2026
One-click install
npx skills add https://github.com/Aurelian1974/ERPEnterprise --skill ui-romanian-inputs-aurelian1974
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ui-romanian-inputs
Source: https://github.com/Aurelian1974/ERPEnterprise/tree/main/.github/skills/ui-romanian-inputs
Command: npx skills add https://github.com/Aurelian1974/ERPEnterprise --skill ui-romanian-inputs-aurelian1974

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires react, zod, react-hook-form, lucide-react.

What problem does it solve? Building ERP forms for Romanian users requires correct validation of national identifiers (CNP, CUI/CIF) and structured address entry with county and locality dependencies, which is error-prone to implement from scratch. ## Core Features & Use Cases - CNPInput: Validates the 13-digit personal numeric code using the official weighted checksum algorithm and extracts birth date, gender, and county from it. - CUIInput: Validates company fiscal codes (with optional RO prefix) and supports an optional ANAF company lookup through a backend proxy endpoint. - AddressInput: Provides street, county, city, postal code, and country fields where selecting a county resets and filters the locality list. - Use Case: When building a partner registration form in a Romanian ERP, drop in these components with the provided Zod schemas and React Hook Form bindings to get validated CNP, CUI, and address fields immediately. ## Quick Start Ask the AI to add a validated CNP input field with birth date extraction to your React Hook Form partner registration form.

Frequently Asked Questions about ui-romanian-inputs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate a Romanian CNP in React?▼

Validate a CNP by checking it is 13 digits, then applying the official weighted checksum: multiply the first 12 digits by weights [2,7,9,1,4,6,3,5,8,2,7,9], sum them, take modulo 11, and compare with the 13th digit. The CNPInput component encapsulates this logic.

How to validate a Romanian CUI/CIF code in JavaScript?▼

Strip the optional RO prefix, ensure 2-10 digits, pad to 9 digits, then apply weights [7,5,3,2,1,7,5,3,2], multiply the sum by 10, take modulo 11, and compare with the control digit. The validateCUI function implements this algorithm.

Can I extract birth date and gender from a CNP?▼

Yes, the CNP encodes birth date and gender. The first digit indicates century and sex (odd for male, even for female), digits 2-7 encode year, month, and day. The extractCNPData function returns birthDate, gender, and county after validation.

Does the ANAF company lookup work directly from the frontend?▼

No, the ANAF lookup must go through a backend proxy endpoint such as /api/v1/administration/anaf/company/{cui}. Direct frontend calls are avoided due to CORS restrictions and security concerns.

How do I make a city dropdown depend on the selected county in React Hook Form?▼

Store county and city in the same form value object, and when the county changes, reset the city field. The AddressInput component does this by clearing city on county change and disabling the locality SearchableSelect until a county is selected.