From 7268b3143b63cf79a143b3ca9ce1ee7db392db5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9E=C3=B3rarinn=20Gunnar=20=C3=81rnason?= Date: Fri, 11 Oct 2024 14:25:29 +0000 Subject: [PATCH] new prop and remove flag --- libs/application/core/src/lib/fieldBuilders.ts | 4 ++-- .../templates/estate/src/forms/Sections/announcerInfo.ts | 2 +- .../estate/src/forms/Sections/representative.ts | 1 - .../inheritance-report/src/forms/sections/applicant.ts | 2 +- .../src/forms/sections/prepaidInheritance/applicant.ts | 2 +- .../sections/prepaidInheritance/inheritanceExecutor.ts | 2 +- .../parliamentary-list-creation/src/forms/Draft.ts | 1 - .../presidential-list-creation/src/forms/Draft.ts | 1 - libs/application/types/src/lib/Fields.ts | 2 +- .../ui-fields/src/lib/PhoneFormField/PhoneFormField.tsx | 9 ++------- 10 files changed, 9 insertions(+), 17 deletions(-) diff --git a/libs/application/core/src/lib/fieldBuilders.ts b/libs/application/core/src/lib/fieldBuilders.ts index 626f55f49442..d04b981e84d7 100644 --- a/libs/application/core/src/lib/fieldBuilders.ts +++ b/libs/application/core/src/lib/fieldBuilders.ts @@ -316,7 +316,7 @@ export const buildPhoneField = ( readOnly, rightAlign, allowedCountryCodes, - disableDropdown, + enableCountrySelector, } = data return { ...extractCommonFields(data), @@ -326,7 +326,7 @@ export const buildPhoneField = ( required, readOnly, allowedCountryCodes, - disableDropdown, + enableCountrySelector, rightAlign, type: FieldTypes.PHONE, component: FieldComponents.PHONE, diff --git a/libs/application/templates/estate/src/forms/Sections/announcerInfo.ts b/libs/application/templates/estate/src/forms/Sections/announcerInfo.ts index 9cd2507860ca..fd00b7528c0b 100644 --- a/libs/application/templates/estate/src/forms/Sections/announcerInfo.ts +++ b/libs/application/templates/estate/src/forms/Sections/announcerInfo.ts @@ -68,7 +68,7 @@ export const announcerInfo = buildSection({ title: m.phone, width: 'half', required: true, - disableDropdown: false, + enableCountrySelector: true, defaultValue: (application: Application) => { const phone = ( diff --git a/libs/application/templates/estate/src/forms/Sections/representative.ts b/libs/application/templates/estate/src/forms/Sections/representative.ts index b0188d3c6e52..cfead77a7477 100644 --- a/libs/application/templates/estate/src/forms/Sections/representative.ts +++ b/libs/application/templates/estate/src/forms/Sections/representative.ts @@ -32,7 +32,6 @@ export const representative = buildSection({ title: m.phone, width: 'half', required: true, - disableDropdown: true, allowedCountryCodes: ['IS'], }), buildTextField({ diff --git a/libs/application/templates/inheritance-report/src/forms/sections/applicant.ts b/libs/application/templates/inheritance-report/src/forms/sections/applicant.ts index 1a79447e2b9e..c76525af5dbd 100644 --- a/libs/application/templates/inheritance-report/src/forms/sections/applicant.ts +++ b/libs/application/templates/inheritance-report/src/forms/sections/applicant.ts @@ -54,7 +54,7 @@ export const applicant = buildSection({ title: m.phone, width: 'half', required: true, - disableDropdown: false, + enableCountrySelector: true, defaultValue: (application: Application) => { const phone = ( diff --git a/libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/applicant.ts b/libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/applicant.ts index 220bcc1c12c7..2de640649a88 100644 --- a/libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/applicant.ts +++ b/libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/applicant.ts @@ -29,7 +29,7 @@ export const prePaidApplicant = buildSection({ title: m.phone, width: 'half', required: true, - disableDropdown: false, + enableCountrySelector: true, }), buildTextField({ id: 'prePaidApplicant.email', diff --git a/libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/inheritanceExecutor.ts b/libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/inheritanceExecutor.ts index 1ae4e8202e29..a411304e2a32 100644 --- a/libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/inheritanceExecutor.ts +++ b/libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/inheritanceExecutor.ts @@ -41,7 +41,7 @@ export const inheritanceExecutor = buildSection({ title: m.phone, width: 'half', required: true, - disableDropdown: false, + enableCountrySelector: true, }), buildDescriptionField({ id: 'description_empty', diff --git a/libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts b/libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts index 0dc9108b06ca..1cf3776bd6d1 100644 --- a/libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts +++ b/libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts @@ -112,7 +112,6 @@ export const Draft: Form = buildForm({ title: m.phone, width: 'half', required: true, - disableDropdown: true, allowedCountryCodes: ['IS'], defaultValue: (application: Application) => { const phone = diff --git a/libs/application/templates/signature-collection/presidential-list-creation/src/forms/Draft.ts b/libs/application/templates/signature-collection/presidential-list-creation/src/forms/Draft.ts index dbf2bf38c22b..74ad3389390b 100644 --- a/libs/application/templates/signature-collection/presidential-list-creation/src/forms/Draft.ts +++ b/libs/application/templates/signature-collection/presidential-list-creation/src/forms/Draft.ts @@ -66,7 +66,6 @@ export const Draft: Form = buildForm({ title: m.phone, width: 'half', required: true, - disableDropdown: true, allowedCountryCodes: ['IS'], defaultValue: (application: Application) => { const phone = diff --git a/libs/application/types/src/lib/Fields.ts b/libs/application/types/src/lib/Fields.ts index 8f3c5828097d..70d3a979efb7 100644 --- a/libs/application/types/src/lib/Fields.ts +++ b/libs/application/types/src/lib/Fields.ts @@ -381,7 +381,7 @@ export interface PhoneField extends BaseField { placeholder?: FormText backgroundColor?: InputBackgroundColor allowedCountryCodes?: string[] - disableDropdown?: boolean + enableCountrySelector?: boolean required?: boolean onChange?: (...event: any[]) => void } diff --git a/libs/application/ui-fields/src/lib/PhoneFormField/PhoneFormField.tsx b/libs/application/ui-fields/src/lib/PhoneFormField/PhoneFormField.tsx index 7eee6934af24..0fbcbb72c30e 100644 --- a/libs/application/ui-fields/src/lib/PhoneFormField/PhoneFormField.tsx +++ b/libs/application/ui-fields/src/lib/PhoneFormField/PhoneFormField.tsx @@ -9,7 +9,6 @@ import { } from '@island.is/shared/form-fields' import { useLocale } from '@island.is/localization' import { getDefaultValue } from '../../getDefaultValue' -import { useFeatureFlag } from '@island.is/react/feature-flags' interface Props extends FieldBaseProps { field: PhoneField @@ -33,15 +32,11 @@ export const PhoneFormField: FC> = ({ readOnly, dataTestId, allowedCountryCodes, - disableDropdown, + enableCountrySelector = false, onChange = () => undefined, } = field const { control, clearErrors } = useFormContext() const { formatMessage } = useLocale() - const { value: isPhoneInputV2Enabled } = useFeatureFlag( - 'isPhoneInputV2Enabled', - false, - ) return (
@@ -71,7 +66,7 @@ export const PhoneFormField: FC> = ({ autoFocus={autoFocus} error={error} control={control} - disableDropdown={disableDropdown || !isPhoneInputV2Enabled} + disableDropdown={!enableCountrySelector} onChange={(e) => { if (error) { clearErrors(id)