@una-ui/nuxt 0.61.0 → 1.0.0-alpha.2
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 +2 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +5 -3
- package/dist/runtime/components/alert/Alert.vue +94 -0
- package/dist/runtime/components/alert/Alert.vue.d.ts +32 -0
- package/dist/runtime/components/alert/AlertClose.vue +58 -0
- package/dist/runtime/components/alert/AlertClose.vue.d.ts +18 -0
- package/dist/runtime/components/alert/AlertDescription.vue +22 -0
- package/dist/runtime/components/alert/AlertDescription.vue.d.ts +15 -0
- package/dist/runtime/components/alert/AlertTitle.vue +22 -0
- package/dist/runtime/components/alert/AlertTitle.vue.d.ts +15 -0
- package/dist/runtime/components/alert-dialog/AlertDialog.vue +2 -2
- package/dist/runtime/components/alert-dialog/AlertDialog.vue.d.ts +1 -0
- package/dist/runtime/components/alert-dialog/AlertDialogCancel.vue +1 -1
- package/dist/runtime/components/alert-dialog/AlertDialogContent.vue +2 -2
- package/dist/runtime/components/alert-dialog/AlertDialogContent.vue.d.ts +1 -0
- package/dist/runtime/components/aspect-ratio/AspectRatio.vue.d.ts +1 -1
- package/dist/runtime/components/combobox/Combobox.vue +2 -1
- package/dist/runtime/components/combobox/ComboboxTrigger.vue +1 -1
- package/dist/runtime/components/elements/Button.vue.d.ts +3 -3
- package/dist/runtime/components/elements/Skeleton.vue +1 -1
- package/dist/runtime/components/elements/Skeleton.vue.d.ts +3 -1
- package/dist/runtime/components/elements/avatar/Avatar.vue +17 -15
- package/dist/runtime/components/elements/avatar/Avatar.vue.d.ts +6 -4
- package/dist/runtime/components/elements/card/Card.vue +15 -4
- package/dist/runtime/components/elements/card/Card.vue.d.ts +6 -4
- package/dist/runtime/components/elements/card/CardAction.vue +19 -0
- package/dist/runtime/components/elements/card/CardAction.vue.d.ts +13 -0
- package/dist/runtime/components/elements/card/CardContent.vue +1 -0
- package/dist/runtime/components/elements/card/CardDescription.vue +1 -0
- package/dist/runtime/components/elements/card/CardFooter.vue +1 -0
- package/dist/runtime/components/elements/card/CardHeader.vue +1 -0
- package/dist/runtime/components/elements/card/CardTitle.vue +1 -0
- package/dist/runtime/components/elements/dialog/Dialog.vue +73 -62
- package/dist/runtime/components/elements/dialog/Dialog.vue.d.ts +12 -9
- package/dist/runtime/components/elements/dialog/DialogClose.vue +1 -0
- package/dist/runtime/components/elements/dialog/DialogClose.vue.d.ts +1 -1
- package/dist/runtime/components/elements/dialog/DialogContent.vue +3 -2
- package/dist/runtime/components/elements/dialog/DialogContent.vue.d.ts +1 -0
- package/dist/runtime/components/elements/dialog/DialogDescription.vue +1 -0
- package/dist/runtime/components/elements/dialog/DialogFooter.vue +1 -0
- package/dist/runtime/components/elements/dialog/DialogHeader.vue +1 -0
- package/dist/runtime/components/elements/dialog/DialogOverlay.vue +1 -0
- package/dist/runtime/components/elements/dialog/DialogScrollContent.vue +2 -2
- package/dist/runtime/components/elements/dialog/DialogScrollContent.vue.d.ts +1 -0
- package/dist/runtime/components/elements/dialog/DialogTitle.vue +1 -0
- package/dist/runtime/components/elements/dialog/DialogTrigger.vue +16 -0
- package/dist/runtime/components/elements/dialog/DialogTrigger.vue.d.ts +13 -0
- package/dist/runtime/components/elements/dropdown-menu/DropdownMenuItem.vue.d.ts +1 -1
- package/dist/runtime/components/elements/pagination/PaginationFirst.vue.d.ts +1 -1
- package/dist/runtime/components/elements/pagination/PaginationLast.vue.d.ts +1 -1
- package/dist/runtime/components/elements/pagination/PaginationNext.vue.d.ts +1 -1
- package/dist/runtime/components/elements/pagination/PaginationPrev.vue.d.ts +1 -1
- package/dist/runtime/components/elements/tabs/TabsTrigger.vue +2 -2
- package/dist/runtime/components/elements/tabs/TabsTrigger.vue.d.ts +1 -0
- package/dist/runtime/components/forms/Checkbox.vue +2 -2
- package/dist/runtime/components/forms/Checkbox.vue.d.ts +2 -0
- package/dist/runtime/components/forms/FormGroup.vue +1 -1
- package/dist/runtime/components/forms/Input.vue.d.ts +6 -6
- package/dist/runtime/components/forms/Slider.vue +12 -11
- package/dist/runtime/components/forms/Slider.vue.d.ts +1 -0
- package/dist/runtime/components/forms/form/FormField.vue +1 -1
- package/dist/runtime/components/forms/radio-group/RadioGroupItem.vue.d.ts +1 -1
- package/dist/runtime/components/forms/select/SelectTrigger.vue +1 -1
- package/dist/runtime/components/misc/ThemeSwitcher.vue +101 -32
- package/dist/runtime/components/navigation/breadcrumb/BreadcrumbEllipsis.vue.d.ts +1 -1
- package/dist/runtime/components/navigation/breadcrumb/BreadcrumbPage.vue +1 -1
- package/dist/runtime/components/navigation/breadcrumb/BreadcrumbSeparator.vue.d.ts +1 -1
- package/dist/runtime/components/navigation-menu/NavigationMenuLink.vue.d.ts +1 -1
- package/dist/runtime/components/navigation-menu/NavigationMenuTrigger.vue.d.ts +1 -1
- package/dist/runtime/components/number-field/NumberField.vue.d.ts +1 -1
- package/dist/runtime/components/number-field/NumberFieldDecrement.vue.d.ts +1 -1
- package/dist/runtime/components/number-field/NumberFieldIncrement.vue.d.ts +1 -1
- package/dist/runtime/components/overlays/toast/ToastAction.vue.d.ts +1 -1
- package/dist/runtime/components/scroll-area/ScrollArea.vue.d.ts +1 -1
- package/dist/runtime/components/sheet/Sheet.vue +11 -5
- package/dist/runtime/components/sheet/Sheet.vue.d.ts +7 -4
- package/dist/runtime/components/sheet/SheetClose.vue +1 -0
- package/dist/runtime/components/sheet/SheetContent.vue +6 -5
- package/dist/runtime/components/sheet/SheetContent.vue.d.ts +4 -2
- package/dist/runtime/components/sheet/SheetDescription.vue +1 -0
- package/dist/runtime/components/sheet/SheetFooter.vue +1 -0
- package/dist/runtime/components/sheet/SheetHeader.vue +1 -0
- package/dist/runtime/components/sheet/SheetOverlay.vue +23 -0
- package/dist/runtime/components/sheet/SheetOverlay.vue.d.ts +12 -0
- package/dist/runtime/components/sheet/SheetTitle.vue +1 -0
- package/dist/runtime/components/sheet/SheetTrigger.vue +4 -1
- package/dist/runtime/components/sidebar/Sidebar.vue +8 -3
- package/dist/runtime/components/sidebar/SidebarContent.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarFooter.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarGroup.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarGroupAction.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarGroupContent.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarGroupLabel.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarHeader.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarInput.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarInset.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarMenu.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarMenuAction.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarMenuBadge.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarMenuButton.vue.d.ts +1 -1
- package/dist/runtime/components/sidebar/SidebarMenuButtonChild.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarMenuButtonChild.vue.d.ts +1 -1
- package/dist/runtime/components/sidebar/SidebarMenuItem.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarMenuSkeleton.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarMenuSub.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarMenuSubButton.vue +3 -1
- package/dist/runtime/components/sidebar/SidebarMenuSubButton.vue.d.ts +1 -1
- package/dist/runtime/components/sidebar/SidebarMenuSubItem.vue +2 -0
- package/dist/runtime/components/sidebar/SidebarProvider.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarRail.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarSeparator.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarTrigger.vue +1 -0
- package/dist/runtime/composables/useUnaSettings.js +22 -9
- package/dist/runtime/composables/useUnaThemes.d.ts +5 -5
- package/dist/runtime/composables/useUnaThemes.js +48 -98
- package/dist/runtime/plugins/theme.client.js +13 -0
- package/dist/runtime/plugins/theme.server.js +12 -0
- package/dist/runtime/types/alert-dialog.d.ts +2 -2
- package/dist/runtime/types/alert.d.ts +30 -15
- package/dist/runtime/types/card.d.ts +5 -0
- package/dist/runtime/types/dialog.d.ts +8 -3
- package/dist/runtime/types/index.d.ts +10 -2
- package/dist/runtime/types/sheet.d.ts +2 -2
- package/package.json +9 -9
- package/dist/runtime/components/elements/Alert.vue +0 -127
- package/dist/runtime/components/elements/Alert.vue.d.ts +0 -22
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'vue';
|
|
2
|
+
import type { NButtonProps } from './button.js';
|
|
1
3
|
export interface NAlertProps {
|
|
4
|
+
size?: HTMLAttributes['class'];
|
|
5
|
+
class?: HTMLAttributes['class'];
|
|
2
6
|
/**
|
|
3
7
|
* Allows you to add `UnaUI` alert preset properties,
|
|
4
8
|
* Think of it as a shortcut for adding options or variants to the preset if available.
|
|
@@ -7,7 +11,7 @@ export interface NAlertProps {
|
|
|
7
11
|
* @example
|
|
8
12
|
* alert="outline-pink"
|
|
9
13
|
*/
|
|
10
|
-
alert?:
|
|
14
|
+
alert?: HTMLAttributes['class'];
|
|
11
15
|
/**
|
|
12
16
|
* Add icon to the alert,
|
|
13
17
|
* If this is true, the icon will be automatically generated based on the color.
|
|
@@ -33,23 +37,34 @@ export interface NAlertProps {
|
|
|
33
37
|
* Add a description to the alert.
|
|
34
38
|
*/
|
|
35
39
|
description?: string;
|
|
40
|
+
_alertTitle?: NAlertTitleProps;
|
|
41
|
+
_alertDescription?: NAlertDescriptionProps;
|
|
42
|
+
_alertClose?: NAlertCloseProps;
|
|
36
43
|
/**
|
|
37
44
|
* `UnaUI` preset configuration
|
|
38
45
|
*
|
|
39
46
|
* @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/alert.ts
|
|
40
47
|
*/
|
|
41
|
-
una?:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
una?: NAlertUnaProps;
|
|
49
|
+
}
|
|
50
|
+
export interface NAlertTitleProps {
|
|
51
|
+
size?: HTMLAttributes['class'];
|
|
52
|
+
class?: HTMLAttributes['class'];
|
|
53
|
+
una?: Pick<NAlertUnaProps, 'alertTitle'>;
|
|
54
|
+
}
|
|
55
|
+
export interface NAlertDescriptionProps {
|
|
56
|
+
size?: HTMLAttributes['class'];
|
|
57
|
+
class?: HTMLAttributes['class'];
|
|
58
|
+
una?: Pick<NAlertUnaProps, 'alertDescription'>;
|
|
59
|
+
}
|
|
60
|
+
export interface NAlertCloseProps extends Omit<NButtonProps, 'una'> {
|
|
61
|
+
size?: HTMLAttributes['class'];
|
|
62
|
+
class?: HTMLAttributes['class'];
|
|
63
|
+
una?: Pick<NAlertUnaProps, 'alertCloseWrapper'> & NButtonProps['una'];
|
|
64
|
+
}
|
|
65
|
+
export interface NAlertUnaProps {
|
|
66
|
+
alert?: HTMLAttributes['class'];
|
|
67
|
+
alertTitle?: HTMLAttributes['class'];
|
|
68
|
+
alertDescription?: HTMLAttributes['class'];
|
|
69
|
+
alertCloseWrapper?: HTMLAttributes['class'];
|
|
55
70
|
}
|
|
@@ -25,6 +25,7 @@ export interface NCardProps extends BaseExtensions {
|
|
|
25
25
|
_cardDescription?: Partial<NCardDescriptionProps>;
|
|
26
26
|
_cardHeader?: Partial<NCardHeaderProps>;
|
|
27
27
|
_cardFooter?: Partial<NCardFooterProps>;
|
|
28
|
+
_cardAction?: Partial<NCardActionProps>;
|
|
28
29
|
/**
|
|
29
30
|
* `UnaUI` preset configuration
|
|
30
31
|
*
|
|
@@ -47,6 +48,9 @@ export interface NCardHeaderProps extends BaseExtensions {
|
|
|
47
48
|
export interface NCardFooterProps extends BaseExtensions {
|
|
48
49
|
una?: Pick<NCardUnaProps, 'cardFooter'>;
|
|
49
50
|
}
|
|
51
|
+
export interface NCardActionProps extends BaseExtensions {
|
|
52
|
+
una?: Pick<NCardUnaProps, 'cardAction'>;
|
|
53
|
+
}
|
|
50
54
|
export interface NCardUnaProps {
|
|
51
55
|
cardDefaultVariant?: HTMLAttributes['class'];
|
|
52
56
|
cardTitle?: HTMLAttributes['class'];
|
|
@@ -54,5 +58,6 @@ export interface NCardUnaProps {
|
|
|
54
58
|
cardContent?: HTMLAttributes['class'];
|
|
55
59
|
cardHeader?: HTMLAttributes['class'];
|
|
56
60
|
cardFooter?: HTMLAttributes['class'];
|
|
61
|
+
cardAction?: HTMLAttributes['class'];
|
|
57
62
|
}
|
|
58
63
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { DialogCloseProps, DialogContentProps, DialogDescriptionProps, DialogRootProps, DialogTitleProps } from 'reka-ui';
|
|
1
|
+
import type { DialogCloseProps, DialogContentProps, DialogDescriptionProps, DialogRootProps, DialogTitleProps, DialogTriggerProps } from 'reka-ui';
|
|
2
2
|
import type { HTMLAttributes } from 'vue';
|
|
3
3
|
import type { NButtonProps } from './button.js';
|
|
4
|
-
export interface NDialogProps extends DialogRootProps, Pick<NDialogContentProps, '
|
|
4
|
+
export interface NDialogProps extends DialogRootProps, Pick<NDialogContentProps, 'dismissible' | 'showClose' | 'overlay' | '_dialogClose' | '_dialogOverlay'> {
|
|
5
5
|
/**
|
|
6
6
|
* The title of the dialog.
|
|
7
7
|
*/
|
|
@@ -11,7 +11,9 @@ export interface NDialogProps extends DialogRootProps, Pick<NDialogContentProps,
|
|
|
11
11
|
*/
|
|
12
12
|
description?: string;
|
|
13
13
|
/**
|
|
14
|
+
* If `true`, the dialog will have a scrollable body.
|
|
14
15
|
*
|
|
16
|
+
* @default false
|
|
15
17
|
*/
|
|
16
18
|
scrollable?: boolean;
|
|
17
19
|
_dialogTitle?: NDialogTitleProps;
|
|
@@ -19,6 +21,7 @@ export interface NDialogProps extends DialogRootProps, Pick<NDialogContentProps,
|
|
|
19
21
|
_dialogHeader?: NDialogHeaderProps;
|
|
20
22
|
_dialogFooter?: NDialogFooterProps;
|
|
21
23
|
_dialogContent?: NDialogContentProps;
|
|
24
|
+
_dialogTrigger?: NDialogTriggerProps;
|
|
22
25
|
/**
|
|
23
26
|
* `UnaUI` preset configuration
|
|
24
27
|
*
|
|
@@ -39,7 +42,7 @@ export interface NDialogContentProps extends DialogContentProps, BaseExtensions
|
|
|
39
42
|
/**
|
|
40
43
|
* Prevent close.
|
|
41
44
|
*/
|
|
42
|
-
|
|
45
|
+
dismissible?: boolean;
|
|
43
46
|
/**
|
|
44
47
|
* Show close button.
|
|
45
48
|
*
|
|
@@ -78,6 +81,8 @@ export interface NDialogFooterProps extends BaseExtensions {
|
|
|
78
81
|
}
|
|
79
82
|
export interface NDialogCloseProps extends DialogCloseProps, NButtonProps {
|
|
80
83
|
}
|
|
84
|
+
export interface NDialogTriggerProps extends DialogTriggerProps {
|
|
85
|
+
}
|
|
81
86
|
export interface NDialogUnaProps {
|
|
82
87
|
dialogTitle?: HTMLAttributes['class'];
|
|
83
88
|
dialogDescription?: HTMLAttributes['class'];
|
|
@@ -63,10 +63,18 @@ export interface ColorPalette {
|
|
|
63
63
|
export interface UnaSettings {
|
|
64
64
|
primaryColors: Colors;
|
|
65
65
|
grayColors: Colors;
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
theme: string | false;
|
|
67
|
+
primary: string | false;
|
|
68
|
+
gray: string | false;
|
|
68
69
|
fontSize: number;
|
|
69
70
|
radius: number;
|
|
71
|
+
themes: {
|
|
72
|
+
name: string;
|
|
73
|
+
cssVars: {
|
|
74
|
+
light: Colors;
|
|
75
|
+
dark: Colors;
|
|
76
|
+
};
|
|
77
|
+
}[];
|
|
70
78
|
}
|
|
71
79
|
export type OutsideEvent<T extends Event> = CustomEvent<{
|
|
72
80
|
originalEvent: T;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DialogCloseProps, DialogContentProps, DialogDescriptionProps, DialogOverlayProps, DialogPortalProps, DialogRootProps, DialogTitleProps, DialogTriggerProps } from 'reka-ui';
|
|
2
2
|
import type { HTMLAttributes } from 'vue';
|
|
3
3
|
import type { NButtonProps } from './button.js';
|
|
4
|
-
export interface NSheetProps extends DialogRootProps, Pick<NSheetContentProps, 'sheet' | '
|
|
4
|
+
export interface NSheetProps extends DialogRootProps, Pick<NSheetContentProps, 'sheet' | 'dismissible' | 'showClose' | 'overlay'> {
|
|
5
5
|
/**
|
|
6
6
|
* The title of the sheet.
|
|
7
7
|
*/
|
|
@@ -47,7 +47,7 @@ export interface NSheetContentProps extends DialogContentProps {
|
|
|
47
47
|
/**
|
|
48
48
|
* Prevent close.
|
|
49
49
|
*/
|
|
50
|
-
|
|
50
|
+
dismissible?: boolean;
|
|
51
51
|
/**
|
|
52
52
|
* Show close button.
|
|
53
53
|
*
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@una-ui/nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.0-alpha.2",
|
|
5
5
|
"description": "Nuxt module for @una-ui",
|
|
6
6
|
"author": "Phojie Rengel <phojrengel@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"@nuxt/kit": "^3.17.5",
|
|
42
42
|
"@nuxtjs/color-mode": "^3.5.2",
|
|
43
43
|
"@tanstack/vue-table": "^8.21.3",
|
|
44
|
-
"@unocss/core": "^66.
|
|
45
|
-
"@unocss/nuxt": "^66.
|
|
46
|
-
"@unocss/preset-attributify": "^66.
|
|
47
|
-
"@unocss/preset-icons": "^66.
|
|
44
|
+
"@unocss/core": "^66.2.0",
|
|
45
|
+
"@unocss/nuxt": "^66.2.0",
|
|
46
|
+
"@unocss/preset-attributify": "^66.2.0",
|
|
47
|
+
"@unocss/preset-icons": "^66.2.0",
|
|
48
48
|
"@vee-validate/nuxt": "^4.15.1",
|
|
49
49
|
"@vee-validate/zod": "^4.15.1",
|
|
50
50
|
"@vueuse/core": "^12.8.2",
|
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
"ohash": "^1.1.6",
|
|
56
56
|
"reka-ui": "^2.3.1",
|
|
57
57
|
"tailwind-merge": "^3.3.1",
|
|
58
|
-
"unocss": "^66.
|
|
58
|
+
"unocss": "^66.2.0",
|
|
59
59
|
"unocss-preset-animations": "^1.2.1",
|
|
60
60
|
"vaul-vue": "^0.4.1",
|
|
61
|
-
"@una-ui/
|
|
62
|
-
"@una-ui/
|
|
61
|
+
"@una-ui/extractor-vue-script": "^1.0.0-alpha.2",
|
|
62
|
+
"@una-ui/preset": "^1.0.0-alpha.2"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@iconify-json/lucide": "^1.2.51",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"build": "nuxt-build-module build",
|
|
78
78
|
"stub": "nuxt-build-module build --stub && pnpm nuxt-module-build prepare",
|
|
79
79
|
"dev": "nuxi dev playground",
|
|
80
|
-
"playground:build": "nuxi
|
|
80
|
+
"playground:build": "nuxi build playground",
|
|
81
81
|
"playground:preview": "nuxi preview playground"
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
3
|
-
import NButton from "../elements/Button.vue";
|
|
4
|
-
import NIcon from "../elements/Icon.vue";
|
|
5
|
-
defineOptions({
|
|
6
|
-
inheritAttrs: false
|
|
7
|
-
});
|
|
8
|
-
const props = defineProps({
|
|
9
|
-
alert: { type: String, required: false },
|
|
10
|
-
icon: { type: [String, Boolean], required: false, default: false },
|
|
11
|
-
closable: { type: Boolean, required: false },
|
|
12
|
-
title: { type: String, required: false },
|
|
13
|
-
description: { type: String, required: false },
|
|
14
|
-
una: { type: Object, required: false }
|
|
15
|
-
});
|
|
16
|
-
const emit = defineEmits(["close"]);
|
|
17
|
-
const slots = defineSlots();
|
|
18
|
-
const alertVariants = ["soft", "outline", "border"];
|
|
19
|
-
const hasVariant = computed(() => alertVariants.some((alertVariants2) => props.alert?.includes(alertVariants2)));
|
|
20
|
-
const isBaseVariant = computed(() => props.alert?.includes("~"));
|
|
21
|
-
const alertClassVariants = computed(() => {
|
|
22
|
-
const icon2 = {
|
|
23
|
-
info: "alert-info-icon",
|
|
24
|
-
success: "alert-success-icon",
|
|
25
|
-
warning: "alert-warning-icon",
|
|
26
|
-
error: "alert-error-icon",
|
|
27
|
-
default: ""
|
|
28
|
-
};
|
|
29
|
-
const alertType = props.alert ? props.alert.includes("info") ? "info" : props.alert.includes("success") ? "success" : props.alert.includes("warning") ? "warning" : props.alert.includes("error") ? "error" : "default" : "default";
|
|
30
|
-
return {
|
|
31
|
-
icon: icon2[alertType]
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
const icon = computed(() => {
|
|
35
|
-
if (props.icon === "" || props.icon === void 0 || props.icon === true)
|
|
36
|
-
return alertClassVariants.value.icon;
|
|
37
|
-
return props.icon.toString();
|
|
38
|
-
});
|
|
39
|
-
</script>
|
|
40
|
-
|
|
41
|
-
<template>
|
|
42
|
-
<div
|
|
43
|
-
v-bind="$attrs"
|
|
44
|
-
:alert="alert"
|
|
45
|
-
class="alert"
|
|
46
|
-
:class="[
|
|
47
|
-
{ 'alert-default-variant': !hasVariant && !isBaseVariant },
|
|
48
|
-
una?.alert
|
|
49
|
-
]"
|
|
50
|
-
>
|
|
51
|
-
<div
|
|
52
|
-
alert="inner-wrapper"
|
|
53
|
-
:class="una?.alertInnerWrapper"
|
|
54
|
-
>
|
|
55
|
-
<div
|
|
56
|
-
v-if="props.icon !== false"
|
|
57
|
-
alert="icon-wrapper"
|
|
58
|
-
:class="una?.alertIconWrapper"
|
|
59
|
-
>
|
|
60
|
-
<slot name="icon">
|
|
61
|
-
<NIcon
|
|
62
|
-
alert="icon-base"
|
|
63
|
-
:name="icon"
|
|
64
|
-
aria-hidden="true"
|
|
65
|
-
/>
|
|
66
|
-
</slot>
|
|
67
|
-
</div>
|
|
68
|
-
|
|
69
|
-
<slot>
|
|
70
|
-
<div
|
|
71
|
-
alert="content-wrapper"
|
|
72
|
-
:class="una?.alertContentWrapper"
|
|
73
|
-
>
|
|
74
|
-
<div
|
|
75
|
-
v-if="slots.title || title"
|
|
76
|
-
alert="title"
|
|
77
|
-
:class="una?.alertTitle"
|
|
78
|
-
>
|
|
79
|
-
<slot name="title">
|
|
80
|
-
<div>
|
|
81
|
-
{{ title }}
|
|
82
|
-
</div>
|
|
83
|
-
</slot>
|
|
84
|
-
</div>
|
|
85
|
-
<div
|
|
86
|
-
v-if="slots.description || description"
|
|
87
|
-
alert="description"
|
|
88
|
-
:class="una?.alertDescription"
|
|
89
|
-
>
|
|
90
|
-
<slot name="description">
|
|
91
|
-
<p>
|
|
92
|
-
{{ description }}
|
|
93
|
-
</p>
|
|
94
|
-
</slot>
|
|
95
|
-
</div>
|
|
96
|
-
</div>
|
|
97
|
-
</slot>
|
|
98
|
-
|
|
99
|
-
<div
|
|
100
|
-
v-if="slots.closeIcon || closable"
|
|
101
|
-
alert="close-wrapper"
|
|
102
|
-
:class="una?.alertCloseWrapper"
|
|
103
|
-
>
|
|
104
|
-
<div
|
|
105
|
-
alert="close-inner-wrapper"
|
|
106
|
-
:class="una?.alertCloseInnerWrapper"
|
|
107
|
-
>
|
|
108
|
-
<NButton
|
|
109
|
-
alert="close"
|
|
110
|
-
:class="una?.alertClose"
|
|
111
|
-
btn="~"
|
|
112
|
-
square
|
|
113
|
-
@click="emit('close')"
|
|
114
|
-
>
|
|
115
|
-
<slot name="closeIcon">
|
|
116
|
-
<NIcon
|
|
117
|
-
:class="`${una?.alertCloseIconBase} alert-close-icon-base`"
|
|
118
|
-
:name="una?.alertCloseIcon ?? 'alert-close-icon'"
|
|
119
|
-
aria-hidden="true"
|
|
120
|
-
/>
|
|
121
|
-
</slot>
|
|
122
|
-
</NButton>
|
|
123
|
-
</div>
|
|
124
|
-
</div>
|
|
125
|
-
</div>
|
|
126
|
-
</div>
|
|
127
|
-
</template>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { NAlertProps } from '../../types/index.js';
|
|
2
|
-
type __VLS_Slots = {
|
|
3
|
-
default?: any;
|
|
4
|
-
title?: any;
|
|
5
|
-
description?: any;
|
|
6
|
-
icon?: any;
|
|
7
|
-
closeIcon?: any;
|
|
8
|
-
};
|
|
9
|
-
declare const __VLS_component: import("vue").DefineComponent<NAlertProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
-
close: (...args: any[]) => void;
|
|
11
|
-
}, string, import("vue").PublicProps, Readonly<NAlertProps> & Readonly<{
|
|
12
|
-
onClose?: ((...args: any[]) => any) | undefined;
|
|
13
|
-
}>, {
|
|
14
|
-
icon: string | boolean;
|
|
15
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
-
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
17
|
-
export default _default;
|
|
18
|
-
type __VLS_WithSlots<T, S> = T & {
|
|
19
|
-
new (): {
|
|
20
|
-
$slots: S;
|
|
21
|
-
};
|
|
22
|
-
};
|