From 5f2e215508baa50a5c68adb600d201435cc86df0 Mon Sep 17 00:00:00 2001 From: Bianca Widstam Date: Tue, 5 Aug 2025 11:54:41 +0000 Subject: [PATCH] Merged in fix/SW-2188-disable-fields-logged-in-user-enter-details (pull request #2595) fix(SW-2188): disable enter details fields when logged in * fix(SW-2188): disable enter details fields when logged in Approved-by: Anton Gunnarsson --- .../EnterDetails/Details/RoomOne/index.tsx | 10 +++++----- .../TempDesignSystem/Form/Input/index.tsx | 1 + .../lib/components/Form/Country/CountryCombobox.tsx | 4 ++-- .../lib/components/Form/Country/CountrySelect.tsx | 4 ++-- .../lib/components/Form/Country/country.module.css | 6 +++++- .../lib/components/Form/Country/country.ts | 2 +- .../lib/components/Form/Phone/index.tsx | 13 ++++++++----- .../lib/components/Form/Phone/phone.module.css | 13 +++++++++++++ .../lib/components/Form/Phone/phone.ts | 1 - .../design-system/lib/components/Label/Label.tsx | 2 ++ .../lib/components/Label/label.module.css | 9 ++++----- .../design-system/lib/components/Label/variants.ts | 3 +++ .../lib/components/Select/select.module.css | 2 ++ 13 files changed, 48 insertions(+), 22 deletions(-) diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/RoomOne/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Details/RoomOne/index.tsx index d89c8e547..0aaba54b0 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/RoomOne/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Details/RoomOne/index.tsx @@ -155,7 +155,7 @@ export default function Details({ user }: DetailsProps) { })} maxLength={30} name="firstName" - readOnly={!!user} + disabled={!!user} registerOptions={{ required: true, onBlur: updateDetailsStore }} /> {user ? null : ( diff --git a/apps/scandic-web/components/TempDesignSystem/Form/Input/index.tsx b/apps/scandic-web/components/TempDesignSystem/Form/Input/index.tsx index e4a7d97a1..20fea8c04 100644 --- a/apps/scandic-web/components/TempDesignSystem/Form/Input/index.tsx +++ b/apps/scandic-web/components/TempDesignSystem/Form/Input/index.tsx @@ -72,6 +72,7 @@ const Input = forwardRef(function Input( maxLength={maxLength} placeholder={placeholder} readOnly={readOnly} + disabled={disabled} required={!!registerOptions.required} type={type} inputMode={inputMode} diff --git a/packages/design-system/lib/components/Form/Country/CountryCombobox.tsx b/packages/design-system/lib/components/Form/Country/CountryCombobox.tsx index 28bd584c2..5a73abd0a 100644 --- a/packages/design-system/lib/components/Form/Country/CountryCombobox.tsx +++ b/packages/design-system/lib/components/Form/Country/CountryCombobox.tsx @@ -32,7 +32,7 @@ export default function CountryCombobox({ lang = 'en', countries, name = 'country', - readOnly = false, + disabled = false, registerOptions = {}, }: CountryProps) { const { startsWith } = useFilter({ sensitivity: 'base' }) @@ -84,7 +84,7 @@ export default function CountryCombobox({ aria-label={label} className={styles.select} data-testid={name} - isReadOnly={readOnly} + isDisabled={disabled} isRequired={Boolean(registerOptions?.required)} isInvalid={fieldState.invalid} name={name} diff --git a/packages/design-system/lib/components/Form/Country/CountrySelect.tsx b/packages/design-system/lib/components/Form/Country/CountrySelect.tsx index 50a533531..e29868702 100644 --- a/packages/design-system/lib/components/Form/Country/CountrySelect.tsx +++ b/packages/design-system/lib/components/Form/Country/CountrySelect.tsx @@ -18,7 +18,7 @@ export default function CountrySelect({ countries, lang = 'en', name = 'country', - readOnly = false, + disabled = false, registerOptions = {}, }: CountryProps) { const { field, formState, fieldState } = useController({ @@ -53,7 +53,7 @@ export default function CountrySelect({