���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
/
@nuxt
/
ui
/
dist
/
runtime
/
components
/
forms
/
Viewing: Toggle.vue
<template> <HSwitch :id="inputId" v-model="active" :name="name" :disabled="disabled || loading" :class="switchClass" v-bind="attrs" > <span :class="containerClass"> <span v-if="loading" :class="[ui.icon.active, ui.icon.base]" aria-hidden="true"> <UIcon :name="loadingIcon" :class="loadingIconClass" /> </span> <span v-if="!loading && onIcon" :class="[active ? ui.icon.active : ui.icon.inactive, ui.icon.base]" aria-hidden="true" > <UIcon :name="onIcon" :class="onIconClass" /> </span> <span v-if="!loading && offIcon" :class="[active ? ui.icon.inactive : ui.icon.active, ui.icon.base]" aria-hidden="true" > <UIcon :name="offIcon" :class="offIconClass" /> </span> </span> </HSwitch> </template> <script> import { computed, toRef, defineComponent } from "vue"; import { Switch as HSwitch, provideUseId } from "@headlessui/vue"; import { twMerge, twJoin } from "tailwind-merge"; import UIcon from "../elements/Icon.vue"; import { useUI } from "../../composables/useUI"; import { useFormGroup } from "../../composables/useFormGroup"; import { mergeConfig } from "../../utils"; import appConfig from "#build/app.config"; import { toggle } from "#ui/ui.config"; import { useId } from "#imports"; const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.toggle, toggle); export default defineComponent({ components: { HSwitch, UIcon }, inheritAttrs: false, props: { id: { type: String, default: null }, name: { type: String, default: null }, modelValue: { type: Boolean, default: false }, disabled: { type: Boolean, default: false }, loading: { type: Boolean, default: false }, onIcon: { type: String, default: () => config.default.onIcon }, offIcon: { type: String, default: () => config.default.offIcon }, loadingIcon: { type: String, default: () => config.default.loadingIcon }, color: { type: String, default: () => config.default.color, validator(value) { return appConfig.ui.colors.includes(value); } }, size: { type: String, default: () => config.default.size, validator(value) { return Object.keys(config.size).includes(value); } }, class: { type: [String, Object, Array], default: () => "" }, ui: { type: Object, default: () => ({}) } }, emits: ["update:modelValue", "change"], setup(props, { emit }) { const { ui, attrs } = useUI("toggle", toRef(props, "ui"), config); const { emitFormChange, color, inputId, name } = useFormGroup(props); const active = computed({ get() { return props.modelValue; }, set(value) { emit("update:modelValue", value); emit("change", value); emitFormChange(); } }); const switchClass = computed(() => { return twMerge(twJoin( ui.value.base, ui.value.size[props.size], ui.value.rounded, color.value && ui.value.ring.replaceAll("{color}", color.value), color.value && (active.value ? ui.value.active : ui.value.inactive).replaceAll("{color}", color.value) ), props.class); }); const containerClass = computed(() => { return twJoin( ui.value.container.base, ui.value.container.size[props.size], active.value ? ui.value.container.active[props.size] : ui.value.container.inactive ); }); const onIconClass = computed(() => { return twJoin( ui.value.icon.size[props.size], color.value && ui.value.icon.on.replaceAll("{color}", color.value) ); }); const offIconClass = computed(() => { return twJoin( ui.value.icon.size[props.size], color.value && ui.value.icon.off.replaceAll("{color}", color.value) ); }); const loadingIconClass = computed(() => { return twJoin( ui.value.icon.size[props.size], color.value && ui.value.icon.loading.replaceAll("{color}", color.value) ); }); provideUseId(() => useId()); return { // eslint-disable-next-line vue/no-dupe-keys ui, attrs, // eslint-disable-next-line vue/no-dupe-keys name, inputId, active, switchClass, containerClass, onIconClass, offIconClass, loadingIconClass }; } }); </script>
Coded With 💗 by
0x6ick Mod By V1rus_Alfa