mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-29 21:08:13 +00:00
refactor: maintain local state for PhoneInput typing to prevent input reset and add helper utilities for E.164 conversion.
This commit is contained in:
@@ -14,7 +14,7 @@ import {
|
||||
type FormSectionConfig,
|
||||
type Vessel,
|
||||
} from '@ema-platform/api';
|
||||
import { AmharicDatePicker, CountrySelect } from '@ema-platform/ui';
|
||||
import { AmharicDatePicker, CountrySelect, PhoneInput } from '@ema-platform/ui';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { LocationPicker } from '../../location/components/LocationPicker';
|
||||
|
||||
@@ -223,6 +223,12 @@ export function ConfigDrivenSection({
|
||||
value={(value as string) ?? ''}
|
||||
onChange={(v) => onChange(field.key, v)}
|
||||
/>
|
||||
) : field.type === 'PHONE' ? (
|
||||
<PhoneInput
|
||||
{...common}
|
||||
value={(value as string) ?? ''}
|
||||
onChange={(v) => onChange(field.key, v)}
|
||||
/>
|
||||
) : field.type === 'TEXTAREA' ? (
|
||||
<Textarea
|
||||
{...common}
|
||||
|
||||
@@ -147,12 +147,13 @@ export function AddressFormContent({
|
||||
onChange={(val) => setValue('nationality', val || '', { shouldValidate: true })}
|
||||
error={errors.nationality?.message}
|
||||
/>
|
||||
<TextInput
|
||||
<PhoneInput
|
||||
label={t('profileFields.primaryPhoneNumber')}
|
||||
description={t('profileAddress.accountManagedHint')}
|
||||
required
|
||||
readOnly
|
||||
{...register('primaryPhoneNumber')}
|
||||
value={watch('primaryPhoneNumber') || ''}
|
||||
onChange={(val) => setValue('primaryPhoneNumber', val, { shouldValidate: true })}
|
||||
error={errors.primaryPhoneNumber?.message}
|
||||
/>
|
||||
<PhoneInput
|
||||
|
||||
Reference in New Issue
Block a user