windly-ui 1.0.2 → 1.0.4
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 +33 -0
- package/dist/runtime/components/Accordion.d.vue.ts +39 -0
- package/dist/runtime/components/Accordion.vue +96 -0
- package/dist/runtime/components/Accordion.vue.d.ts +39 -0
- package/dist/runtime/components/Alert.d.vue.ts +83 -0
- package/dist/runtime/components/Alert.vue +78 -0
- package/dist/runtime/components/Alert.vue.d.ts +83 -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 +208 -0
- package/dist/runtime/components/Button.vue +126 -0
- package/dist/runtime/components/Button.vue.d.ts +208 -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 +63 -0
- package/dist/runtime/components/Dialog.vue +85 -0
- package/dist/runtime/components/Dialog.vue.d.ts +63 -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 +65 -0
- package/dist/runtime/components/FileUploader.vue +358 -0
- package/dist/runtime/components/FileUploader.vue.d.ts +65 -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 +68 -0
- package/dist/runtime/components/Input.vue +241 -0
- package/dist/runtime/components/Input.vue.d.ts +68 -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 +51 -0
- package/dist/runtime/components/Select.vue +271 -0
- package/dist/runtime/components/Select.vue.d.ts +51 -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
package/dist/module.mjs
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { defineNuxtModule, createResolver, addComponentsDir, extendPages } from '@nuxt/kit';
|
|
2
|
+
import tailwindColor from '../dist/runtime/tailwind-color.js';
|
|
3
|
+
|
|
4
|
+
const module$1 = defineNuxtModule({
|
|
5
|
+
setup(_, nuxt) {
|
|
6
|
+
const resolver = createResolver(import.meta.url);
|
|
7
|
+
addComponentsDir({
|
|
8
|
+
path: resolver.resolve("./runtime/components"),
|
|
9
|
+
prefix: "UI",
|
|
10
|
+
pathPrefix: false
|
|
11
|
+
});
|
|
12
|
+
extendPages((pages) => {
|
|
13
|
+
pages.push({
|
|
14
|
+
name: "windly-ui-docs",
|
|
15
|
+
path: "/_windly-ui",
|
|
16
|
+
file: resolver.resolve("./docs/index.vue")
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
nuxt.hook("tailwindcss:config", (config) => {
|
|
20
|
+
config.content ??= {};
|
|
21
|
+
if (!Array.isArray(config.content.files)) {
|
|
22
|
+
config.content.files = [];
|
|
23
|
+
}
|
|
24
|
+
config.content.files.push(
|
|
25
|
+
resolver.resolve("./runtime/components/**/*.{vue,js,ts}")
|
|
26
|
+
);
|
|
27
|
+
config.safelist ??= [];
|
|
28
|
+
config.safelist.push(...tailwindColor);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export { module$1 as default };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
type TriggerType = 'click' | 'hover';
|
|
2
|
+
type ToggleSide = 'left' | 'right';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
title?: string;
|
|
5
|
+
caption?: string;
|
|
6
|
+
modelValue?: boolean;
|
|
7
|
+
defaultOpen?: boolean;
|
|
8
|
+
trigger?: TriggerType;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
dense?: boolean;
|
|
11
|
+
toggleSide?: ToggleSide;
|
|
12
|
+
margin?: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare var __VLS_6: {}, __VLS_19: {};
|
|
15
|
+
type __VLS_Slots = {} & {
|
|
16
|
+
header?: (props: typeof __VLS_6) => any;
|
|
17
|
+
} & {
|
|
18
|
+
default?: (props: typeof __VLS_19) => any;
|
|
19
|
+
};
|
|
20
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
21
|
+
"update:modelValue": (value: boolean) => any;
|
|
22
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
23
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
24
|
+
}>, {
|
|
25
|
+
defaultOpen: boolean;
|
|
26
|
+
trigger: TriggerType;
|
|
27
|
+
disabled: boolean;
|
|
28
|
+
dense: boolean;
|
|
29
|
+
toggleSide: ToggleSide;
|
|
30
|
+
margin: boolean;
|
|
31
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
32
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
33
|
+
declare const _default: typeof __VLS_export;
|
|
34
|
+
export default _default;
|
|
35
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
36
|
+
new (): {
|
|
37
|
+
$slots: S;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, computed, watch } from "vue";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
title: { type: String, required: false },
|
|
5
|
+
caption: { type: String, required: false },
|
|
6
|
+
modelValue: { type: Boolean, required: false },
|
|
7
|
+
defaultOpen: { type: Boolean, required: false, default: false },
|
|
8
|
+
trigger: { type: String, required: false, default: "click" },
|
|
9
|
+
disabled: { type: Boolean, required: false, default: false },
|
|
10
|
+
dense: { type: Boolean, required: false, default: false },
|
|
11
|
+
toggleSide: { type: String, required: false, default: "right" },
|
|
12
|
+
margin: { type: Boolean, required: false, default: true }
|
|
13
|
+
});
|
|
14
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
15
|
+
const isControlled = computed(() => props.modelValue !== void 0);
|
|
16
|
+
const isOpen = ref(props.defaultOpen ?? false);
|
|
17
|
+
watch(
|
|
18
|
+
() => props.modelValue,
|
|
19
|
+
(val) => {
|
|
20
|
+
if (isControlled.value && typeof val === "boolean") {
|
|
21
|
+
isOpen.value = val;
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{ immediate: true }
|
|
25
|
+
);
|
|
26
|
+
const setOpen = (val) => {
|
|
27
|
+
if (props.disabled) return;
|
|
28
|
+
isOpen.value = val;
|
|
29
|
+
emit("update:modelValue", val);
|
|
30
|
+
};
|
|
31
|
+
const toggle = () => setOpen(!isOpen.value);
|
|
32
|
+
const headerEvents = computed(() => {
|
|
33
|
+
if (props.trigger === "hover") {
|
|
34
|
+
return {
|
|
35
|
+
mouseenter: () => setOpen(true),
|
|
36
|
+
mouseleave: () => setOpen(false),
|
|
37
|
+
click: void 0
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
mouseenter: void 0,
|
|
42
|
+
mouseleave: void 0,
|
|
43
|
+
click: toggle
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<template>
|
|
49
|
+
<div class="flex flex-col rounded-md border transition-opacity" :class="[
|
|
50
|
+
dense ? 'text-sm' : '',
|
|
51
|
+
disabled ? 'opacity-50 pointer-events-none' : ''
|
|
52
|
+
]">
|
|
53
|
+
|
|
54
|
+
<!-- Header -->
|
|
55
|
+
<div v-on="headerEvents" class="flex items-center cursor-pointer select-none gap-3" :class="[
|
|
56
|
+
margin ? dense ? 'p-2' : 'p-3' : dense ? 'py-2' : 'py-3',
|
|
57
|
+
isOpen ? 'border-b' : ''
|
|
58
|
+
]">
|
|
59
|
+
|
|
60
|
+
<!-- Toggle (left) -->
|
|
61
|
+
<UIButton v-if="toggleSide === 'left'" icon="chevron_right" flat dense class="transition-transform"
|
|
62
|
+
:class="{
|
|
63
|
+
'rotate-90': isOpen
|
|
64
|
+
}" />
|
|
65
|
+
|
|
66
|
+
<!-- Header content -->
|
|
67
|
+
<div class="flex-1">
|
|
68
|
+
<slot name="header">
|
|
69
|
+
<h3 class="font-semibold">
|
|
70
|
+
{{ title }}
|
|
71
|
+
</h3>
|
|
72
|
+
<p v-if="caption" class="text-gray-500 text-xs">
|
|
73
|
+
{{ caption }}
|
|
74
|
+
</p>
|
|
75
|
+
</slot>
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<!-- Toggle (right) -->
|
|
79
|
+
<UIButton v-if="toggleSide === 'right'" icon="chevron_right" flat dense class="transition-transform"
|
|
80
|
+
:class="{
|
|
81
|
+
'rotate-90': isOpen
|
|
82
|
+
}" />
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<!-- Content -->
|
|
86
|
+
<transition enter-active-class="transition-all duration-300 ease-out"
|
|
87
|
+
leave-active-class="transition-all duration-200 ease-in" enter-from-class="opacity-0 max-h-0"
|
|
88
|
+
enter-to-class="opacity-100 max-h-[1000px]" leave-from-class="opacity-100 max-h-[1000px]"
|
|
89
|
+
leave-to-class="opacity-0 max-h-0">
|
|
90
|
+
<div v-show="isOpen" class="overflow-hidden pb-3" :class="margin ? 'px-3' : 'px-none'">
|
|
91
|
+
<slot />
|
|
92
|
+
</div>
|
|
93
|
+
</transition>
|
|
94
|
+
|
|
95
|
+
</div>
|
|
96
|
+
</template>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
type TriggerType = 'click' | 'hover';
|
|
2
|
+
type ToggleSide = 'left' | 'right';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
title?: string;
|
|
5
|
+
caption?: string;
|
|
6
|
+
modelValue?: boolean;
|
|
7
|
+
defaultOpen?: boolean;
|
|
8
|
+
trigger?: TriggerType;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
dense?: boolean;
|
|
11
|
+
toggleSide?: ToggleSide;
|
|
12
|
+
margin?: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare var __VLS_6: {}, __VLS_19: {};
|
|
15
|
+
type __VLS_Slots = {} & {
|
|
16
|
+
header?: (props: typeof __VLS_6) => any;
|
|
17
|
+
} & {
|
|
18
|
+
default?: (props: typeof __VLS_19) => any;
|
|
19
|
+
};
|
|
20
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
21
|
+
"update:modelValue": (value: boolean) => any;
|
|
22
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
23
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
24
|
+
}>, {
|
|
25
|
+
defaultOpen: boolean;
|
|
26
|
+
trigger: TriggerType;
|
|
27
|
+
disabled: boolean;
|
|
28
|
+
dense: boolean;
|
|
29
|
+
toggleSide: ToggleSide;
|
|
30
|
+
margin: boolean;
|
|
31
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
32
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
33
|
+
declare const _default: typeof __VLS_export;
|
|
34
|
+
export default _default;
|
|
35
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
36
|
+
new (): {
|
|
37
|
+
$slots: S;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
4
|
+
type __VLS_WithSlots<T, S> = T & (new () => {
|
|
5
|
+
$slots: S;
|
|
6
|
+
});
|
|
7
|
+
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
8
|
+
isOpen: {
|
|
9
|
+
type: BooleanConstructor;
|
|
10
|
+
required: true;
|
|
11
|
+
};
|
|
12
|
+
title: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
default: string;
|
|
15
|
+
};
|
|
16
|
+
message: {
|
|
17
|
+
type: StringConstructor;
|
|
18
|
+
default: string;
|
|
19
|
+
};
|
|
20
|
+
confirmBtnText: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
default: string;
|
|
23
|
+
};
|
|
24
|
+
cancelBtnText: {
|
|
25
|
+
type: StringConstructor;
|
|
26
|
+
default: string;
|
|
27
|
+
};
|
|
28
|
+
showConfirmBtn: {
|
|
29
|
+
type: BooleanConstructor;
|
|
30
|
+
default: boolean;
|
|
31
|
+
};
|
|
32
|
+
showCloseIcon: {
|
|
33
|
+
type: BooleanConstructor;
|
|
34
|
+
default: boolean;
|
|
35
|
+
};
|
|
36
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
37
|
+
"update:isOpen": (...args: any[]) => void;
|
|
38
|
+
confirm: (...args: any[]) => void;
|
|
39
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
40
|
+
isOpen: {
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
required: true;
|
|
43
|
+
};
|
|
44
|
+
title: {
|
|
45
|
+
type: StringConstructor;
|
|
46
|
+
default: string;
|
|
47
|
+
};
|
|
48
|
+
message: {
|
|
49
|
+
type: StringConstructor;
|
|
50
|
+
default: string;
|
|
51
|
+
};
|
|
52
|
+
confirmBtnText: {
|
|
53
|
+
type: StringConstructor;
|
|
54
|
+
default: string;
|
|
55
|
+
};
|
|
56
|
+
cancelBtnText: {
|
|
57
|
+
type: StringConstructor;
|
|
58
|
+
default: string;
|
|
59
|
+
};
|
|
60
|
+
showConfirmBtn: {
|
|
61
|
+
type: BooleanConstructor;
|
|
62
|
+
default: boolean;
|
|
63
|
+
};
|
|
64
|
+
showCloseIcon: {
|
|
65
|
+
type: BooleanConstructor;
|
|
66
|
+
default: boolean;
|
|
67
|
+
};
|
|
68
|
+
}>> & Readonly<{
|
|
69
|
+
"onUpdate:isOpen"?: ((...args: any[]) => any) | undefined;
|
|
70
|
+
onConfirm?: ((...args: any[]) => any) | undefined;
|
|
71
|
+
}>, {
|
|
72
|
+
title: string;
|
|
73
|
+
message: string;
|
|
74
|
+
confirmBtnText: string;
|
|
75
|
+
cancelBtnText: string;
|
|
76
|
+
showConfirmBtn: boolean;
|
|
77
|
+
showCloseIcon: boolean;
|
|
78
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
79
|
+
type __VLS_Slots = {
|
|
80
|
+
title?: ((props: {}) => any) | undefined;
|
|
81
|
+
} & {
|
|
82
|
+
message?: ((props: {}) => any) | undefined;
|
|
83
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useAttrs } from "vue";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
isOpen: {
|
|
5
|
+
type: Boolean,
|
|
6
|
+
required: true
|
|
7
|
+
},
|
|
8
|
+
title: {
|
|
9
|
+
type: String,
|
|
10
|
+
default: "Modal Title"
|
|
11
|
+
},
|
|
12
|
+
message: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: ""
|
|
15
|
+
},
|
|
16
|
+
confirmBtnText: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: "Confirm"
|
|
19
|
+
},
|
|
20
|
+
cancelBtnText: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: "Cancel"
|
|
23
|
+
},
|
|
24
|
+
showConfirmBtn: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false
|
|
27
|
+
},
|
|
28
|
+
showCloseIcon: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const dialogAttributes = useAttrs();
|
|
34
|
+
const emit = defineEmits(["update:isOpen", "confirm"]);
|
|
35
|
+
const close = () => emit("update:isOpen", false);
|
|
36
|
+
const handleConfirm = () => {
|
|
37
|
+
emit("confirm");
|
|
38
|
+
close();
|
|
39
|
+
};
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<UIDialog v-bind="dialogAttributes" :isOpen="isOpen" @update:isOpen="(val) => emit('update:isOpen', val)">
|
|
44
|
+
<div class="bg-white rounded-lg shadow-lg w-96 p-6">
|
|
45
|
+
<!-- Header -->
|
|
46
|
+
<div class="flex justify-between items-center mb-4">
|
|
47
|
+
<slot name="title">
|
|
48
|
+
<h3 class="text-lg font-semibold">
|
|
49
|
+
{{ title }}
|
|
50
|
+
</h3>
|
|
51
|
+
</slot>
|
|
52
|
+
|
|
53
|
+
<button v-if="showCloseIcon" @click="close" class="text-gray-500 hover:text-gray-700" aria-label="Close modal">
|
|
54
|
+
<span class="material-icons">close</span>
|
|
55
|
+
</button>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<!-- Message -->
|
|
59
|
+
<slot name="message">
|
|
60
|
+
<p class="text-gray-600 mb-6">
|
|
61
|
+
{{ message }}
|
|
62
|
+
</p>
|
|
63
|
+
</slot>
|
|
64
|
+
|
|
65
|
+
<!-- Actions -->
|
|
66
|
+
<div class="flex justify-end">
|
|
67
|
+
<button @click="close" class="mr-2 px-4 py-2 bg-gray-200 text-gray-700 rounded-lg transition hover:bg-gray-300">
|
|
68
|
+
{{ cancelBtnText }}
|
|
69
|
+
</button>
|
|
70
|
+
|
|
71
|
+
<button v-if="showConfirmBtn" @click="handleConfirm"
|
|
72
|
+
class="px-4 py-2 bg-blue-500 text-white rounded-lg transition hover:bg-blue-600">
|
|
73
|
+
{{ confirmBtnText }}
|
|
74
|
+
</button>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</UIDialog>
|
|
78
|
+
</template>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
4
|
+
type __VLS_WithSlots<T, S> = T & (new () => {
|
|
5
|
+
$slots: S;
|
|
6
|
+
});
|
|
7
|
+
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
8
|
+
isOpen: {
|
|
9
|
+
type: BooleanConstructor;
|
|
10
|
+
required: true;
|
|
11
|
+
};
|
|
12
|
+
title: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
default: string;
|
|
15
|
+
};
|
|
16
|
+
message: {
|
|
17
|
+
type: StringConstructor;
|
|
18
|
+
default: string;
|
|
19
|
+
};
|
|
20
|
+
confirmBtnText: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
default: string;
|
|
23
|
+
};
|
|
24
|
+
cancelBtnText: {
|
|
25
|
+
type: StringConstructor;
|
|
26
|
+
default: string;
|
|
27
|
+
};
|
|
28
|
+
showConfirmBtn: {
|
|
29
|
+
type: BooleanConstructor;
|
|
30
|
+
default: boolean;
|
|
31
|
+
};
|
|
32
|
+
showCloseIcon: {
|
|
33
|
+
type: BooleanConstructor;
|
|
34
|
+
default: boolean;
|
|
35
|
+
};
|
|
36
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
37
|
+
"update:isOpen": (...args: any[]) => void;
|
|
38
|
+
confirm: (...args: any[]) => void;
|
|
39
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
40
|
+
isOpen: {
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
required: true;
|
|
43
|
+
};
|
|
44
|
+
title: {
|
|
45
|
+
type: StringConstructor;
|
|
46
|
+
default: string;
|
|
47
|
+
};
|
|
48
|
+
message: {
|
|
49
|
+
type: StringConstructor;
|
|
50
|
+
default: string;
|
|
51
|
+
};
|
|
52
|
+
confirmBtnText: {
|
|
53
|
+
type: StringConstructor;
|
|
54
|
+
default: string;
|
|
55
|
+
};
|
|
56
|
+
cancelBtnText: {
|
|
57
|
+
type: StringConstructor;
|
|
58
|
+
default: string;
|
|
59
|
+
};
|
|
60
|
+
showConfirmBtn: {
|
|
61
|
+
type: BooleanConstructor;
|
|
62
|
+
default: boolean;
|
|
63
|
+
};
|
|
64
|
+
showCloseIcon: {
|
|
65
|
+
type: BooleanConstructor;
|
|
66
|
+
default: boolean;
|
|
67
|
+
};
|
|
68
|
+
}>> & Readonly<{
|
|
69
|
+
"onUpdate:isOpen"?: ((...args: any[]) => any) | undefined;
|
|
70
|
+
onConfirm?: ((...args: any[]) => any) | undefined;
|
|
71
|
+
}>, {
|
|
72
|
+
title: string;
|
|
73
|
+
message: string;
|
|
74
|
+
confirmBtnText: string;
|
|
75
|
+
cancelBtnText: string;
|
|
76
|
+
showConfirmBtn: boolean;
|
|
77
|
+
showCloseIcon: boolean;
|
|
78
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
79
|
+
type __VLS_Slots = {
|
|
80
|
+
title?: ((props: {}) => any) | undefined;
|
|
81
|
+
} & {
|
|
82
|
+
message?: ((props: {}) => any) | undefined;
|
|
83
|
+
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
contentClass: {
|
|
3
|
+
readonly type: StringConstructor;
|
|
4
|
+
readonly default: "";
|
|
5
|
+
};
|
|
6
|
+
contentStyle: {
|
|
7
|
+
readonly type: StringConstructor;
|
|
8
|
+
readonly default: "";
|
|
9
|
+
};
|
|
10
|
+
textColor: {
|
|
11
|
+
readonly type: StringConstructor;
|
|
12
|
+
readonly default: "";
|
|
13
|
+
};
|
|
14
|
+
disable: {
|
|
15
|
+
readonly type: BooleanConstructor;
|
|
16
|
+
readonly default: false;
|
|
17
|
+
};
|
|
18
|
+
loading: {
|
|
19
|
+
readonly type: BooleanConstructor;
|
|
20
|
+
readonly default: false;
|
|
21
|
+
};
|
|
22
|
+
color: {
|
|
23
|
+
readonly type: StringConstructor;
|
|
24
|
+
readonly default: "blue-900";
|
|
25
|
+
};
|
|
26
|
+
rounded: {
|
|
27
|
+
readonly type: StringConstructor;
|
|
28
|
+
readonly default: "md";
|
|
29
|
+
};
|
|
30
|
+
size: {
|
|
31
|
+
readonly type: StringConstructor;
|
|
32
|
+
readonly default: "md";
|
|
33
|
+
};
|
|
34
|
+
iconSize: {
|
|
35
|
+
readonly type: StringConstructor;
|
|
36
|
+
readonly default: "lg";
|
|
37
|
+
};
|
|
38
|
+
image: {
|
|
39
|
+
type: StringConstructor;
|
|
40
|
+
default: string;
|
|
41
|
+
};
|
|
42
|
+
altText: {
|
|
43
|
+
type: StringConstructor;
|
|
44
|
+
default: string;
|
|
45
|
+
};
|
|
46
|
+
initials: {
|
|
47
|
+
type: StringConstructor;
|
|
48
|
+
default: string;
|
|
49
|
+
};
|
|
50
|
+
borderColor: {
|
|
51
|
+
type: StringConstructor;
|
|
52
|
+
default: string;
|
|
53
|
+
};
|
|
54
|
+
borderThickness: {
|
|
55
|
+
type: NumberConstructor;
|
|
56
|
+
default: number;
|
|
57
|
+
};
|
|
58
|
+
shadow: {
|
|
59
|
+
type: BooleanConstructor;
|
|
60
|
+
default: boolean;
|
|
61
|
+
};
|
|
62
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
63
|
+
contentClass: {
|
|
64
|
+
readonly type: StringConstructor;
|
|
65
|
+
readonly default: "";
|
|
66
|
+
};
|
|
67
|
+
contentStyle: {
|
|
68
|
+
readonly type: StringConstructor;
|
|
69
|
+
readonly default: "";
|
|
70
|
+
};
|
|
71
|
+
textColor: {
|
|
72
|
+
readonly type: StringConstructor;
|
|
73
|
+
readonly default: "";
|
|
74
|
+
};
|
|
75
|
+
disable: {
|
|
76
|
+
readonly type: BooleanConstructor;
|
|
77
|
+
readonly default: false;
|
|
78
|
+
};
|
|
79
|
+
loading: {
|
|
80
|
+
readonly type: BooleanConstructor;
|
|
81
|
+
readonly default: false;
|
|
82
|
+
};
|
|
83
|
+
color: {
|
|
84
|
+
readonly type: StringConstructor;
|
|
85
|
+
readonly default: "blue-900";
|
|
86
|
+
};
|
|
87
|
+
rounded: {
|
|
88
|
+
readonly type: StringConstructor;
|
|
89
|
+
readonly default: "md";
|
|
90
|
+
};
|
|
91
|
+
size: {
|
|
92
|
+
readonly type: StringConstructor;
|
|
93
|
+
readonly default: "md";
|
|
94
|
+
};
|
|
95
|
+
iconSize: {
|
|
96
|
+
readonly type: StringConstructor;
|
|
97
|
+
readonly default: "lg";
|
|
98
|
+
};
|
|
99
|
+
image: {
|
|
100
|
+
type: StringConstructor;
|
|
101
|
+
default: string;
|
|
102
|
+
};
|
|
103
|
+
altText: {
|
|
104
|
+
type: StringConstructor;
|
|
105
|
+
default: string;
|
|
106
|
+
};
|
|
107
|
+
initials: {
|
|
108
|
+
type: StringConstructor;
|
|
109
|
+
default: string;
|
|
110
|
+
};
|
|
111
|
+
borderColor: {
|
|
112
|
+
type: StringConstructor;
|
|
113
|
+
default: string;
|
|
114
|
+
};
|
|
115
|
+
borderThickness: {
|
|
116
|
+
type: NumberConstructor;
|
|
117
|
+
default: number;
|
|
118
|
+
};
|
|
119
|
+
shadow: {
|
|
120
|
+
type: BooleanConstructor;
|
|
121
|
+
default: boolean;
|
|
122
|
+
};
|
|
123
|
+
}>> & Readonly<{}>, {
|
|
124
|
+
image: string;
|
|
125
|
+
contentClass: string;
|
|
126
|
+
contentStyle: string;
|
|
127
|
+
textColor: string;
|
|
128
|
+
disable: boolean;
|
|
129
|
+
loading: boolean;
|
|
130
|
+
color: string;
|
|
131
|
+
rounded: string;
|
|
132
|
+
size: string;
|
|
133
|
+
iconSize: string;
|
|
134
|
+
altText: string;
|
|
135
|
+
initials: string;
|
|
136
|
+
borderColor: string;
|
|
137
|
+
borderThickness: number;
|
|
138
|
+
shadow: boolean;
|
|
139
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
140
|
+
declare const _default: typeof __VLS_export;
|
|
141
|
+
export default _default;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
defineOptions({
|
|
3
|
+
inheritAttrs: false
|
|
4
|
+
});
|
|
5
|
+
import { computed } from "vue";
|
|
6
|
+
import { useUiClasses } from "./useUiClasses";
|
|
7
|
+
import { uiProps } from "./uiProps";
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
image: { type: String, default: "" },
|
|
10
|
+
altText: { type: String, default: "Avatar" },
|
|
11
|
+
initials: { type: String, default: "" },
|
|
12
|
+
borderColor: { type: String, default: "#fff" },
|
|
13
|
+
borderThickness: { type: Number, default: 2 },
|
|
14
|
+
shadow: { type: Boolean, default: false },
|
|
15
|
+
...uiProps
|
|
16
|
+
});
|
|
17
|
+
const {
|
|
18
|
+
// props
|
|
19
|
+
contentClass,
|
|
20
|
+
contentStyle,
|
|
21
|
+
textColor,
|
|
22
|
+
color,
|
|
23
|
+
size,
|
|
24
|
+
// computed
|
|
25
|
+
colorClass,
|
|
26
|
+
computedContentClass,
|
|
27
|
+
isColorDark,
|
|
28
|
+
isHex,
|
|
29
|
+
isTailwindColor
|
|
30
|
+
} = useUiClasses(props);
|
|
31
|
+
const sizeClass = computed(() => {
|
|
32
|
+
const map = {
|
|
33
|
+
sm: "avatar-sm",
|
|
34
|
+
md: "avatar-md",
|
|
35
|
+
lg: "avatar-lg"
|
|
36
|
+
};
|
|
37
|
+
return map[size.value];
|
|
38
|
+
});
|
|
39
|
+
const shadowClass = computed(
|
|
40
|
+
() => props.shadow ? "shadow-lg" : ""
|
|
41
|
+
);
|
|
42
|
+
const avatarClass = computed(() => {
|
|
43
|
+
return [
|
|
44
|
+
computedContentClass.value,
|
|
45
|
+
sizeClass.value,
|
|
46
|
+
shadowClass.value,
|
|
47
|
+
isTailwindColor(textColor.value) ? `text-${textColor.value}` : `text-${isColorDark(color.value) ? "white" : "gray-700"}`,
|
|
48
|
+
isTailwindColor(color.value) ? `bg-${color.value}` : ""
|
|
49
|
+
].filter((c) => !["", "!"].includes(c));
|
|
50
|
+
});
|
|
51
|
+
const avatarStyle = computed(() => ({
|
|
52
|
+
backgroundColor: isHex(color.value) && color.value,
|
|
53
|
+
color: isHex(textColor.value) && textColor.value,
|
|
54
|
+
borderColor: props.borderColor,
|
|
55
|
+
borderWidth: `${props.borderThickness}px`,
|
|
56
|
+
borderStyle: "solid",
|
|
57
|
+
...contentStyle.value
|
|
58
|
+
}));
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<template>
|
|
62
|
+
<div class="avatar" :class="avatarClass" :style="avatarStyle">
|
|
63
|
+
<img v-if="image" :src="image" :alt="altText" class="avatar-image" />
|
|
64
|
+
<span v-else class="avatar-initials">
|
|
65
|
+
{{ initials || ".." }}
|
|
66
|
+
</span>
|
|
67
|
+
</div>
|
|
68
|
+
</template>
|
|
69
|
+
|
|
70
|
+
<style scoped>
|
|
71
|
+
.avatar{align-items:center;border-radius:50%;display:flex;justify-content:center;overflow:hidden;position:relative;text-align:center}.avatar-sm{font-size:.875rem;height:40px;width:40px}.avatar-md{font-size:1rem;height:60px;width:60px}.avatar-lg{font-size:1.25rem;height:80px;width:80px}.avatar-image{height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.avatar-initials{font-weight:700}.shadow-lg{box-shadow:0 4px 15px rgba(0,0,0,.2)}
|
|
72
|
+
</style>
|