windly-ui 1.0.1 → 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/dist/module.d.mts +3 -0
- package/dist/module.json +8 -0
- package/dist/module.mjs +26 -0
- package/dist/runtime/components/Accordion.d.vue.ts +39 -0
- package/{ui-library → dist/runtime}/components/Accordion.vue +44 -70
- 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/{ui-library → dist/runtime}/components/Breadcrumbs.vue +37 -59
- 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/{ui-library → dist/runtime}/components/Card.vue +26 -39
- package/dist/runtime/components/Card.vue.d.ts +83 -0
- package/dist/runtime/components/Checkbox.d.vue.ts +190 -0
- package/{ui-library → dist/runtime}/components/Checkbox.vue +45 -68
- 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/{ui-library → dist/runtime}/components/Dialog.vue +30 -65
- 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/{ui-library/components/uiProps.ts → dist/runtime/components/uiProps.js} +2 -2
- package/dist/runtime/components/useUiClasses.d.ts +43 -0
- package/{ui-library/components/useUiClasses.ts → dist/runtime/components/useUiClasses.js} +25 -60
- 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/dist/types.d.mts +7 -0
- package/package.json +14 -16
- package/README.md +0 -208
- package/ui-library/components/Avatar.vue +0 -121
- package/ui-library/components/Badge.vue +0 -116
- package/ui-library/components/Button.vue +0 -154
- package/ui-library/components/CodeBlock.vue +0 -99
- package/ui-library/components/ColorPicker.vue +0 -302
- package/ui-library/components/Date.vue +0 -240
- package/ui-library/components/Divider.vue +0 -78
- package/ui-library/components/Drawer.vue +0 -67
- package/ui-library/components/Dropdown.vue +0 -248
- package/ui-library/components/FileUploader.vue +0 -330
- package/ui-library/components/Icon.vue +0 -82
- package/ui-library/components/Image.vue +0 -78
- package/ui-library/components/Input.vue +0 -531
- package/ui-library/components/Radio.vue +0 -356
- package/ui-library/components/ScrollArea.vue +0 -43
- package/ui-library/components/Select.vue +0 -309
- package/ui-library/components/Stepper.vue +0 -361
- package/ui-library/components/TabPanel.vue +0 -25
- package/ui-library/components/Table.vue +0 -152
- package/ui-library/components/Tabs.vue +0 -71
- package/ui-library/components/Textarea.vue +0 -233
- package/ui-library/components/Toggle.vue +0 -319
- package/ui-library/components/Tooltip.vue +0 -200
- package/ui-library/components/plugin.ts +0 -8
- package/ui-library/module.ts +0 -20
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
color: {
|
|
3
|
+
type: StringConstructor;
|
|
4
|
+
default: string;
|
|
5
|
+
};
|
|
6
|
+
type: {
|
|
7
|
+
type: StringConstructor;
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
10
|
+
vertical: {
|
|
11
|
+
type: BooleanConstructor;
|
|
12
|
+
default: boolean;
|
|
13
|
+
};
|
|
14
|
+
inset: {
|
|
15
|
+
type: BooleanConstructor;
|
|
16
|
+
default: boolean;
|
|
17
|
+
};
|
|
18
|
+
thickness: {
|
|
19
|
+
type: StringConstructor;
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
22
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
23
|
+
color: {
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
default: string;
|
|
26
|
+
};
|
|
27
|
+
type: {
|
|
28
|
+
type: StringConstructor;
|
|
29
|
+
default: string;
|
|
30
|
+
};
|
|
31
|
+
vertical: {
|
|
32
|
+
type: BooleanConstructor;
|
|
33
|
+
default: boolean;
|
|
34
|
+
};
|
|
35
|
+
inset: {
|
|
36
|
+
type: BooleanConstructor;
|
|
37
|
+
default: boolean;
|
|
38
|
+
};
|
|
39
|
+
thickness: {
|
|
40
|
+
type: StringConstructor;
|
|
41
|
+
default: string;
|
|
42
|
+
};
|
|
43
|
+
}>> & Readonly<{}>, {
|
|
44
|
+
type: string;
|
|
45
|
+
color: string;
|
|
46
|
+
vertical: boolean;
|
|
47
|
+
inset: boolean;
|
|
48
|
+
thickness: string;
|
|
49
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
50
|
+
declare const _default: typeof __VLS_export;
|
|
51
|
+
export default _default;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
defineOptions({
|
|
3
|
+
inheritAttrs: false
|
|
4
|
+
});
|
|
5
|
+
import { computed } from "vue";
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
color: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: "gray-300"
|
|
10
|
+
},
|
|
11
|
+
type: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: "solid"
|
|
14
|
+
},
|
|
15
|
+
vertical: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: false
|
|
18
|
+
},
|
|
19
|
+
inset: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false
|
|
22
|
+
},
|
|
23
|
+
thickness: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: "1px"
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const isHex = (val) => val.startsWith("#");
|
|
29
|
+
const dividerStyle = computed(() => {
|
|
30
|
+
const style = {};
|
|
31
|
+
if (isHex(props.color)) {
|
|
32
|
+
style.borderColor = props.color;
|
|
33
|
+
}
|
|
34
|
+
style.borderWidth = props.thickness;
|
|
35
|
+
return style;
|
|
36
|
+
});
|
|
37
|
+
const dividerClass = computed(() => [
|
|
38
|
+
props.vertical ? "h-full border-l" : "w-full border-t",
|
|
39
|
+
props.type === "dashed" ? "border-dashed" : "",
|
|
40
|
+
props.type === "dotted" ? "border-dotted" : "",
|
|
41
|
+
props.inset ? "mx-4" : "",
|
|
42
|
+
!isHex(props.color) ? `border-${props.color}` : ""
|
|
43
|
+
]);
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<template>
|
|
47
|
+
<div
|
|
48
|
+
:class="dividerClass"
|
|
49
|
+
:style="dividerStyle"
|
|
50
|
+
v-bind="$attrs"
|
|
51
|
+
/>
|
|
52
|
+
</template>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
color: {
|
|
3
|
+
type: StringConstructor;
|
|
4
|
+
default: string;
|
|
5
|
+
};
|
|
6
|
+
type: {
|
|
7
|
+
type: StringConstructor;
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
10
|
+
vertical: {
|
|
11
|
+
type: BooleanConstructor;
|
|
12
|
+
default: boolean;
|
|
13
|
+
};
|
|
14
|
+
inset: {
|
|
15
|
+
type: BooleanConstructor;
|
|
16
|
+
default: boolean;
|
|
17
|
+
};
|
|
18
|
+
thickness: {
|
|
19
|
+
type: StringConstructor;
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
22
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
23
|
+
color: {
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
default: string;
|
|
26
|
+
};
|
|
27
|
+
type: {
|
|
28
|
+
type: StringConstructor;
|
|
29
|
+
default: string;
|
|
30
|
+
};
|
|
31
|
+
vertical: {
|
|
32
|
+
type: BooleanConstructor;
|
|
33
|
+
default: boolean;
|
|
34
|
+
};
|
|
35
|
+
inset: {
|
|
36
|
+
type: BooleanConstructor;
|
|
37
|
+
default: boolean;
|
|
38
|
+
};
|
|
39
|
+
thickness: {
|
|
40
|
+
type: StringConstructor;
|
|
41
|
+
default: string;
|
|
42
|
+
};
|
|
43
|
+
}>> & Readonly<{}>, {
|
|
44
|
+
type: string;
|
|
45
|
+
color: string;
|
|
46
|
+
vertical: boolean;
|
|
47
|
+
inset: boolean;
|
|
48
|
+
thickness: string;
|
|
49
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
50
|
+
declare const _default: typeof __VLS_export;
|
|
51
|
+
export default _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type DrawerDirection = 'left' | 'right';
|
|
2
|
+
interface Props {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
direction?: DrawerDirection;
|
|
5
|
+
background?: string;
|
|
6
|
+
width?: string;
|
|
7
|
+
padding?: string;
|
|
8
|
+
}
|
|
9
|
+
declare var __VLS_1: {};
|
|
10
|
+
type __VLS_Slots = {} & {
|
|
11
|
+
default?: (props: typeof __VLS_1) => any;
|
|
12
|
+
};
|
|
13
|
+
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
14
|
+
close: () => any;
|
|
15
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
16
|
+
onClose?: (() => any) | undefined;
|
|
17
|
+
}>, {
|
|
18
|
+
width: string;
|
|
19
|
+
background: string;
|
|
20
|
+
direction: DrawerDirection;
|
|
21
|
+
padding: string;
|
|
22
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
24
|
+
declare const _default: typeof __VLS_export;
|
|
25
|
+
export default _default;
|
|
26
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
27
|
+
new (): {
|
|
28
|
+
$slots: S;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
defineOptions({
|
|
3
|
+
name: "UIDrawer"
|
|
4
|
+
});
|
|
5
|
+
defineProps({
|
|
6
|
+
isOpen: { type: Boolean, required: true },
|
|
7
|
+
direction: { type: String, required: false, default: "right" },
|
|
8
|
+
background: { type: String, required: false, default: "bg-white dark:bg-gray-900" },
|
|
9
|
+
width: { type: String, required: false, default: "w-80" },
|
|
10
|
+
padding: { type: String, required: false, default: "p-6" }
|
|
11
|
+
});
|
|
12
|
+
const emit = defineEmits(["close"]);
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<div
|
|
17
|
+
class="fixed inset-0 z-40 bg-black/40 transition-opacity duration-300"
|
|
18
|
+
:class="[
|
|
19
|
+
isOpen ? 'opacity-100 visible' : 'opacity-0 invisible'
|
|
20
|
+
]"
|
|
21
|
+
@click="emit('close')"
|
|
22
|
+
/>
|
|
23
|
+
|
|
24
|
+
<div
|
|
25
|
+
class="fixed top-0 bottom-0 z-50 shadow-2xl transition-transform duration-500 ease-in-out"
|
|
26
|
+
:class="[
|
|
27
|
+
width,
|
|
28
|
+
padding,
|
|
29
|
+
background,
|
|
30
|
+
direction === 'left' ? 'left-0' : 'right-0',
|
|
31
|
+
direction === 'left' ? isOpen ? 'translate-x-0' : '-translate-x-full' : isOpen ? 'translate-x-0' : 'translate-x-full'
|
|
32
|
+
]"
|
|
33
|
+
>
|
|
34
|
+
<button
|
|
35
|
+
class="absolute top-4 right-4 text-xl font-bold"
|
|
36
|
+
@click="emit('close')"
|
|
37
|
+
>
|
|
38
|
+
✕
|
|
39
|
+
</button>
|
|
40
|
+
|
|
41
|
+
<slot />
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type DrawerDirection = 'left' | 'right';
|
|
2
|
+
interface Props {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
direction?: DrawerDirection;
|
|
5
|
+
background?: string;
|
|
6
|
+
width?: string;
|
|
7
|
+
padding?: string;
|
|
8
|
+
}
|
|
9
|
+
declare var __VLS_1: {};
|
|
10
|
+
type __VLS_Slots = {} & {
|
|
11
|
+
default?: (props: typeof __VLS_1) => any;
|
|
12
|
+
};
|
|
13
|
+
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
14
|
+
close: () => any;
|
|
15
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
16
|
+
onClose?: (() => any) | undefined;
|
|
17
|
+
}>, {
|
|
18
|
+
width: string;
|
|
19
|
+
background: string;
|
|
20
|
+
direction: DrawerDirection;
|
|
21
|
+
padding: string;
|
|
22
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
24
|
+
declare const _default: typeof __VLS_export;
|
|
25
|
+
export default _default;
|
|
26
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
27
|
+
new (): {
|
|
28
|
+
$slots: S;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
type DropdownAlign = 'left' | 'right';
|
|
2
|
+
type Rounded = 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
align?: DropdownAlign;
|
|
5
|
+
width?: string;
|
|
6
|
+
menuBgClass?: string;
|
|
7
|
+
rounded?: Rounded;
|
|
8
|
+
bordered?: boolean;
|
|
9
|
+
borderColor?: string;
|
|
10
|
+
flat?: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare var __VLS_1: {}, __VLS_9: {};
|
|
13
|
+
type __VLS_Slots = {} & {
|
|
14
|
+
trigger?: (props: typeof __VLS_1) => any;
|
|
15
|
+
} & {
|
|
16
|
+
menu?: (props: typeof __VLS_9) => any;
|
|
17
|
+
};
|
|
18
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
19
|
+
rounded: Rounded;
|
|
20
|
+
borderColor: string;
|
|
21
|
+
align: DropdownAlign;
|
|
22
|
+
flat: boolean;
|
|
23
|
+
bordered: boolean;
|
|
24
|
+
width: string;
|
|
25
|
+
menuBgClass: string;
|
|
26
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
27
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
28
|
+
declare const _default: typeof __VLS_export;
|
|
29
|
+
export default _default;
|
|
30
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
31
|
+
new (): {
|
|
32
|
+
$slots: S;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
defineOptions({
|
|
3
|
+
name: "UIDropdown"
|
|
4
|
+
});
|
|
5
|
+
import {
|
|
6
|
+
computed,
|
|
7
|
+
onBeforeUnmount,
|
|
8
|
+
onMounted,
|
|
9
|
+
ref
|
|
10
|
+
} from "vue";
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
align: { type: String, required: false, default: "left" },
|
|
13
|
+
width: { type: String, required: false, default: "w-48" },
|
|
14
|
+
menuBgClass: { type: String, required: false, default: "bg-white dark:bg-gray-800" },
|
|
15
|
+
rounded: { type: String, required: false, default: "xl" },
|
|
16
|
+
bordered: { type: Boolean, required: false, default: false },
|
|
17
|
+
borderColor: { type: String, required: false, default: "gray-200" },
|
|
18
|
+
flat: { type: Boolean, required: false, default: false }
|
|
19
|
+
});
|
|
20
|
+
const isOpen = ref(false);
|
|
21
|
+
const dropdownRef = ref(null);
|
|
22
|
+
const isHex = (val) => {
|
|
23
|
+
return val.startsWith("#") || val.startsWith("rgb") || val.startsWith("hsl");
|
|
24
|
+
};
|
|
25
|
+
const toggle = () => {
|
|
26
|
+
isOpen.value = !isOpen.value;
|
|
27
|
+
};
|
|
28
|
+
const close = () => {
|
|
29
|
+
isOpen.value = false;
|
|
30
|
+
};
|
|
31
|
+
const handleClickOutside = (event) => {
|
|
32
|
+
const target = event.target;
|
|
33
|
+
if (dropdownRef.value && !dropdownRef.value.contains(
|
|
34
|
+
target
|
|
35
|
+
)) {
|
|
36
|
+
close();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
onMounted(() => {
|
|
40
|
+
document.addEventListener(
|
|
41
|
+
"click",
|
|
42
|
+
handleClickOutside
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
onBeforeUnmount(() => {
|
|
46
|
+
document.removeEventListener(
|
|
47
|
+
"click",
|
|
48
|
+
handleClickOutside
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
const roundedClass = computed(
|
|
52
|
+
() => {
|
|
53
|
+
const map = {
|
|
54
|
+
none: "rounded-none",
|
|
55
|
+
sm: "rounded-sm",
|
|
56
|
+
md: "rounded-md",
|
|
57
|
+
lg: "rounded-lg",
|
|
58
|
+
xl: "rounded-xl",
|
|
59
|
+
full: "rounded-full"
|
|
60
|
+
};
|
|
61
|
+
return map[props.rounded];
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
const dropdownClasses = computed(() => [
|
|
65
|
+
"absolute mt-2 z-50 transition-all overflow-hidden",
|
|
66
|
+
props.align === "right" ? "right-0" : "left-0",
|
|
67
|
+
props.width,
|
|
68
|
+
roundedClass.value,
|
|
69
|
+
props.bordered && !isHex(props.borderColor) ? `border border-${props.borderColor}` : "",
|
|
70
|
+
props.flat ? "shadow-none" : "shadow-lg"
|
|
71
|
+
]);
|
|
72
|
+
const dropdownStyle = computed(
|
|
73
|
+
() => {
|
|
74
|
+
const style = {};
|
|
75
|
+
if (props.bordered && isHex(props.borderColor)) {
|
|
76
|
+
style.border = `1px solid ${props.borderColor}`;
|
|
77
|
+
}
|
|
78
|
+
return style;
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
const menuClasses = computed(
|
|
82
|
+
() => [
|
|
83
|
+
"p-2",
|
|
84
|
+
roundedClass.value,
|
|
85
|
+
props.menuBgClass
|
|
86
|
+
]
|
|
87
|
+
);
|
|
88
|
+
</script>
|
|
89
|
+
|
|
90
|
+
<template>
|
|
91
|
+
<div
|
|
92
|
+
ref="dropdownRef"
|
|
93
|
+
class="relative inline-block"
|
|
94
|
+
>
|
|
95
|
+
<!-- Trigger -->
|
|
96
|
+
<div @click="toggle">
|
|
97
|
+
<slot name="trigger" />
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<!-- Dropdown -->
|
|
101
|
+
<transition
|
|
102
|
+
name="fade-slide"
|
|
103
|
+
>
|
|
104
|
+
<div
|
|
105
|
+
v-if="isOpen"
|
|
106
|
+
:class="
|
|
107
|
+
dropdownClasses
|
|
108
|
+
"
|
|
109
|
+
:style="
|
|
110
|
+
dropdownStyle
|
|
111
|
+
"
|
|
112
|
+
>
|
|
113
|
+
<div
|
|
114
|
+
:class="
|
|
115
|
+
menuClasses
|
|
116
|
+
"
|
|
117
|
+
>
|
|
118
|
+
<slot name="menu" />
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
</transition>
|
|
122
|
+
</div>
|
|
123
|
+
</template>
|
|
124
|
+
|
|
125
|
+
<style scoped>
|
|
126
|
+
.fade-slide-enter-active,.fade-slide-leave-active{transition:all .2s ease}.fade-slide-enter-from{opacity:0;transform:translateY(-8px)}.fade-slide-enter-to,.fade-slide-leave-from{opacity:1;transform:translateY(0)}.fade-slide-leave-to{opacity:0;transform:translateY(-8px)}
|
|
127
|
+
</style>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
type DropdownAlign = 'left' | 'right';
|
|
2
|
+
type Rounded = 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
align?: DropdownAlign;
|
|
5
|
+
width?: string;
|
|
6
|
+
menuBgClass?: string;
|
|
7
|
+
rounded?: Rounded;
|
|
8
|
+
bordered?: boolean;
|
|
9
|
+
borderColor?: string;
|
|
10
|
+
flat?: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare var __VLS_1: {}, __VLS_9: {};
|
|
13
|
+
type __VLS_Slots = {} & {
|
|
14
|
+
trigger?: (props: typeof __VLS_1) => any;
|
|
15
|
+
} & {
|
|
16
|
+
menu?: (props: typeof __VLS_9) => any;
|
|
17
|
+
};
|
|
18
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
19
|
+
rounded: Rounded;
|
|
20
|
+
borderColor: string;
|
|
21
|
+
align: DropdownAlign;
|
|
22
|
+
flat: boolean;
|
|
23
|
+
bordered: boolean;
|
|
24
|
+
width: string;
|
|
25
|
+
menuBgClass: string;
|
|
26
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
27
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
28
|
+
declare const _default: typeof __VLS_export;
|
|
29
|
+
export default _default;
|
|
30
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
31
|
+
new (): {
|
|
32
|
+
$slots: S;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
interface UploadedFile {
|
|
2
|
+
file: File;
|
|
3
|
+
name: string;
|
|
4
|
+
size: number;
|
|
5
|
+
type: string;
|
|
6
|
+
}
|
|
7
|
+
type Separator = 'solid' | 'dashed' | 'dotted';
|
|
8
|
+
type Rounded = 'none' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
|
+
type __VLS_Props = {
|
|
10
|
+
modelValue?: UploadedFile[];
|
|
11
|
+
header?: string;
|
|
12
|
+
subHeader?: string;
|
|
13
|
+
fileType?: string;
|
|
14
|
+
multiple?: boolean;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
bordered?: boolean;
|
|
17
|
+
flat?: boolean;
|
|
18
|
+
rounded?: Rounded;
|
|
19
|
+
borderColor?: string;
|
|
20
|
+
bgColor?: string;
|
|
21
|
+
separator?: Separator;
|
|
22
|
+
dense?: boolean;
|
|
23
|
+
fileRemoverIcon?: string;
|
|
24
|
+
fileSizeLimitKb?: number;
|
|
25
|
+
};
|
|
26
|
+
declare var __VLS_1: {};
|
|
27
|
+
type __VLS_Slots = {} & {
|
|
28
|
+
content?: (props: typeof __VLS_1) => any;
|
|
29
|
+
};
|
|
30
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
31
|
+
"update:modelValue": (value: UploadedFile[]) => any;
|
|
32
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
33
|
+
"onUpdate:modelValue"?: ((value: UploadedFile[]) => any) | undefined;
|
|
34
|
+
}>, {
|
|
35
|
+
modelValue: UploadedFile[];
|
|
36
|
+
disabled: boolean;
|
|
37
|
+
dense: boolean;
|
|
38
|
+
header: string;
|
|
39
|
+
rounded: Rounded;
|
|
40
|
+
borderColor: string;
|
|
41
|
+
separator: Separator;
|
|
42
|
+
flat: boolean;
|
|
43
|
+
bordered: boolean;
|
|
44
|
+
subHeader: string;
|
|
45
|
+
fileType: string;
|
|
46
|
+
multiple: boolean;
|
|
47
|
+
bgColor: string;
|
|
48
|
+
fileRemoverIcon: string;
|
|
49
|
+
fileSizeLimitKb: number;
|
|
50
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
51
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
52
|
+
declare const _default: typeof __VLS_export;
|
|
53
|
+
export default _default;
|
|
54
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
55
|
+
new (): {
|
|
56
|
+
$slots: S;
|
|
57
|
+
};
|
|
58
|
+
};
|