refactor: replace checked with defaultChecked for Switch components across multiple forms

This commit is contained in:
Marco Pedone 2026-02-24 10:40:07 +01:00
parent b5dcb5e8e1
commit 51d58a3008
10 changed files with 29 additions and 30 deletions

View file

@ -161,8 +161,8 @@ export const FormBanners = ({
<FormLabel htmlFor="unskippable">Non Saltabile</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="unskippable"
onCheckedChange={field.onChange}
/>
@ -181,8 +181,8 @@ export const FormBanners = ({
<FormLabel htmlFor="hcta">Ha Link</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="hcta"
onCheckedChange={field.onChange}
/>
@ -321,8 +321,8 @@ export const FormBanners = ({
<FormLabel htmlFor="attivo">Attivo</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="attivo"
onCheckedChange={field.onChange}
/>
@ -341,8 +341,8 @@ export const FormBanners = ({
<FormLabel htmlFor="pub">Mostra nel pubblico</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="pub"
onCheckedChange={field.onChange}
/>
@ -361,7 +361,6 @@ export const FormBanners = ({
<FormLabel htmlFor="priv">Mostra in area riservata</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="priv"

View file

@ -187,7 +187,7 @@ export const FormContattoAnnucio = ({ codice }: { codice: string }) => {
<FormControl>
<Checkbox
checked={field.value}
defaultChecked={field.value}
id="checkbox"
onCheckedChange={field.onChange}
/>

View file

@ -89,8 +89,8 @@ export const FormEditServizio = ({
<FormLabel htmlFor="isSent">Inviato</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="isSent"
onCheckedChange={field.onChange}
/>
@ -113,8 +113,8 @@ export const FormEditServizio = ({
<FormLabel htmlFor="isInterrotto">Interrotto</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="isInterrotto"
onCheckedChange={field.onChange}
/>
@ -202,8 +202,8 @@ export const FormEditServizio = ({
<FormLabel htmlFor="isOkAcconto">Acconto Pagato</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="isOkAcconto"
onCheckedChange={field.onChange}
/>
@ -226,8 +226,8 @@ export const FormEditServizio = ({
<FormLabel htmlFor="isOkSaldo">Saldo Pagato</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="isOkSaldo"
onCheckedChange={field.onChange}
/>
@ -252,8 +252,8 @@ export const FormEditServizio = ({
</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="isOkConsulenza"
onCheckedChange={field.onChange}
/>
@ -278,8 +278,8 @@ export const FormEditServizio = ({
<FormLabel htmlFor="skipPayment">Salta Pagamento</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="skipPayment"
onCheckedChange={field.onChange}
/>
@ -304,8 +304,8 @@ export const FormEditServizio = ({
</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="skipControlloDoc"
onCheckedChange={field.onChange}
/>
@ -330,8 +330,8 @@ export const FormEditServizio = ({
</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="skipDocMotivazione"
onCheckedChange={field.onChange}
/>

View file

@ -90,8 +90,8 @@ export const FormFlags = ({
</div>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="value"
onCheckedChange={field.onChange}
/>

View file

@ -193,7 +193,7 @@ export const FormLogin = () => {
<FormControl>
<Checkbox
checked={field.value}
defaultChecked={field.value}
id="checkbox"
onCheckedChange={field.onChange}
/>

View file

@ -73,8 +73,8 @@ export const MustChangePasswordForm = ({
</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="mustChangePassword"
onCheckedChange={field.onChange}
/>

View file

@ -385,8 +385,8 @@ export const FormNewServizio = ({
</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="arredato"
onCheckedChange={field.onChange}
/>
@ -608,8 +608,8 @@ export const FormNewServizio = ({
<FormLabel htmlFor="skipPayment">Salta Pagamento</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="skipPayment"
onCheckedChange={field.onChange}
/>
@ -634,8 +634,8 @@ export const FormNewServizio = ({
</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="skipControlloDoc"
onCheckedChange={field.onChange}
/>
@ -660,8 +660,8 @@ export const FormNewServizio = ({
</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="skipDocMotivazione"
onCheckedChange={field.onChange}
/>

View file

@ -669,8 +669,8 @@ export const FormNewServizioAcquisto = ({
</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="arredato"
onCheckedChange={field.onChange}
/>
@ -1257,8 +1257,8 @@ export const FormNewServizioAcquisto = ({
</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="skipPayment"
onCheckedChange={(v) => {
field.onChange(v);

View file

@ -294,8 +294,8 @@ export const FormPrezzo = ({
<FormLabel htmlFor="isAcconto">Acconto</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="isAcconto"
onCheckedChange={field.onChange}
/>
@ -314,8 +314,8 @@ export const FormPrezzo = ({
<FormLabel htmlFor="isSaldo">Saldo</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="isSaldo"
onCheckedChange={field.onChange}
/>
@ -334,8 +334,8 @@ export const FormPrezzo = ({
<FormLabel htmlFor="isConsulenza">Consulenza</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="isConsulenza"
onCheckedChange={field.onChange}
/>
@ -354,8 +354,8 @@ export const FormPrezzo = ({
<FormLabel htmlFor="isTransitorio">Transitorio</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="isTransitorio"
onCheckedChange={field.onChange}
/>
@ -374,8 +374,8 @@ export const FormPrezzo = ({
<FormLabel htmlFor="isStabile">Stabile</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="isStabile"
onCheckedChange={field.onChange}
/>
@ -395,8 +395,8 @@ export const FormPrezzo = ({
<FormLabel htmlFor="isActive">Attivo</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="isActive"
onCheckedChange={field.onChange}
/>

View file

@ -185,8 +185,8 @@ export const ProfileFormAccount = ({
<FormLabel htmlFor="isAdmin">Admin</FormLabel>
<FormControl>
<Switch
checked={field.value}
className="data-[state=checked]:bg-neutral-700"
defaultChecked={field.value}
id="isAdmin"
onCheckedChange={(v) => {
field.onChange(v);