windly-ui 1.0.2 → 1.0.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/{ui-library/dist → dist}/module.json +2 -2
- package/dist/module.mjs +26 -0
- package/dist/runtime/components/Accordion.d.vue.ts +39 -0
- package/dist/runtime/components/Accordion.vue +92 -0
- package/dist/runtime/components/Accordion.vue.d.ts +39 -0
- package/dist/runtime/components/Avatar.d.vue.ts +141 -0
- package/dist/runtime/components/Avatar.vue +72 -0
- package/dist/runtime/components/Avatar.vue.d.ts +141 -0
- package/dist/runtime/components/Badge.d.vue.ts +133 -0
- package/dist/runtime/components/Badge.vue +99 -0
- package/dist/runtime/components/Badge.vue.d.ts +133 -0
- package/dist/runtime/components/Breadcrumbs.d.vue.ts +83 -0
- package/dist/runtime/components/Breadcrumbs.vue +116 -0
- package/dist/runtime/components/Breadcrumbs.vue.d.ts +83 -0
- package/dist/runtime/components/Button.d.vue.ts +199 -0
- package/dist/runtime/components/Button.vue +125 -0
- package/dist/runtime/components/Button.vue.d.ts +199 -0
- package/dist/runtime/components/Card.d.vue.ts +83 -0
- package/dist/runtime/components/Card.vue +71 -0
- package/dist/runtime/components/Card.vue.d.ts +83 -0
- package/dist/runtime/components/Checkbox.d.vue.ts +190 -0
- package/dist/runtime/components/Checkbox.vue +125 -0
- package/dist/runtime/components/Checkbox.vue.d.ts +190 -0
- package/dist/runtime/components/CodeBlock.d.vue.ts +16 -0
- package/dist/runtime/components/CodeBlock.vue +75 -0
- package/dist/runtime/components/CodeBlock.vue.d.ts +16 -0
- package/dist/runtime/components/ColorPicker.d.vue.ts +91 -0
- package/dist/runtime/components/ColorPicker.vue +244 -0
- package/dist/runtime/components/ColorPicker.vue.d.ts +91 -0
- package/dist/runtime/components/Date.d.vue.ts +137 -0
- package/dist/runtime/components/Date.vue +201 -0
- package/dist/runtime/components/Date.vue.d.ts +137 -0
- package/dist/runtime/components/Dialog.d.vue.ts +103 -0
- package/dist/runtime/components/Dialog.vue +152 -0
- package/dist/runtime/components/Dialog.vue.d.ts +103 -0
- package/dist/runtime/components/Divider.d.vue.ts +51 -0
- package/dist/runtime/components/Divider.vue +52 -0
- package/dist/runtime/components/Divider.vue.d.ts +51 -0
- package/dist/runtime/components/Drawer.d.vue.ts +30 -0
- package/dist/runtime/components/Drawer.vue +43 -0
- package/dist/runtime/components/Drawer.vue.d.ts +30 -0
- package/dist/runtime/components/Dropdown.d.vue.ts +34 -0
- package/dist/runtime/components/Dropdown.vue +127 -0
- package/dist/runtime/components/Dropdown.vue.d.ts +34 -0
- package/dist/runtime/components/FileUploader.d.vue.ts +58 -0
- package/dist/runtime/components/FileUploader.vue +202 -0
- package/dist/runtime/components/FileUploader.vue.d.ts +58 -0
- package/dist/runtime/components/Icon.d.vue.ts +41 -0
- package/dist/runtime/components/Icon.vue +66 -0
- package/dist/runtime/components/Icon.vue.d.ts +41 -0
- package/dist/runtime/components/Image.d.vue.ts +77 -0
- package/dist/runtime/components/Image.vue +61 -0
- package/dist/runtime/components/Image.vue.d.ts +77 -0
- package/dist/runtime/components/Input.d.vue.ts +66 -0
- package/dist/runtime/components/Input.vue +233 -0
- package/dist/runtime/components/Input.vue.d.ts +66 -0
- package/dist/runtime/components/Radio.d.vue.ts +41 -0
- package/dist/runtime/components/Radio.vue +222 -0
- package/dist/runtime/components/Radio.vue.d.ts +41 -0
- package/dist/runtime/components/ScrollArea.d.vue.ts +79 -0
- package/dist/runtime/components/ScrollArea.vue +36 -0
- package/dist/runtime/components/ScrollArea.vue.d.ts +79 -0
- package/dist/runtime/components/Select.d.vue.ts +43 -0
- package/dist/runtime/components/Select.vue +200 -0
- package/dist/runtime/components/Select.vue.d.ts +43 -0
- package/dist/runtime/components/Stepper.d.vue.ts +46 -0
- package/dist/runtime/components/Stepper.vue +218 -0
- package/dist/runtime/components/Stepper.vue.d.ts +46 -0
- package/dist/runtime/components/TabPanel.d.vue.ts +17 -0
- package/dist/runtime/components/TabPanel.vue +21 -0
- package/dist/runtime/components/TabPanel.vue.d.ts +17 -0
- package/dist/runtime/components/Table.d.vue.ts +40 -0
- package/dist/runtime/components/Table.vue +92 -0
- package/dist/runtime/components/Table.vue.d.ts +40 -0
- package/dist/runtime/components/Tabs.d.vue.ts +20 -0
- package/dist/runtime/components/Tabs.vue +62 -0
- package/dist/runtime/components/Tabs.vue.d.ts +20 -0
- package/dist/runtime/components/Textarea.d.vue.ts +208 -0
- package/dist/runtime/components/Textarea.vue +185 -0
- package/dist/runtime/components/Textarea.vue.d.ts +208 -0
- package/dist/runtime/components/Toggle.d.vue.ts +36 -0
- package/dist/runtime/components/Toggle.vue +173 -0
- package/dist/runtime/components/Toggle.vue.d.ts +36 -0
- package/dist/runtime/components/Tooltip.d.vue.ts +63 -0
- package/dist/runtime/components/Tooltip.vue +144 -0
- package/dist/runtime/components/Tooltip.vue.d.ts +63 -0
- package/dist/runtime/components/uiProps.d.ts +38 -0
- package/dist/runtime/components/uiProps.js +11 -0
- package/dist/runtime/components/useUiClasses.d.ts +43 -0
- package/dist/runtime/components/useUiClasses.js +124 -0
- package/dist/runtime/composables/plugin.d.ts +2 -0
- package/dist/runtime/composables/plugin.js +3 -0
- package/dist/runtime/tailwind-color.d.ts +2 -0
- package/dist/runtime/tailwind-color.js +5859 -0
- package/package.json +12 -46
- package/LICENSE +0 -21
- package/README.md +0 -232
- package/ui-library/dist/module.mjs +0 -22
- /package/{ui-library/dist → dist}/module.d.mts +0 -0
- /package/{ui-library/dist → dist}/types.d.mts +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
interface SelectOption {
|
|
2
|
+
text: string;
|
|
3
|
+
value: string | number | boolean;
|
|
4
|
+
}
|
|
5
|
+
type Rounded = 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
6
|
+
type __VLS_Props = {
|
|
7
|
+
filter?: boolean;
|
|
8
|
+
modelValue?: string | number | boolean;
|
|
9
|
+
label: string;
|
|
10
|
+
id?: string;
|
|
11
|
+
options: SelectOption[];
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
hint?: string;
|
|
16
|
+
flat?: boolean;
|
|
17
|
+
bordered?: boolean;
|
|
18
|
+
rounded?: Rounded;
|
|
19
|
+
borderColor?: string;
|
|
20
|
+
bgColor?: string;
|
|
21
|
+
textColor?: string;
|
|
22
|
+
};
|
|
23
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
24
|
+
"update:modelValue": (value: string | number | boolean) => any;
|
|
25
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
26
|
+
"onUpdate:modelValue"?: ((value: string | number | boolean) => any) | undefined;
|
|
27
|
+
}>, {
|
|
28
|
+
modelValue: string | number | boolean;
|
|
29
|
+
disabled: boolean;
|
|
30
|
+
filter: boolean;
|
|
31
|
+
textColor: string;
|
|
32
|
+
rounded: Rounded;
|
|
33
|
+
borderColor: string;
|
|
34
|
+
required: boolean;
|
|
35
|
+
flat: boolean;
|
|
36
|
+
id: string;
|
|
37
|
+
placeholder: string;
|
|
38
|
+
bordered: boolean;
|
|
39
|
+
bgColor: string;
|
|
40
|
+
hint: string;
|
|
41
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
42
|
+
declare const _default: typeof __VLS_export;
|
|
43
|
+
export default _default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
interface StepItem {
|
|
2
|
+
label: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
icon?: string;
|
|
5
|
+
iconColor?: string;
|
|
6
|
+
}
|
|
7
|
+
type Step = string | StepItem;
|
|
8
|
+
type __VLS_Props = {
|
|
9
|
+
steps: Step[];
|
|
10
|
+
modelValue?: number;
|
|
11
|
+
vertical?: boolean;
|
|
12
|
+
completedColor?: string;
|
|
13
|
+
activeColor?: string;
|
|
14
|
+
inactiveColor?: string;
|
|
15
|
+
connectorCompletedColor?: string;
|
|
16
|
+
connectorInactiveColor?: string;
|
|
17
|
+
inactiveSteps?: number[];
|
|
18
|
+
};
|
|
19
|
+
declare var __VLS_1: {
|
|
20
|
+
step: number;
|
|
21
|
+
};
|
|
22
|
+
type __VLS_Slots = {} & {
|
|
23
|
+
default?: (props: typeof __VLS_1) => any;
|
|
24
|
+
};
|
|
25
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
26
|
+
"update:modelValue": (value: number) => any;
|
|
27
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
28
|
+
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
29
|
+
}>, {
|
|
30
|
+
modelValue: number;
|
|
31
|
+
activeColor: string;
|
|
32
|
+
vertical: boolean;
|
|
33
|
+
completedColor: string;
|
|
34
|
+
inactiveColor: string;
|
|
35
|
+
connectorCompletedColor: string;
|
|
36
|
+
connectorInactiveColor: string;
|
|
37
|
+
inactiveSteps: number[];
|
|
38
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
39
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
40
|
+
declare const _default: typeof __VLS_export;
|
|
41
|
+
export default _default;
|
|
42
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
43
|
+
new (): {
|
|
44
|
+
$slots: S;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
steps: { type: Array, required: true },
|
|
5
|
+
modelValue: { type: Number, required: false, default: 0 },
|
|
6
|
+
vertical: { type: Boolean, required: false, default: false },
|
|
7
|
+
completedColor: { type: String, required: false, default: "green-500" },
|
|
8
|
+
activeColor: { type: String, required: false, default: "blue-500" },
|
|
9
|
+
inactiveColor: { type: String, required: false, default: "gray-300" },
|
|
10
|
+
connectorCompletedColor: { type: String, required: false, default: "green-500" },
|
|
11
|
+
connectorInactiveColor: { type: String, required: false, default: "gray-300" },
|
|
12
|
+
inactiveSteps: { type: Array, required: false, default: () => [] }
|
|
13
|
+
});
|
|
14
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
15
|
+
const currentStep = computed(
|
|
16
|
+
() => props.modelValue
|
|
17
|
+
);
|
|
18
|
+
const normalizedSteps = computed(
|
|
19
|
+
() => props.steps.map((step) => {
|
|
20
|
+
if (typeof step === "string") {
|
|
21
|
+
return {
|
|
22
|
+
label: step
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return step;
|
|
26
|
+
})
|
|
27
|
+
);
|
|
28
|
+
const isHex = (val) => val.startsWith("#");
|
|
29
|
+
const isInactiveStep = (index) => {
|
|
30
|
+
return props.inactiveSteps.includes(
|
|
31
|
+
index
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
const stepState = (index) => {
|
|
35
|
+
if (isInactiveStep(index)) {
|
|
36
|
+
return "inactive";
|
|
37
|
+
}
|
|
38
|
+
if (index < currentStep.value) {
|
|
39
|
+
return "completed";
|
|
40
|
+
}
|
|
41
|
+
if (index === currentStep.value) {
|
|
42
|
+
return "active";
|
|
43
|
+
}
|
|
44
|
+
return "pending";
|
|
45
|
+
};
|
|
46
|
+
const stepClasses = (index) => {
|
|
47
|
+
const state = stepState(index);
|
|
48
|
+
switch (state) {
|
|
49
|
+
case "completed":
|
|
50
|
+
return [
|
|
51
|
+
!isHex(
|
|
52
|
+
props.completedColor
|
|
53
|
+
) ? `bg-${props.completedColor}` : "",
|
|
54
|
+
"text-white"
|
|
55
|
+
];
|
|
56
|
+
case "active":
|
|
57
|
+
return [
|
|
58
|
+
!isHex(
|
|
59
|
+
props.activeColor
|
|
60
|
+
) ? `bg-${props.activeColor}` : "",
|
|
61
|
+
"text-white"
|
|
62
|
+
];
|
|
63
|
+
case "inactive":
|
|
64
|
+
return [
|
|
65
|
+
!isHex(
|
|
66
|
+
props.inactiveColor
|
|
67
|
+
) ? `bg-${props.inactiveColor}` : "",
|
|
68
|
+
"text-gray-500 opacity-60 cursor-not-allowed"
|
|
69
|
+
];
|
|
70
|
+
case "pending":
|
|
71
|
+
default:
|
|
72
|
+
return [
|
|
73
|
+
!isHex(
|
|
74
|
+
props.inactiveColor
|
|
75
|
+
) ? `bg-${props.inactiveColor}` : "",
|
|
76
|
+
"text-gray-600"
|
|
77
|
+
];
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const stepStyle = (index) => {
|
|
81
|
+
const style = {};
|
|
82
|
+
const state = stepState(index);
|
|
83
|
+
const colorMap = {
|
|
84
|
+
completed: props.completedColor,
|
|
85
|
+
active: props.activeColor,
|
|
86
|
+
inactive: props.inactiveColor,
|
|
87
|
+
pending: props.inactiveColor
|
|
88
|
+
};
|
|
89
|
+
const color = colorMap[state];
|
|
90
|
+
if (isHex(color)) {
|
|
91
|
+
style.backgroundColor = color;
|
|
92
|
+
}
|
|
93
|
+
return style;
|
|
94
|
+
};
|
|
95
|
+
const connectorClasses = (index) => {
|
|
96
|
+
const completed = index < currentStep.value && !isInactiveStep(index + 1);
|
|
97
|
+
const color = completed ? props.connectorCompletedColor : props.connectorInactiveColor;
|
|
98
|
+
return [
|
|
99
|
+
!isHex(color) ? `bg-${color}` : ""
|
|
100
|
+
];
|
|
101
|
+
};
|
|
102
|
+
const connectorStyle = (index) => {
|
|
103
|
+
const style = {};
|
|
104
|
+
const completed = index < currentStep.value && !isInactiveStep(index + 1);
|
|
105
|
+
const color = completed ? props.connectorCompletedColor : props.connectorInactiveColor;
|
|
106
|
+
if (isHex(color)) {
|
|
107
|
+
style.backgroundColor = color;
|
|
108
|
+
}
|
|
109
|
+
return style;
|
|
110
|
+
};
|
|
111
|
+
const labelClasses = (index) => {
|
|
112
|
+
if (isInactiveStep(index)) {
|
|
113
|
+
return "text-gray-400 opacity-60 cursor-not-allowed";
|
|
114
|
+
}
|
|
115
|
+
if (index === currentStep.value) {
|
|
116
|
+
return "text-black dark:text-white";
|
|
117
|
+
}
|
|
118
|
+
return "text-gray-500";
|
|
119
|
+
};
|
|
120
|
+
const navigate = (index) => {
|
|
121
|
+
if (isInactiveStep(index)) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
emit(
|
|
125
|
+
"update:modelValue",
|
|
126
|
+
index
|
|
127
|
+
);
|
|
128
|
+
};
|
|
129
|
+
</script>
|
|
130
|
+
|
|
131
|
+
<template>
|
|
132
|
+
<div :class="{
|
|
133
|
+
flex: vertical,
|
|
134
|
+
block: !vertical
|
|
135
|
+
}">
|
|
136
|
+
<!-- Steps -->
|
|
137
|
+
<div :class="{
|
|
138
|
+
'flex flex-col items-start': vertical,
|
|
139
|
+
'flex items-start justify-between': !vertical
|
|
140
|
+
}">
|
|
141
|
+
<div v-for="(
|
|
142
|
+
step, index
|
|
143
|
+
) in normalizedSteps" :key="index" :class="{
|
|
144
|
+
'relative flex-1 flex items-start': !vertical,
|
|
145
|
+
'relative flex flex-col items-start': vertical
|
|
146
|
+
}">
|
|
147
|
+
<div :class="{
|
|
148
|
+
'flex items-center': vertical,
|
|
149
|
+
'flex flex-col items-center': !vertical
|
|
150
|
+
}">
|
|
151
|
+
<!-- Step Indicator -->
|
|
152
|
+
<div @click="
|
|
153
|
+
navigate(index)
|
|
154
|
+
" :class="[
|
|
155
|
+
'flex items-center justify-center w-10 h-10 rounded-full font-bold z-10 transition-colors',
|
|
156
|
+
stepClasses(index)
|
|
157
|
+
]" :style="
|
|
158
|
+
stepStyle(index)
|
|
159
|
+
">
|
|
160
|
+
<template v-if="step.icon">
|
|
161
|
+
<span class="material-icons">
|
|
162
|
+
{{ step.icon }}
|
|
163
|
+
</span>
|
|
164
|
+
</template>
|
|
165
|
+
|
|
166
|
+
<template v-else>
|
|
167
|
+
{{ index + 1 }}
|
|
168
|
+
</template>
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
<!-- Label -->
|
|
172
|
+
<div class="text-center text-sm font-medium mx-2" :class="[
|
|
173
|
+
vertical ? 'ml-4' : 'mt-2',
|
|
174
|
+
labelClasses(index)
|
|
175
|
+
]" @click="
|
|
176
|
+
navigate(index)
|
|
177
|
+
">
|
|
178
|
+
{{ step.label }}
|
|
179
|
+
</div>
|
|
180
|
+
</div>
|
|
181
|
+
|
|
182
|
+
<!-- Connector -->
|
|
183
|
+
<div v-if="
|
|
184
|
+
index !== normalizedSteps.length - 1
|
|
185
|
+
" :class="{
|
|
186
|
+
'flex-1 h-[1px] mt-5 relative': !vertical,
|
|
187
|
+
'w-[1px] h-16 ml-5 relative': vertical
|
|
188
|
+
}">
|
|
189
|
+
<div class="absolute w-full h-full" :class="
|
|
190
|
+
connectorClasses(
|
|
191
|
+
index
|
|
192
|
+
)
|
|
193
|
+
" :style="[
|
|
194
|
+
connectorStyle(
|
|
195
|
+
index
|
|
196
|
+
),
|
|
197
|
+
{
|
|
198
|
+
top: vertical ? '50%' : '',
|
|
199
|
+
transform: 'translateY(-50%)'
|
|
200
|
+
}
|
|
201
|
+
]" />
|
|
202
|
+
</div>
|
|
203
|
+
</div>
|
|
204
|
+
</div>
|
|
205
|
+
|
|
206
|
+
<!-- Content -->
|
|
207
|
+
<div :class="{
|
|
208
|
+
'ml-4': vertical,
|
|
209
|
+
'mt-4': !vertical
|
|
210
|
+
}">
|
|
211
|
+
<slot :step="currentStep" />
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
</template>
|
|
215
|
+
|
|
216
|
+
<style scoped>
|
|
217
|
+
.material-icons{font-size:1.5rem}
|
|
218
|
+
</style>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
interface StepItem {
|
|
2
|
+
label: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
icon?: string;
|
|
5
|
+
iconColor?: string;
|
|
6
|
+
}
|
|
7
|
+
type Step = string | StepItem;
|
|
8
|
+
type __VLS_Props = {
|
|
9
|
+
steps: Step[];
|
|
10
|
+
modelValue?: number;
|
|
11
|
+
vertical?: boolean;
|
|
12
|
+
completedColor?: string;
|
|
13
|
+
activeColor?: string;
|
|
14
|
+
inactiveColor?: string;
|
|
15
|
+
connectorCompletedColor?: string;
|
|
16
|
+
connectorInactiveColor?: string;
|
|
17
|
+
inactiveSteps?: number[];
|
|
18
|
+
};
|
|
19
|
+
declare var __VLS_1: {
|
|
20
|
+
step: number;
|
|
21
|
+
};
|
|
22
|
+
type __VLS_Slots = {} & {
|
|
23
|
+
default?: (props: typeof __VLS_1) => any;
|
|
24
|
+
};
|
|
25
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
26
|
+
"update:modelValue": (value: number) => any;
|
|
27
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
28
|
+
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
29
|
+
}>, {
|
|
30
|
+
modelValue: number;
|
|
31
|
+
activeColor: string;
|
|
32
|
+
vertical: boolean;
|
|
33
|
+
completedColor: string;
|
|
34
|
+
inactiveColor: string;
|
|
35
|
+
connectorCompletedColor: string;
|
|
36
|
+
connectorInactiveColor: string;
|
|
37
|
+
inactiveSteps: number[];
|
|
38
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
39
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
40
|
+
declare const _default: typeof __VLS_export;
|
|
41
|
+
export default _default;
|
|
42
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
43
|
+
new (): {
|
|
44
|
+
$slots: S;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
name: string;
|
|
3
|
+
label: string;
|
|
4
|
+
};
|
|
5
|
+
declare var __VLS_1: {};
|
|
6
|
+
type __VLS_Slots = {} & {
|
|
7
|
+
default?: (props: typeof __VLS_1) => any;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
14
|
+
new (): {
|
|
15
|
+
$slots: S;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-show="isActive">
|
|
3
|
+
<slot />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup>
|
|
8
|
+
import { inject, computed, onMounted } from "vue";
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
name: { type: String, required: true },
|
|
11
|
+
label: { type: String, required: true }
|
|
12
|
+
});
|
|
13
|
+
const tabs = inject("tabs");
|
|
14
|
+
onMounted(() => {
|
|
15
|
+
tabs?.registerTab({
|
|
16
|
+
name: props.name,
|
|
17
|
+
label: props.label
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
const isActive = computed(() => tabs?.modelValue.value === props.name);
|
|
21
|
+
</script>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
name: string;
|
|
3
|
+
label: string;
|
|
4
|
+
};
|
|
5
|
+
declare var __VLS_1: {};
|
|
6
|
+
type __VLS_Slots = {} & {
|
|
7
|
+
default?: (props: typeof __VLS_1) => any;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
14
|
+
new (): {
|
|
15
|
+
$slots: S;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
type Separator = "none" | "horizontal" | "vertical" | "cell";
|
|
2
|
+
type Rounded = "none" | "sm" | "md" | "lg" | "xl";
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
flat?: boolean;
|
|
5
|
+
bordered?: boolean;
|
|
6
|
+
striped?: boolean;
|
|
7
|
+
dense?: boolean;
|
|
8
|
+
hover?: boolean;
|
|
9
|
+
rounded?: Rounded;
|
|
10
|
+
separator?: Separator;
|
|
11
|
+
borderColor?: string;
|
|
12
|
+
bgColor?: string;
|
|
13
|
+
};
|
|
14
|
+
declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {};
|
|
15
|
+
type __VLS_Slots = {} & {
|
|
16
|
+
header?: (props: typeof __VLS_1) => any;
|
|
17
|
+
} & {
|
|
18
|
+
default?: (props: typeof __VLS_3) => any;
|
|
19
|
+
} & {
|
|
20
|
+
footer?: (props: typeof __VLS_5) => any;
|
|
21
|
+
};
|
|
22
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
23
|
+
hover: boolean;
|
|
24
|
+
dense: boolean;
|
|
25
|
+
rounded: Rounded;
|
|
26
|
+
borderColor: string;
|
|
27
|
+
separator: Separator;
|
|
28
|
+
flat: boolean;
|
|
29
|
+
bordered: boolean;
|
|
30
|
+
bgColor: string;
|
|
31
|
+
striped: boolean;
|
|
32
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
33
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
34
|
+
declare const _default: typeof __VLS_export;
|
|
35
|
+
export default _default;
|
|
36
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
37
|
+
new (): {
|
|
38
|
+
$slots: S;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
flat: { type: Boolean, required: false, default: false },
|
|
5
|
+
bordered: { type: Boolean, required: false, default: false },
|
|
6
|
+
striped: { type: Boolean, required: false, default: false },
|
|
7
|
+
dense: { type: Boolean, required: false, default: false },
|
|
8
|
+
hover: { type: Boolean, required: false, default: true },
|
|
9
|
+
rounded: { type: String, required: false, default: "md" },
|
|
10
|
+
separator: { type: String, required: false, default: "horizontal" },
|
|
11
|
+
borderColor: { type: String, required: false, default: "border-gray-200 dark:border-gray-700" },
|
|
12
|
+
bgColor: { type: String, required: false, default: "bg-white dark:bg-gray-900" }
|
|
13
|
+
});
|
|
14
|
+
const roundedClass = computed(() => {
|
|
15
|
+
const map = {
|
|
16
|
+
none: "",
|
|
17
|
+
sm: "rounded-sm",
|
|
18
|
+
md: "rounded-md",
|
|
19
|
+
lg: "rounded-lg",
|
|
20
|
+
xl: "rounded-xl"
|
|
21
|
+
};
|
|
22
|
+
return map[props.rounded];
|
|
23
|
+
});
|
|
24
|
+
const wrapperClass = computed(() => [
|
|
25
|
+
"w-full overflow-x-auto",
|
|
26
|
+
roundedClass.value,
|
|
27
|
+
props.bordered ? `border ${props.borderColor}` : "",
|
|
28
|
+
props.flat ? "shadow-none" : "shadow-sm",
|
|
29
|
+
props.bgColor
|
|
30
|
+
]);
|
|
31
|
+
const separatorClass = computed(() => {
|
|
32
|
+
switch (props.separator) {
|
|
33
|
+
case "vertical":
|
|
34
|
+
return [
|
|
35
|
+
"[&_th]:border-r",
|
|
36
|
+
"[&_td]:border-r",
|
|
37
|
+
props.borderColor
|
|
38
|
+
];
|
|
39
|
+
case "cell":
|
|
40
|
+
return [
|
|
41
|
+
"[&_th]:border",
|
|
42
|
+
"[&_td]:border",
|
|
43
|
+
props.borderColor
|
|
44
|
+
];
|
|
45
|
+
case "none":
|
|
46
|
+
return [];
|
|
47
|
+
case "horizontal":
|
|
48
|
+
default:
|
|
49
|
+
return [
|
|
50
|
+
"[&_tr]:border-b",
|
|
51
|
+
props.borderColor
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const tableClass = computed(() => [
|
|
56
|
+
"w-full border-collapse",
|
|
57
|
+
separatorClass.value
|
|
58
|
+
]);
|
|
59
|
+
const headerClass = computed(() => [
|
|
60
|
+
"bg-gray-50 dark:bg-gray-800"
|
|
61
|
+
]);
|
|
62
|
+
const bodyClass = computed(() => [
|
|
63
|
+
props.striped ? "[&_tr:nth-child(even)]:bg-gray-50 dark:[&_tr:nth-child(even)]:bg-gray-800/40" : "",
|
|
64
|
+
props.hover ? "[&_tr:hover]:bg-gray-100 dark:[&_tr:hover]:bg-gray-700" : "",
|
|
65
|
+
props.dense ? "[&_td]:py-2 [&_th]:py-2" : "[&_td]:py-3 [&_th]:py-3"
|
|
66
|
+
]);
|
|
67
|
+
const footerClass = computed(() => [
|
|
68
|
+
"bg-gray-50 dark:bg-gray-900"
|
|
69
|
+
]);
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<template>
|
|
73
|
+
<div :class="wrapperClass">
|
|
74
|
+
<table :class="tableClass">
|
|
75
|
+
<thead
|
|
76
|
+
v-if="$slots.header"
|
|
77
|
+
:class="headerClass"
|
|
78
|
+
>
|
|
79
|
+
<slot name="header" />
|
|
80
|
+
</thead>
|
|
81
|
+
<tbody :class="bodyClass">
|
|
82
|
+
<slot />
|
|
83
|
+
</tbody>
|
|
84
|
+
<tfoot
|
|
85
|
+
v-if="$slots.footer"
|
|
86
|
+
:class="footerClass"
|
|
87
|
+
>
|
|
88
|
+
<slot name="footer" />
|
|
89
|
+
</tfoot>
|
|
90
|
+
</table>
|
|
91
|
+
</div>
|
|
92
|
+
</template>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
type Separator = "none" | "horizontal" | "vertical" | "cell";
|
|
2
|
+
type Rounded = "none" | "sm" | "md" | "lg" | "xl";
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
flat?: boolean;
|
|
5
|
+
bordered?: boolean;
|
|
6
|
+
striped?: boolean;
|
|
7
|
+
dense?: boolean;
|
|
8
|
+
hover?: boolean;
|
|
9
|
+
rounded?: Rounded;
|
|
10
|
+
separator?: Separator;
|
|
11
|
+
borderColor?: string;
|
|
12
|
+
bgColor?: string;
|
|
13
|
+
};
|
|
14
|
+
declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {};
|
|
15
|
+
type __VLS_Slots = {} & {
|
|
16
|
+
header?: (props: typeof __VLS_1) => any;
|
|
17
|
+
} & {
|
|
18
|
+
default?: (props: typeof __VLS_3) => any;
|
|
19
|
+
} & {
|
|
20
|
+
footer?: (props: typeof __VLS_5) => any;
|
|
21
|
+
};
|
|
22
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
23
|
+
hover: boolean;
|
|
24
|
+
dense: boolean;
|
|
25
|
+
rounded: Rounded;
|
|
26
|
+
borderColor: string;
|
|
27
|
+
separator: Separator;
|
|
28
|
+
flat: boolean;
|
|
29
|
+
bordered: boolean;
|
|
30
|
+
bgColor: string;
|
|
31
|
+
striped: boolean;
|
|
32
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
33
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
34
|
+
declare const _default: typeof __VLS_export;
|
|
35
|
+
export default _default;
|
|
36
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
37
|
+
new (): {
|
|
38
|
+
$slots: S;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
modelValue: string;
|
|
3
|
+
};
|
|
4
|
+
declare var __VLS_1: {};
|
|
5
|
+
type __VLS_Slots = {} & {
|
|
6
|
+
default?: (props: typeof __VLS_1) => any;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
9
|
+
"update:modelValue": (value: string) => any;
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
11
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
12
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
16
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
17
|
+
new (): {
|
|
18
|
+
$slots: S;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, reactive, watch, nextTick, provide, computed, onMounted } from "vue";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
modelValue: { type: String, required: true }
|
|
5
|
+
});
|
|
6
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
7
|
+
const tabs = ref([]);
|
|
8
|
+
const tabRefs = ref([]);
|
|
9
|
+
const tabsEl = ref(null);
|
|
10
|
+
const indicatorStyle = ref({
|
|
11
|
+
width: "0px",
|
|
12
|
+
transform: "translateX(0px)"
|
|
13
|
+
});
|
|
14
|
+
function updateIndicator(index) {
|
|
15
|
+
const tab = tabRefs.value[index];
|
|
16
|
+
if (!tab || !tabsEl.value) return;
|
|
17
|
+
indicatorStyle.value = {
|
|
18
|
+
width: `${tab.offsetWidth}px`,
|
|
19
|
+
transform: `translateX(${tab.offsetLeft}px)`
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function setActive(name, index) {
|
|
23
|
+
emit("update:modelValue", name);
|
|
24
|
+
nextTick(() => updateIndicator(index));
|
|
25
|
+
}
|
|
26
|
+
function registerTab(tab) {
|
|
27
|
+
tabs.value.push(tab);
|
|
28
|
+
}
|
|
29
|
+
onMounted(() => {
|
|
30
|
+
watch(
|
|
31
|
+
() => props.modelValue,
|
|
32
|
+
async () => {
|
|
33
|
+
await nextTick();
|
|
34
|
+
const index = tabs.value.findIndex((t) => t.name === props.modelValue);
|
|
35
|
+
if (index !== -1) updateIndicator(index);
|
|
36
|
+
},
|
|
37
|
+
{ immediate: true }
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
provide("tabs", {
|
|
41
|
+
modelValue: computed(() => props.modelValue),
|
|
42
|
+
registerTab
|
|
43
|
+
});
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<template>
|
|
47
|
+
<!-- Tabs Header -->
|
|
48
|
+
<div ref="tabsEl" class="relative flex border-b bg-gray-100">
|
|
49
|
+
<span class="absolute bottom-0 h-0.5 bg-blue-600 transition-all duration-300 ease-out"
|
|
50
|
+
:style="indicatorStyle" />
|
|
51
|
+
|
|
52
|
+
<button v-for="(tab, index) in tabs" :key="tab.name" :ref="(el) => tabRefs[index] = el"
|
|
53
|
+
@click="setActive(tab.name, index)" class="relative px-4 py-2 text-sm font-medium transition-colors" :class="modelValue === tab.name ? 'text-blue-600' : 'text-gray-600 hover:text-gray-800'">
|
|
54
|
+
{{ tab.label }}
|
|
55
|
+
</button>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<!-- Content -->
|
|
59
|
+
<div class="relative">
|
|
60
|
+
<slot />
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
modelValue: string;
|
|
3
|
+
};
|
|
4
|
+
declare var __VLS_1: {};
|
|
5
|
+
type __VLS_Slots = {} & {
|
|
6
|
+
default?: (props: typeof __VLS_1) => any;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
9
|
+
"update:modelValue": (value: string) => any;
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
11
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
12
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
16
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
17
|
+
new (): {
|
|
18
|
+
$slots: S;
|
|
19
|
+
};
|
|
20
|
+
};
|