Merged in chore/move-checkbox-component (pull request #2501)

chore(SW-3145): Move checkbox component to design-system

* Inline type

* Remove error handling from Checkbox internals

* Move Form/Checkbox

* Fix self referencing imports


Approved-by: Joakim Jäderberg
This commit is contained in:
Anton Gunnarsson
2025-07-03 08:37:01 +00:00
parent 0ffb40e94b
commit e5f8394f50
18 changed files with 50 additions and 56 deletions

View File

@@ -7,9 +7,11 @@ import { FormProvider, useForm } from "react-hook-form"
import { useIntl } from "react-intl"
import { Button } from "@scandic-hotels/design-system/Button"
import Checkbox from "@scandic-hotels/design-system/Form/Checkbox"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { trpc } from "@scandic-hotels/trpc/client"
import {
signupErrors,
type SignUpSchema,
signUpSchema,
} from "@scandic-hotels/trpc/routers/user/schemas"
@@ -20,7 +22,6 @@ import {
privacyPolicy,
} from "@/constants/webHrefs"
import Checkbox from "@/components/TempDesignSystem/Form/Checkbox"
import CountrySelect from "@/components/TempDesignSystem/Form/Country"
import DateSelect from "@/components/TempDesignSystem/Form/Date"
import Input from "@/components/TempDesignSystem/Form/Input"
@@ -217,7 +218,17 @@ export default function SignupForm({ title }: SignUpFormProps) {
</h3>
</Typography>
</header>
<Checkbox name="termsAccepted" registerOptions={{ required: true }}>
<Checkbox
name="termsAccepted"
registerOptions={{
required: true,
}}
errorCodeMessages={{
[signupErrors.TERMS_REQUIRED]: intl.formatMessage({
defaultMessage: "You must accept the terms and conditions",
}),
}}
>
{intl.formatMessage({
defaultMessage: "I accept",
})}