@nuxt/ui 3.1.1 → 3.1.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/.nuxt/ui/alert.ts +0 -5
- package/.nuxt/ui/badge.ts +30 -7
- package/.nuxt/ui/button-group.ts +0 -13
- package/.nuxt/ui/button.ts +2 -7
- package/.nuxt/ui/calendar.ts +1 -1
- package/.nuxt/ui/carousel.ts +0 -5
- package/.nuxt/ui/checkbox-group.ts +144 -1
- package/.nuxt/ui/color-picker.ts +2 -2
- package/.nuxt/ui/context-menu.ts +2 -1
- package/.nuxt/ui/dropdown-menu.ts +2 -1
- package/.nuxt/ui/input-menu.ts +4 -13
- package/.nuxt/ui/input-number.ts +10 -0
- package/.nuxt/ui/input.ts +2 -11
- package/.nuxt/ui/link.ts +12 -5
- package/.nuxt/ui/navigation-menu.ts +43 -34
- package/.nuxt/ui/radio-group.ts +1 -1
- package/.nuxt/ui/select-menu.ts +4 -13
- package/.nuxt/ui/select.ts +4 -13
- package/.nuxt/ui/tabs.ts +4 -3
- package/.nuxt/ui/textarea.ts +2 -11
- package/.nuxt/ui/toast.ts +0 -5
- package/.nuxt/ui/tooltip.ts +1 -1
- package/.nuxt/ui.css +4 -1
- package/cli/templates.mjs +2 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +14 -5
- package/dist/runtime/components/Accordion.vue +9 -9
- package/dist/runtime/components/Accordion.vue.d.ts +2 -0
- package/dist/runtime/components/Alert.vue +1 -1
- package/dist/runtime/components/Avatar.vue +2 -2
- package/dist/runtime/components/AvatarGroup.vue +1 -1
- package/dist/runtime/components/Badge.vue +5 -3
- package/dist/runtime/components/Badge.vue.d.ts +2 -0
- package/dist/runtime/components/Breadcrumb.vue +8 -8
- package/dist/runtime/components/Breadcrumb.vue.d.ts +2 -0
- package/dist/runtime/components/Button.vue +2 -3
- package/dist/runtime/components/Button.vue.d.ts +1 -1
- package/dist/runtime/components/Calendar.vue +2 -1
- package/dist/runtime/components/Card.vue +1 -1
- package/dist/runtime/components/Carousel.vue +5 -2
- package/dist/runtime/components/Carousel.vue.d.ts +6 -1
- package/dist/runtime/components/Checkbox.vue +2 -2
- package/dist/runtime/components/CheckboxGroup.vue +8 -5
- package/dist/runtime/components/CheckboxGroup.vue.d.ts +7 -1
- package/dist/runtime/components/Chip.vue +1 -1
- package/dist/runtime/components/Collapsible.vue +1 -1
- package/dist/runtime/components/ColorPicker.vue +1 -1
- package/dist/runtime/components/CommandPalette.vue +18 -18
- package/dist/runtime/components/CommandPalette.vue.d.ts +2 -0
- package/dist/runtime/components/ContextMenu.vue.d.ts +2 -0
- package/dist/runtime/components/ContextMenuContent.vue +69 -67
- package/dist/runtime/components/Drawer.vue +15 -1
- package/dist/runtime/components/DropdownMenu.vue.d.ts +2 -0
- package/dist/runtime/components/DropdownMenuContent.vue +71 -69
- package/dist/runtime/components/FormField.vue +5 -5
- package/dist/runtime/components/Input.vue +3 -2
- package/dist/runtime/components/Input.vue.d.ts +30 -29
- package/dist/runtime/components/InputMenu.vue +20 -20
- package/dist/runtime/components/InputMenu.vue.d.ts +210 -0
- package/dist/runtime/components/InputNumber.vue +13 -7
- package/dist/runtime/components/InputNumber.vue.d.ts +78 -0
- package/dist/runtime/components/Link.vue +5 -14
- package/dist/runtime/components/Modal.vue +2 -2
- package/dist/runtime/components/Modal.vue.d.ts +3 -0
- package/dist/runtime/components/NavigationMenu.vue +106 -41
- package/dist/runtime/components/NavigationMenu.vue.d.ts +38 -7
- package/dist/runtime/components/Pagination.vue +1 -1
- package/dist/runtime/components/PinInput.vue +1 -1
- package/dist/runtime/components/Popover.vue +4 -0
- package/dist/runtime/components/Popover.vue.d.ts +1 -0
- package/dist/runtime/components/Progress.vue +1 -1
- package/dist/runtime/components/RadioGroup.vue +8 -8
- package/dist/runtime/components/RadioGroup.vue.d.ts +2 -0
- package/dist/runtime/components/Select.vue +15 -15
- package/dist/runtime/components/Select.vue.d.ts +3 -1
- package/dist/runtime/components/SelectMenu.vue +16 -16
- package/dist/runtime/components/SelectMenu.vue.d.ts +2 -0
- package/dist/runtime/components/Separator.vue +1 -1
- package/dist/runtime/components/Slideover.vue +9 -2
- package/dist/runtime/components/Slideover.vue.d.ts +3 -0
- package/dist/runtime/components/Slider.vue +16 -4
- package/dist/runtime/components/Slider.vue.d.ts +26 -20
- package/dist/runtime/components/Stepper.vue +10 -10
- package/dist/runtime/components/Stepper.vue.d.ts +2 -0
- package/dist/runtime/components/Switch.vue +1 -1
- package/dist/runtime/components/Table.vue +2 -2
- package/dist/runtime/components/Tabs.vue +6 -6
- package/dist/runtime/components/Tabs.vue.d.ts +2 -0
- package/dist/runtime/components/Textarea.vue +7 -4
- package/dist/runtime/components/Textarea.vue.d.ts +30 -31
- package/dist/runtime/components/Toast.vue +3 -2
- package/dist/runtime/components/Toast.vue.d.ts +6 -0
- package/dist/runtime/components/Toaster.vue +4 -4
- package/dist/runtime/components/Toaster.vue.d.ts +6 -0
- package/dist/runtime/components/Tree.vue +10 -10
- package/dist/runtime/components/Tree.vue.d.ts +2 -0
- package/dist/runtime/composables/useFormField.d.ts +1 -1
- package/dist/runtime/composables/useFormField.js +2 -1
- package/dist/runtime/inertia/components/Link.vue +46 -60
- package/dist/runtime/inertia/components/Link.vue.d.ts +1 -1
- package/dist/runtime/inertia/components/LinkBase.vue +68 -0
- package/dist/runtime/inertia/components/LinkBase.vue.d.ts +25 -0
- package/dist/runtime/inertia/stubs.d.ts +1 -1
- package/dist/runtime/inertia/stubs.js +1 -1
- package/dist/runtime/locale/index.d.ts +7 -2
- package/dist/runtime/locale/index.js +7 -2
- package/dist/runtime/locale/ky.d.ts +3 -0
- package/dist/runtime/locale/ky.js +54 -0
- package/dist/runtime/locale/lt.d.ts +3 -0
- package/dist/runtime/locale/lt.js +54 -0
- package/dist/runtime/locale/mn.d.ts +3 -0
- package/dist/runtime/locale/mn.js +54 -0
- package/dist/runtime/locale/ms.d.ts +3 -0
- package/dist/runtime/locale/ms.js +54 -0
- package/dist/runtime/locale/sl.d.ts +3 -0
- package/dist/runtime/locale/sl.js +54 -0
- package/dist/runtime/utils/link.d.ts +1 -0
- package/dist/runtime/utils/link.js +12 -0
- package/dist/runtime/vue/components/Link.vue +27 -40
- package/dist/runtime/vue/composables/useAppConfig.js +3 -1
- package/dist/runtime/vue/stubs.d.ts +1 -1
- package/dist/runtime/vue/stubs.js +1 -1
- package/dist/shared/{ui.CbtTMMzt.mjs → ui.Bix4DSU4.mjs} +153 -52
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +28 -28
|
@@ -5,11 +5,12 @@ import theme from "#build/ui/link";
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { computed } from "vue";
|
|
7
7
|
import { defu } from "defu";
|
|
8
|
-
import { isEqual
|
|
8
|
+
import { isEqual } from "ohash/utils";
|
|
9
9
|
import { useForwardProps } from "reka-ui";
|
|
10
10
|
import { reactiveOmit } from "@vueuse/core";
|
|
11
11
|
import { useRoute, useAppConfig } from "#imports";
|
|
12
12
|
import { tv } from "../utils/tv";
|
|
13
|
+
import { isPartiallyEqual } from "../utils/link";
|
|
13
14
|
import ULinkBase from "./LinkBase.vue";
|
|
14
15
|
defineOptions({ inheritAttrs: false });
|
|
15
16
|
const props = defineProps({
|
|
@@ -43,7 +44,7 @@ const props = defineProps({
|
|
|
43
44
|
defineSlots();
|
|
44
45
|
const route = useRoute();
|
|
45
46
|
const appConfig = useAppConfig();
|
|
46
|
-
const nuxtLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "exactQuery", "exactHash", "activeClass", "inactiveClass", "raw", "class"));
|
|
47
|
+
const nuxtLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "exactQuery", "exactHash", "activeClass", "inactiveClass", "to", "href", "raw", "custom", "class"));
|
|
47
48
|
const ui = computed(() => tv({
|
|
48
49
|
extend: tv(theme),
|
|
49
50
|
...defu({
|
|
@@ -55,17 +56,7 @@ const ui = computed(() => tv({
|
|
|
55
56
|
}
|
|
56
57
|
}, appConfig.ui?.link || {})
|
|
57
58
|
}));
|
|
58
|
-
|
|
59
|
-
const diffedKeys = diff(item1, item2).reduce((filtered, q) => {
|
|
60
|
-
if (q.type === "added") {
|
|
61
|
-
filtered.add(q.key);
|
|
62
|
-
}
|
|
63
|
-
return filtered;
|
|
64
|
-
}, /* @__PURE__ */ new Set());
|
|
65
|
-
const item1Filtered = Object.fromEntries(Object.entries(item1).filter(([key]) => !diffedKeys.has(key)));
|
|
66
|
-
const item2Filtered = Object.fromEntries(Object.entries(item2).filter(([key]) => !diffedKeys.has(key)));
|
|
67
|
-
return isEqual(item1Filtered, item2Filtered);
|
|
68
|
-
}
|
|
59
|
+
const to = computed(() => props.to ?? props.href);
|
|
69
60
|
function isLinkActive({ route: linkRoute, isActive, isExactActive }) {
|
|
70
61
|
if (props.active !== void 0) {
|
|
71
62
|
return props.active;
|
|
@@ -96,7 +87,7 @@ function resolveLinkClass({ route: route2, isActive, isExactActive }) {
|
|
|
96
87
|
</script>
|
|
97
88
|
|
|
98
89
|
<template>
|
|
99
|
-
<NuxtLink v-slot="{ href, navigate, route: linkRoute, rel, target, isExternal, isActive, isExactActive }" v-bind="nuxtLinkProps" custom>
|
|
90
|
+
<NuxtLink v-slot="{ href, navigate, route: linkRoute, rel, target, isExternal, isActive, isExactActive }" v-bind="nuxtLinkProps" :to="to" custom>
|
|
100
91
|
<template v-if="custom">
|
|
101
92
|
<slot
|
|
102
93
|
v-bind="{
|
|
@@ -28,7 +28,7 @@ const props = defineProps({
|
|
|
28
28
|
defaultOpen: { type: Boolean, required: false },
|
|
29
29
|
modal: { type: Boolean, required: false, default: true }
|
|
30
30
|
});
|
|
31
|
-
const emits = defineEmits(["after:leave", "close:prevent", "update:open"]);
|
|
31
|
+
const emits = defineEmits(["after:leave", "after:enter", "close:prevent", "update:open"]);
|
|
32
32
|
const slots = defineSlots();
|
|
33
33
|
const { t } = useLocale();
|
|
34
34
|
const appConfig = useAppConfig();
|
|
@@ -66,7 +66,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.modal || {} }
|
|
|
66
66
|
<DialogPortal v-bind="portalProps">
|
|
67
67
|
<DialogOverlay v-if="overlay" :class="ui.overlay({ class: props.ui?.overlay })" />
|
|
68
68
|
|
|
69
|
-
<DialogContent :class="ui.content({ class: [!slots.default && props.class, props.ui?.content] })" v-bind="contentProps" @after-leave="emits('after:leave')" v-on="contentEvents">
|
|
69
|
+
<DialogContent :class="ui.content({ class: [!slots.default && props.class, props.ui?.content] })" v-bind="contentProps" @after-enter="emits('after:enter')" @after-leave="emits('after:leave')" v-on="contentEvents">
|
|
70
70
|
<VisuallyHidden v-if="!!slots.content && (title || !!slots.title || (description || !!slots.description))">
|
|
71
71
|
<DialogTitle v-if="title || !!slots.title">
|
|
72
72
|
<slot name="title">
|
|
@@ -51,6 +51,7 @@ export interface ModalProps extends DialogRootProps {
|
|
|
51
51
|
}
|
|
52
52
|
export interface ModalEmits extends DialogRootEmits {
|
|
53
53
|
'after:leave': [];
|
|
54
|
+
'after:enter': [];
|
|
54
55
|
'close:prevent': [];
|
|
55
56
|
}
|
|
56
57
|
export interface ModalSlots {
|
|
@@ -72,10 +73,12 @@ export interface ModalSlots {
|
|
|
72
73
|
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ModalProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
73
74
|
"update:open": (value: boolean) => any;
|
|
74
75
|
"after:leave": () => any;
|
|
76
|
+
"after:enter": () => any;
|
|
75
77
|
"close:prevent": () => any;
|
|
76
78
|
}, string, import("vue").PublicProps, Readonly<ModalProps> & Readonly<{
|
|
77
79
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
78
80
|
"onAfter:leave"?: (() => any) | undefined;
|
|
81
|
+
"onAfter:enter"?: (() => any) | undefined;
|
|
79
82
|
"onClose:prevent"?: (() => any) | undefined;
|
|
80
83
|
}>, {
|
|
81
84
|
close: boolean | Partial<ButtonProps>;
|
|
@@ -4,8 +4,9 @@ import theme from "#build/ui/navigation-menu";
|
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { computed, toRef } from "vue";
|
|
7
|
-
import { NavigationMenuRoot, NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink, NavigationMenuIndicator, NavigationMenuViewport, useForwardPropsEmits } from "reka-ui";
|
|
8
|
-
import {
|
|
7
|
+
import { NavigationMenuRoot, NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink, NavigationMenuIndicator, NavigationMenuViewport, AccordionRoot, AccordionItem, AccordionTrigger, AccordionContent, useForwardPropsEmits } from "reka-ui";
|
|
8
|
+
import { defu } from "defu";
|
|
9
|
+
import { reactivePick, createReusableTemplate } from "@vueuse/core";
|
|
9
10
|
import { useAppConfig } from "#imports";
|
|
10
11
|
import { get, isArrayOfArray } from "../utils";
|
|
11
12
|
import { tv } from "../utils/tv";
|
|
@@ -15,7 +16,8 @@ import ULink from "./Link.vue";
|
|
|
15
16
|
import UAvatar from "./Avatar.vue";
|
|
16
17
|
import UIcon from "./Icon.vue";
|
|
17
18
|
import UBadge from "./Badge.vue";
|
|
18
|
-
import
|
|
19
|
+
import UPopover from "./Popover.vue";
|
|
20
|
+
import UTooltip from "./Tooltip.vue";
|
|
19
21
|
const props = defineProps({
|
|
20
22
|
as: { type: null, required: false },
|
|
21
23
|
trailingIcon: { type: String, required: false },
|
|
@@ -25,6 +27,8 @@ const props = defineProps({
|
|
|
25
27
|
variant: { type: null, required: false },
|
|
26
28
|
orientation: { type: null, required: false, default: "horizontal" },
|
|
27
29
|
collapsed: { type: Boolean, required: false },
|
|
30
|
+
tooltip: { type: [Boolean, Object], required: false },
|
|
31
|
+
popover: { type: [Boolean, Object], required: false },
|
|
28
32
|
highlight: { type: Boolean, required: false },
|
|
29
33
|
highlightColor: { type: null, required: false },
|
|
30
34
|
content: { type: Object, required: false },
|
|
@@ -40,7 +44,10 @@ const props = defineProps({
|
|
|
40
44
|
disableHoverTrigger: { type: Boolean, required: false },
|
|
41
45
|
skipDelayDuration: { type: Number, required: false },
|
|
42
46
|
disablePointerLeaveClose: { type: Boolean, required: false },
|
|
43
|
-
unmountOnHide: { type: Boolean, required: false, default: true }
|
|
47
|
+
unmountOnHide: { type: Boolean, required: false, default: true },
|
|
48
|
+
disabled: { type: Boolean, required: false },
|
|
49
|
+
type: { type: String, required: false, default: "multiple" },
|
|
50
|
+
collapsible: { type: Boolean, required: false, default: true }
|
|
44
51
|
});
|
|
45
52
|
const emits = defineEmits(["update:modelValue"]);
|
|
46
53
|
const slots = defineSlots();
|
|
@@ -57,7 +64,10 @@ const rootProps = useForwardPropsEmits(computed(() => ({
|
|
|
57
64
|
disablePointerLeaveClose: props.disablePointerLeaveClose,
|
|
58
65
|
unmountOnHide: props.unmountOnHide
|
|
59
66
|
})), emits);
|
|
67
|
+
const accordionProps = useForwardPropsEmits(reactivePick(props, "collapsible", "disabled", "type", "unmountOnHide"), emits);
|
|
60
68
|
const contentProps = toRef(() => props.content);
|
|
69
|
+
const tooltipProps = toRef(() => defu(typeof props.tooltip === "boolean" ? {} : props.tooltip, { delayDuration: 0, content: { side: "right" } }));
|
|
70
|
+
const popoverProps = toRef(() => defu(typeof props.popover === "boolean" ? {} : props.popover, { mode: "hover", content: { side: "right", align: "start", alignOffset: 2 } }));
|
|
61
71
|
const [DefineLinkTemplate, ReuseLinkTemplate] = createReusableTemplate();
|
|
62
72
|
const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate({
|
|
63
73
|
props: {
|
|
@@ -68,7 +78,7 @@ const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate({
|
|
|
68
78
|
});
|
|
69
79
|
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.navigationMenu || {} })({
|
|
70
80
|
orientation: props.orientation,
|
|
71
|
-
contentOrientation: props.contentOrientation,
|
|
81
|
+
contentOrientation: props.orientation === "vertical" ? void 0 : props.contentOrientation,
|
|
72
82
|
collapsed: props.collapsed,
|
|
73
83
|
color: props.color,
|
|
74
84
|
variant: props.variant,
|
|
@@ -78,86 +88,133 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.navigationMen
|
|
|
78
88
|
const lists = computed(
|
|
79
89
|
() => props.items?.length ? isArrayOfArray(props.items) ? props.items : [props.items] : []
|
|
80
90
|
);
|
|
91
|
+
function getAccordionDefaultValue(list) {
|
|
92
|
+
function findItemsWithDefaultOpen(items, level = 0) {
|
|
93
|
+
return items.reduce((acc, item, index) => {
|
|
94
|
+
if (item.defaultOpen || item.open) {
|
|
95
|
+
acc.push(item.value || (level > 0 ? `item-${level}-${index}` : `item-${index}`));
|
|
96
|
+
}
|
|
97
|
+
if (item.children?.length) {
|
|
98
|
+
acc.push(...findItemsWithDefaultOpen(item.children, level + 1));
|
|
99
|
+
}
|
|
100
|
+
return acc;
|
|
101
|
+
}, []);
|
|
102
|
+
}
|
|
103
|
+
const indexes = findItemsWithDefaultOpen(list);
|
|
104
|
+
return props.type === "single" ? indexes[0] : indexes;
|
|
105
|
+
}
|
|
81
106
|
</script>
|
|
82
107
|
|
|
83
108
|
<template>
|
|
84
109
|
<DefineLinkTemplate v-slot="{ item, active, index }">
|
|
85
110
|
<slot :name="item.slot || 'item'" :item="item" :index="index">
|
|
86
111
|
<slot :name="item.slot ? `${item.slot}-leading` : 'item-leading'" :item="item" :active="active" :index="index">
|
|
87
|
-
<UAvatar v-if="item.avatar" :size="props.ui?.linkLeadingAvatarSize || ui.linkLeadingAvatarSize()" v-bind="item.avatar" :class="ui.linkLeadingAvatar({ class: props.ui?.linkLeadingAvatar, active, disabled: !!item.disabled })" />
|
|
88
|
-
<UIcon v-else-if="item.icon" :name="item.icon" :class="ui.linkLeadingIcon({ class: props.ui?.linkLeadingIcon, active, disabled: !!item.disabled })" />
|
|
112
|
+
<UAvatar v-if="item.avatar" :size="item.ui?.linkLeadingAvatarSize || props.ui?.linkLeadingAvatarSize || ui.linkLeadingAvatarSize()" v-bind="item.avatar" :class="ui.linkLeadingAvatar({ class: [props.ui?.linkLeadingAvatar, item.ui?.linkLeadingAvatar], active, disabled: !!item.disabled })" />
|
|
113
|
+
<UIcon v-else-if="item.icon" :name="item.icon" :class="ui.linkLeadingIcon({ class: [props.ui?.linkLeadingIcon, item.ui?.linkLeadingIcon], active, disabled: !!item.disabled })" />
|
|
89
114
|
</slot>
|
|
90
115
|
|
|
91
116
|
<span
|
|
92
117
|
v-if="(!collapsed || orientation !== 'vertical') && (get(item, props.labelKey) || !!slots[item.slot ? `${item.slot}-label` : 'item-label'])"
|
|
93
|
-
:class="ui.linkLabel({ class: props.ui?.linkLabel })"
|
|
118
|
+
:class="ui.linkLabel({ class: [props.ui?.linkLabel, item.ui?.linkLabel] })"
|
|
94
119
|
>
|
|
95
120
|
<slot :name="item.slot ? `${item.slot}-label` : 'item-label'" :item="item" :active="active" :index="index">
|
|
96
121
|
{{ get(item, props.labelKey) }}
|
|
97
122
|
</slot>
|
|
98
123
|
|
|
99
|
-
<UIcon v-if="item.target === '_blank' && externalIcon !== false" :name="typeof externalIcon === 'string' ? externalIcon : appConfig.ui.icons.external" :class="ui.linkLabelExternalIcon({ class: props.ui?.linkLabelExternalIcon, active })" />
|
|
124
|
+
<UIcon v-if="item.target === '_blank' && externalIcon !== false" :name="typeof externalIcon === 'string' ? externalIcon : appConfig.ui.icons.external" :class="ui.linkLabelExternalIcon({ class: [props.ui?.linkLabelExternalIcon, item.ui?.linkLabelExternalIcon], active })" />
|
|
100
125
|
</span>
|
|
101
126
|
|
|
102
|
-
<span v-if="(!collapsed || orientation !== 'vertical') && (item.badge || orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content']) || orientation === 'vertical' && item.children?.length || item.trailingIcon || !!slots[item.slot ? `${item.slot}-trailing` : 'item-trailing'])" :class="ui.linkTrailing({ class: props.ui?.linkTrailing })">
|
|
127
|
+
<component :is="orientation === 'vertical' && item.children?.length && !collapsed ? AccordionTrigger : 'span'" v-if="(!collapsed || orientation !== 'vertical') && (item.badge || orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content']) || orientation === 'vertical' && item.children?.length || item.trailingIcon || !!slots[item.slot ? `${item.slot}-trailing` : 'item-trailing'])" as="span" :class="ui.linkTrailing({ class: [props.ui?.linkTrailing, item.ui?.linkTrailing] })" @click.stop.prevent>
|
|
103
128
|
<slot :name="item.slot ? `${item.slot}-trailing` : 'item-trailing'" :item="item" :active="active" :index="index">
|
|
104
129
|
<UBadge
|
|
105
130
|
v-if="item.badge"
|
|
106
131
|
color="neutral"
|
|
107
132
|
variant="outline"
|
|
108
|
-
:size="props.ui?.linkTrailingBadgeSize || ui.linkTrailingBadgeSize()"
|
|
133
|
+
:size="item.ui?.linkTrailingBadgeSize || props.ui?.linkTrailingBadgeSize || ui.linkTrailingBadgeSize()"
|
|
109
134
|
v-bind="typeof item.badge === 'string' || typeof item.badge === 'number' ? { label: item.badge } : item.badge"
|
|
110
|
-
:class="ui.linkTrailingBadge({ class: props.ui?.linkTrailingBadge })"
|
|
135
|
+
:class="ui.linkTrailingBadge({ class: [props.ui?.linkTrailingBadge, item.ui?.linkTrailingBadge] })"
|
|
111
136
|
/>
|
|
112
137
|
|
|
113
|
-
<UIcon v-if="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content']) || orientation === 'vertical' && item.children?.length" :name="item.trailingIcon || trailingIcon || appConfig.ui.icons.chevronDown" :class="ui.linkTrailingIcon({ class: props.ui?.linkTrailingIcon, active })" />
|
|
114
|
-
<UIcon v-else-if="item.trailingIcon" :name="item.trailingIcon" :class="ui.linkTrailingIcon({ class: props.ui?.linkTrailingIcon, active })" />
|
|
138
|
+
<UIcon v-if="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content']) || orientation === 'vertical' && item.children?.length" :name="item.trailingIcon || trailingIcon || appConfig.ui.icons.chevronDown" :class="ui.linkTrailingIcon({ class: [props.ui?.linkTrailingIcon, item.ui?.linkTrailingIcon], active })" />
|
|
139
|
+
<UIcon v-else-if="item.trailingIcon" :name="item.trailingIcon" :class="ui.linkTrailingIcon({ class: [props.ui?.linkTrailingIcon, item.ui?.linkTrailingIcon], active })" />
|
|
115
140
|
</slot>
|
|
116
|
-
</
|
|
141
|
+
</component>
|
|
117
142
|
</slot>
|
|
118
143
|
</DefineLinkTemplate>
|
|
119
144
|
|
|
120
145
|
<DefineItemTemplate v-slot="{ item, index, level = 0 }">
|
|
121
146
|
<component
|
|
122
|
-
:is="orientation === 'vertical' &&
|
|
147
|
+
:is="orientation === 'vertical' && !collapsed ? AccordionItem : NavigationMenuItem"
|
|
123
148
|
as="li"
|
|
124
|
-
:value="item.value ||
|
|
125
|
-
:default-open="item.defaultOpen"
|
|
126
|
-
:unmount-on-hide="orientation === 'vertical' && item.children?.length && !collapsed ? unmountOnHide : void 0"
|
|
127
|
-
:open="item.open"
|
|
149
|
+
:value="item.value || (level > 0 ? `item-${level}-${index}` : `item-${index}`)"
|
|
128
150
|
>
|
|
129
|
-
<div v-if="orientation === 'vertical' && item.type === 'label'" :class="ui.label({ class: props.ui?.label })">
|
|
151
|
+
<div v-if="orientation === 'vertical' && item.type === 'label' && !collapsed" :class="ui.label({ class: [props.ui?.label, item.ui?.label, item.class] })">
|
|
130
152
|
<ReuseLinkTemplate :item="item" :index="index" />
|
|
131
153
|
</div>
|
|
132
|
-
<ULink v-else-if="item.type !== 'label'" v-slot="{ active, ...slotProps }" v-bind="orientation === 'vertical' && item.children?.length && !collapsed ? {} : pickLinkProps(item)" custom>
|
|
154
|
+
<ULink v-else-if="item.type !== 'label'" v-slot="{ active, ...slotProps }" v-bind="orientation === 'vertical' && item.children?.length && !collapsed && item.type === 'trigger' ? {} : pickLinkProps(item)" custom>
|
|
133
155
|
<component
|
|
134
|
-
:is="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content']) ? NavigationMenuTrigger : NavigationMenuLink"
|
|
156
|
+
:is="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content']) ? NavigationMenuTrigger : orientation === 'vertical' && item.children?.length && !collapsed && !slotProps.href ? AccordionTrigger : NavigationMenuLink"
|
|
135
157
|
as-child
|
|
136
158
|
:active="active || item.active"
|
|
137
159
|
:disabled="item.disabled"
|
|
138
160
|
@select="item.onSelect"
|
|
139
161
|
>
|
|
140
|
-
<
|
|
162
|
+
<UPopover v-if="orientation === 'vertical' && collapsed && item.children?.length && (!!props.popover || !!item.popover)" v-bind="{ ...popoverProps, ...typeof item.popover === 'boolean' ? {} : item.popover || {} }" :ui="{ content: ui.content({ class: [props.ui?.content, item.ui?.content] }) }">
|
|
163
|
+
<ULinkBase v-bind="slotProps" :class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active: active || item.active, disabled: !!item.disabled, level: level > 0 })">
|
|
164
|
+
<ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" />
|
|
165
|
+
</ULinkBase>
|
|
166
|
+
|
|
167
|
+
<template #content>
|
|
168
|
+
<slot :name="item.slot ? `${item.slot}-content` : 'item-content'" :item="item" :active="active || item.active" :index="index">
|
|
169
|
+
<ul :class="ui.childList({ class: [props.ui?.childList, item.ui?.childList] })">
|
|
170
|
+
<li :class="ui.childLabel({ class: [props.ui?.childLabel, item.ui?.childLabel] })">
|
|
171
|
+
{{ get(item, props.labelKey) }}
|
|
172
|
+
</li>
|
|
173
|
+
<li v-for="(childItem, childIndex) in item.children" :key="childIndex" :class="ui.childItem({ class: [props.ui?.childItem, item.ui?.childItem] })">
|
|
174
|
+
<ULink v-slot="{ active: childActive, ...childSlotProps }" v-bind="pickLinkProps(childItem)" custom>
|
|
175
|
+
<NavigationMenuLink as-child :active="childActive" @select="childItem.onSelect">
|
|
176
|
+
<ULinkBase v-bind="childSlotProps" :class="ui.childLink({ class: [props.ui?.childLink, item.ui?.childLink, childItem.class], active: childActive })">
|
|
177
|
+
<UIcon v-if="childItem.icon" :name="childItem.icon" :class="ui.childLinkIcon({ class: [props.ui?.childLinkIcon, item.ui?.childLinkIcon], active: childActive })" />
|
|
178
|
+
|
|
179
|
+
<span :class="ui.childLinkLabel({ class: [props.ui?.childLinkLabel, item.ui?.childLinkLabel], active: childActive })">
|
|
180
|
+
{{ get(childItem, props.labelKey) }}
|
|
181
|
+
|
|
182
|
+
<UIcon v-if="childItem.target === '_blank' && externalIcon !== false" :name="typeof externalIcon === 'string' ? externalIcon : appConfig.ui.icons.external" :class="ui.childLinkLabelExternalIcon({ class: [props.ui?.childLinkLabelExternalIcon, item.ui?.childLinkLabelExternalIcon], active: childActive })" />
|
|
183
|
+
</span>
|
|
184
|
+
</ULinkBase>
|
|
185
|
+
</NavigationMenuLink>
|
|
186
|
+
</ULink>
|
|
187
|
+
</li>
|
|
188
|
+
</ul>
|
|
189
|
+
</slot>
|
|
190
|
+
</template>
|
|
191
|
+
</UPopover>
|
|
192
|
+
<UTooltip v-else-if="orientation === 'vertical' && collapsed && (!!props.tooltip || !!item.tooltip)" :text="get(item, props.labelKey)" v-bind="{ ...tooltipProps, ...typeof item.tooltip === 'boolean' ? {} : item.tooltip || {} }">
|
|
193
|
+
<ULinkBase v-bind="slotProps" :class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active: active || item.active, disabled: !!item.disabled, level: level > 0 })">
|
|
194
|
+
<ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" />
|
|
195
|
+
</ULinkBase>
|
|
196
|
+
</UTooltip>
|
|
197
|
+
<ULinkBase v-else v-bind="slotProps" :class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active: active || item.active, disabled: !!item.disabled, level: orientation === 'horizontal' || level > 0 })">
|
|
141
198
|
<ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" />
|
|
142
199
|
</ULinkBase>
|
|
143
200
|
</component>
|
|
144
201
|
|
|
145
|
-
<NavigationMenuContent v-if="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content'])" v-bind="contentProps" :class="ui.content({ class: props.ui?.content })">
|
|
146
|
-
<slot :name="item.slot ? `${item.slot}-content` : 'item-content'" :item="item" :active="active" :index="index">
|
|
147
|
-
<ul :class="ui.childList({ class: props.ui?.childList })">
|
|
148
|
-
<li v-for="(childItem, childIndex) in item.children" :key="childIndex" :class="ui.childItem({ class: props.ui?.childItem })">
|
|
202
|
+
<NavigationMenuContent v-if="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content'])" v-bind="contentProps" :class="ui.content({ class: [props.ui?.content, item.ui?.content] })">
|
|
203
|
+
<slot :name="item.slot ? `${item.slot}-content` : 'item-content'" :item="item" :active="active || item.active" :index="index">
|
|
204
|
+
<ul :class="ui.childList({ class: [props.ui?.childList, item.ui?.childList] })">
|
|
205
|
+
<li v-for="(childItem, childIndex) in item.children" :key="childIndex" :class="ui.childItem({ class: [props.ui?.childItem, item.ui?.childItem] })">
|
|
149
206
|
<ULink v-slot="{ active: childActive, ...childSlotProps }" v-bind="pickLinkProps(childItem)" custom>
|
|
150
207
|
<NavigationMenuLink as-child :active="childActive" @select="childItem.onSelect">
|
|
151
|
-
<ULinkBase v-bind="childSlotProps" :class="ui.childLink({ class: [props.ui?.childLink, childItem.class], active: childActive })">
|
|
152
|
-
<UIcon v-if="childItem.icon" :name="childItem.icon" :class="ui.childLinkIcon({ class: props.ui?.childLinkIcon, active: childActive })" />
|
|
208
|
+
<ULinkBase v-bind="childSlotProps" :class="ui.childLink({ class: [props.ui?.childLink, item.ui?.childLink, childItem.class], active: childActive })">
|
|
209
|
+
<UIcon v-if="childItem.icon" :name="childItem.icon" :class="ui.childLinkIcon({ class: [props.ui?.childLinkIcon, item.ui?.childLinkIcon], active: childActive })" />
|
|
153
210
|
|
|
154
|
-
<div :class="ui.childLinkWrapper({ class: props.ui?.childLinkWrapper })">
|
|
155
|
-
<p :class="ui.childLinkLabel({ class: props.ui?.childLinkLabel, active: childActive })">
|
|
211
|
+
<div :class="ui.childLinkWrapper({ class: [props.ui?.childLinkWrapper, item.ui?.childLinkWrapper] })">
|
|
212
|
+
<p :class="ui.childLinkLabel({ class: [props.ui?.childLinkLabel, item.ui?.childLinkLabel], active: childActive })">
|
|
156
213
|
{{ get(childItem, props.labelKey) }}
|
|
157
214
|
|
|
158
|
-
<UIcon v-if="childItem.target === '_blank' && externalIcon !== false" :name="typeof externalIcon === 'string' ? externalIcon : appConfig.ui.icons.external" :class="ui.childLinkLabelExternalIcon({ class: props.ui?.childLinkLabelExternalIcon, active: childActive })" />
|
|
215
|
+
<UIcon v-if="childItem.target === '_blank' && externalIcon !== false" :name="typeof externalIcon === 'string' ? externalIcon : appConfig.ui.icons.external" :class="ui.childLinkLabelExternalIcon({ class: [props.ui?.childLinkLabelExternalIcon, item.ui?.childLinkLabelExternalIcon], active: childActive })" />
|
|
159
216
|
</p>
|
|
160
|
-
<p v-if="childItem.description" :class="ui.childLinkDescription({ class: props.ui?.childLinkDescription, active: childActive })">
|
|
217
|
+
<p v-if="childItem.description" :class="ui.childLinkDescription({ class: [props.ui?.childLinkDescription, item.ui?.childLinkDescription], active: childActive })">
|
|
161
218
|
{{ childItem.description }}
|
|
162
219
|
</p>
|
|
163
220
|
</div>
|
|
@@ -170,7 +227,7 @@ const lists = computed(
|
|
|
170
227
|
</NavigationMenuContent>
|
|
171
228
|
</ULink>
|
|
172
229
|
|
|
173
|
-
<
|
|
230
|
+
<AccordionContent v-if="orientation === 'vertical' && item.children?.length && !collapsed" :class="ui.content({ class: [props.ui?.content, item.ui?.content] })">
|
|
174
231
|
<ul :class="ui.childList({ class: props.ui?.childList })">
|
|
175
232
|
<ReuseItemTemplate
|
|
176
233
|
v-for="(childItem, childIndex) in item.children"
|
|
@@ -178,20 +235,28 @@ const lists = computed(
|
|
|
178
235
|
:item="childItem"
|
|
179
236
|
:index="childIndex"
|
|
180
237
|
:level="level + 1"
|
|
181
|
-
:class="ui.childItem({ class: props.ui?.childItem })"
|
|
238
|
+
:class="ui.childItem({ class: [props.ui?.childItem, childItem.ui?.childItem] })"
|
|
182
239
|
/>
|
|
183
240
|
</ul>
|
|
184
|
-
</
|
|
241
|
+
</AccordionContent>
|
|
185
242
|
</component>
|
|
186
243
|
</DefineItemTemplate>
|
|
187
244
|
|
|
188
|
-
<NavigationMenuRoot v-bind="rootProps" :data-collapsed="collapsed" :class="ui.root({ class: [props.
|
|
245
|
+
<NavigationMenuRoot v-bind="rootProps" :data-collapsed="collapsed" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
|
189
246
|
<slot name="list-leading" />
|
|
190
247
|
|
|
191
248
|
<template v-for="(list, listIndex) in lists" :key="`list-${listIndex}`">
|
|
192
|
-
<
|
|
193
|
-
|
|
194
|
-
|
|
249
|
+
<component
|
|
250
|
+
v-bind="orientation === 'vertical' && !collapsed ? {
|
|
251
|
+
...accordionProps,
|
|
252
|
+
defaultValue: getAccordionDefaultValue(list)
|
|
253
|
+
} : {}"
|
|
254
|
+
:is="orientation === 'vertical' && !collapsed ? AccordionRoot : NavigationMenuList"
|
|
255
|
+
as="ul"
|
|
256
|
+
:class="ui.list({ class: props.ui?.list })"
|
|
257
|
+
>
|
|
258
|
+
<ReuseItemTemplate v-for="(item, index) in list" :key="`list-${listIndex}-${index}`" :item="item" :index="index" :class="ui.item({ class: [props.ui?.item, item.ui?.item] })" />
|
|
259
|
+
</component>
|
|
195
260
|
|
|
196
261
|
<div v-if="orientation === 'vertical' && listIndex < lists.length - 1" :class="ui.separator({ class: props.ui?.separator })" />
|
|
197
262
|
</template>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { NavigationMenuRootProps, NavigationMenuRootEmits, NavigationMenuContentProps, NavigationMenuContentEmits,
|
|
1
|
+
import type { NavigationMenuRootProps, NavigationMenuRootEmits, NavigationMenuContentProps, NavigationMenuContentEmits, AccordionRootProps } from 'reka-ui';
|
|
2
2
|
import type { AppConfig } from '@nuxt/schema';
|
|
3
3
|
import theme from '#build/ui/navigation-menu';
|
|
4
|
-
import type { AvatarProps, BadgeProps, LinkProps } from '../types';
|
|
4
|
+
import type { AvatarProps, BadgeProps, LinkProps, PopoverProps, TooltipProps } from '../types';
|
|
5
5
|
import type { ArrayOrNested, DynamicSlots, MergeTypes, NestedItem, EmitsToProps, ComponentConfig } from '../types/utils';
|
|
6
6
|
type NavigationMenu = ComponentConfig<typeof theme, AppConfig, 'navigationMenu'>;
|
|
7
|
-
export interface NavigationMenuChildItem extends Omit<NavigationMenuItem, 'type'> {
|
|
7
|
+
export interface NavigationMenuChildItem extends Omit<NavigationMenuItem, 'type' | 'ui'> {
|
|
8
8
|
/** Description is only used when `orientation` is `horizontal`. */
|
|
9
9
|
description?: string;
|
|
10
10
|
[key: string]: any;
|
|
11
11
|
}
|
|
12
|
-
export interface NavigationMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custom'
|
|
12
|
+
export interface NavigationMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custom'> {
|
|
13
13
|
label?: string;
|
|
14
14
|
/**
|
|
15
15
|
* @IconifyIcon
|
|
@@ -21,23 +21,42 @@ export interface NavigationMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'cu
|
|
|
21
21
|
* `{ size: 'sm', color: 'neutral', variant: 'outline' }`{lang="ts-type"}
|
|
22
22
|
*/
|
|
23
23
|
badge?: string | number | BadgeProps;
|
|
24
|
+
/**
|
|
25
|
+
* Display a tooltip on the item when the menu is collapsed with the label of the item.
|
|
26
|
+
* This has priority over the global `tooltip` prop.
|
|
27
|
+
*/
|
|
28
|
+
tooltip?: boolean | TooltipProps;
|
|
29
|
+
/**
|
|
30
|
+
* Display a popover on the item when the menu is collapsed with the children list.
|
|
31
|
+
* This has priority over the global `popover` prop.
|
|
32
|
+
*/
|
|
33
|
+
popover?: boolean | PopoverProps;
|
|
24
34
|
/**
|
|
25
35
|
* @IconifyIcon
|
|
26
36
|
*/
|
|
27
37
|
trailingIcon?: string;
|
|
28
38
|
/**
|
|
29
39
|
* The type of the item.
|
|
30
|
-
* The `label` type only
|
|
40
|
+
* The `label` type is only displayed in `vertical` orientation.
|
|
41
|
+
* The `trigger` type is used to force the item to be collapsible when its a link in `vertical` orientation.
|
|
31
42
|
* @defaultValue 'link'
|
|
32
43
|
*/
|
|
33
|
-
type?: 'label' | 'link';
|
|
44
|
+
type?: 'label' | 'trigger' | 'link';
|
|
34
45
|
slot?: string;
|
|
46
|
+
/**
|
|
47
|
+
* The value of the item. Avoid using `index` as the value to prevent conflicts in horizontal orientation with Reka UI.
|
|
48
|
+
* @defaultValue `item-${index}`
|
|
49
|
+
*/
|
|
35
50
|
value?: string;
|
|
36
51
|
children?: NavigationMenuChildItem[];
|
|
52
|
+
defaultOpen?: boolean;
|
|
53
|
+
open?: boolean;
|
|
37
54
|
onSelect?(e: Event): void;
|
|
55
|
+
class?: any;
|
|
56
|
+
ui?: Pick<NavigationMenu['slots'], 'item' | 'linkLeadingAvatarSize' | 'linkLeadingAvatar' | 'linkLeadingIcon' | 'linkLabel' | 'linkLabelExternalIcon' | 'linkTrailing' | 'linkTrailingBadgeSize' | 'linkTrailingBadge' | 'linkTrailingIcon' | 'label' | 'link' | 'content' | 'childList' | 'childLabel' | 'childItem' | 'childLink' | 'childLinkIcon' | 'childLinkWrapper' | 'childLinkLabel' | 'childLinkLabelExternalIcon' | 'childLinkDescription'>;
|
|
38
57
|
[key: string]: any;
|
|
39
58
|
}
|
|
40
|
-
export interface NavigationMenuProps<T extends ArrayOrNested<NavigationMenuItem> = ArrayOrNested<NavigationMenuItem>> extends Pick<NavigationMenuRootProps, 'modelValue' | 'defaultValue' | 'delayDuration' | 'disableClickTrigger' | 'disableHoverTrigger' | 'skipDelayDuration' | 'disablePointerLeaveClose' | 'unmountOnHide'> {
|
|
59
|
+
export interface NavigationMenuProps<T extends ArrayOrNested<NavigationMenuItem> = ArrayOrNested<NavigationMenuItem>> extends Pick<NavigationMenuRootProps, 'modelValue' | 'defaultValue' | 'delayDuration' | 'disableClickTrigger' | 'disableHoverTrigger' | 'skipDelayDuration' | 'disablePointerLeaveClose' | 'unmountOnHide'>, Pick<AccordionRootProps, 'disabled' | 'type' | 'collapsible'> {
|
|
41
60
|
/**
|
|
42
61
|
* The element or component this component should render as.
|
|
43
62
|
* @defaultValue 'div'
|
|
@@ -76,6 +95,18 @@ export interface NavigationMenuProps<T extends ArrayOrNested<NavigationMenuItem>
|
|
|
76
95
|
* @defaultValue false
|
|
77
96
|
*/
|
|
78
97
|
collapsed?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Display a tooltip on the items when the menu is collapsed with the label of the item.
|
|
100
|
+
* `{ delayDuration: 0, content: { side: 'right' } }`{lang="ts-type"}
|
|
101
|
+
* @defaultValue false
|
|
102
|
+
*/
|
|
103
|
+
tooltip?: boolean | TooltipProps;
|
|
104
|
+
/**
|
|
105
|
+
* Display a popover on the items when the menu is collapsed with the children list.
|
|
106
|
+
* `{ mode: 'hover', content: { side: 'right', align: 'start', alignOffset: 2 } }`{lang="ts-type"}
|
|
107
|
+
* @defaultValue false
|
|
108
|
+
*/
|
|
109
|
+
popover?: boolean | PopoverProps;
|
|
79
110
|
/** Display a line next to the active item. */
|
|
80
111
|
highlight?: boolean;
|
|
81
112
|
/**
|
|
@@ -47,7 +47,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.pagination ||
|
|
|
47
47
|
</script>
|
|
48
48
|
|
|
49
49
|
<template>
|
|
50
|
-
<PaginationRoot v-slot="{ page, pageCount }" v-bind="rootProps" :class="ui.root({ class: [props.
|
|
50
|
+
<PaginationRoot v-slot="{ page, pageCount }" v-bind="rootProps" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
|
51
51
|
<PaginationList v-slot="{ items }" :class="ui.list({ class: props.ui?.list })">
|
|
52
52
|
<PaginationFirst v-if="showControls || !!slots.first" as-child :class="ui.first({ class: props.ui?.first })">
|
|
53
53
|
<slot name="first">
|
|
@@ -75,7 +75,7 @@ defineExpose({
|
|
|
75
75
|
v-bind="{ ...rootProps, ...ariaAttrs }"
|
|
76
76
|
:id="id"
|
|
77
77
|
:name="name"
|
|
78
|
-
:class="ui.root({ class: [props.
|
|
78
|
+
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
79
79
|
@update:model-value="emitFormInput()"
|
|
80
80
|
@complete="onComplete"
|
|
81
81
|
>
|
|
@@ -58,6 +58,10 @@ const Component = computed(() => props.mode === "hover" ? HoverCard : Popover);
|
|
|
58
58
|
<slot :open="open" />
|
|
59
59
|
</Component.Trigger>
|
|
60
60
|
|
|
61
|
+
<Component.Anchor v-if="'Anchor' in Component && !!slots.anchor" as-child>
|
|
62
|
+
<slot name="anchor" />
|
|
63
|
+
</Component.Anchor>
|
|
64
|
+
|
|
61
65
|
<Component.Portal v-bind="portalProps">
|
|
62
66
|
<Component.Content v-bind="contentProps" :class="ui.content({ class: [!slots.default && props.class, props.ui?.content] })" v-on="contentEvents">
|
|
63
67
|
<slot name="content" />
|
|
@@ -41,6 +41,7 @@ export interface PopoverSlots {
|
|
|
41
41
|
open: boolean;
|
|
42
42
|
}): any;
|
|
43
43
|
content(props?: {}): any;
|
|
44
|
+
anchor(props?: {}): any;
|
|
44
45
|
}
|
|
45
46
|
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<PopoverProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
46
47
|
"update:open": (value: boolean) => any;
|
|
@@ -109,7 +109,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.progress || {
|
|
|
109
109
|
</script>
|
|
110
110
|
|
|
111
111
|
<template>
|
|
112
|
-
<Primitive :as="as" :class="ui.root({ class: [props.
|
|
112
|
+
<Primitive :as="as" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
|
113
113
|
<div v-if="!isIndeterminate && (status || !!slots.status)" :class="ui.status({ class: props.ui?.status })" :style="statusStyle">
|
|
114
114
|
<slot name="status" :percent="percent">
|
|
115
115
|
{{ percent }}%
|
|
@@ -93,7 +93,7 @@ function onUpdate(value) {
|
|
|
93
93
|
v-bind="rootProps"
|
|
94
94
|
:name="name"
|
|
95
95
|
:disabled="disabled"
|
|
96
|
-
:class="ui.root({ class: [props.
|
|
96
|
+
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
97
97
|
@update:model-value="onUpdate"
|
|
98
98
|
>
|
|
99
99
|
<fieldset :class="ui.fieldset({ class: props.ui?.fieldset })" v-bind="ariaAttrs">
|
|
@@ -103,25 +103,25 @@ function onUpdate(value) {
|
|
|
103
103
|
</slot>
|
|
104
104
|
</legend>
|
|
105
105
|
|
|
106
|
-
<component :is="variant === 'list' ? 'div' : Label" v-for="item in normalizedItems" :key="item.value" :class="ui.item({ class: props.ui?.item })">
|
|
107
|
-
<div :class="ui.container({ class: props.ui?.container })">
|
|
106
|
+
<component :is="!variant || variant === 'list' ? 'div' : Label" v-for="item in normalizedItems" :key="item.value" :class="ui.item({ class: [props.ui?.item, item.ui?.item, item.class] })">
|
|
107
|
+
<div :class="ui.container({ class: [props.ui?.container, item.ui?.container] })">
|
|
108
108
|
<RadioGroupItem
|
|
109
109
|
:id="item.id"
|
|
110
110
|
:value="item.value"
|
|
111
111
|
:disabled="item.disabled"
|
|
112
|
-
:class="ui.base({ class: props.ui?.base, disabled: item.disabled })"
|
|
112
|
+
:class="ui.base({ class: [props.ui?.base, item.ui?.base], disabled: item.disabled })"
|
|
113
113
|
>
|
|
114
|
-
<RadioGroupIndicator :class="ui.indicator({ class: props.ui?.indicator })" />
|
|
114
|
+
<RadioGroupIndicator :class="ui.indicator({ class: [props.ui?.indicator, item.ui?.indicator] })" />
|
|
115
115
|
</RadioGroupItem>
|
|
116
116
|
</div>
|
|
117
117
|
|
|
118
|
-
<div v-if="item.label || !!slots.label || (item.description || !!slots.description)" :class="ui.wrapper({ class: props.ui?.wrapper })">
|
|
119
|
-
<component :is="variant === 'list' ? Label : 'p'" v-if="item.label || !!slots.label" :for="item.id" :class="ui.label({ class: props.ui?.label })">
|
|
118
|
+
<div v-if="item.label || !!slots.label || (item.description || !!slots.description)" :class="ui.wrapper({ class: [props.ui?.wrapper, item.ui?.wrapper] })">
|
|
119
|
+
<component :is="!variant || variant === 'list' ? Label : 'p'" v-if="item.label || !!slots.label" :for="item.id" :class="ui.label({ class: [props.ui?.label, item.ui?.label] })">
|
|
120
120
|
<slot name="label" :item="item" :model-value="modelValue">
|
|
121
121
|
{{ item.label }}
|
|
122
122
|
</slot>
|
|
123
123
|
</component>
|
|
124
|
-
<p v-if="item.description || !!slots.description" :class="ui.description({ class: props.ui?.description })">
|
|
124
|
+
<p v-if="item.description || !!slots.description" :class="ui.description({ class: [props.ui?.description, item.ui?.description] })">
|
|
125
125
|
<slot name="description" :item="item" :model-value="modelValue">
|
|
126
126
|
{{ item.description }}
|
|
127
127
|
</slot>
|
|
@@ -9,6 +9,8 @@ export type RadioGroupItem = {
|
|
|
9
9
|
description?: string;
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
value?: RadioGroupValue;
|
|
12
|
+
class?: any;
|
|
13
|
+
ui?: Pick<RadioGroup['slots'], 'item' | 'container' | 'base' | 'indicator' | 'wrapper' | 'label' | 'description'>;
|
|
12
14
|
[key: string]: any;
|
|
13
15
|
} | RadioGroupValue;
|
|
14
16
|
export interface RadioGroupProps<T extends RadioGroupItem = RadioGroupItem> extends Pick<RadioGroupRootProps, 'defaultValue' | 'disabled' | 'loop' | 'modelValue' | 'name' | 'required'> {
|