mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-19 06:21:46 +01:00
fix(Progress): handle horizontal animation in RTL mode (#2723)
This commit is contained in:
@@ -50,6 +50,7 @@ export type ProgressSlots = {
|
||||
import { computed } from 'vue'
|
||||
import { ProgressIndicator, ProgressRoot, useForwardPropsEmits } from 'radix-vue'
|
||||
import { reactivePick } from '@vueuse/core'
|
||||
import { useLocale } from '../composables/useLocale'
|
||||
|
||||
const props = withDefaults(defineProps<ProgressProps>(), {
|
||||
inverted: false,
|
||||
@@ -59,6 +60,8 @@ const props = withDefaults(defineProps<ProgressProps>(), {
|
||||
const emits = defineEmits<ProgressEmits>()
|
||||
defineSlots<ProgressSlots>()
|
||||
|
||||
const { dir } = useLocale()
|
||||
|
||||
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'getValueLabel', 'modelValue'), emits)
|
||||
|
||||
const isIndeterminate = computed(() => rootProps.value.modelValue === null)
|
||||
@@ -93,8 +96,20 @@ const indicatorStyle = computed(() => {
|
||||
return
|
||||
}
|
||||
|
||||
return {
|
||||
transform: `translate${props.orientation === 'vertical' ? 'Y' : 'X'}(${props.inverted ? '' : '-'}${100 - percent.value}%)`
|
||||
if (props.orientation === 'vertical') {
|
||||
return {
|
||||
transform: `translateY(${props.inverted ? '' : '-'}${100 - percent.value}%)`
|
||||
}
|
||||
} else {
|
||||
if (dir.value === 'rtl') {
|
||||
return {
|
||||
transform: `translateX(${props.inverted ? '-' : ''}${100 - percent.value}%)`
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
transform: `translateX(${props.inverted ? '' : '-'}${100 - percent.value}%)`
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -362,6 +362,24 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@keyframes carousel-rtl {
|
||||
|
||||
0%,
|
||||
100% {
|
||||
width: 50%
|
||||
}
|
||||
|
||||
0% {
|
||||
transform: translateX(100%)
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translateX(-200%)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@keyframes carousel-vertical {
|
||||
|
||||
0%,
|
||||
@@ -394,6 +412,22 @@
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes carousel-inverse-rtl {
|
||||
|
||||
0%,
|
||||
100% {
|
||||
width: 50%
|
||||
}
|
||||
|
||||
0% {
|
||||
transform: translateX(-200%)
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translateX(100%)
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes carousel-inverse-vertical {
|
||||
|
||||
0%,
|
||||
|
||||
Reference in New Issue
Block a user