@smurfox/proxy-ui 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TabsRounded, TabsProps } from "../types/index.js";
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<TabsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
3
|
+
"update:modelValue": (value: string) => any;
|
|
4
|
+
}, string, import("vue").PublicProps, Readonly<TabsProps> & Readonly<{
|
|
5
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
6
|
+
}>, {
|
|
7
|
+
rounded: TabsRounded;
|
|
8
|
+
iconSize: number;
|
|
9
|
+
modelValue: string;
|
|
10
|
+
bgColor: string;
|
|
11
|
+
btnColor: string;
|
|
12
|
+
activeTextColor: string;
|
|
13
|
+
inactiveTextColor: string;
|
|
14
|
+
disabledTabs: string[];
|
|
15
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="inline-flex gap-1 p-1"
|
|
4
|
+
:class="[bgColor, roundedClasses[rounded]]"
|
|
5
|
+
>
|
|
6
|
+
<button
|
|
7
|
+
v-for="tab in tabs"
|
|
8
|
+
:key="tab.value"
|
|
9
|
+
class="relative flex items-center gap-2"
|
|
10
|
+
:disabled="tab.disabled || disabledTabs.includes(tab.value)"
|
|
11
|
+
:class="[
|
|
12
|
+
'px-4 py-1.5 text-sm font-medium transition-colors duration-200',
|
|
13
|
+
roundedClasses[rounded],
|
|
14
|
+
tab.disabled || disabledTabs.includes(tab.value) ? 'text-black/30 dark:text-white/40' : modelValue === tab.value ? activeTextColor + ' cursor-pointer' : inactiveTextColor + ' cursor-pointer'
|
|
15
|
+
]"
|
|
16
|
+
@click="
|
|
17
|
+
!(tab.disabled || disabledTabs.includes(tab.value)) && emit('update:modelValue', tab.value)
|
|
18
|
+
"
|
|
19
|
+
>
|
|
20
|
+
<motion.div
|
|
21
|
+
v-if="modelValue === tab.value"
|
|
22
|
+
layout-id="tab-indicator"
|
|
23
|
+
class="absolute inset-0 shadow-sm"
|
|
24
|
+
:class="[btnColor, roundedClasses[rounded]]"
|
|
25
|
+
:transition="{ type: 'spring', stiffness: 400, damping: 35 }"
|
|
26
|
+
/>
|
|
27
|
+
<Icon
|
|
28
|
+
v-if="tab.icon"
|
|
29
|
+
:name="tab.icon"
|
|
30
|
+
:size="iconSize"
|
|
31
|
+
class="relative z-10"
|
|
32
|
+
/>
|
|
33
|
+
<span class="relative z-10">{{ tab.label }}</span>
|
|
34
|
+
</button>
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script setup>
|
|
39
|
+
import { motion } from "motion-v";
|
|
40
|
+
const roundedClasses = {
|
|
41
|
+
none: "rounded-none",
|
|
42
|
+
xs: "rounded-xs",
|
|
43
|
+
sm: "rounded-sm",
|
|
44
|
+
md: "rounded-md",
|
|
45
|
+
lg: "rounded-lg",
|
|
46
|
+
xl: "rounded-xl",
|
|
47
|
+
"2xl": "rounded-2xl",
|
|
48
|
+
full: "rounded-full"
|
|
49
|
+
};
|
|
50
|
+
const props = defineProps({
|
|
51
|
+
modelValue: { type: String, required: true, default: "" },
|
|
52
|
+
tabs: { type: Array, required: true },
|
|
53
|
+
iconSize: { type: Number, required: false, default: 15 },
|
|
54
|
+
rounded: { type: String, required: false, default: "lg" },
|
|
55
|
+
bgColor: { type: String, required: false, default: "bg-black/5 dark:bg-white/10" },
|
|
56
|
+
btnColor: { type: String, required: false, default: "bg-white dark:bg-white/10" },
|
|
57
|
+
activeTextColor: { type: String, required: false, default: "text-black dark:text-white" },
|
|
58
|
+
inactiveTextColor: { type: String, required: false, default: "text-black/70 dark:text-white/70 hover:text-black dark:hover:text-white" },
|
|
59
|
+
disabledTabs: { type: Array, required: false, default: () => [] }
|
|
60
|
+
});
|
|
61
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
62
|
+
</script>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TabsRounded, TabsProps } from "../types/index.js";
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<TabsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
3
|
+
"update:modelValue": (value: string) => any;
|
|
4
|
+
}, string, import("vue").PublicProps, Readonly<TabsProps> & Readonly<{
|
|
5
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
6
|
+
}>, {
|
|
7
|
+
rounded: TabsRounded;
|
|
8
|
+
iconSize: number;
|
|
9
|
+
modelValue: string;
|
|
10
|
+
bgColor: string;
|
|
11
|
+
btnColor: string;
|
|
12
|
+
activeTextColor: string;
|
|
13
|
+
inactiveTextColor: string;
|
|
14
|
+
disabledTabs: string[];
|
|
15
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
@@ -38,3 +38,21 @@ export interface CardProps {
|
|
|
38
38
|
}
|
|
39
39
|
export type AvatarSize = "sm" | "md" | "lg" | "full";
|
|
40
40
|
export type AvatarRounded = "none" | "sm" | "md" | "lg" | "xl" | "2xl" | "full";
|
|
41
|
+
export type TabsRounded = "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "full";
|
|
42
|
+
export interface TabItem {
|
|
43
|
+
label: string;
|
|
44
|
+
value: string;
|
|
45
|
+
icon?: string;
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface TabsProps {
|
|
49
|
+
modelValue: string;
|
|
50
|
+
tabs: TabItem[];
|
|
51
|
+
iconSize?: number;
|
|
52
|
+
rounded?: TabsRounded;
|
|
53
|
+
bgColor?: string;
|
|
54
|
+
btnColor?: string;
|
|
55
|
+
activeTextColor?: string;
|
|
56
|
+
inactiveTextColor?: string;
|
|
57
|
+
disabledTabs?: string[];
|
|
58
|
+
}
|