���Root Mod By V1rus_Alfa
User / IP
:
216.73.217.78
Host / Server
:
195.214.235.115 / npln.ir
System
:
Linux damavand.pws-dns.net 5.14.0-503.35.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 4 05:23:43 EDT 2025 x86_64
Command
|
Upload
|
Mass Deface
|
Create
:
/
home2
/
cutunixc
/
.trash
/
node_modules.2
/
@nuxt
/
ui
/
dist
/
runtime
/
components
/
elements
/
Viewing: Carousel.vue
<template> <div :class="ui.wrapper" v-bind="attrs"> <div ref="carouselRef" :class="ui.container" class="no-scrollbar"> <div v-for="(item, index) in items" :key="index" :class="ui.item" :role="indicators ? 'tabpanel' : null" > <slot :item="item" :index="index" /> </div> </div> <div v-if="arrows" :class="ui.arrows.wrapper"> <slot name="prev" :on-click="onClickPrev" :disabled="isFirst"> <UButton v-if="prevButton" :disabled="isFirst" v-bind="{ ...ui.default.prevButton, ...prevButton }" :class="twMerge(ui.default.prevButton.class, prevButton?.class)" aria-label="Prev" @click="onClickPrev" /> </slot> <slot name="next" :on-click="onClickNext" :disabled="isLast"> <UButton v-if="nextButton" :disabled="isLast" v-bind="{ ...ui.default.nextButton, ...nextButton }" :class="twMerge(ui.default.nextButton.class, nextButton?.class)" aria-label="Next" @click="onClickNext" /> </slot> </div> <div v-if="indicators" role="tablist" :class="ui.indicators.wrapper"> <template v-for="page in pages" :key="page"> <slot name="indicator" :on-click="onClick" :active="page === currentPage" :page="page"> <button type="button" role="tab" :aria-selected="page === currentPage" :class="[ ui.indicators.base, page === currentPage ? ui.indicators.active : ui.indicators.inactive ]" :aria-label="`set slide ${page}`" @click="onClick(page)" /> </slot> </template> </div> </div> </template> <script> import { ref, toRef, computed, defineComponent } from "vue"; import { twMerge } from "tailwind-merge"; import { mergeConfig } from "../../utils"; import UButton from "../elements/Button.vue"; import { useUI } from "../../composables/useUI"; import { useCarouselScroll } from "../../composables/useCarouselScroll"; import { useScroll, useResizeObserver, useElementSize } from "@vueuse/core"; import appConfig from "#build/app.config"; import { carousel } from "#ui/ui.config"; const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.carousel, carousel); export default defineComponent({ components: { UButton }, inheritAttrs: false, props: { items: { type: Array, default: () => [] }, arrows: { type: Boolean, default: false }, indicators: { type: Boolean, default: false }, prevButton: { type: Object, default: () => config.default.prevButton }, nextButton: { type: Object, default: () => config.default.nextButton }, class: { type: [String, Object, Array], default: () => "" }, ui: { type: Object, default: void 0 } }, setup(props, { expose }) { const { ui, attrs } = useUI("carousel", toRef(props, "ui"), config, toRef(props, "class")); const carouselRef = ref(); const itemWidth = ref(0); const { x } = useScroll(carouselRef, { behavior: "smooth" }); const { width: carouselWidth } = useElementSize(carouselRef); useCarouselScroll(carouselRef); useResizeObserver(carouselRef, (entries) => { const [entry] = entries; itemWidth.value = entry?.target?.firstElementChild?.clientWidth || 0; }); const currentPage = computed(() => { if (!itemWidth.value) { return 0; } return Math.round(x.value / itemWidth.value) + 1; }); const pages = computed(() => { if (!itemWidth.value) { return 0; } return props.items.length - Math.round(carouselWidth.value / itemWidth.value) + 1; }); const isFirst = computed(() => currentPage.value <= 1); const isLast = computed(() => currentPage.value === pages.value); function onClickNext() { x.value += itemWidth.value; } function onClickPrev() { x.value -= itemWidth.value; } function onClick(page) { x.value = (page - 1) * itemWidth.value; } expose({ pages, page: currentPage, prev: onClickPrev, next: onClickNext, select: onClick }); return { // eslint-disable-next-line vue/no-dupe-keys ui, attrs, isFirst, isLast, carouselRef, pages, currentPage, onClickNext, onClickPrev, onClick, twMerge }; } }); </script> <style scoped> .no-scrollbar::-webkit-scrollbar{display:none}.no-scrollbar{-ms-overflow-style:none;scrollbar-width:none} </style>
Coded With 💗 by
0x6ick Mod By V1rus_Alfa