File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,24 +9,12 @@ const checked = defineModel<boolean>({
99 required: true ,
1010})
1111const id = useId ()
12- const { locale, locales } = useI18n ()
13- const dir = computed (() => {
14- const localeObj = locales .value .find (item => item .code === locale .value )
15- return localeObj ?.dir ?? ' ltr'
16- })
1712 </script >
1813
1914<template >
2015 <label :for =" id" >
2116 <span class =" toggle--label-text" >{{ label }}</span >
22- <input
23- role =" switch"
24- type =" checkbox"
25- :id
26- class =" toggle--checkbox"
27- :class =" dir"
28- v-model =" checked"
29- />
17+ <input role =" switch" type =" checkbox" :id class =" toggle--checkbox" v-model =" checked" />
3018 <span class =" toggle--background" ></span >
3119 </label >
3220 <p v-if =" description" class =" text-sm text-fg-muted mt-2" >
@@ -95,21 +83,18 @@ label:has(input:hover) .toggle--background {
9583 width : 20px ;
9684 height : 20px ;
9785 top : 1px ;
86+ inset-inline-start : 1px ;
9887 position : absolute ;
9988 border-radius : 9999px ;
10089 background : var (--bg );
10190}
10291
10392/* Support rtl locales */
104- .toggle--checkbox + .toggle--background ::before {
105- inset-inline-start : 3px ;
106- }
107-
108- .toggle--checkbox :checked .ltr + .toggle--background ::before {
109- transform : translate (19px );
93+ :dir (ltr ) .toggle--checkbox :checked + .toggle--background ::before {
94+ transform : translate (20px );
11095}
11196
112- .toggle--checkbox :checked .rtl + .toggle--background ::before {
113- transform : translate (-19 px );
97+ :dir ( rtl ) .toggle--checkbox :checked + .toggle--background ::before {
98+ transform : translate (-20 px );
11499}
115100 </style >
You can’t perform that action at this time.
0 commit comments