@vasakgroup/vue-libvasak 0.1.0 → 0.2.0
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/vue-libvasak.css +0 -0
- package/dist/vue-libvasak.es.js +626 -233
- package/dist/vue-libvasak.umd.js +1 -1
- package/package.json +8 -8
- package/src/cards/DeviceCard.vue +82 -0
- package/src/cards/ListCard.vue +40 -0
- package/src/controls/ActionButton.vue +85 -0
- package/src/controls/ToggleControl.vue +55 -0
- package/src/forms/FormGroup.vue +27 -0
- package/src/forms/SliderControl.vue +100 -0
- package/src/forms/SwitchToggle.vue +49 -0
- package/src/index.ts +37 -2
- package/src/layout/ConfigSection.vue +28 -0
- package/src/sidebar/SideButton.vue +1 -3
- package/src/tray/TrayIconButton.vue +80 -0
- package/src/types/vue-libvasak.d.ts +153 -8
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
title: string;
|
|
4
|
+
icon?: string;
|
|
5
|
+
customClass?: string | Record<string, boolean>;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
withDefaults(defineProps<Props>(), {
|
|
9
|
+
icon: '',
|
|
10
|
+
customClass: () => ({}),
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div
|
|
16
|
+
class="flex flex-col gap-4 p-4 background rounded-vsk"
|
|
17
|
+
:class="customClass"
|
|
18
|
+
>
|
|
19
|
+
<h3 class="text-base font-semibold m-0 text-vsk-primary">
|
|
20
|
+
{{ icon ? `${icon} ${title}` : title }}
|
|
21
|
+
</h3>
|
|
22
|
+
<slot />
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<style scoped>
|
|
27
|
+
/* Ningún estilo adicional requerido */
|
|
28
|
+
</style>
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { defineComponent } from "vue";
|
|
3
|
-
|
|
4
2
|
const props = defineProps({
|
|
5
3
|
title: {
|
|
6
4
|
type: String,
|
|
@@ -15,6 +13,6 @@ const props = defineProps({
|
|
|
15
13
|
|
|
16
14
|
<template>
|
|
17
15
|
<a href="#" class="sidebar-button">
|
|
18
|
-
<img :src="image" class="img-fluid" />
|
|
16
|
+
<img :src="image" :alt="title" class="img-fluid" />
|
|
19
17
|
</a>
|
|
20
18
|
</template>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="p-1 rounded-vsk relative hover:bg-vsk-primary/30 group transition-all duration-300"
|
|
4
|
+
:class="customClass"
|
|
5
|
+
:title="tooltip"
|
|
6
|
+
@click="handleClick"
|
|
7
|
+
@mouseenter="showTooltip = true"
|
|
8
|
+
@mouseleave="showTooltip = false"
|
|
9
|
+
>
|
|
10
|
+
<img
|
|
11
|
+
:src="icon"
|
|
12
|
+
:alt="alt"
|
|
13
|
+
class="m-auto h-5.5 w-auto transition-all duration-300"
|
|
14
|
+
:class="iconClass"
|
|
15
|
+
/>
|
|
16
|
+
|
|
17
|
+
<!-- Badge/Counter -->
|
|
18
|
+
<div
|
|
19
|
+
v-if="badge !== null && badge > 0"
|
|
20
|
+
class="absolute bottom-1 right-1 bg-vsk-primary text-white text-xs rounded-full w-4 h-4 flex items-center justify-center font-bold animate-bounce"
|
|
21
|
+
>
|
|
22
|
+
{{ badge }}
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<!-- Tooltip personalizado -->
|
|
26
|
+
<div
|
|
27
|
+
v-if="showCustomTooltip && customTooltipText"
|
|
28
|
+
class="absolute top-1 left-1/2 transform -translate-x-1/2 text-xs font-semibold p-1 rounded-vsk transition-all duration-300 pointer-events-none background"
|
|
29
|
+
:class="[
|
|
30
|
+
tooltipClass,
|
|
31
|
+
{
|
|
32
|
+
'opacity-0 -translate-y-2': !showTooltip,
|
|
33
|
+
'opacity-100 translate-y-0': showTooltip
|
|
34
|
+
}
|
|
35
|
+
]"
|
|
36
|
+
>
|
|
37
|
+
{{ customTooltipText }}
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<!-- Slot para contenido adicional personalizado -->
|
|
41
|
+
<slot></slot>
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script setup lang="ts">
|
|
46
|
+
import { ref } from 'vue';
|
|
47
|
+
|
|
48
|
+
interface Props {
|
|
49
|
+
icon: string;
|
|
50
|
+
alt?: string;
|
|
51
|
+
tooltip?: string;
|
|
52
|
+
badge?: number | null;
|
|
53
|
+
iconClass?: string | Record<string, boolean>;
|
|
54
|
+
customClass?: string | Record<string, boolean>;
|
|
55
|
+
tooltipClass?: string | Record<string, boolean>;
|
|
56
|
+
showCustomTooltip?: boolean;
|
|
57
|
+
customTooltipText?: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
withDefaults(defineProps<Props>(), {
|
|
61
|
+
alt: '',
|
|
62
|
+
tooltip: '',
|
|
63
|
+
badge: null,
|
|
64
|
+
iconClass: () => ({}),
|
|
65
|
+
customClass: '',
|
|
66
|
+
tooltipClass: '',
|
|
67
|
+
showCustomTooltip: false,
|
|
68
|
+
customTooltipText: '',
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const emit = defineEmits<{
|
|
72
|
+
click: [];
|
|
73
|
+
}>();
|
|
74
|
+
|
|
75
|
+
const showTooltip = ref(false);
|
|
76
|
+
|
|
77
|
+
const handleClick = () => {
|
|
78
|
+
emit('click');
|
|
79
|
+
};
|
|
80
|
+
</script>
|
|
@@ -1,10 +1,155 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
declare module "@vasakgroup/vue-libvasak" {
|
|
2
|
+
import { DefineComponent, App } from "vue";
|
|
3
|
+
|
|
4
|
+
/* Layout */
|
|
5
|
+
export interface WindowFrameProps {
|
|
6
|
+
title?: string;
|
|
7
|
+
image?: string;
|
|
8
|
+
class?: string;
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* Sidebar */
|
|
13
|
+
export interface SideBarProps {
|
|
14
|
+
class?: string;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface SideButtonProps {
|
|
19
|
+
title?: string;
|
|
20
|
+
image?: string;
|
|
21
|
+
class?: string;
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Controls */
|
|
26
|
+
export interface ActionButtonProps {
|
|
27
|
+
label: string;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
variant?: "primary" | "secondary" | "danger";
|
|
30
|
+
loading?: boolean;
|
|
31
|
+
customClass?: string | Record<string, boolean>;
|
|
32
|
+
size?: "sm" | "md" | "lg";
|
|
33
|
+
fullWidth?: boolean;
|
|
34
|
+
iconSrc?: string;
|
|
35
|
+
iconAlt?: string;
|
|
36
|
+
iconRight?: boolean;
|
|
37
|
+
type?: "button" | "submit" | "reset";
|
|
38
|
+
stopPropagation?: boolean;
|
|
39
|
+
preventDefault?: boolean;
|
|
40
|
+
[key: string]: any;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface ToggleControlProps {
|
|
44
|
+
icon: string;
|
|
45
|
+
alt?: string;
|
|
46
|
+
tooltip?: string;
|
|
47
|
+
isActive?: boolean;
|
|
48
|
+
isLoading?: boolean;
|
|
49
|
+
iconClass?: Record<string, boolean>;
|
|
50
|
+
customClass?: Record<string, boolean>;
|
|
51
|
+
[key: string]: any;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* Layout/Config */
|
|
55
|
+
export interface ConfigSectionProps {
|
|
56
|
+
title: string;
|
|
57
|
+
icon?: string;
|
|
58
|
+
customClass?: string | Record<string, boolean>;
|
|
59
|
+
[key: string]: any;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* Cards */
|
|
63
|
+
export interface DeviceCardProps {
|
|
64
|
+
icon: string;
|
|
65
|
+
title: string;
|
|
66
|
+
subtitle?: string;
|
|
67
|
+
metadata?: string;
|
|
68
|
+
extraInfo?: string[];
|
|
69
|
+
isConnected?: boolean;
|
|
70
|
+
showActionButton?: boolean;
|
|
71
|
+
actionLabel?: string;
|
|
72
|
+
showStatusIndicator?: boolean;
|
|
73
|
+
customClass?: string;
|
|
74
|
+
clickable?: boolean;
|
|
75
|
+
[key: string]: any;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface ListCardProps {
|
|
79
|
+
clickable?: boolean;
|
|
80
|
+
customClass?: string | Record<string, boolean>;
|
|
81
|
+
[key: string]: any;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Forms */
|
|
85
|
+
export interface FormGroupProps {
|
|
86
|
+
label: string;
|
|
87
|
+
htmlFor?: string;
|
|
88
|
+
customClass?: string | Record<string, boolean>;
|
|
89
|
+
labelClass?: string | Record<string, boolean>;
|
|
90
|
+
[key: string]: any;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface SliderControlProps {
|
|
94
|
+
icon: string;
|
|
95
|
+
alt?: string;
|
|
96
|
+
tooltip?: string;
|
|
97
|
+
modelValue: number;
|
|
98
|
+
min?: number;
|
|
99
|
+
max?: number;
|
|
100
|
+
showButton?: boolean;
|
|
101
|
+
iconClass?: string | Record<string, boolean>;
|
|
102
|
+
getPercentageClass?: (percentage: number) => string;
|
|
103
|
+
[key: string]: any;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface SwitchToggleProps {
|
|
107
|
+
isOn: boolean;
|
|
108
|
+
disabled?: boolean;
|
|
109
|
+
size?: "small" | "medium";
|
|
110
|
+
activeClass?: string;
|
|
111
|
+
inactiveClass?: string;
|
|
112
|
+
customClass?: string;
|
|
113
|
+
[key: string]: any;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* Tray */
|
|
117
|
+
export interface TrayIconButtonProps {
|
|
118
|
+
icon: string;
|
|
119
|
+
alt?: string;
|
|
120
|
+
tooltip?: string;
|
|
121
|
+
badge?: number | null;
|
|
122
|
+
iconClass?: string | Record<string, boolean>;
|
|
123
|
+
customClass?: string | Record<string, boolean>;
|
|
124
|
+
tooltipClass?: string | Record<string, boolean>;
|
|
125
|
+
showCustomTooltip?: boolean;
|
|
126
|
+
customTooltipText?: string;
|
|
127
|
+
[key: string]: any;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* Component exports */
|
|
131
|
+
export const WindowFrame: DefineComponent<WindowFrameProps, any, any, {}, {}, {}, {}, {}, string>;
|
|
132
|
+
export const SideBar: DefineComponent<SideBarProps, any, any, {}, {}, {}, {}, {}, string>;
|
|
133
|
+
export const SideButton: DefineComponent<SideButtonProps, any, any, {}, {}, {}, {}, {}, string>;
|
|
134
|
+
|
|
135
|
+
export const ActionButton: DefineComponent<ActionButtonProps, any, any, {}, {}, {}, {}, { click: () => void }, string>;
|
|
136
|
+
export const ToggleControl: DefineComponent<ToggleControlProps, any, any, {}, {}, {}, {}, { click: () => void }, string>;
|
|
137
|
+
export const ConfigSection: DefineComponent<ConfigSectionProps, any, any, {}, {}, {}, {}, {}, string>;
|
|
138
|
+
|
|
139
|
+
export const DeviceCard: DefineComponent<DeviceCardProps, any, any, {}, {}, {}, {}, { action: () => void; click: () => void }, string>;
|
|
140
|
+
export const ListCard: DefineComponent<ListCardProps, any, any, {}, {}, {}, {}, { click: () => void }, string>;
|
|
141
|
+
|
|
142
|
+
export const FormGroup: DefineComponent<FormGroupProps, any, any, {}, {}, {}, {}, {}, string>;
|
|
143
|
+
export const SliderControl: DefineComponent<SliderControlProps, any, any, {}, {}, {}, {}, { 'update:modelValue': (value: number) => void; buttonClick: () => void }, string>;
|
|
144
|
+
export const SwitchToggle: DefineComponent<SwitchToggleProps, any, any, {}, {}, {}, {}, { toggle: (value: boolean) => void }, string>;
|
|
145
|
+
|
|
146
|
+
export const TrayIconButton: DefineComponent<TrayIconButtonProps, any, any, {}, {}, {}, {}, { click: () => void }, string>;
|
|
147
|
+
|
|
148
|
+
// Plugin de Vue
|
|
149
|
+
export interface VueLibVasakPlugin {
|
|
150
|
+
install(app: App): void;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
declare const plugin: VueLibVasakPlugin;
|
|
9
154
|
export default plugin;
|
|
10
155
|
}
|