# pakdatakit-react 0.2.0

> Release notes for pakdatakit-react 0.2.0, a PakDataKit companion package: what changed, what was fixed and how to upgrade.

Source: https://pakdatakit.dev/releases/pakdatakit-react-0.2.0/

[pakdatakit-react 0.2.0 on its registry](https://www.npmjs.com/package/pakdatakit-react/v/0.2.0)

Requires pakdatakit 2.4.0 (for `pakdatakit/quality`).

## Added

- `PakCheckoutForm` and `PakKycForm`: unstyled checkout and KYC forms with
  full name, mobile number, province, district, optional tehsil (`tehsil`
  prop), city with suggestions from the chosen province, address, nearby
  place and postal code; `PakKycForm` adds a required CNIC. The mobile and
  CNIC fields reuse `PhoneInput` and `CNICInput`.
- Accessible markup: real `<label for>`, native `<select>`s, `required` and
  `aria-required`, `aria-invalid` and `aria-describedby` on errors, an error
  summary with `role="alert"` whose links move focus to the field, and focus
  on the first invalid field after a blocked submit.
- `locale="ur"`: Urdu labels, placeholders, errors and hints, with
  `dir="rtl"` and `lang="ur"` on the form. Any text can be replaced with the
  `labels` prop.
- Controlled (`values` / `onChange`) or uncontrolled (`defaultValues`) use,
  `onSubmit(values)` with trimmed values, `onInvalid(errors)`, `className`
  and per-element `classNames`.
- Optional delivery hints (`hints` prop, `usePakHints`): address
  completeness from `scoreAddress`, warning signs from `phoneRiskSignals`,
  and a postal code that belongs to another city. They never block submit,
  are announced with `aria-live="polite"`, and load `pakdatakit/quality`
  and the post office directory with a dynamic `import()` only when turned
  on, so the base form bundle stays small.
- For react-hook-form and other form libraries: `pakRules` and
  `createPakRules({ locale, labels })` (`register('cnic', pakRules.cnic)`),
  `validatePakField`, `validatePakForm`, `useLocationOptions`,
  `applyLocationChange` and `suggestCities`.

## Changed

- `CNICInput`, `PhoneInput` and `IBANInput` are marked as pure, so bundlers
  drop the ones you do not use.
