From e5119a9ca4e217ef769904323c16bd8c0cbc02d9 Mon Sep 17 00:00:00 2001
From: Malik-Jouda <48517781+Malik-Jouda@users.noreply.github.com>
Date: Thu, 14 Nov 2024 11:17:55 +0200
Subject: [PATCH] fix(Breadcrumb/Carousel/Pagination): handle icons in RTL mode
(#2633)
---
src/runtime/components/Breadcrumb.vue | 8 ++++++--
src/runtime/components/Carousel.vue | 9 ++++++---
src/runtime/components/Pagination.vue | 17 ++++++++++++-----
src/runtime/utils/locale.ts | 2 +-
4 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/src/runtime/components/Breadcrumb.vue b/src/runtime/components/Breadcrumb.vue
index 101d8624..5bb26970 100644
--- a/src/runtime/components/Breadcrumb.vue
+++ b/src/runtime/components/Breadcrumb.vue
@@ -76,8 +76,10 @@ extendDevtoolsMeta({
@@ -123,7 +127,7 @@ const ui = breadcrumb()
-
+
diff --git a/src/runtime/components/Carousel.vue b/src/runtime/components/Carousel.vue
index 852b832c..2eb7683c 100644
--- a/src/runtime/components/Carousel.vue
+++ b/src/runtime/components/Carousel.vue
@@ -135,9 +135,12 @@ const props = withDefaults(defineProps>(), {
defineSlots>()
const appConfig = useAppConfig()
-const { t } = useLocale()
+const { dir, t } = useLocale()
const rootProps = useForwardProps(reactivePick(props, 'active', 'align', 'breakpoints', 'containScroll', 'dragFree', 'dragThreshold', 'duration', 'inViewThreshold', 'loop', 'skipSnaps', 'slidesToScroll', 'startIndex', 'watchDrag', 'watchResize', 'watchSlides', 'watchFocus'))
+const prevIcon = computed(() => props.prevIcon || (dir.value === 'rtl' ? appConfig.ui.icons.arrowRight : appConfig.ui.icons.arrowLeft))
+const nextIcon = computed(() => props.nextIcon || (dir.value === 'rtl' ? appConfig.ui.icons.arrowLeft : appConfig.ui.icons.arrowRight))
+
const ui = computed(() => carousel({
orientation: props.orientation
}))
@@ -277,7 +280,7 @@ defineExpose({
@@ -136,12 +143,12 @@ const ui = pagination()
-
+
-
+
@@ -169,12 +176,12 @@ const ui = pagination()
-
+
-
+
diff --git a/src/runtime/utils/locale.ts b/src/runtime/utils/locale.ts
index 39598167..9428c046 100644
--- a/src/runtime/utils/locale.ts
+++ b/src/runtime/utils/locale.ts
@@ -30,7 +30,7 @@ export function translate(path: string, option: undefined | TranslatorOption, lo
export function buildLocaleContext(locale: MaybeRef): LocaleContext {
const lang = computed(() => unref(locale).name)
const code = computed(() => unref(locale).code)
- const dir = computed(() => unref(locale).dir)
+ const dir = computed(() => unref(locale).dir.toLowerCase())
const localeRef = isRef(locale) ? locale : ref(locale)
return {