diff --git a/src/runtime/components/Pagination.vue b/src/runtime/components/Pagination.vue index fc3a336961..7a6c2c4abf 100644 --- a/src/runtime/components/Pagination.vue +++ b/src/runtime/components/Pagination.vue @@ -109,7 +109,6 @@ import { useForwardProps } from '../composables/useForwardProps' import { reactivePick } from '@vueuse/core' import { useAppConfig } from '#imports' import { useComponentProps } from '../composables/useComponentProps' -import { useLocale } from '../composables/useLocale' import { tv } from '../utils/tv' import UButton from './Button.vue' @@ -129,19 +128,18 @@ const slots = defineSlots() const props = useComponentProps('pagination', _props) -const { dir } = useLocale() const appConfig = useAppConfig() as Pagination['AppConfig'] const rootProps = useForwardProps(reactivePick(props, 'as', 'defaultPage', 'disabled', 'itemsPerPage', 'page', 'showEdges', 'siblingCount', 'total'), emits) // eslint-disable-next-line vue/no-dupe-keys -const firstIcon = computed(() => props.firstIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronDoubleRight : appConfig.ui.icons.chevronDoubleLeft)) +const firstIcon = computed(() => props.firstIcon || appConfig.ui.icons.chevronDoubleLeft) // eslint-disable-next-line vue/no-dupe-keys -const prevIcon = computed(() => props.prevIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronRight : appConfig.ui.icons.chevronLeft)) +const prevIcon = computed(() => props.prevIcon || appConfig.ui.icons.chevronLeft) // eslint-disable-next-line vue/no-dupe-keys -const nextIcon = computed(() => props.nextIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronLeft : appConfig.ui.icons.chevronRight)) +const nextIcon = computed(() => props.nextIcon || appConfig.ui.icons.chevronRight) // eslint-disable-next-line vue/no-dupe-keys -const lastIcon = computed(() => props.lastIcon || (dir.value === 'rtl' ? appConfig.ui.icons.chevronDoubleLeft : appConfig.ui.icons.chevronDoubleRight)) +const lastIcon = computed(() => props.lastIcon || appConfig.ui.icons.chevronDoubleRight) // eslint-disable-next-line vue/no-dupe-keys const ui = computed(() => tv({ extend: theme, ...(appConfig.ui?.pagination || {}) })()) @@ -152,12 +150,26 @@ const ui = computed(() => tv({ extend: theme, ...(appConfig.ui?.pagination || {} - + - + @@ -185,12 +197,26 @@ const ui = computed(() => tv({ extend: theme, ...(appConfig.ui?.pagination || {} - + - + diff --git a/test/components/Pagination.spec.ts b/test/components/Pagination.spec.ts index e437ecd1c2..fbcb865431 100644 --- a/test/components/Pagination.spec.ts +++ b/test/components/Pagination.spec.ts @@ -55,4 +55,23 @@ describe('Pagination', () => { expect(await axe(wrapper.element)).toHaveNoViolations() }) + + it('mirrors default control icons in RTL', async () => { + const wrapper = await mountSuspended(Pagination, { + props: { + total: 100, + page: 5, + showEdges: true, + siblingCount: 1 + } + }) + + for (const control of ['first', 'prev', 'next', 'last']) { + const icon = wrapper.find(`[data-slot="${control}"] [data-slot="leadingIcon"]`) + expect(icon.classes(), `${control} icon`).toContain('rtl:-scale-x-100') + } + + const ellipsisIcon = wrapper.find('[data-slot="ellipsis"] [data-slot="leadingIcon"]') + expect(ellipsisIcon.classes(), 'ellipsis icon').not.toContain('rtl:-scale-x-100') + }) }) diff --git a/test/components/__snapshots__/Pagination-vue.spec.ts.snap b/test/components/__snapshots__/Pagination-vue.spec.ts.snap index d226b682a6..d0ea890211 100644 --- a/test/components/__snapshots__/Pagination-vue.spec.ts.snap +++ b/test/components/__snapshots__/Pagination-vue.spec.ts.snap @@ -2,10 +2,10 @@ exports[`Pagination > renders with as correctly 1`] = ` "
-
@@ -35,10 +35,10 @@ exports[`Pagination > renders with as correctly 1`] = ` exports[`Pagination > renders with class correctly 1`] = ` "