From 68787b26fdf2bd5f9d9e812e5bfddb19abe45d1d Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Mon, 24 Mar 2025 10:48:03 +0100 Subject: [PATCH] fix(Switch): prevent transition on focus outline --- src/theme/switch.ts | 2 +- .../__snapshots__/Switch-vue.spec.ts.snap | 50 +++++++++---------- .../__snapshots__/Switch.spec.ts.snap | 50 +++++++++---------- 3 files changed, 51 insertions(+), 51 deletions(-) diff --git a/src/theme/switch.ts b/src/theme/switch.ts index 83ea377d..19e45e3d 100644 --- a/src/theme/switch.ts +++ b/src/theme/switch.ts @@ -3,7 +3,7 @@ import type { ModuleOptions } from '../module' export default (options: Required) => ({ slots: { root: 'relative flex items-start', - base: ['inline-flex items-center shrink-0 rounded-full border-2 border-transparent focus-visible:outline-2 focus-visible:outline-offset-2 data-[state=unchecked]:bg-(--ui-bg-accented)', options.theme.transitions && 'transition-colors duration-200'], + base: ['inline-flex items-center shrink-0 rounded-full border-2 border-transparent focus-visible:outline-2 focus-visible:outline-offset-2 data-[state=unchecked]:bg-(--ui-bg-accented)', options.theme.transitions && 'transition-[background] duration-200'], container: 'flex items-center', thumb: 'group pointer-events-none rounded-full bg-(--ui-bg) shadow-lg ring-0 transition-transform duration-200 data-[state=unchecked]:translate-x-0 data-[state=unchecked]:rtl:-translate-x-0 flex items-center justify-center', icon: ['absolute shrink-0 group-data-[state=unchecked]:text-(--ui-text-dimmed) opacity-0 size-10/12', options.theme.transitions && 'transition-[color,opacity] duration-200'], diff --git a/test/components/__snapshots__/Switch-vue.spec.ts.snap b/test/components/__snapshots__/Switch-vue.spec.ts.snap index 3bee2963..7ba34ee1 100644 --- a/test/components/__snapshots__/Switch-vue.spec.ts.snap +++ b/test/components/__snapshots__/Switch-vue.spec.ts.snap @@ -2,7 +2,7 @@ exports[`Switch > renders with ariaLabel correctly 1`] = ` "
-
@@ -11,7 +11,7 @@ exports[`Switch > renders with ariaLabel correctly 1`] = ` exports[`Switch > renders with as correctly 1`] = ` "
-
@@ -20,7 +20,7 @@ exports[`Switch > renders with as correctly 1`] = ` exports[`Switch > renders with checkedIcon correctly 1`] = ` "
-
@@ -29,7 +29,7 @@ exports[`Switch > renders with checkedIcon correctly 1`] = ` exports[`Switch > renders with class correctly 1`] = ` "
-
@@ -38,7 +38,7 @@ exports[`Switch > renders with class correctly 1`] = ` exports[`Switch > renders with color neutral correctly 1`] = ` "
-
@@ -47,7 +47,7 @@ exports[`Switch > renders with color neutral correctly 1`] = ` exports[`Switch > renders with defaultValue correctly 1`] = ` "
-
@@ -56,7 +56,7 @@ exports[`Switch > renders with defaultValue correctly 1`] = ` exports[`Switch > renders with description correctly 1`] = ` "
-
@@ -67,7 +67,7 @@ exports[`Switch > renders with description correctly 1`] = ` exports[`Switch > renders with description slot correctly 1`] = ` "
-
@@ -78,7 +78,7 @@ exports[`Switch > renders with description slot correctly 1`] = ` exports[`Switch > renders with disabled correctly 1`] = ` "
-
@@ -87,7 +87,7 @@ exports[`Switch > renders with disabled correctly 1`] = ` exports[`Switch > renders with id correctly 1`] = ` "
-
@@ -96,7 +96,7 @@ exports[`Switch > renders with id correctly 1`] = ` exports[`Switch > renders with label correctly 1`] = ` "
-
@@ -107,7 +107,7 @@ exports[`Switch > renders with label correctly 1`] = ` exports[`Switch > renders with label slot correctly 1`] = ` "
-
@@ -118,7 +118,7 @@ exports[`Switch > renders with label slot correctly 1`] = ` exports[`Switch > renders with loading correctly 1`] = ` "
-
@@ -127,7 +127,7 @@ exports[`Switch > renders with loading correctly 1`] = ` exports[`Switch > renders with loadingIcon correctly 1`] = ` "
-
@@ -136,7 +136,7 @@ exports[`Switch > renders with loadingIcon correctly 1`] = ` exports[`Switch > renders with modelValue correctly 1`] = ` "
-
@@ -145,7 +145,7 @@ exports[`Switch > renders with modelValue correctly 1`] = ` exports[`Switch > renders with name correctly 1`] = ` "
-
@@ -154,7 +154,7 @@ exports[`Switch > renders with name correctly 1`] = ` exports[`Switch > renders with required correctly 1`] = ` "
-
@@ -165,7 +165,7 @@ exports[`Switch > renders with required correctly 1`] = ` exports[`Switch > renders with size lg correctly 1`] = ` "
-
@@ -174,7 +174,7 @@ exports[`Switch > renders with size lg correctly 1`] = ` exports[`Switch > renders with size md correctly 1`] = ` "
-
@@ -183,7 +183,7 @@ exports[`Switch > renders with size md correctly 1`] = ` exports[`Switch > renders with size sm correctly 1`] = ` "
-
@@ -192,7 +192,7 @@ exports[`Switch > renders with size sm correctly 1`] = ` exports[`Switch > renders with size xl correctly 1`] = ` "
-
@@ -201,7 +201,7 @@ exports[`Switch > renders with size xl correctly 1`] = ` exports[`Switch > renders with size xs correctly 1`] = ` "
-
@@ -210,7 +210,7 @@ exports[`Switch > renders with size xs correctly 1`] = ` exports[`Switch > renders with ui correctly 1`] = ` "
-
@@ -219,7 +219,7 @@ exports[`Switch > renders with ui correctly 1`] = ` exports[`Switch > renders with uncheckedIcon correctly 1`] = ` "
-
@@ -228,7 +228,7 @@ exports[`Switch > renders with uncheckedIcon correctly 1`] = ` exports[`Switch > renders with value correctly 1`] = ` "
-
diff --git a/test/components/__snapshots__/Switch.spec.ts.snap b/test/components/__snapshots__/Switch.spec.ts.snap index e7d5d2c2..65db4e41 100644 --- a/test/components/__snapshots__/Switch.spec.ts.snap +++ b/test/components/__snapshots__/Switch.spec.ts.snap @@ -2,7 +2,7 @@ exports[`Switch > renders with ariaLabel correctly 1`] = ` "
-
@@ -11,7 +11,7 @@ exports[`Switch > renders with ariaLabel correctly 1`] = ` exports[`Switch > renders with as correctly 1`] = ` "
-
@@ -20,7 +20,7 @@ exports[`Switch > renders with as correctly 1`] = ` exports[`Switch > renders with checkedIcon correctly 1`] = ` "
-
@@ -30,7 +30,7 @@ exports[`Switch > renders with checkedIcon correctly 1`] = ` exports[`Switch > renders with class correctly 1`] = ` "
-
@@ -39,7 +39,7 @@ exports[`Switch > renders with class correctly 1`] = ` exports[`Switch > renders with color neutral correctly 1`] = ` "
-
@@ -48,7 +48,7 @@ exports[`Switch > renders with color neutral correctly 1`] = ` exports[`Switch > renders with defaultValue correctly 1`] = ` "
-
@@ -57,7 +57,7 @@ exports[`Switch > renders with defaultValue correctly 1`] = ` exports[`Switch > renders with description correctly 1`] = ` "
-
@@ -68,7 +68,7 @@ exports[`Switch > renders with description correctly 1`] = ` exports[`Switch > renders with description slot correctly 1`] = ` "
-
@@ -79,7 +79,7 @@ exports[`Switch > renders with description slot correctly 1`] = ` exports[`Switch > renders with disabled correctly 1`] = ` "
-
@@ -88,7 +88,7 @@ exports[`Switch > renders with disabled correctly 1`] = ` exports[`Switch > renders with id correctly 1`] = ` "
-
@@ -97,7 +97,7 @@ exports[`Switch > renders with id correctly 1`] = ` exports[`Switch > renders with label correctly 1`] = ` "
-
@@ -108,7 +108,7 @@ exports[`Switch > renders with label correctly 1`] = ` exports[`Switch > renders with label slot correctly 1`] = ` "
-
@@ -119,7 +119,7 @@ exports[`Switch > renders with label slot correctly 1`] = ` exports[`Switch > renders with loading correctly 1`] = ` "
-
@@ -128,7 +128,7 @@ exports[`Switch > renders with loading correctly 1`] = ` exports[`Switch > renders with loadingIcon correctly 1`] = ` "
-
@@ -137,7 +137,7 @@ exports[`Switch > renders with loadingIcon correctly 1`] = ` exports[`Switch > renders with modelValue correctly 1`] = ` "
-
@@ -146,7 +146,7 @@ exports[`Switch > renders with modelValue correctly 1`] = ` exports[`Switch > renders with name correctly 1`] = ` "
-
@@ -155,7 +155,7 @@ exports[`Switch > renders with name correctly 1`] = ` exports[`Switch > renders with required correctly 1`] = ` "
-
@@ -166,7 +166,7 @@ exports[`Switch > renders with required correctly 1`] = ` exports[`Switch > renders with size lg correctly 1`] = ` "
-
@@ -175,7 +175,7 @@ exports[`Switch > renders with size lg correctly 1`] = ` exports[`Switch > renders with size md correctly 1`] = ` "
-
@@ -184,7 +184,7 @@ exports[`Switch > renders with size md correctly 1`] = ` exports[`Switch > renders with size sm correctly 1`] = ` "
-
@@ -193,7 +193,7 @@ exports[`Switch > renders with size sm correctly 1`] = ` exports[`Switch > renders with size xl correctly 1`] = ` "
-
@@ -202,7 +202,7 @@ exports[`Switch > renders with size xl correctly 1`] = ` exports[`Switch > renders with size xs correctly 1`] = ` "
-
@@ -211,7 +211,7 @@ exports[`Switch > renders with size xs correctly 1`] = ` exports[`Switch > renders with ui correctly 1`] = ` "
-
@@ -220,7 +220,7 @@ exports[`Switch > renders with ui correctly 1`] = ` exports[`Switch > renders with uncheckedIcon correctly 1`] = ` "
-
@@ -229,7 +229,7 @@ exports[`Switch > renders with uncheckedIcon correctly 1`] = ` exports[`Switch > renders with value correctly 1`] = ` "
-