@smurfox/proxy-ui 0.1.35 → 0.2.1
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/README.md +253 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +3 -2
- package/dist/runtime/components/Avatar.d.vue.ts +1 -1
- package/dist/runtime/components/Avatar.vue +18 -13
- package/dist/runtime/components/Avatar.vue.d.ts +1 -1
- package/dist/runtime/components/Button.d.vue.ts +1 -1
- package/dist/runtime/components/Button.vue +30 -12
- package/dist/runtime/components/Button.vue.d.ts +1 -1
- package/dist/runtime/components/Card.d.vue.ts +1 -1
- package/dist/runtime/components/Card.vue.d.ts +1 -1
- package/dist/runtime/components/Chip.d.vue.ts +1 -1
- package/dist/runtime/components/Chip.vue +25 -13
- package/dist/runtime/components/Chip.vue.d.ts +1 -1
- package/dist/runtime/components/Dropdown.d.vue.ts +12 -0
- package/dist/runtime/components/Dropdown.vue +51 -0
- package/dist/runtime/components/Dropdown.vue.d.ts +12 -0
- package/dist/runtime/components/Input.d.vue.ts +2 -2
- package/dist/runtime/components/Input.vue +25 -13
- package/dist/runtime/components/Input.vue.d.ts +2 -2
- package/dist/runtime/components/Select.d.vue.ts +2 -2
- package/dist/runtime/components/Select.vue +104 -86
- package/dist/runtime/components/Select.vue.d.ts +2 -2
- package/dist/runtime/components/Table.d.vue.ts +98 -0
- package/dist/runtime/components/Table.vue +196 -0
- package/dist/runtime/components/Table.vue.d.ts +98 -0
- package/dist/runtime/components/Tabs.d.vue.ts +2 -2
- package/dist/runtime/components/Tabs.vue +8 -8
- package/dist/runtime/components/Tabs.vue.d.ts +2 -2
- package/dist/runtime/components/TextArea.d.vue.ts +1 -1
- package/dist/runtime/components/TextArea.vue +51 -51
- package/dist/runtime/components/TextArea.vue.d.ts +1 -1
- package/dist/runtime/types/index.d.ts +15 -14
- package/package.json +1 -1
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="flex flex-col gap-1">
|
|
3
|
-
<div
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
<div
|
|
4
|
+
v-if="label"
|
|
5
|
+
class="flex items-start gap-1"
|
|
6
|
+
>
|
|
7
|
+
<label
|
|
8
|
+
class="dark:text-white"
|
|
9
|
+
:class="[labelClass]"
|
|
10
|
+
>{{ label }} </label>
|
|
11
|
+
<span
|
|
12
|
+
v-if="props.required"
|
|
13
|
+
class="text-danger"
|
|
14
|
+
>*</span>
|
|
6
15
|
</div>
|
|
7
16
|
<div class="relative w-full">
|
|
8
17
|
<!-- startContent -->
|
|
@@ -20,7 +29,7 @@
|
|
|
20
29
|
:class="[
|
|
21
30
|
$slots.startContent ? 'pl-9' : '',
|
|
22
31
|
$slots.endContent ? 'pr-9' : '',
|
|
23
|
-
|
|
32
|
+
roundedClasses[props.rounded],
|
|
24
33
|
props.error ? errorVariants[props.variant] : variants[props.variant],
|
|
25
34
|
props.disabled ? 'opacity-70' : ''
|
|
26
35
|
]"
|
|
@@ -29,7 +38,7 @@
|
|
|
29
38
|
@input="
|
|
30
39
|
emit('update:modelValue', $event.target.value)
|
|
31
40
|
"
|
|
32
|
-
|
|
41
|
+
>
|
|
33
42
|
<!-- endContent -->
|
|
34
43
|
<div
|
|
35
44
|
v-if="$slots.endContent"
|
|
@@ -45,21 +54,24 @@
|
|
|
45
54
|
{{ description }}
|
|
46
55
|
</p>
|
|
47
56
|
<!-- error message fuera de contenedor relativo -->
|
|
48
|
-
<p
|
|
57
|
+
<p
|
|
58
|
+
v-if="props.error"
|
|
59
|
+
class="text-danger text-xs mt-1"
|
|
60
|
+
>
|
|
49
61
|
{{ props.error }}
|
|
50
62
|
</p>
|
|
51
63
|
</div>
|
|
52
64
|
</template>
|
|
53
65
|
|
|
54
66
|
<script setup>
|
|
55
|
-
const
|
|
56
|
-
none: "rounded-none",
|
|
57
|
-
sm: "rounded-sm",
|
|
58
|
-
md: "rounded-md",
|
|
59
|
-
lg: "rounded-lg",
|
|
60
|
-
xl: "rounded-xl",
|
|
67
|
+
const roundedClasses = {
|
|
68
|
+
"none": "rounded-none",
|
|
69
|
+
"sm": "rounded-sm",
|
|
70
|
+
"md": "rounded-md",
|
|
71
|
+
"lg": "rounded-lg",
|
|
72
|
+
"xl": "rounded-xl",
|
|
61
73
|
"2xl": "rounded-2xl",
|
|
62
|
-
full: "rounded-full"
|
|
74
|
+
"full": "rounded-full"
|
|
63
75
|
};
|
|
64
76
|
const variants = {
|
|
65
77
|
default: "border border-gray-200 dark:border-white/10 bg-white dark:bg-white/10 enabled:hover:bg-gray-100 dark:enabled:hover:bg-white/20 dark:text-white focus:bg-white dark:focus:bg-white/10 focus:ring-2 focus:ring-primary focus:outline-none",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InputVariant, InputRounded } from
|
|
1
|
+
import type { InputVariant, InputRounded } from '../types/index.js';
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
modelValue?: string | number;
|
|
4
4
|
type?: string;
|
|
@@ -27,8 +27,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
27
27
|
type: string;
|
|
28
28
|
variant: InputVariant;
|
|
29
29
|
disabled: boolean;
|
|
30
|
-
labelClass: string;
|
|
31
30
|
required: boolean;
|
|
31
|
+
labelClass: string;
|
|
32
32
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
33
33
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
34
34
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InputRounded, InputVariant } from
|
|
1
|
+
import type { InputRounded, InputVariant } from '../types/index.js';
|
|
2
2
|
interface SelectOption {
|
|
3
3
|
label: string;
|
|
4
4
|
value: string | number;
|
|
@@ -28,9 +28,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
28
28
|
variant: InputVariant;
|
|
29
29
|
disabled: boolean;
|
|
30
30
|
placeholder: string;
|
|
31
|
+
required: boolean;
|
|
31
32
|
modelValue: string | number | null;
|
|
32
33
|
labelClass: string;
|
|
33
|
-
required: boolean;
|
|
34
34
|
options: SelectOption[];
|
|
35
35
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
36
36
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,109 +1,127 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="flex flex-col gap-1">
|
|
3
|
-
<div
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
<div class="flex flex-col gap-1">
|
|
3
|
+
<div
|
|
4
|
+
v-if="label"
|
|
5
|
+
class="flex items-start gap-1"
|
|
6
|
+
>
|
|
7
|
+
<label
|
|
8
|
+
class="dark:text-white"
|
|
9
|
+
:class="[labelClass]"
|
|
10
|
+
>{{ label }} </label>
|
|
11
|
+
<span
|
|
12
|
+
v-if="props.required"
|
|
13
|
+
class="text-danger"
|
|
14
|
+
>*</span>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<div
|
|
18
|
+
ref="selectRef"
|
|
19
|
+
class="relative w-full text-left"
|
|
20
|
+
>
|
|
21
|
+
<button
|
|
22
|
+
type="button"
|
|
23
|
+
class="w-full p-3 text-sm text-left transition-colors flex items-center justify-between gap-3"
|
|
12
24
|
:class="[
|
|
13
25
|
roundedVariants[props.rounded],
|
|
14
26
|
props.error ? errorVariants[props.variant] : variants[props.variant],
|
|
15
27
|
props.disabled ? 'opacity-70 cursor-not-allowed' : 'cursor-pointer',
|
|
16
28
|
!selectedOption ? 'text-gray-500 dark:text-white/50' : ''
|
|
17
|
-
]"
|
|
18
|
-
:disabled="props.disabled"
|
|
19
|
-
@click.stop="toggle"
|
|
20
|
-
>
|
|
21
|
-
<span class="truncate">
|
|
22
|
-
{{ displayText }}
|
|
23
|
-
</span>
|
|
24
|
-
<Icon
|
|
25
|
-
name="mdi:chevron-down"
|
|
26
|
-
class="text-gray-400 transition-transform duration-200 shrink-0"
|
|
27
|
-
:class="{ 'rotate-180': isOpen && !props.disabled }"
|
|
28
|
-
/>
|
|
29
|
-
</button>
|
|
30
|
-
|
|
31
|
-
<Teleport
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
]"
|
|
30
|
+
:disabled="props.disabled"
|
|
31
|
+
@click.stop="toggle"
|
|
32
|
+
>
|
|
33
|
+
<span class="truncate">
|
|
34
|
+
{{ displayText }}
|
|
35
|
+
</span>
|
|
36
|
+
<Icon
|
|
37
|
+
name="mdi:chevron-down"
|
|
38
|
+
class="text-gray-400 transition-transform duration-200 shrink-0"
|
|
39
|
+
:class="{ 'rotate-180': isOpen && !props.disabled }"
|
|
40
|
+
/>
|
|
41
|
+
</button>
|
|
42
|
+
|
|
43
|
+
<Teleport
|
|
44
|
+
v-if="isOpen && !props.disabled"
|
|
45
|
+
to="body"
|
|
46
|
+
>
|
|
47
|
+
<AnimatePresence>
|
|
48
|
+
<motion.div
|
|
49
|
+
v-if="isOpen && !props.disabled"
|
|
50
|
+
:initial="{ scale: 0.96, opacity: 0, y: -6 }"
|
|
51
|
+
:animate="{ scale: 1, opacity: 1, y: 0 }"
|
|
52
|
+
:exit="{ scale: 0.96, opacity: 0, y: -6 }"
|
|
53
|
+
class="fixed p-2 max-h-56 overflow-y-auto origin-top border rounded-xl shadow-xl"
|
|
39
54
|
:class="
|
|
40
55
|
isDarkMode ? 'bg-[#212123] border-white/10 text-white' : 'bg-white border-gray-100'
|
|
41
|
-
"
|
|
42
|
-
:style="dropdownStyle"
|
|
43
|
-
@click.stop
|
|
44
|
-
>
|
|
45
|
-
<div
|
|
46
|
-
v-if="props.options.length === 0"
|
|
47
|
-
class="px-4 py-2 text-sm text-center"
|
|
48
|
-
:class="isDarkMode ? 'text-white/60' : 'text-black/50'"
|
|
49
|
-
>
|
|
50
|
-
No available options
|
|
51
|
-
</div>
|
|
52
|
-
<template v-else>
|
|
53
|
-
<button
|
|
54
|
-
v-for="option in props.options"
|
|
55
|
-
:key="String(option.value)"
|
|
56
|
-
type="button"
|
|
57
|
-
class="w-full flex items-center justify-between gap-3 px-3 py-2 mb-1 text-left cursor-pointer rounded-lg transition-colors"
|
|
56
|
+
"
|
|
57
|
+
:style="dropdownStyle"
|
|
58
|
+
@click.stop
|
|
59
|
+
>
|
|
60
|
+
<div
|
|
61
|
+
v-if="props.options.length === 0"
|
|
62
|
+
class="px-4 py-2 text-sm text-center"
|
|
63
|
+
:class="isDarkMode ? 'text-white/60' : 'text-black/50'"
|
|
64
|
+
>
|
|
65
|
+
No available options
|
|
66
|
+
</div>
|
|
67
|
+
<template v-else>
|
|
68
|
+
<button
|
|
69
|
+
v-for="option in props.options"
|
|
70
|
+
:key="String(option.value)"
|
|
71
|
+
type="button"
|
|
72
|
+
class="w-full flex items-center justify-between gap-3 px-3 py-2 mb-1 text-left cursor-pointer rounded-lg transition-colors"
|
|
58
73
|
:class="[
|
|
59
74
|
isDarkMode ? 'hover:bg-white/10' : 'hover:bg-gray-100',
|
|
60
75
|
option.value === props.modelValue ? selectedOptionClass : ''
|
|
61
|
-
]"
|
|
62
|
-
@click.stop="selectOption(option)"
|
|
63
|
-
>
|
|
64
|
-
<span
|
|
65
|
-
class="text-sm truncate"
|
|
76
|
+
]"
|
|
77
|
+
@click.stop="selectOption(option)"
|
|
78
|
+
>
|
|
79
|
+
<span
|
|
80
|
+
class="text-sm truncate"
|
|
66
81
|
:class="
|
|
67
82
|
option.value === props.modelValue ? 'text-primary' : unselectedOptionClass
|
|
68
|
-
"
|
|
69
|
-
>
|
|
70
|
-
{{ option.label }}
|
|
71
|
-
</span>
|
|
72
|
-
<Icon
|
|
73
|
-
v-if="option.value === props.modelValue"
|
|
74
|
-
name="mdi:check"
|
|
75
|
-
class="text-primary text-sm shrink-0"
|
|
76
|
-
/>
|
|
77
|
-
</button>
|
|
78
|
-
</template>
|
|
79
|
-
</motion.div>
|
|
80
|
-
</AnimatePresence>
|
|
81
|
-
</Teleport>
|
|
82
|
-
</div>
|
|
83
|
-
|
|
84
|
-
<p
|
|
85
|
-
v-if="description && !props.error"
|
|
86
|
-
class="text-gray-600 dark:text-white/60 text-xs"
|
|
87
|
-
>
|
|
88
|
-
{{ description }}
|
|
89
|
-
</p>
|
|
90
|
-
<p
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
83
|
+
"
|
|
84
|
+
>
|
|
85
|
+
{{ option.label }}
|
|
86
|
+
</span>
|
|
87
|
+
<Icon
|
|
88
|
+
v-if="option.value === props.modelValue"
|
|
89
|
+
name="mdi:check"
|
|
90
|
+
class="text-primary text-sm shrink-0"
|
|
91
|
+
/>
|
|
92
|
+
</button>
|
|
93
|
+
</template>
|
|
94
|
+
</motion.div>
|
|
95
|
+
</AnimatePresence>
|
|
96
|
+
</Teleport>
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
<p
|
|
100
|
+
v-if="description && !props.error"
|
|
101
|
+
class="text-gray-600 dark:text-white/60 text-xs"
|
|
102
|
+
>
|
|
103
|
+
{{ description }}
|
|
104
|
+
</p>
|
|
105
|
+
<p
|
|
106
|
+
v-if="props.error"
|
|
107
|
+
class="text-danger text-xs mt-1"
|
|
108
|
+
>
|
|
109
|
+
{{ props.error }}
|
|
110
|
+
</p>
|
|
111
|
+
</div>
|
|
94
112
|
</template>
|
|
95
113
|
|
|
96
114
|
<script setup>
|
|
97
115
|
import { AnimatePresence, motion } from "motion-v";
|
|
98
116
|
import { computed, nextTick, onMounted, onUnmounted, ref } from "vue";
|
|
99
117
|
const roundedVariants = {
|
|
100
|
-
none: "rounded-none",
|
|
101
|
-
sm: "rounded-sm",
|
|
102
|
-
md: "rounded-md",
|
|
103
|
-
lg: "rounded-lg",
|
|
104
|
-
xl: "rounded-xl",
|
|
118
|
+
"none": "rounded-none",
|
|
119
|
+
"sm": "rounded-sm",
|
|
120
|
+
"md": "rounded-md",
|
|
121
|
+
"lg": "rounded-lg",
|
|
122
|
+
"xl": "rounded-xl",
|
|
105
123
|
"2xl": "rounded-2xl",
|
|
106
|
-
full: "rounded-full"
|
|
124
|
+
"full": "rounded-full"
|
|
107
125
|
};
|
|
108
126
|
const variants = {
|
|
109
127
|
default: "border border-gray-200 dark:border-white/10 bg-white dark:bg-white/10 enabled:hover:bg-gray-100 dark:enabled:hover:bg-white/20 dark:text-white focus:bg-white dark:focus:bg-white/10 focus:ring-2 focus:ring-primary focus:outline-none",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InputRounded, InputVariant } from
|
|
1
|
+
import type { InputRounded, InputVariant } from '../types/index.js';
|
|
2
2
|
interface SelectOption {
|
|
3
3
|
label: string;
|
|
4
4
|
value: string | number;
|
|
@@ -28,9 +28,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
28
28
|
variant: InputVariant;
|
|
29
29
|
disabled: boolean;
|
|
30
30
|
placeholder: string;
|
|
31
|
+
required: boolean;
|
|
31
32
|
modelValue: string | number | null;
|
|
32
33
|
labelClass: string;
|
|
33
|
-
required: boolean;
|
|
34
34
|
options: SelectOption[];
|
|
35
35
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
36
36
|
declare const _default: typeof __VLS_export;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
declare const roundedClasses: {
|
|
2
|
+
readonly none: "rounded-none";
|
|
3
|
+
readonly xs: "rounded-xs";
|
|
4
|
+
readonly sm: "rounded-sm";
|
|
5
|
+
readonly md: "rounded-md";
|
|
6
|
+
readonly lg: "rounded-lg";
|
|
7
|
+
readonly xl: "rounded-xl";
|
|
8
|
+
readonly '2xl': "rounded-2xl";
|
|
9
|
+
readonly '3xl': "rounded-3xl";
|
|
10
|
+
readonly full: "rounded-full";
|
|
11
|
+
};
|
|
12
|
+
declare const sizes: {
|
|
13
|
+
readonly sm: "py-2";
|
|
14
|
+
readonly md: "py-4";
|
|
15
|
+
readonly lg: "py-6";
|
|
16
|
+
};
|
|
17
|
+
type __VLS_Props = {
|
|
18
|
+
items?: Array<{
|
|
19
|
+
id: string | number;
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
}>;
|
|
22
|
+
columns?: {
|
|
23
|
+
name: string;
|
|
24
|
+
id: string;
|
|
25
|
+
width?: string;
|
|
26
|
+
}[];
|
|
27
|
+
rounded?: keyof typeof roundedClasses;
|
|
28
|
+
isBordered?: boolean;
|
|
29
|
+
isSelectable?: boolean;
|
|
30
|
+
headerColor?: string;
|
|
31
|
+
bodyColor?: string;
|
|
32
|
+
itemsSize?: keyof typeof sizes;
|
|
33
|
+
};
|
|
34
|
+
declare var __VLS_10: `cell-${string}`, __VLS_11: {
|
|
35
|
+
item: {
|
|
36
|
+
[key: string]: unknown;
|
|
37
|
+
id: string | number;
|
|
38
|
+
};
|
|
39
|
+
value: unknown;
|
|
40
|
+
}, __VLS_21: {
|
|
41
|
+
item: {
|
|
42
|
+
[key: string]: unknown;
|
|
43
|
+
id: string | number;
|
|
44
|
+
};
|
|
45
|
+
columns: {
|
|
46
|
+
name: string;
|
|
47
|
+
id: string;
|
|
48
|
+
width?: string;
|
|
49
|
+
}[];
|
|
50
|
+
}, __VLS_24: `cell-${string}`, __VLS_25: {
|
|
51
|
+
item: {
|
|
52
|
+
[key: string]: unknown;
|
|
53
|
+
id: string | number;
|
|
54
|
+
};
|
|
55
|
+
value: unknown;
|
|
56
|
+
};
|
|
57
|
+
type __VLS_Slots = {} & {
|
|
58
|
+
[K in NonNullable<typeof __VLS_10>]?: (props: typeof __VLS_11) => any;
|
|
59
|
+
} & {
|
|
60
|
+
[K in NonNullable<typeof __VLS_24>]?: (props: typeof __VLS_25) => any;
|
|
61
|
+
} & {
|
|
62
|
+
'mobile-card'?: (props: typeof __VLS_21) => any;
|
|
63
|
+
};
|
|
64
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
65
|
+
"row-click": (item: {
|
|
66
|
+
[key: string]: unknown;
|
|
67
|
+
id: string | number;
|
|
68
|
+
}) => any;
|
|
69
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
70
|
+
"onRow-click"?: ((item: {
|
|
71
|
+
[key: string]: unknown;
|
|
72
|
+
id: string | number;
|
|
73
|
+
}) => any) | undefined;
|
|
74
|
+
}>, {
|
|
75
|
+
rounded: keyof typeof roundedClasses;
|
|
76
|
+
columns: {
|
|
77
|
+
name: string;
|
|
78
|
+
id: string;
|
|
79
|
+
width?: string;
|
|
80
|
+
}[];
|
|
81
|
+
isBordered: boolean;
|
|
82
|
+
items: Array<{
|
|
83
|
+
id: string | number;
|
|
84
|
+
[key: string]: unknown;
|
|
85
|
+
}>;
|
|
86
|
+
isSelectable: boolean;
|
|
87
|
+
headerColor: string;
|
|
88
|
+
bodyColor: string;
|
|
89
|
+
itemsSize: keyof typeof sizes;
|
|
90
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
91
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
92
|
+
declare const _default: typeof __VLS_export;
|
|
93
|
+
export default _default;
|
|
94
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
95
|
+
new (): {
|
|
96
|
+
$slots: S;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="relative w-full">
|
|
3
|
+
<!-- Vista de tabla para pantallas medianas y grandes -->
|
|
4
|
+
<div
|
|
5
|
+
class="hidden md:block overflow-x-clip"
|
|
6
|
+
:class="[
|
|
7
|
+
roundedClasses[props.rounded],
|
|
8
|
+
isBordered ? 'border border-gray-200 dark:border-white/10 ' : ''
|
|
9
|
+
]"
|
|
10
|
+
>
|
|
11
|
+
<table class="w-full text-sm text-left rtl:text-right table-fixed">
|
|
12
|
+
<thead :class="props.headerColor">
|
|
13
|
+
<tr>
|
|
14
|
+
<th
|
|
15
|
+
v-for="(column, index) in props.columns"
|
|
16
|
+
:key="column.id"
|
|
17
|
+
scope="col"
|
|
18
|
+
:style="{ width: column.width || 'auto' }"
|
|
19
|
+
:class="[
|
|
20
|
+
'px-4 py-3 font-bold text-xs uppercase',
|
|
21
|
+
index === 0 ? isBordered ? roundedTopStartClasses[props.rounded] : roundedStartClasses[props.rounded] : '',
|
|
22
|
+
index === props.columns.length - 1 ? isBordered ? roundedTopEndClasses[props.rounded] : roundedEndClasses[props.rounded] : ''
|
|
23
|
+
]"
|
|
24
|
+
>
|
|
25
|
+
{{ column.name }}
|
|
26
|
+
</th>
|
|
27
|
+
</tr>
|
|
28
|
+
</thead>
|
|
29
|
+
|
|
30
|
+
<tbody :class="props.bodyColor">
|
|
31
|
+
<template v-if="items.length > 0">
|
|
32
|
+
<motion.tr
|
|
33
|
+
v-for="item in items"
|
|
34
|
+
:key="item.id"
|
|
35
|
+
:while-hover="props.isSelectable ? { scale: 1.01 } : {}"
|
|
36
|
+
:transition="{ type: 'spring', stiffness: 400, damping: 30 }"
|
|
37
|
+
:class="props.isSelectable ? 'cursor-pointer hover:bg-gray-100 dark:hover:bg-white/5' : ''"
|
|
38
|
+
@click="props.isSelectable && emit('row-click', item)"
|
|
39
|
+
>
|
|
40
|
+
<td
|
|
41
|
+
v-for="column in columns"
|
|
42
|
+
:key="column.id"
|
|
43
|
+
:style="{ width: column.width || 'auto' }"
|
|
44
|
+
class="px-4 text-gray-900 dark:text-white break-words"
|
|
45
|
+
:class="sizes[props.itemsSize]"
|
|
46
|
+
>
|
|
47
|
+
<slot
|
|
48
|
+
:name="`cell-${column.id}`"
|
|
49
|
+
:item="item"
|
|
50
|
+
:value="item[column.id]"
|
|
51
|
+
>
|
|
52
|
+
{{ item[column.id] }}
|
|
53
|
+
</slot>
|
|
54
|
+
</td>
|
|
55
|
+
</motion.tr>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<tr v-else>
|
|
59
|
+
<td
|
|
60
|
+
:colspan="columns.length"
|
|
61
|
+
class="text-lg text-center py-20 text-black/50 dark:text-white/50"
|
|
62
|
+
>
|
|
63
|
+
No se encontraron resultados
|
|
64
|
+
</td>
|
|
65
|
+
</tr>
|
|
66
|
+
</tbody>
|
|
67
|
+
</table>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<!-- Vista de tarjetas para dispositivos móviles -->
|
|
71
|
+
<div class="block md:hidden space-y-4 p-1">
|
|
72
|
+
<motion.div
|
|
73
|
+
v-for="item in items"
|
|
74
|
+
:key="item.id"
|
|
75
|
+
:while-hover="props.isSelectable ? { y: -3 } : {}"
|
|
76
|
+
:transition="{ type: 'spring', stiffness: 400, damping: 25 }"
|
|
77
|
+
class="bg-white dark:bg-[#18181B] border border-gray-200 dark:border-white/10 rounded-lg p-4 shadow-sm"
|
|
78
|
+
:class="props.isSelectable ? 'cursor-pointer hover:bg-gray-50 dark:hover:bg-white/5 hover:shadow-md' : ''"
|
|
79
|
+
@click="props.isSelectable && emit('row-click', item)"
|
|
80
|
+
>
|
|
81
|
+
<slot
|
|
82
|
+
name="mobile-card"
|
|
83
|
+
:item="item"
|
|
84
|
+
:columns="columns"
|
|
85
|
+
>
|
|
86
|
+
<!-- Contenido por defecto si no se proporciona slot personalizado -->
|
|
87
|
+
<div class="space-y-2">
|
|
88
|
+
<div
|
|
89
|
+
v-for="column in columns"
|
|
90
|
+
:key="column.id"
|
|
91
|
+
class="flex justify-between items-center"
|
|
92
|
+
>
|
|
93
|
+
<span
|
|
94
|
+
class="text-xs font-medium text-gray-500 dark:text-gray-400 uppercase"
|
|
95
|
+
>
|
|
96
|
+
{{ column.name }}
|
|
97
|
+
</span>
|
|
98
|
+
<div class="text-sm">
|
|
99
|
+
<slot
|
|
100
|
+
:name="`cell-${column.id}`"
|
|
101
|
+
:item="item"
|
|
102
|
+
:value="item[column.id]"
|
|
103
|
+
>
|
|
104
|
+
{{ item[column.id] }}
|
|
105
|
+
</slot>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
</slot>
|
|
110
|
+
</motion.div>
|
|
111
|
+
|
|
112
|
+
<!-- Mensaje cuando no hay items -->
|
|
113
|
+
<div
|
|
114
|
+
v-if="items.length === 0"
|
|
115
|
+
class="text-lg text-center py-20 text-black/50 dark:text-white/50"
|
|
116
|
+
>
|
|
117
|
+
No se encontraron resultados
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
</template>
|
|
122
|
+
|
|
123
|
+
<script setup>
|
|
124
|
+
import { motion } from "motion-v";
|
|
125
|
+
const roundedClasses = {
|
|
126
|
+
"none": "rounded-none",
|
|
127
|
+
"xs": "rounded-xs",
|
|
128
|
+
"sm": "rounded-sm",
|
|
129
|
+
"md": "rounded-md",
|
|
130
|
+
"lg": "rounded-lg",
|
|
131
|
+
"xl": "rounded-xl",
|
|
132
|
+
"2xl": "rounded-2xl",
|
|
133
|
+
"3xl": "rounded-3xl",
|
|
134
|
+
"full": "rounded-full"
|
|
135
|
+
};
|
|
136
|
+
const roundedStartClasses = {
|
|
137
|
+
"none": "rounded-s-none",
|
|
138
|
+
"xs": "rounded-s-xs",
|
|
139
|
+
"sm": "rounded-s-sm",
|
|
140
|
+
"md": "rounded-s-md",
|
|
141
|
+
"lg": "rounded-s-lg",
|
|
142
|
+
"xl": "rounded-s-xl",
|
|
143
|
+
"2xl": "rounded-s-2xl",
|
|
144
|
+
"3xl": "rounded-s-3xl",
|
|
145
|
+
"full": "rounded-s-full"
|
|
146
|
+
};
|
|
147
|
+
const roundedEndClasses = {
|
|
148
|
+
"none": "rounded-e-none",
|
|
149
|
+
"xs": "rounded-e-xs",
|
|
150
|
+
"sm": "rounded-e-sm",
|
|
151
|
+
"md": "rounded-e-md",
|
|
152
|
+
"lg": "rounded-e-lg",
|
|
153
|
+
"xl": "rounded-e-xl",
|
|
154
|
+
"2xl": "rounded-e-2xl",
|
|
155
|
+
"3xl": "rounded-e-3xl",
|
|
156
|
+
"full": "rounded-e-full"
|
|
157
|
+
};
|
|
158
|
+
const roundedTopStartClasses = {
|
|
159
|
+
"none": "rounded-ss-none",
|
|
160
|
+
"xs": "rounded-ss-xs",
|
|
161
|
+
"sm": "rounded-ss-sm",
|
|
162
|
+
"md": "rounded-ss-md",
|
|
163
|
+
"lg": "rounded-ss-lg",
|
|
164
|
+
"xl": "rounded-ss-xl",
|
|
165
|
+
"2xl": "rounded-ss-2xl",
|
|
166
|
+
"3xl": "rounded-ss-3xl",
|
|
167
|
+
"full": "rounded-ss-full"
|
|
168
|
+
};
|
|
169
|
+
const roundedTopEndClasses = {
|
|
170
|
+
"none": "rounded-se-none",
|
|
171
|
+
"xs": "rounded-se-xs",
|
|
172
|
+
"sm": "rounded-se-sm",
|
|
173
|
+
"md": "rounded-se-md",
|
|
174
|
+
"lg": "rounded-se-lg",
|
|
175
|
+
"xl": "rounded-se-xl",
|
|
176
|
+
"2xl": "rounded-se-2xl",
|
|
177
|
+
"3xl": "rounded-se-3xl",
|
|
178
|
+
"full": "rounded-se-full"
|
|
179
|
+
};
|
|
180
|
+
const sizes = {
|
|
181
|
+
sm: "py-2",
|
|
182
|
+
md: "py-4",
|
|
183
|
+
lg: "py-6"
|
|
184
|
+
};
|
|
185
|
+
const props = defineProps({
|
|
186
|
+
items: { type: Array, required: false, default: () => [] },
|
|
187
|
+
columns: { type: Array, required: false, default: () => [] },
|
|
188
|
+
rounded: { type: null, required: false, default: "lg" },
|
|
189
|
+
isBordered: { type: Boolean, required: false, default: false },
|
|
190
|
+
isSelectable: { type: Boolean, required: false, default: false },
|
|
191
|
+
headerColor: { type: String, required: false, default: "bg-[#F4F4F5] text-[#71717A] dark:bg-[#27272A] dark:text-[#A1A1AA]" },
|
|
192
|
+
bodyColor: { type: String, required: false, default: "" },
|
|
193
|
+
itemsSize: { type: null, required: false, default: "md" }
|
|
194
|
+
});
|
|
195
|
+
const emit = defineEmits(["row-click"]);
|
|
196
|
+
</script>
|