# Romania Cod Numeric Personal Input

RomaniaCodNumericPersonalInput is a headless input for entering Romania's Cod Numeric Personal (CNP), Romania's national-id identifier. It renders as `<input type="text">` with pattern validation, numeric/letter keyboard hints, and `autocomplete="off"` to protect sensitive identifiers. It is the editable companion to RomaniaCodNumericPersonalView.

**Status:** beta — implemented and unit-tested in all seven frameworks with an axe-clean demo page; not yet exercised in composed flows.

## Implementation Notes

- Renders as `<input type="text">` with pattern validation
- Format: 13 digits: gender and century (1/3/5/7 male; 2/4/6/8 female; 9 foreigner), date of birth (YYMMDD), country zone (01-52, or 99 for Bucharest sectors), serial (3 digits), and a Modulus-11 checksum digit
- `autocomplete="off"` to protect sensitive identifiers
- Supports two-way binding on the `value` prop
- Companion to RomaniaCodNumericPersonalView

## Props

- `label`: string (required) — accessible label via `aria-label`
- `value`: string (default: "") — bindable input value
- `required`: boolean (default: false) — form validation
- `disabled`: boolean (default: false) — disabled state
- `...restProps`: any — additional HTML attributes spread onto the `<input>`

## Usage

```html
<Field
  label="Personal Numerical Code"
  required
>
  <RomaniaCodNumericPersonalInput
    label="Personal Numerical Code"
    value="{value}"
    required
  />
  <Hint>13 digits: gender and century (1/3/5/7 male</Hint>
  <ErrorMessage>Please enter a valid Personal Numerical Code</ErrorMessage>
</Field>
```

## ARIA

- `aria-label={label}` — provides accessible name

## When to Use

- Use in forms collecting Romania's Cod Numeric Personal (CNP).
- Use with pattern validation matching the documented format.
- Use in administrative or national-id workflows where the identifier is required.

## When Not to Use

- Do not use for displaying read-only identifiers — use `romania-cod-numeric-personal-view` instead.
- Do not use for general text input — use `text-input` instead.
- Do not use for other countries' identifiers — use the corresponding country-specific input.

## Headless

This headless component ships zero CSS. The consumer provides all styling targeting the `.romania-cod-numeric-personal-input` class hook.

## Testing

- Verify renders an `<input>` with the correct class and `type="text"`
- Verify `aria-label` is set from the `label` prop
- Verify pattern attribute matches the documented format
- Verify `autocomplete="off"`
- Verify value binding works

## Domain Knowledge

Thirteen digits: a leading sex/century digit (1 male 1900–1999, 2 female 1900–1999, 3 male 1800–1899, 4 female 1800–1899, 5 male 2000+, 6 female 2000+, 7 male resident, 8 female resident, 9 foreign citizen); date of birth (YYMMDD); two-digit county code (01–52, or 99 for non-Romanians, or 4 followed by a Bucharest sector number); a three-digit serial number; and a check digit computed by weighted multiplication with the constant 279146358279 modulo 11 (remainder 10 maps to 1).

**Where to find it:** Romanian Birth Certificate, Identity Card (Carte de Identitate), and Driving Licence.

## Security and privacy

A national identifier is personal data, and often a key to other records.

- The input renders `autocomplete="off"`, so the browser neither saves nor offers the value, and `spellcheck="false"`, so an enhanced spellchecker does not send it to a cloud service. `bin/check-identifier-inputs` keeps both in all nine catalogs.
- Do not log the value, put it in a URL or query string, or send it to analytics or an error tracker; mask it there if it must appear.
- The component stores nothing. Do not keep the value in `localStorage`, `sessionStorage` or a cookie; submit it in the body of a POST over HTTPS.
- A format or checksum check proves the number is well formed, not that it belongs to the person entering it.
- The page decides who may see it: the input does not mask what is typed. Use the matching `-view` to show it back, masked as the service requires.

## Related components

- `romania-cod-numeric-personal-view` — a read-only display of Romania's Cod Numeric Personal (CNP)
- `text-input` — a single-line text input field <input type="text">

## Known limitations

None known.

## References

- Wikipedia: https://en.wikipedia.org/wiki/National_identification_number#Romania

---

Lily™ and Lily Design System™ are trademarks.
