@nuxt/ui 4.2.0 → 4.2.1
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/.nuxt/ui.css +152 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/Accordion.vue +1 -1
- package/dist/runtime/components/Alert.vue +2 -2
- package/dist/runtime/components/AuthForm.vue +1 -1
- package/dist/runtime/components/Avatar.vue +1 -1
- package/dist/runtime/components/Badge.vue +3 -3
- package/dist/runtime/components/Banner.vue +2 -2
- package/dist/runtime/components/Breadcrumb.vue +1 -1
- package/dist/runtime/components/Button.vue +4 -4
- package/dist/runtime/components/Calendar.vue +4 -4
- package/dist/runtime/components/Carousel.vue +2 -2
- package/dist/runtime/components/ChatMessage.vue +1 -1
- package/dist/runtime/components/ChatMessages.vue +1 -1
- package/dist/runtime/components/ChatPrompt.vue +2 -2
- package/dist/runtime/components/ChatPromptSubmit.d.vue.ts +6 -6
- package/dist/runtime/components/ChatPromptSubmit.vue +13 -13
- package/dist/runtime/components/ChatPromptSubmit.vue.d.ts +6 -6
- package/dist/runtime/components/Checkbox.vue +2 -2
- package/dist/runtime/components/CheckboxGroup.vue +1 -1
- package/dist/runtime/components/CommandPalette.vue +7 -7
- package/dist/runtime/components/ContextMenu.vue +3 -3
- package/dist/runtime/components/ContextMenuContent.vue +3 -3
- package/dist/runtime/components/DashboardNavbar.vue +1 -1
- package/dist/runtime/components/DashboardSearch.vue +3 -3
- package/dist/runtime/components/DashboardSearchButton.vue +4 -4
- package/dist/runtime/components/DashboardSidebarCollapse.vue +4 -4
- package/dist/runtime/components/DashboardSidebarToggle.vue +4 -4
- package/dist/runtime/components/DropdownMenu.vue +3 -3
- package/dist/runtime/components/DropdownMenuContent.vue +3 -3
- package/dist/runtime/components/Empty.vue +1 -1
- package/dist/runtime/components/FileUpload.vue +3 -3
- package/dist/runtime/components/Icon.d.vue.ts +1 -1
- package/dist/runtime/components/Icon.vue +1 -1
- package/dist/runtime/components/Icon.vue.d.ts +1 -1
- package/dist/runtime/components/Input.vue +4 -4
- package/dist/runtime/components/InputDate.vue +5 -5
- package/dist/runtime/components/InputMenu.vue +6 -6
- package/dist/runtime/components/InputNumber.vue +2 -2
- package/dist/runtime/components/InputTags.vue +5 -5
- package/dist/runtime/components/InputTime.vue +4 -4
- package/dist/runtime/components/Link.d.vue.ts +52 -2
- package/dist/runtime/components/Link.vue.d.ts +52 -2
- package/dist/runtime/components/Modal.vue +1 -1
- package/dist/runtime/components/NavigationMenu.vue +2 -2
- package/dist/runtime/components/PageCard.vue +1 -1
- package/dist/runtime/components/PageFeature.vue +1 -1
- package/dist/runtime/components/PageSection.vue +1 -1
- package/dist/runtime/components/Pagination.vue +5 -5
- package/dist/runtime/components/Select.vue +5 -5
- package/dist/runtime/components/SelectMenu.vue +5 -5
- package/dist/runtime/components/Separator.vue +1 -1
- package/dist/runtime/components/Slideover.vue +1 -1
- package/dist/runtime/components/Switch.vue +3 -3
- package/dist/runtime/components/Textarea.vue +4 -4
- package/dist/runtime/components/Toast.vue +2 -2
- package/dist/runtime/components/Tree.vue +3 -3
- package/dist/runtime/components/color-mode/ColorModeAvatar.vue +1 -1
- package/dist/runtime/components/color-mode/ColorModeButton.vue +5 -4
- package/dist/runtime/components/color-mode/ColorModeSelect.vue +4 -4
- package/dist/runtime/components/color-mode/ColorModeSwitch.vue +1 -1
- package/dist/runtime/components/content/ContentNavigation.vue +1 -1
- package/dist/runtime/components/content/ContentSearch.vue +3 -3
- package/dist/runtime/components/content/ContentSearchButton.vue +4 -4
- package/dist/runtime/components/content/ContentSurround.vue +2 -2
- package/dist/runtime/components/content/ContentToc.vue +1 -1
- package/dist/runtime/components/locale/LocaleSelect.vue +5 -5
- package/dist/runtime/components/prose/Callout.vue +1 -1
- package/dist/runtime/components/prose/Card.vue +1 -1
- package/dist/runtime/components/prose/CodeCollapse.vue +1 -1
- package/dist/runtime/components/prose/CodeIcon.vue +1 -1
- package/dist/runtime/components/prose/Collapsible.vue +1 -1
- package/dist/runtime/components/prose/Pre.vue +1 -1
- package/dist/runtime/composables/useComponentIcons.d.ts +2 -2
- package/dist/runtime/inertia/components/Link.d.vue.ts +5 -2
- package/dist/runtime/inertia/components/Link.vue +25 -6
- package/dist/runtime/inertia/components/Link.vue.d.ts +5 -2
- package/dist/runtime/inertia/components/LinkBase.d.vue.ts +1 -0
- package/dist/runtime/inertia/components/LinkBase.vue +5 -2
- package/dist/runtime/inertia/components/LinkBase.vue.d.ts +1 -0
- package/dist/runtime/vue/components/Icon.vue +1 -1
- package/dist/runtime/vue/components/Link.d.vue.ts +4 -2
- package/dist/runtime/vue/components/Link.vue +31 -8
- package/dist/runtime/vue/components/Link.vue.d.ts +4 -2
- package/dist/runtime/vue/components/color-mode/ColorModeSelect.vue +4 -4
- package/dist/runtime/vue/components/color-mode/ColorModeSwitch.vue +1 -1
- package/package.json +5 -1
|
@@ -19,7 +19,7 @@ defineOptions({ inheritAttrs: false });
|
|
|
19
19
|
const props = defineProps({
|
|
20
20
|
as: { type: null, required: false, default: "nav" },
|
|
21
21
|
defaultOpen: { type: Boolean, required: false, default: void 0 },
|
|
22
|
-
trailingIcon: { type:
|
|
22
|
+
trailingIcon: { type: null, required: false },
|
|
23
23
|
color: { type: null, required: false },
|
|
24
24
|
variant: { type: null, required: false },
|
|
25
25
|
highlight: { type: Boolean, required: false, default: false },
|
|
@@ -15,13 +15,13 @@ import { tv } from "../../utils/tv";
|
|
|
15
15
|
import UModal from "../Modal.vue";
|
|
16
16
|
import UCommandPalette from "../CommandPalette.vue";
|
|
17
17
|
const props = defineProps({
|
|
18
|
-
icon: { type:
|
|
18
|
+
icon: { type: null, required: false },
|
|
19
19
|
placeholder: { type: String, required: false },
|
|
20
20
|
autofocus: { type: Boolean, required: false },
|
|
21
21
|
loading: { type: Boolean, required: false },
|
|
22
|
-
loadingIcon: { type:
|
|
22
|
+
loadingIcon: { type: null, required: false },
|
|
23
23
|
close: { type: [Boolean, Object], required: false, default: true },
|
|
24
|
-
closeIcon: { type:
|
|
24
|
+
closeIcon: { type: null, required: false },
|
|
25
25
|
shortcut: { type: String, required: false, default: "meta_k" },
|
|
26
26
|
links: { type: Array, required: false },
|
|
27
27
|
navigation: { type: Array, required: false },
|
|
@@ -17,7 +17,7 @@ import UKbd from "../Kbd.vue";
|
|
|
17
17
|
import UTooltip from "../Tooltip.vue";
|
|
18
18
|
defineOptions({ inheritAttrs: false });
|
|
19
19
|
const props = defineProps({
|
|
20
|
-
icon: { type:
|
|
20
|
+
icon: { type: null, required: false },
|
|
21
21
|
label: { type: String, required: false },
|
|
22
22
|
color: { type: null, required: false, default: "neutral" },
|
|
23
23
|
variant: { type: null, required: false },
|
|
@@ -35,11 +35,11 @@ const props = defineProps({
|
|
|
35
35
|
onClick: { type: [Function, Array], required: false },
|
|
36
36
|
avatar: { type: Object, required: false },
|
|
37
37
|
leading: { type: Boolean, required: false },
|
|
38
|
-
leadingIcon: { type:
|
|
38
|
+
leadingIcon: { type: null, required: false },
|
|
39
39
|
trailing: { type: Boolean, required: false },
|
|
40
|
-
trailingIcon: { type:
|
|
40
|
+
trailingIcon: { type: null, required: false },
|
|
41
41
|
loading: { type: Boolean, required: false },
|
|
42
|
-
loadingIcon: { type:
|
|
42
|
+
loadingIcon: { type: null, required: false },
|
|
43
43
|
as: { type: null, required: false },
|
|
44
44
|
type: { type: null, required: false },
|
|
45
45
|
disabled: { type: Boolean, required: false },
|
|
@@ -13,8 +13,8 @@ import UIcon from "../Icon.vue";
|
|
|
13
13
|
defineOptions({ inheritAttrs: false });
|
|
14
14
|
const props = defineProps({
|
|
15
15
|
as: { type: null, required: false },
|
|
16
|
-
prevIcon: { type:
|
|
17
|
-
nextIcon: { type:
|
|
16
|
+
prevIcon: { type: null, required: false },
|
|
17
|
+
nextIcon: { type: null, required: false },
|
|
18
18
|
surround: { type: Array, required: false },
|
|
19
19
|
class: { type: null, required: false },
|
|
20
20
|
ui: { type: null, required: false }
|
|
@@ -14,7 +14,7 @@ import UIcon from "../Icon.vue";
|
|
|
14
14
|
defineOptions({ inheritAttrs: false });
|
|
15
15
|
const props = defineProps({
|
|
16
16
|
as: { type: null, required: false, default: "nav" },
|
|
17
|
-
trailingIcon: { type:
|
|
17
|
+
trailingIcon: { type: null, required: false },
|
|
18
18
|
title: { type: String, required: false },
|
|
19
19
|
color: { type: null, required: false },
|
|
20
20
|
highlight: { type: Boolean, required: false },
|
|
@@ -16,8 +16,8 @@ const props = defineProps({
|
|
|
16
16
|
variant: { type: null, required: false },
|
|
17
17
|
size: { type: null, required: false },
|
|
18
18
|
required: { type: Boolean, required: false },
|
|
19
|
-
trailingIcon: { type:
|
|
20
|
-
selectedIcon: { type:
|
|
19
|
+
trailingIcon: { type: null, required: false },
|
|
20
|
+
selectedIcon: { type: null, required: false },
|
|
21
21
|
content: { type: Object, required: false },
|
|
22
22
|
arrow: { type: [Boolean, Object], required: false },
|
|
23
23
|
portal: { type: [Boolean, String], required: false, skipCheck: true },
|
|
@@ -42,13 +42,13 @@ const props = defineProps({
|
|
|
42
42
|
resetSearchTermOnBlur: { type: Boolean, required: false },
|
|
43
43
|
resetSearchTermOnSelect: { type: Boolean, required: false },
|
|
44
44
|
highlightOnHover: { type: Boolean, required: false },
|
|
45
|
-
icon: { type:
|
|
45
|
+
icon: { type: null, required: false },
|
|
46
46
|
avatar: { type: Object, required: false },
|
|
47
47
|
leading: { type: Boolean, required: false },
|
|
48
|
-
leadingIcon: { type:
|
|
48
|
+
leadingIcon: { type: null, required: false },
|
|
49
49
|
trailing: { type: Boolean, required: false },
|
|
50
50
|
loading: { type: Boolean, required: false },
|
|
51
|
-
loadingIcon: { type:
|
|
51
|
+
loadingIcon: { type: null, required: false }
|
|
52
52
|
});
|
|
53
53
|
const selectMenuProps = useForwardProps(reactiveOmit(props, "locales"));
|
|
54
54
|
const modelValue = defineModel({ type: String, ...{ required: true } });
|
|
@@ -12,7 +12,7 @@ defineOptions({ inheritAttrs: false });
|
|
|
12
12
|
const props = defineProps({
|
|
13
13
|
to: { type: null, required: false },
|
|
14
14
|
target: { type: [String, Object, null], required: false },
|
|
15
|
-
icon: { type:
|
|
15
|
+
icon: { type: null, required: false },
|
|
16
16
|
color: { type: null, required: false },
|
|
17
17
|
class: { type: null, required: false },
|
|
18
18
|
ui: { type: null, required: false }
|
|
@@ -12,7 +12,7 @@ defineOptions({ inheritAttrs: false });
|
|
|
12
12
|
const props = defineProps({
|
|
13
13
|
to: { type: null, required: false },
|
|
14
14
|
target: { type: [String, Object, null], required: false },
|
|
15
|
-
icon: { type:
|
|
15
|
+
icon: { type: null, required: false },
|
|
16
16
|
title: { type: String, required: false },
|
|
17
17
|
description: { type: String, required: false },
|
|
18
18
|
color: { type: null, required: false },
|
|
@@ -9,7 +9,7 @@ import { useLocale } from "../../composables/useLocale";
|
|
|
9
9
|
import { tv } from "../../utils/tv";
|
|
10
10
|
import UButton from "../Button.vue";
|
|
11
11
|
const props = defineProps({
|
|
12
|
-
icon: { type:
|
|
12
|
+
icon: { type: null, required: false },
|
|
13
13
|
name: { type: String, required: false },
|
|
14
14
|
openText: { type: String, required: false },
|
|
15
15
|
closeText: { type: String, required: false },
|
|
@@ -8,7 +8,7 @@ import { defu } from "defu";
|
|
|
8
8
|
import { useAppConfig } from "#imports";
|
|
9
9
|
import UIcon from "../Icon.vue";
|
|
10
10
|
const props = defineProps({
|
|
11
|
-
icon: { type:
|
|
11
|
+
icon: { type: null, required: false },
|
|
12
12
|
filename: { type: String, required: false }
|
|
13
13
|
});
|
|
14
14
|
const appConfig = useAppConfig();
|
|
@@ -11,7 +11,7 @@ import { tv } from "../../utils/tv";
|
|
|
11
11
|
import UCollapsible from "../Collapsible.vue";
|
|
12
12
|
import UIcon from "../Icon.vue";
|
|
13
13
|
const props = defineProps({
|
|
14
|
-
icon: { type:
|
|
14
|
+
icon: { type: null, required: false },
|
|
15
15
|
name: { type: String, required: false },
|
|
16
16
|
openText: { type: String, required: false },
|
|
17
17
|
closeText: { type: String, required: false },
|
|
@@ -11,7 +11,7 @@ import { tv } from "../../utils/tv";
|
|
|
11
11
|
import UCodeIcon from "./CodeIcon.vue";
|
|
12
12
|
import UButton from "../Button.vue";
|
|
13
13
|
const props = defineProps({
|
|
14
|
-
icon: { type:
|
|
14
|
+
icon: { type: null, required: false },
|
|
15
15
|
code: { type: String, required: false },
|
|
16
16
|
language: { type: String, required: false },
|
|
17
17
|
filename: { type: String, required: false },
|
|
@@ -32,8 +32,8 @@ export interface UseComponentIconsProps {
|
|
|
32
32
|
loadingIcon?: IconProps['name'];
|
|
33
33
|
}
|
|
34
34
|
export declare function useComponentIcons(componentProps: MaybeRefOrGetter<UseComponentIconsProps>): {
|
|
35
|
-
isLeading: import("vue").ComputedRef<
|
|
36
|
-
isTrailing: import("vue").ComputedRef<
|
|
35
|
+
isLeading: import("vue").ComputedRef<any>;
|
|
36
|
+
isTrailing: import("vue").ComputedRef<any>;
|
|
37
37
|
leadingIconName: import("vue").ComputedRef<any>;
|
|
38
38
|
trailingIconName: import("vue").ComputedRef<any>;
|
|
39
39
|
};
|
|
@@ -27,6 +27,10 @@ export interface LinkProps extends Partial<Omit<InertiaLinkProps, 'href' | 'onCl
|
|
|
27
27
|
* A rel attribute value to apply on the link. Defaults to "noopener noreferrer" for external links.
|
|
28
28
|
*/
|
|
29
29
|
rel?: 'noopener' | 'noreferrer' | 'nofollow' | 'sponsored' | 'ugc' | (string & {}) | null;
|
|
30
|
+
/**
|
|
31
|
+
* If set to true, no rel attribute will be added to the link
|
|
32
|
+
*/
|
|
33
|
+
noRel?: boolean;
|
|
30
34
|
/**
|
|
31
35
|
* Value passed to the attribute `aria-current` when the link is exact active.
|
|
32
36
|
*
|
|
@@ -59,8 +63,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<LinkPr
|
|
|
59
63
|
type: "reset" | "submit" | "button";
|
|
60
64
|
as: any;
|
|
61
65
|
active: boolean;
|
|
62
|
-
|
|
63
|
-
inactiveClass: string;
|
|
66
|
+
ariaCurrentValue: "page" | "step" | "location" | "date" | "time" | "true" | "false";
|
|
64
67
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, LinkSlots>;
|
|
65
68
|
declare const _default: typeof __VLS_export;
|
|
66
69
|
export default _default;
|
|
@@ -11,22 +11,24 @@ import { usePage } from "@inertiajs/vue3";
|
|
|
11
11
|
import { hasProtocol } from "ufo";
|
|
12
12
|
import { useAppConfig } from "#imports";
|
|
13
13
|
import { tv } from "../../utils/tv";
|
|
14
|
+
import { mergeClasses } from "../../utils";
|
|
14
15
|
import ULinkBase from "../../components/LinkBase.vue";
|
|
15
16
|
defineOptions({ inheritAttrs: false });
|
|
16
17
|
const props = defineProps({
|
|
17
18
|
as: { type: null, required: false, default: "button" },
|
|
18
|
-
activeClass: { type: String, required: false
|
|
19
|
+
activeClass: { type: String, required: false },
|
|
19
20
|
to: { type: String, required: false },
|
|
20
21
|
href: { type: String, required: false },
|
|
21
22
|
external: { type: Boolean, required: false },
|
|
22
23
|
target: { type: [String, Object, null], required: false },
|
|
23
24
|
rel: { type: [String, Object, null], required: false },
|
|
24
|
-
|
|
25
|
+
noRel: { type: Boolean, required: false },
|
|
26
|
+
ariaCurrentValue: { type: String, required: false, default: "page" },
|
|
25
27
|
type: { type: null, required: false, default: "button" },
|
|
26
28
|
disabled: { type: Boolean, required: false },
|
|
27
29
|
active: { type: Boolean, required: false, default: void 0 },
|
|
28
30
|
exact: { type: Boolean, required: false },
|
|
29
|
-
inactiveClass: { type: String, required: false
|
|
31
|
+
inactiveClass: { type: String, required: false },
|
|
30
32
|
custom: { type: Boolean, required: false },
|
|
31
33
|
raw: { type: Boolean, required: false },
|
|
32
34
|
class: { type: null, required: false },
|
|
@@ -59,14 +61,14 @@ const props = defineProps({
|
|
|
59
61
|
defineSlots();
|
|
60
62
|
const page = usePage();
|
|
61
63
|
const appConfig = useAppConfig();
|
|
62
|
-
const routerLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "activeClass", "inactiveClass", "to", "href", "raw", "custom", "class"));
|
|
64
|
+
const routerLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "activeClass", "inactiveClass", "to", "href", "raw", "custom", "class", "noRel"));
|
|
63
65
|
const ui = computed(() => tv({
|
|
64
66
|
extend: tv(theme),
|
|
65
67
|
...defu({
|
|
66
68
|
variants: {
|
|
67
69
|
active: {
|
|
68
|
-
true: props.activeClass,
|
|
69
|
-
false: props.inactiveClass
|
|
70
|
+
true: mergeClasses(appConfig.ui?.link?.variants?.active?.true, props.activeClass),
|
|
71
|
+
false: mergeClasses(appConfig.ui?.link?.variants?.active?.false, props.inactiveClass)
|
|
70
72
|
}
|
|
71
73
|
}
|
|
72
74
|
}, appConfig.ui?.link || {})
|
|
@@ -84,6 +86,19 @@ const isExternal = computed(() => {
|
|
|
84
86
|
}
|
|
85
87
|
return typeof href.value === "string" && hasProtocol(href.value, { acceptRelative: true });
|
|
86
88
|
});
|
|
89
|
+
const hasTarget = computed(() => !!props.target && props.target !== "_self");
|
|
90
|
+
const rel = computed(() => {
|
|
91
|
+
if (props.noRel) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
if (props.rel !== void 0) {
|
|
95
|
+
return props.rel || null;
|
|
96
|
+
}
|
|
97
|
+
if (isExternal.value || hasTarget.value) {
|
|
98
|
+
return "noopener noreferrer";
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
});
|
|
87
102
|
const isLinkActive = computed(() => {
|
|
88
103
|
if (props.active !== void 0) {
|
|
89
104
|
return props.active;
|
|
@@ -118,6 +133,8 @@ const linkClass = computed(() => {
|
|
|
118
133
|
type,
|
|
119
134
|
disabled,
|
|
120
135
|
href,
|
|
136
|
+
rel,
|
|
137
|
+
target,
|
|
121
138
|
active: isLinkActive,
|
|
122
139
|
isExternal
|
|
123
140
|
}"
|
|
@@ -132,6 +149,8 @@ const linkClass = computed(() => {
|
|
|
132
149
|
type,
|
|
133
150
|
disabled,
|
|
134
151
|
href,
|
|
152
|
+
rel,
|
|
153
|
+
target,
|
|
135
154
|
isExternal
|
|
136
155
|
}"
|
|
137
156
|
:class="linkClass"
|
|
@@ -27,6 +27,10 @@ export interface LinkProps extends Partial<Omit<InertiaLinkProps, 'href' | 'onCl
|
|
|
27
27
|
* A rel attribute value to apply on the link. Defaults to "noopener noreferrer" for external links.
|
|
28
28
|
*/
|
|
29
29
|
rel?: 'noopener' | 'noreferrer' | 'nofollow' | 'sponsored' | 'ugc' | (string & {}) | null;
|
|
30
|
+
/**
|
|
31
|
+
* If set to true, no rel attribute will be added to the link
|
|
32
|
+
*/
|
|
33
|
+
noRel?: boolean;
|
|
30
34
|
/**
|
|
31
35
|
* Value passed to the attribute `aria-current` when the link is exact active.
|
|
32
36
|
*
|
|
@@ -59,8 +63,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<LinkPr
|
|
|
59
63
|
type: "reset" | "submit" | "button";
|
|
60
64
|
as: any;
|
|
61
65
|
active: boolean;
|
|
62
|
-
|
|
63
|
-
inactiveClass: string;
|
|
66
|
+
ariaCurrentValue: "page" | "step" | "location" | "date" | "time" | "true" | "false";
|
|
64
67
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, LinkSlots>;
|
|
65
68
|
declare const _default: typeof __VLS_export;
|
|
66
69
|
export default _default;
|
|
@@ -13,6 +13,7 @@ const props = defineProps({
|
|
|
13
13
|
onClick: { type: [Function, Array], required: false },
|
|
14
14
|
href: { type: String, required: false },
|
|
15
15
|
target: { type: [String, Object, null], required: false },
|
|
16
|
+
rel: { type: [String, Object, null], required: false },
|
|
16
17
|
active: { type: Boolean, required: false },
|
|
17
18
|
isExternal: { type: Boolean, required: false }
|
|
18
19
|
});
|
|
@@ -35,7 +36,8 @@ function onClickWrapper(e) {
|
|
|
35
36
|
v-if="!!href && !isExternal && !disabled"
|
|
36
37
|
:href="href"
|
|
37
38
|
v-bind="{
|
|
38
|
-
|
|
39
|
+
rel,
|
|
40
|
+
target,
|
|
39
41
|
...$attrs
|
|
40
42
|
}"
|
|
41
43
|
@click="onClickWrapper"
|
|
@@ -50,7 +52,8 @@ function onClickWrapper(e) {
|
|
|
50
52
|
'aria-disabled': disabled ? 'true' : void 0,
|
|
51
53
|
'role': disabled ? 'link' : void 0,
|
|
52
54
|
'tabindex': disabled ? -1 : void 0,
|
|
53
|
-
'
|
|
55
|
+
'rel': rel,
|
|
56
|
+
'target': target,
|
|
54
57
|
...$attrs
|
|
55
58
|
} : as === 'button' ? {
|
|
56
59
|
as,
|
|
@@ -22,6 +22,10 @@ export interface LinkProps extends Partial<Omit<RouterLinkProps, 'custom'>>, /**
|
|
|
22
22
|
* A rel attribute value to apply on the link. Defaults to "noopener noreferrer" for external links.
|
|
23
23
|
*/
|
|
24
24
|
rel?: 'noopener' | 'noreferrer' | 'nofollow' | 'sponsored' | 'ugc' | (string & {}) | null;
|
|
25
|
+
/**
|
|
26
|
+
* If set to true, no rel attribute will be added to the link
|
|
27
|
+
*/
|
|
28
|
+
noRel?: boolean;
|
|
25
29
|
/**
|
|
26
30
|
* The type of the button when not a link.
|
|
27
31
|
* @defaultValue 'button'
|
|
@@ -52,9 +56,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<LinkPr
|
|
|
52
56
|
type: "reset" | "submit" | "button";
|
|
53
57
|
as: any;
|
|
54
58
|
active: boolean;
|
|
55
|
-
activeClass: string;
|
|
56
59
|
ariaCurrentValue: "page" | "step" | "location" | "date" | "time" | "true" | "false";
|
|
57
|
-
inactiveClass: string;
|
|
58
60
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, LinkSlots>;
|
|
59
61
|
declare const _default: typeof __VLS_export;
|
|
60
62
|
export default _default;
|
|
@@ -12,6 +12,7 @@ import { hasProtocol } from "ufo";
|
|
|
12
12
|
import { useRoute, RouterLink } from "vue-router";
|
|
13
13
|
import { useAppConfig } from "#imports";
|
|
14
14
|
import { tv } from "../../utils/tv";
|
|
15
|
+
import { mergeClasses } from "../../utils";
|
|
15
16
|
import { isPartiallyEqual } from "../../utils/link";
|
|
16
17
|
import ULinkBase from "../../components/LinkBase.vue";
|
|
17
18
|
defineOptions({ inheritAttrs: false });
|
|
@@ -21,17 +22,18 @@ const props = defineProps({
|
|
|
21
22
|
external: { type: Boolean, required: false },
|
|
22
23
|
target: { type: [String, Object, null], required: false },
|
|
23
24
|
rel: { type: [String, Object, null], required: false },
|
|
25
|
+
noRel: { type: Boolean, required: false },
|
|
24
26
|
type: { type: null, required: false, default: "button" },
|
|
25
27
|
disabled: { type: Boolean, required: false },
|
|
26
28
|
active: { type: Boolean, required: false, default: void 0 },
|
|
27
29
|
exact: { type: Boolean, required: false },
|
|
28
30
|
exactQuery: { type: [Boolean, String], required: false },
|
|
29
31
|
exactHash: { type: Boolean, required: false },
|
|
30
|
-
inactiveClass: { type: String, required: false
|
|
32
|
+
inactiveClass: { type: String, required: false },
|
|
31
33
|
custom: { type: Boolean, required: false },
|
|
32
34
|
raw: { type: Boolean, required: false },
|
|
33
35
|
class: { type: null, required: false },
|
|
34
|
-
activeClass: { type: String, required: false
|
|
36
|
+
activeClass: { type: String, required: false },
|
|
35
37
|
exactActiveClass: { type: String, required: false },
|
|
36
38
|
ariaCurrentValue: { type: String, required: false, default: "page" },
|
|
37
39
|
viewTransition: { type: Boolean, required: false },
|
|
@@ -41,14 +43,14 @@ const props = defineProps({
|
|
|
41
43
|
defineSlots();
|
|
42
44
|
const route = useRoute();
|
|
43
45
|
const appConfig = useAppConfig();
|
|
44
|
-
const routerLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "exactQuery", "exactHash", "activeClass", "inactiveClass", "to", "href", "raw", "custom", "class"));
|
|
46
|
+
const routerLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "exactQuery", "exactHash", "activeClass", "inactiveClass", "to", "href", "raw", "custom", "class", "noRel"));
|
|
45
47
|
const ui = computed(() => tv({
|
|
46
48
|
extend: tv(theme),
|
|
47
49
|
...defu({
|
|
48
50
|
variants: {
|
|
49
51
|
active: {
|
|
50
|
-
true: props.activeClass,
|
|
51
|
-
false: props.inactiveClass
|
|
52
|
+
true: mergeClasses(appConfig.ui?.link?.variants?.active?.true, props.activeClass),
|
|
53
|
+
false: mergeClasses(appConfig.ui?.link?.variants?.active?.false, props.inactiveClass)
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
}, appConfig.ui?.link || {})
|
|
@@ -63,6 +65,19 @@ const isExternal = computed(() => {
|
|
|
63
65
|
}
|
|
64
66
|
return typeof to.value === "string" && hasProtocol(to.value, { acceptRelative: true });
|
|
65
67
|
});
|
|
68
|
+
const hasTarget = computed(() => !!props.target && props.target !== "_self");
|
|
69
|
+
const rel = computed(() => {
|
|
70
|
+
if (props.noRel) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
if (props.rel !== void 0) {
|
|
74
|
+
return props.rel || null;
|
|
75
|
+
}
|
|
76
|
+
if (isExternal.value || hasTarget.value) {
|
|
77
|
+
return "noopener noreferrer";
|
|
78
|
+
}
|
|
79
|
+
return null;
|
|
80
|
+
});
|
|
66
81
|
function isLinkActive({ route: linkRoute, isActive, isExactActive }) {
|
|
67
82
|
if (props.active !== void 0) {
|
|
68
83
|
return props.active;
|
|
@@ -108,6 +123,9 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
|
|
|
108
123
|
disabled,
|
|
109
124
|
href,
|
|
110
125
|
navigate,
|
|
126
|
+
rel,
|
|
127
|
+
target,
|
|
128
|
+
isExternal,
|
|
111
129
|
active: isLinkActive({ route: linkRoute, isActive, isExactActive })
|
|
112
130
|
}"
|
|
113
131
|
/>
|
|
@@ -121,7 +139,10 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
|
|
|
121
139
|
type,
|
|
122
140
|
disabled,
|
|
123
141
|
href,
|
|
124
|
-
navigate
|
|
142
|
+
navigate,
|
|
143
|
+
rel,
|
|
144
|
+
target,
|
|
145
|
+
isExternal
|
|
125
146
|
}"
|
|
126
147
|
:class="resolveLinkClass({ route: linkRoute, isActive, isExactActive })"
|
|
127
148
|
>
|
|
@@ -139,7 +160,8 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
|
|
|
139
160
|
type,
|
|
140
161
|
disabled,
|
|
141
162
|
href: to,
|
|
142
|
-
|
|
163
|
+
rel,
|
|
164
|
+
target,
|
|
143
165
|
active,
|
|
144
166
|
isExternal
|
|
145
167
|
}"
|
|
@@ -153,7 +175,8 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
|
|
|
153
175
|
type,
|
|
154
176
|
disabled,
|
|
155
177
|
href: to,
|
|
156
|
-
|
|
178
|
+
rel,
|
|
179
|
+
target,
|
|
157
180
|
isExternal
|
|
158
181
|
}"
|
|
159
182
|
:class="resolveLinkClass()"
|
|
@@ -22,6 +22,10 @@ export interface LinkProps extends Partial<Omit<RouterLinkProps, 'custom'>>, /**
|
|
|
22
22
|
* A rel attribute value to apply on the link. Defaults to "noopener noreferrer" for external links.
|
|
23
23
|
*/
|
|
24
24
|
rel?: 'noopener' | 'noreferrer' | 'nofollow' | 'sponsored' | 'ugc' | (string & {}) | null;
|
|
25
|
+
/**
|
|
26
|
+
* If set to true, no rel attribute will be added to the link
|
|
27
|
+
*/
|
|
28
|
+
noRel?: boolean;
|
|
25
29
|
/**
|
|
26
30
|
* The type of the button when not a link.
|
|
27
31
|
* @defaultValue 'button'
|
|
@@ -52,9 +56,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<LinkPr
|
|
|
52
56
|
type: "reset" | "submit" | "button";
|
|
53
57
|
as: any;
|
|
54
58
|
active: boolean;
|
|
55
|
-
activeClass: string;
|
|
56
59
|
ariaCurrentValue: "page" | "step" | "location" | "date" | "time" | "true" | "false";
|
|
57
|
-
inactiveClass: string;
|
|
58
60
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, LinkSlots>;
|
|
59
61
|
declare const _default: typeof __VLS_export;
|
|
60
62
|
export default _default;
|
|
@@ -17,8 +17,8 @@ const props = defineProps({
|
|
|
17
17
|
variant: { type: null, required: false },
|
|
18
18
|
size: { type: null, required: false },
|
|
19
19
|
required: { type: Boolean, required: false },
|
|
20
|
-
trailingIcon: { type:
|
|
21
|
-
selectedIcon: { type:
|
|
20
|
+
trailingIcon: { type: null, required: false },
|
|
21
|
+
selectedIcon: { type: null, required: false },
|
|
22
22
|
content: { type: Object, required: false },
|
|
23
23
|
arrow: { type: [Boolean, Object], required: false },
|
|
24
24
|
portal: { type: [Boolean, String], required: false, skipCheck: true },
|
|
@@ -45,10 +45,10 @@ const props = defineProps({
|
|
|
45
45
|
highlightOnHover: { type: Boolean, required: false },
|
|
46
46
|
avatar: { type: Object, required: false },
|
|
47
47
|
leading: { type: Boolean, required: false },
|
|
48
|
-
leadingIcon: { type:
|
|
48
|
+
leadingIcon: { type: null, required: false },
|
|
49
49
|
trailing: { type: Boolean, required: false },
|
|
50
50
|
loading: { type: Boolean, required: false },
|
|
51
|
-
loadingIcon: { type:
|
|
51
|
+
loadingIcon: { type: null, required: false }
|
|
52
52
|
});
|
|
53
53
|
const { t } = useLocale();
|
|
54
54
|
const colorMode = useColorMode();
|
|
@@ -14,7 +14,7 @@ const props = defineProps({
|
|
|
14
14
|
color: { type: null, required: false },
|
|
15
15
|
size: { type: null, required: false },
|
|
16
16
|
loading: { type: Boolean, required: false },
|
|
17
|
-
loadingIcon: { type:
|
|
17
|
+
loadingIcon: { type: null, required: false },
|
|
18
18
|
label: { type: String, required: false },
|
|
19
19
|
description: { type: String, required: false },
|
|
20
20
|
class: { type: null, required: false },
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/ui",
|
|
3
3
|
"description": "A UI Library for Modern Web Apps, powered by Vue & Tailwind CSS.",
|
|
4
|
-
"version": "4.2.
|
|
4
|
+
"version": "4.2.1",
|
|
5
5
|
"packageManager": "pnpm@10.22.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -87,12 +87,16 @@
|
|
|
87
87
|
]
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
|
+
"imports": {
|
|
91
|
+
"#build/ui.css": "./.nuxt/ui.css"
|
|
92
|
+
},
|
|
90
93
|
"bin": {
|
|
91
94
|
"nuxt-ui": "./cli/index.mjs"
|
|
92
95
|
},
|
|
93
96
|
"style": "./dist/runtime/index.css",
|
|
94
97
|
"main": "./dist/module.mjs",
|
|
95
98
|
"files": [
|
|
99
|
+
".nuxt/ui.css",
|
|
96
100
|
"dist",
|
|
97
101
|
"cli",
|
|
98
102
|
"vue-plugin.d.ts"
|