@nuxt/ui 4.0.1 → 4.1.0
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/calendar.ts +221 -9
- package/.nuxt/ui/chat-message.ts +10 -3
- package/.nuxt/ui/command-palette.ts +12 -2
- package/.nuxt/ui/context-menu.ts +3 -1
- package/.nuxt/ui/dropdown-menu.ts +3 -1
- package/.nuxt/ui/empty.ts +83 -0
- package/.nuxt/ui/index.ts +1 -0
- package/.nuxt/ui/input-menu.ts +12 -2
- package/.nuxt/ui/input-number.ts +25 -14
- package/.nuxt/ui/kbd.ts +1 -1
- package/.nuxt/ui/prose/code-tree.ts +1 -1
- package/.nuxt/ui/prose/img.ts +2 -1
- package/.nuxt/ui/select-menu.ts +12 -2
- package/.nuxt/ui/select.ts +4 -2
- package/.nuxt/ui/table.ts +8 -2
- package/.nuxt/ui/tree.ts +25 -11
- package/cli/templates.mjs +14 -2
- package/dist/module.d.mts +15 -0
- package/dist/module.json +2 -2
- package/dist/module.mjs +5 -2
- package/dist/runtime/components/Accordion.d.vue.ts +7 -1
- package/dist/runtime/components/Accordion.vue +4 -4
- package/dist/runtime/components/Accordion.vue.d.ts +7 -1
- package/dist/runtime/components/Alert.d.vue.ts +4 -4
- package/dist/runtime/components/Alert.vue +1 -1
- package/dist/runtime/components/Alert.vue.d.ts +4 -4
- package/dist/runtime/components/AuthForm.d.vue.ts +3 -1
- package/dist/runtime/components/AuthForm.vue +1 -1
- package/dist/runtime/components/AuthForm.vue.d.ts +3 -1
- package/dist/runtime/components/Avatar.d.vue.ts +5 -4
- package/dist/runtime/components/Avatar.vue +10 -3
- package/dist/runtime/components/Avatar.vue.d.ts +5 -4
- package/dist/runtime/components/Badge.d.vue.ts +9 -3
- package/dist/runtime/components/Badge.vue +3 -3
- package/dist/runtime/components/Badge.vue.d.ts +9 -3
- package/dist/runtime/components/Banner.d.vue.ts +4 -2
- package/dist/runtime/components/Banner.vue +1 -1
- package/dist/runtime/components/Banner.vue.d.ts +4 -2
- package/dist/runtime/components/BlogPost.d.vue.ts +9 -3
- package/dist/runtime/components/BlogPost.vue +2 -2
- package/dist/runtime/components/BlogPost.vue.d.ts +9 -3
- package/dist/runtime/components/BlogPosts.d.vue.ts +22 -13
- package/dist/runtime/components/BlogPosts.vue +8 -2
- package/dist/runtime/components/BlogPosts.vue.d.ts +22 -13
- package/dist/runtime/components/Breadcrumb.d.vue.ts +19 -4
- package/dist/runtime/components/Breadcrumb.vue +8 -8
- package/dist/runtime/components/Breadcrumb.vue.d.ts +19 -4
- package/dist/runtime/components/Button.d.vue.ts +9 -3
- package/dist/runtime/components/Button.vue +3 -3
- package/dist/runtime/components/Button.vue.d.ts +9 -3
- package/dist/runtime/components/Calendar.d.vue.ts +4 -0
- package/dist/runtime/components/Calendar.vue +3 -1
- package/dist/runtime/components/Calendar.vue.d.ts +4 -0
- package/dist/runtime/components/ChangelogVersion.d.vue.ts +12 -4
- package/dist/runtime/components/ChangelogVersion.vue +3 -3
- package/dist/runtime/components/ChangelogVersion.vue.d.ts +12 -4
- package/dist/runtime/components/ChangelogVersions.d.vue.ts +8 -36
- package/dist/runtime/components/ChangelogVersions.vue +2 -2
- package/dist/runtime/components/ChangelogVersions.vue.d.ts +8 -36
- package/dist/runtime/components/ChatMessage.d.vue.ts +1 -0
- package/dist/runtime/components/ChatMessage.vue +1 -1
- package/dist/runtime/components/ChatMessage.vue.d.ts +1 -0
- package/dist/runtime/components/ChatMessages.d.vue.ts +14 -15
- package/dist/runtime/components/ChatMessages.vue +24 -8
- package/dist/runtime/components/ChatMessages.vue.d.ts +14 -15
- package/dist/runtime/components/CommandPalette.d.vue.ts +43 -12
- package/dist/runtime/components/CommandPalette.vue +134 -68
- package/dist/runtime/components/CommandPalette.vue.d.ts +43 -12
- package/dist/runtime/components/ContextMenu.d.vue.ts +28 -6
- package/dist/runtime/components/ContextMenu.vue +2 -0
- package/dist/runtime/components/ContextMenu.vue.d.ts +28 -6
- package/dist/runtime/components/ContextMenuContent.d.vue.ts +2 -3
- package/dist/runtime/components/ContextMenuContent.vue +21 -11
- package/dist/runtime/components/ContextMenuContent.vue.d.ts +2 -3
- package/dist/runtime/components/DashboardNavbar.d.vue.ts +9 -3
- package/dist/runtime/components/DashboardNavbar.vue +3 -3
- package/dist/runtime/components/DashboardNavbar.vue.d.ts +9 -3
- package/dist/runtime/components/DashboardSearch.d.vue.ts +3 -1
- package/dist/runtime/components/DashboardSearch.vue +2 -2
- package/dist/runtime/components/DashboardSearch.vue.d.ts +3 -1
- package/dist/runtime/components/DashboardSearchButton.vue +2 -2
- package/dist/runtime/components/DashboardSidebar.d.vue.ts +5 -1
- package/dist/runtime/components/DashboardSidebar.vue +4 -4
- package/dist/runtime/components/DashboardSidebar.vue.d.ts +5 -1
- package/dist/runtime/components/Drawer.vue +2 -5
- package/dist/runtime/components/DropdownMenu.d.vue.ts +28 -6
- package/dist/runtime/components/DropdownMenu.vue +2 -0
- package/dist/runtime/components/DropdownMenu.vue.d.ts +28 -6
- package/dist/runtime/components/DropdownMenuContent.d.vue.ts +8 -5
- package/dist/runtime/components/DropdownMenuContent.vue +21 -11
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +8 -5
- package/dist/runtime/components/Empty.d.vue.ts +53 -0
- package/dist/runtime/components/Empty.vue +68 -0
- package/dist/runtime/components/Empty.vue.d.ts +53 -0
- package/dist/runtime/components/Error.d.vue.ts +0 -1
- package/dist/runtime/components/Error.vue +1 -1
- package/dist/runtime/components/Error.vue.d.ts +0 -1
- package/dist/runtime/components/FileUpload.d.vue.ts +6 -1
- package/dist/runtime/components/FileUpload.vue +8 -7
- package/dist/runtime/components/FileUpload.vue.d.ts +6 -1
- package/dist/runtime/components/FooterColumns.d.vue.ts +9 -2
- package/dist/runtime/components/FooterColumns.vue +2 -2
- package/dist/runtime/components/FooterColumns.vue.d.ts +9 -2
- package/dist/runtime/components/Header.d.vue.ts +4 -1
- package/dist/runtime/components/Header.vue +3 -3
- package/dist/runtime/components/Header.vue.d.ts +4 -1
- package/dist/runtime/components/Input.d.vue.ts +9 -3
- package/dist/runtime/components/Input.vue +3 -3
- package/dist/runtime/components/Input.vue.d.ts +9 -3
- package/dist/runtime/components/InputMenu.d.vue.ts +40 -10
- package/dist/runtime/components/InputMenu.vue +117 -65
- package/dist/runtime/components/InputMenu.vue.d.ts +40 -10
- package/dist/runtime/components/InputNumber.d.vue.ts +4 -2
- package/dist/runtime/components/InputNumber.vue +7 -5
- package/dist/runtime/components/InputNumber.vue.d.ts +4 -2
- package/dist/runtime/components/InputTags.d.vue.ts +10 -3
- package/dist/runtime/components/InputTags.vue +5 -5
- package/dist/runtime/components/InputTags.vue.d.ts +10 -3
- package/dist/runtime/components/Main.d.vue.ts +2 -4
- package/dist/runtime/components/Main.vue +1 -1
- package/dist/runtime/components/Main.vue.d.ts +2 -4
- package/dist/runtime/components/Modal.d.vue.ts +1 -4
- package/dist/runtime/components/Modal.vue +3 -6
- package/dist/runtime/components/Modal.vue.d.ts +1 -4
- package/dist/runtime/components/NavigationMenu.d.vue.ts +16 -4
- package/dist/runtime/components/NavigationMenu.vue +14 -7
- package/dist/runtime/components/NavigationMenu.vue.d.ts +16 -4
- package/dist/runtime/components/PageAnchors.d.vue.ts +9 -2
- package/dist/runtime/components/PageAnchors.vue +2 -2
- package/dist/runtime/components/PageAnchors.vue.d.ts +9 -2
- package/dist/runtime/components/PageCard.d.vue.ts +3 -1
- package/dist/runtime/components/PageCard.vue +1 -1
- package/dist/runtime/components/PageCard.vue.d.ts +3 -1
- package/dist/runtime/components/PageFeature.d.vue.ts +3 -1
- package/dist/runtime/components/PageFeature.vue +1 -1
- package/dist/runtime/components/PageFeature.vue.d.ts +3 -1
- package/dist/runtime/components/PageLinks.d.vue.ts +9 -2
- package/dist/runtime/components/PageLinks.vue +2 -2
- package/dist/runtime/components/PageLinks.vue.d.ts +9 -2
- package/dist/runtime/components/PageSection.d.vue.ts +3 -1
- package/dist/runtime/components/PageSection.vue +1 -1
- package/dist/runtime/components/PageSection.vue.d.ts +3 -1
- package/dist/runtime/components/Pagination.d.vue.ts +3 -1
- package/dist/runtime/components/Pagination.vue +1 -1
- package/dist/runtime/components/Pagination.vue.d.ts +3 -1
- package/dist/runtime/components/Popover.d.vue.ts +24 -23
- package/dist/runtime/components/Popover.vue +4 -4
- package/dist/runtime/components/Popover.vue.d.ts +24 -23
- package/dist/runtime/components/PricingPlan.d.vue.ts +9 -3
- package/dist/runtime/components/PricingPlan.vue +3 -3
- package/dist/runtime/components/PricingPlan.vue.d.ts +9 -3
- package/dist/runtime/components/PricingPlans.d.vue.ts +20 -13
- package/dist/runtime/components/PricingPlans.vue +7 -1
- package/dist/runtime/components/PricingPlans.vue.d.ts +20 -13
- package/dist/runtime/components/Select.d.vue.ts +20 -9
- package/dist/runtime/components/Select.vue +18 -9
- package/dist/runtime/components/Select.vue.d.ts +20 -9
- package/dist/runtime/components/SelectMenu.d.vue.ts +39 -11
- package/dist/runtime/components/SelectMenu.vue +114 -61
- package/dist/runtime/components/SelectMenu.vue.d.ts +39 -11
- package/dist/runtime/components/Separator.d.vue.ts +3 -1
- package/dist/runtime/components/Separator.vue +1 -1
- package/dist/runtime/components/Separator.vue.d.ts +3 -1
- package/dist/runtime/components/Slideover.d.vue.ts +1 -4
- package/dist/runtime/components/Slideover.vue +3 -6
- package/dist/runtime/components/Slideover.vue.d.ts +1 -4
- package/dist/runtime/components/Stepper.d.vue.ts +4 -1
- package/dist/runtime/components/Stepper.vue +1 -1
- package/dist/runtime/components/Stepper.vue.d.ts +4 -1
- package/dist/runtime/components/Table.d.vue.ts +21 -1
- package/dist/runtime/components/Table.vue +126 -60
- package/dist/runtime/components/Table.vue.d.ts +21 -1
- package/dist/runtime/components/Tabs.d.vue.ts +8 -3
- package/dist/runtime/components/Tabs.vue +3 -3
- package/dist/runtime/components/Tabs.vue.d.ts +8 -3
- package/dist/runtime/components/Textarea.d.vue.ts +9 -3
- package/dist/runtime/components/Textarea.vue +3 -3
- package/dist/runtime/components/Textarea.vue.d.ts +9 -3
- package/dist/runtime/components/Toast.d.vue.ts +4 -4
- package/dist/runtime/components/Toast.vue +1 -1
- package/dist/runtime/components/Toast.vue.d.ts +4 -4
- package/dist/runtime/components/Toaster.d.vue.ts +6 -0
- package/dist/runtime/components/Toaster.vue +6 -3
- package/dist/runtime/components/Toaster.vue.d.ts +6 -0
- package/dist/runtime/components/Tooltip.d.vue.ts +3 -1
- package/dist/runtime/components/Tooltip.vue +1 -1
- package/dist/runtime/components/Tooltip.vue.d.ts +3 -1
- package/dist/runtime/components/Tree.d.vue.ts +43 -5
- package/dist/runtime/components/Tree.vue +169 -81
- package/dist/runtime/components/Tree.vue.d.ts +43 -5
- package/dist/runtime/components/User.d.vue.ts +3 -1
- package/dist/runtime/components/User.vue +1 -1
- package/dist/runtime/components/User.vue.d.ts +3 -1
- package/dist/runtime/components/content/ContentNavigation.d.vue.ts +1 -0
- package/dist/runtime/components/content/ContentNavigation.vue +5 -5
- package/dist/runtime/components/content/ContentNavigation.vue.d.ts +1 -0
- package/dist/runtime/components/content/ContentSearch.d.vue.ts +3 -1
- package/dist/runtime/components/content/ContentSearch.vue +4 -2
- package/dist/runtime/components/content/ContentSearch.vue.d.ts +3 -1
- package/dist/runtime/components/content/ContentSearchButton.vue +2 -2
- package/dist/runtime/components/content/ContentSurround.d.vue.ts +1 -0
- package/dist/runtime/components/content/ContentSurround.vue +4 -4
- package/dist/runtime/components/content/ContentSurround.vue.d.ts +1 -0
- package/dist/runtime/components/content/ContentToc.d.vue.ts +2 -0
- package/dist/runtime/components/content/ContentToc.vue +2 -2
- package/dist/runtime/components/content/ContentToc.vue.d.ts +2 -0
- package/dist/runtime/components/prose/Accordion.d.vue.ts +6 -0
- package/dist/runtime/components/prose/Accordion.vue +3 -2
- package/dist/runtime/components/prose/Accordion.vue.d.ts +6 -0
- package/dist/runtime/components/prose/CodeTree.vue +40 -36
- package/dist/runtime/components/prose/Collapsible.d.vue.ts +2 -2
- package/dist/runtime/components/prose/Collapsible.vue +2 -2
- package/dist/runtime/components/prose/Collapsible.vue.d.ts +2 -2
- package/dist/runtime/components/prose/Field.d.vue.ts +1 -1
- package/dist/runtime/components/prose/Field.vue.d.ts +1 -1
- package/dist/runtime/components/prose/Img.vue +14 -3
- package/dist/runtime/components/prose/Tabs.d.vue.ts +6 -0
- package/dist/runtime/components/prose/Tabs.vue +3 -2
- package/dist/runtime/components/prose/Tabs.vue.d.ts +6 -0
- package/dist/runtime/composables/useKbd.js +1 -1
- package/dist/runtime/composables/useToast.d.ts +3 -1
- package/dist/runtime/composables/useToast.js +4 -3
- package/dist/runtime/inertia/components/Link.vue +12 -7
- package/dist/runtime/locale/hr.d.ts +3 -0
- package/dist/runtime/locale/hr.js +129 -0
- package/dist/runtime/locale/index.d.ts +1 -0
- package/dist/runtime/locale/index.js +1 -0
- package/dist/runtime/types/index.d.ts +2 -1
- package/dist/runtime/types/index.js +2 -1
- package/dist/runtime/types/tv.d.ts +6 -0
- package/dist/shared/{ui.D-FDXAUi.mjs → ui.Cmctwxv6.mjs} +381 -48
- package/dist/unplugin.mjs +2 -1
- package/dist/vite.mjs +3 -2
- package/package.json +18 -17
|
@@ -23,6 +23,7 @@ const props = defineProps({
|
|
|
23
23
|
portal: { type: [Boolean, String], required: false, skipCheck: true },
|
|
24
24
|
sub: { type: Boolean, required: false },
|
|
25
25
|
labelKey: { type: null, required: true },
|
|
26
|
+
descriptionKey: { type: null, required: true },
|
|
26
27
|
checkedIcon: { type: [String, Object], required: false },
|
|
27
28
|
loadingIcon: { type: [String, Object], required: false },
|
|
28
29
|
externalIcon: { type: [Boolean, String, Object], required: false },
|
|
@@ -48,7 +49,7 @@ const slots = defineSlots();
|
|
|
48
49
|
const { dir } = useLocale();
|
|
49
50
|
const appConfig = useAppConfig();
|
|
50
51
|
const portalProps = usePortal(toRef(() => props.portal));
|
|
51
|
-
const contentProps = useForwardPropsEmits(reactiveOmit(props, "sub", "items", "portal", "labelKey", "checkedIcon", "loadingIcon", "externalIcon", "class", "ui", "uiOverride"), emits);
|
|
52
|
+
const contentProps = useForwardPropsEmits(reactiveOmit(props, "sub", "items", "portal", "labelKey", "descriptionKey", "checkedIcon", "loadingIcon", "externalIcon", "class", "ui", "uiOverride"), emits);
|
|
52
53
|
const getProxySlots = () => omit(slots, ["default"]);
|
|
53
54
|
const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate();
|
|
54
55
|
const childrenIcon = computed(() => dir.value === "rtl" ? appConfig.ui.icons.chevronLeft : appConfig.ui.icons.chevronRight);
|
|
@@ -59,23 +60,31 @@ const groups = computed(
|
|
|
59
60
|
|
|
60
61
|
<template>
|
|
61
62
|
<DefineItemTemplate v-slot="{ item, active, index }">
|
|
62
|
-
<slot :name="item.slot || 'item'" :item="item" :index="index">
|
|
63
|
-
<slot :name="item.slot ? `${item.slot}-leading` : 'item-leading'" :item="item" :active="active" :index="index">
|
|
63
|
+
<slot :name="item.slot || 'item'" :item="item" :index="index" :ui="ui">
|
|
64
|
+
<slot :name="item.slot ? `${item.slot}-leading` : 'item-leading'" :item="item" :active="active" :index="index" :ui="ui">
|
|
64
65
|
<UIcon v-if="item.loading" :name="loadingIcon || appConfig.ui.icons.loading" :class="ui.itemLeadingIcon({ class: [uiOverride?.itemLeadingIcon, item.ui?.itemLeadingIcon], color: item?.color, loading: true })" />
|
|
65
66
|
<UIcon v-else-if="item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: [uiOverride?.itemLeadingIcon, item.ui?.itemLeadingIcon], color: item?.color, active })" />
|
|
66
67
|
<UAvatar v-else-if="item.avatar" :size="item.ui?.itemLeadingAvatarSize || uiOverride?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: [uiOverride?.itemLeadingAvatar, item.ui?.itemLeadingAvatar], active })" />
|
|
67
68
|
</slot>
|
|
68
69
|
|
|
69
|
-
<span v-if="get(item, props.labelKey) || !!slots[item.slot ? `${item.slot}-label` : 'item-label']" :class="ui.
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
<span v-if="get(item, props.labelKey) || !!slots[item.slot ? `${item.slot}-label` : 'item-label'] || (get(item, props.descriptionKey) || !!slots[item.slot ? `${item.slot}-description` : 'item-description'])" :class="ui.itemWrapper({ class: [uiOverride?.itemWrapper, item.ui?.itemWrapper] })">
|
|
71
|
+
<span :class="ui.itemLabel({ class: [uiOverride?.itemLabel, item.ui?.itemLabel], active })">
|
|
72
|
+
<slot :name="item.slot ? `${item.slot}-label` : 'item-label'" :item="item" :active="active" :index="index">
|
|
73
|
+
{{ get(item, props.labelKey) }}
|
|
74
|
+
</slot>
|
|
75
|
+
|
|
76
|
+
<UIcon v-if="item.target === '_blank' && externalIcon !== false" :name="typeof externalIcon === 'string' ? externalIcon : appConfig.ui.icons.external" :class="ui.itemLabelExternalIcon({ class: [uiOverride?.itemLabelExternalIcon, item.ui?.itemLabelExternalIcon], color: item?.color, active })" />
|
|
77
|
+
</span>
|
|
73
78
|
|
|
74
|
-
<
|
|
79
|
+
<span v-if="get(item, props.descriptionKey)" :class="ui.itemDescription({ class: [uiOverride?.itemDescription, item.ui?.itemDescription] })">
|
|
80
|
+
<slot :name="item.slot ? `${item.slot}-description` : 'item-description'" :item="item" :active="active" :index="index">
|
|
81
|
+
{{ get(item, props.descriptionKey) }}
|
|
82
|
+
</slot>
|
|
83
|
+
</span>
|
|
75
84
|
</span>
|
|
76
85
|
|
|
77
86
|
<span :class="ui.itemTrailing({ class: [uiOverride?.itemTrailing, item.ui?.itemTrailing] })">
|
|
78
|
-
<slot :name="item.slot ? `${item.slot}-trailing` : 'item-trailing'" :item="item" :active="active" :index="index">
|
|
87
|
+
<slot :name="item.slot ? `${item.slot}-trailing` : 'item-trailing'" :item="item" :active="active" :index="index" :ui="ui">
|
|
79
88
|
<UIcon v-if="item.children?.length" :name="childrenIcon" :class="ui.itemTrailingIcon({ class: [uiOverride?.itemTrailingIcon, item.ui?.itemTrailingIcon], color: item?.color, active })" />
|
|
80
89
|
<span v-else-if="item.kbds?.length" :class="ui.itemTrailingKbds({ class: [uiOverride?.itemTrailingKbds, item.ui?.itemTrailingKbds] })">
|
|
81
90
|
<UKbd v-for="(kbd, kbdIndex) in item.kbds" :key="kbdIndex" :size="item.ui?.itemTrailingKbdsSize || uiOverride?.itemTrailingKbdsSize || ui.itemTrailingKbdsSize()" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
|
|
@@ -90,7 +99,7 @@ const groups = computed(
|
|
|
90
99
|
</DefineItemTemplate>
|
|
91
100
|
|
|
92
101
|
<ContextMenu.Portal v-bind="portalProps">
|
|
93
|
-
<component :is="sub ? ContextMenu.SubContent : ContextMenu.Content" :class="props.class" v-bind="contentProps">
|
|
102
|
+
<component :is="sub ? ContextMenu.SubContent : ContextMenu.Content" :class="ui.content({ class: [uiOverride?.content, props.class] })" v-bind="contentProps">
|
|
94
103
|
<slot name="content-top" />
|
|
95
104
|
|
|
96
105
|
<div role="presentation" :class="ui.viewport({ class: uiOverride?.viewport })">
|
|
@@ -113,13 +122,14 @@ const groups = computed(
|
|
|
113
122
|
|
|
114
123
|
<UContextMenuContent
|
|
115
124
|
sub
|
|
116
|
-
:class="
|
|
125
|
+
:class="item.ui?.content"
|
|
117
126
|
:ui="ui"
|
|
118
127
|
:ui-override="uiOverride"
|
|
119
128
|
:portal="portal"
|
|
120
129
|
:items="item.children"
|
|
121
130
|
:align-offset="-4"
|
|
122
131
|
:label-key="labelKey"
|
|
132
|
+
:description-key="descriptionKey"
|
|
123
133
|
:checked-icon="checkedIcon"
|
|
124
134
|
:loading-icon="loadingIcon"
|
|
125
135
|
:external-icon="externalIcon"
|
|
@@ -11,6 +11,7 @@ interface ContextMenuContentProps<T extends ArrayOrNested<ContextMenuItem>> exte
|
|
|
11
11
|
portal?: boolean | string | HTMLElement;
|
|
12
12
|
sub?: boolean;
|
|
13
13
|
labelKey: GetItemKeys<T>;
|
|
14
|
+
descriptionKey: GetItemKeys<T>;
|
|
14
15
|
/**
|
|
15
16
|
* @IconifyIcon
|
|
16
17
|
*/
|
|
@@ -24,9 +25,7 @@ interface ContextMenuContentProps<T extends ArrayOrNested<ContextMenuItem>> exte
|
|
|
24
25
|
*/
|
|
25
26
|
externalIcon?: boolean | IconProps['name'];
|
|
26
27
|
class?: any;
|
|
27
|
-
ui:
|
|
28
|
-
[K in keyof Required<ContextMenu['slots']>]: (props?: Record<string, any>) => string;
|
|
29
|
-
};
|
|
28
|
+
ui: ContextMenu['ui'];
|
|
30
29
|
uiOverride?: ContextMenu['slots'];
|
|
31
30
|
}
|
|
32
31
|
declare const __VLS_export: <T extends ArrayOrNested<ContextMenuItem>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
@@ -33,12 +33,18 @@ export interface DashboardNavbarProps {
|
|
|
33
33
|
type DashboardNavbarSlotsProps = Omit<DashboardContext, 'storage' | 'storageKey' | 'persistent' | 'unit'>;
|
|
34
34
|
export interface DashboardNavbarSlots {
|
|
35
35
|
title(props?: {}): any;
|
|
36
|
-
leading(props: DashboardNavbarSlotsProps
|
|
37
|
-
|
|
36
|
+
leading(props: DashboardNavbarSlotsProps & {
|
|
37
|
+
ui: DashboardNavbar['ui'];
|
|
38
|
+
}): any;
|
|
39
|
+
trailing(props: DashboardNavbarSlotsProps & {
|
|
40
|
+
ui: DashboardNavbar['ui'];
|
|
41
|
+
}): any;
|
|
38
42
|
left(props: DashboardNavbarSlotsProps): any;
|
|
39
43
|
default(props: DashboardNavbarSlotsProps): any;
|
|
40
44
|
right(props: DashboardNavbarSlotsProps): any;
|
|
41
|
-
toggle(props: DashboardNavbarSlotsProps
|
|
45
|
+
toggle(props: DashboardNavbarSlotsProps & {
|
|
46
|
+
ui: DashboardNavbar['ui'];
|
|
47
|
+
}): any;
|
|
42
48
|
}
|
|
43
49
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<DashboardNavbarProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DashboardNavbarProps> & Readonly<{}>, {
|
|
44
50
|
toggle: boolean | Partial<ButtonProps>;
|
|
@@ -30,7 +30,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.dashboardNavb
|
|
|
30
30
|
|
|
31
31
|
<template>
|
|
32
32
|
<DefineToggleTemplate>
|
|
33
|
-
<slot name="toggle" v-bind="dashboardContext">
|
|
33
|
+
<slot name="toggle" v-bind="{ ...dashboardContext, ui }">
|
|
34
34
|
<UDashboardSidebarToggle
|
|
35
35
|
v-if="toggle"
|
|
36
36
|
v-bind="typeof toggle === 'object' ? toggle : {}"
|
|
@@ -45,7 +45,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.dashboardNavb
|
|
|
45
45
|
<ReuseToggleTemplate v-if="toggleSide === 'left'" />
|
|
46
46
|
|
|
47
47
|
<slot name="left" v-bind="dashboardContext">
|
|
48
|
-
<slot name="leading" v-bind="dashboardContext">
|
|
48
|
+
<slot name="leading" v-bind="{ ...dashboardContext, ui }">
|
|
49
49
|
<UIcon v-if="icon" :name="icon" :class="ui.icon({ class: props.ui?.icon })" />
|
|
50
50
|
</slot>
|
|
51
51
|
|
|
@@ -55,7 +55,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.dashboardNavb
|
|
|
55
55
|
</slot>
|
|
56
56
|
</h1>
|
|
57
57
|
|
|
58
|
-
<slot name="trailing" v-bind="dashboardContext" />
|
|
58
|
+
<slot name="trailing" v-bind="{ ...dashboardContext, ui }" />
|
|
59
59
|
</slot>
|
|
60
60
|
</div>
|
|
61
61
|
|
|
@@ -33,12 +33,18 @@ export interface DashboardNavbarProps {
|
|
|
33
33
|
type DashboardNavbarSlotsProps = Omit<DashboardContext, 'storage' | 'storageKey' | 'persistent' | 'unit'>;
|
|
34
34
|
export interface DashboardNavbarSlots {
|
|
35
35
|
title(props?: {}): any;
|
|
36
|
-
leading(props: DashboardNavbarSlotsProps
|
|
37
|
-
|
|
36
|
+
leading(props: DashboardNavbarSlotsProps & {
|
|
37
|
+
ui: DashboardNavbar['ui'];
|
|
38
|
+
}): any;
|
|
39
|
+
trailing(props: DashboardNavbarSlotsProps & {
|
|
40
|
+
ui: DashboardNavbar['ui'];
|
|
41
|
+
}): any;
|
|
38
42
|
left(props: DashboardNavbarSlotsProps): any;
|
|
39
43
|
default(props: DashboardNavbarSlotsProps): any;
|
|
40
44
|
right(props: DashboardNavbarSlotsProps): any;
|
|
41
|
-
toggle(props: DashboardNavbarSlotsProps
|
|
45
|
+
toggle(props: DashboardNavbarSlotsProps & {
|
|
46
|
+
ui: DashboardNavbar['ui'];
|
|
47
|
+
}): any;
|
|
42
48
|
}
|
|
43
49
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<DashboardNavbarProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DashboardNavbarProps> & Readonly<{}>, {
|
|
44
50
|
toggle: boolean | Partial<ButtonProps>;
|
|
@@ -62,7 +62,9 @@ export interface DashboardSearchProps<T extends CommandPaletteItem = CommandPale
|
|
|
62
62
|
ui?: DashboardSearch['slots'] & CommandPaletteProps<CommandPaletteGroup<CommandPaletteItem>, CommandPaletteItem>['ui'];
|
|
63
63
|
}
|
|
64
64
|
export type DashboardSearchSlots = CommandPaletteSlots<CommandPaletteGroup<CommandPaletteItem>, CommandPaletteItem> & {
|
|
65
|
-
content(props
|
|
65
|
+
content(props: {
|
|
66
|
+
close: () => void;
|
|
67
|
+
}): any;
|
|
66
68
|
};
|
|
67
69
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<DashboardSearchProps<CommandPaletteItem> & {
|
|
68
70
|
open?: boolean;
|
|
@@ -115,8 +115,8 @@ defineExpose({
|
|
|
115
115
|
v-bind="modalProps"
|
|
116
116
|
:class="ui.modal({ class: [props.ui?.modal, props.class] })"
|
|
117
117
|
>
|
|
118
|
-
<template #content>
|
|
119
|
-
<slot name="content">
|
|
118
|
+
<template #content="contentData">
|
|
119
|
+
<slot name="content" v-bind="contentData">
|
|
120
120
|
<UCommandPalette
|
|
121
121
|
ref="commandPaletteRef"
|
|
122
122
|
v-model:search-term="searchTerm"
|
|
@@ -62,7 +62,9 @@ export interface DashboardSearchProps<T extends CommandPaletteItem = CommandPale
|
|
|
62
62
|
ui?: DashboardSearch['slots'] & CommandPaletteProps<CommandPaletteGroup<CommandPaletteItem>, CommandPaletteItem>['ui'];
|
|
63
63
|
}
|
|
64
64
|
export type DashboardSearchSlots = CommandPaletteSlots<CommandPaletteGroup<CommandPaletteItem>, CommandPaletteItem> & {
|
|
65
|
-
content(props
|
|
65
|
+
content(props: {
|
|
66
|
+
close: () => void;
|
|
67
|
+
}): any;
|
|
66
68
|
};
|
|
67
69
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<DashboardSearchProps<CommandPaletteItem> & {
|
|
68
70
|
open?: boolean;
|
|
@@ -63,9 +63,9 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.dashboardSear
|
|
|
63
63
|
<slot :name="name" v-bind="slotData" />
|
|
64
64
|
</template>
|
|
65
65
|
|
|
66
|
-
<template v-if="!collapsed" #trailing>
|
|
66
|
+
<template v-if="!collapsed" #trailing="{ ui: uiProxy }">
|
|
67
67
|
<div :class="ui.trailing({ class: props.ui?.trailing })">
|
|
68
|
-
<slot name="trailing">
|
|
68
|
+
<slot name="trailing" :ui="uiProxy">
|
|
69
69
|
<template v-if="kbds?.length">
|
|
70
70
|
<UKbd v-for="(kbd, index) in kbds" :key="index" variant="subtle" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
|
|
71
71
|
</template>
|
|
@@ -46,12 +46,16 @@ export interface DashboardSidebarSlots {
|
|
|
46
46
|
'toggle'(props: {
|
|
47
47
|
open: boolean;
|
|
48
48
|
toggle: () => void;
|
|
49
|
+
ui: DashboardSidebar['ui'];
|
|
50
|
+
}): any;
|
|
51
|
+
'content'(props: {
|
|
52
|
+
close?: () => void;
|
|
49
53
|
}): any;
|
|
50
|
-
'content'(props?: {}): any;
|
|
51
54
|
'resize-handle'(props: {
|
|
52
55
|
onMouseDown: (e: MouseEvent) => void;
|
|
53
56
|
onTouchStart: (e: TouchEvent) => void;
|
|
54
57
|
onDoubleClick: (e: MouseEvent) => void;
|
|
58
|
+
ui: DashboardSidebar['ui'];
|
|
55
59
|
}): any;
|
|
56
60
|
}
|
|
57
61
|
declare const __VLS_export: <T extends DashboardSidebarMode>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
@@ -80,7 +80,7 @@ function toggleOpen() {
|
|
|
80
80
|
|
|
81
81
|
<template>
|
|
82
82
|
<DefineToggleTemplate>
|
|
83
|
-
<slot name="toggle" :open="open" :toggle="toggleOpen">
|
|
83
|
+
<slot name="toggle" :open="open" :toggle="toggleOpen" :ui="ui">
|
|
84
84
|
<UDashboardSidebarToggle
|
|
85
85
|
v-if="toggle"
|
|
86
86
|
v-bind="typeof toggle === 'object' ? toggle : {}"
|
|
@@ -91,7 +91,7 @@ function toggleOpen() {
|
|
|
91
91
|
</DefineToggleTemplate>
|
|
92
92
|
|
|
93
93
|
<DefineResizeHandleTemplate>
|
|
94
|
-
<slot name="resize-handle" :on-mouse-down="onMouseDown" :on-touch-start="onTouchStart" :on-double-click="onDoubleClick">
|
|
94
|
+
<slot name="resize-handle" :on-mouse-down="onMouseDown" :on-touch-start="onTouchStart" :on-double-click="onDoubleClick" :ui="ui">
|
|
95
95
|
<UDashboardResizeHandle
|
|
96
96
|
v-if="resizable"
|
|
97
97
|
:aria-controls="id"
|
|
@@ -139,8 +139,8 @@ function toggleOpen() {
|
|
|
139
139
|
content: ui.content({ class: props.ui?.content })
|
|
140
140
|
}"
|
|
141
141
|
>
|
|
142
|
-
<template #content>
|
|
143
|
-
<slot name="content">
|
|
142
|
+
<template #content="contentData">
|
|
143
|
+
<slot name="content" v-bind="contentData">
|
|
144
144
|
<div v-if="!!slots.header || mode !== 'drawer'" :class="ui.header({ class: props.ui?.header, menu: true })">
|
|
145
145
|
<ReuseToggleTemplate v-if="mode !== 'drawer' && toggleSide === 'left'" />
|
|
146
146
|
|
|
@@ -46,12 +46,16 @@ export interface DashboardSidebarSlots {
|
|
|
46
46
|
'toggle'(props: {
|
|
47
47
|
open: boolean;
|
|
48
48
|
toggle: () => void;
|
|
49
|
+
ui: DashboardSidebar['ui'];
|
|
50
|
+
}): any;
|
|
51
|
+
'content'(props: {
|
|
52
|
+
close?: () => void;
|
|
49
53
|
}): any;
|
|
50
|
-
'content'(props?: {}): any;
|
|
51
54
|
'resize-handle'(props: {
|
|
52
55
|
onMouseDown: (e: MouseEvent) => void;
|
|
53
56
|
onTouchStart: (e: TouchEvent) => void;
|
|
54
57
|
onDoubleClick: (e: MouseEvent) => void;
|
|
58
|
+
ui: DashboardSidebar['ui'];
|
|
55
59
|
}): any;
|
|
56
60
|
}
|
|
57
61
|
declare const __VLS_export: <T extends DashboardSidebarMode>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
@@ -45,9 +45,6 @@ const rootProps = useForwardPropsEmits(reactivePick(props, "activeSnapPoint", "c
|
|
|
45
45
|
const portalProps = usePortal(toRef(() => props.portal));
|
|
46
46
|
const contentProps = toRef(() => props.content);
|
|
47
47
|
const contentEvents = computed(() => {
|
|
48
|
-
const defaultEvents = {
|
|
49
|
-
closeAutoFocus: (e) => e.preventDefault()
|
|
50
|
-
};
|
|
51
48
|
if (!props.dismissible) {
|
|
52
49
|
const events = ["pointerDownOutside", "interactOutside", "escapeKeyDown"];
|
|
53
50
|
return events.reduce((acc, curr) => {
|
|
@@ -56,9 +53,9 @@ const contentEvents = computed(() => {
|
|
|
56
53
|
emits("close:prevent");
|
|
57
54
|
};
|
|
58
55
|
return acc;
|
|
59
|
-
},
|
|
56
|
+
}, {});
|
|
60
57
|
}
|
|
61
|
-
return
|
|
58
|
+
return {};
|
|
62
59
|
});
|
|
63
60
|
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.drawer || {} })({
|
|
64
61
|
direction: props.direction,
|
|
@@ -7,13 +7,16 @@ import type { ComponentConfig } from '../types/tv';
|
|
|
7
7
|
type DropdownMenu = ComponentConfig<typeof theme, AppConfig, 'dropdownMenu'>;
|
|
8
8
|
export interface DropdownMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custom'> {
|
|
9
9
|
label?: string;
|
|
10
|
+
description?: string;
|
|
10
11
|
/**
|
|
11
12
|
* @IconifyIcon
|
|
12
13
|
*/
|
|
13
14
|
icon?: IconProps['name'];
|
|
14
15
|
color?: DropdownMenu['variants']['color'];
|
|
15
16
|
avatar?: AvatarProps;
|
|
16
|
-
content?: Omit<DropdownMenuContentProps, 'as' | 'asChild' | 'forceMount'> &
|
|
17
|
+
content?: Omit<DropdownMenuContentProps, 'as' | 'asChild' | 'forceMount'> & {
|
|
18
|
+
class?: any;
|
|
19
|
+
} & Partial<EmitsToProps<DropdownMenuContentEmits>>;
|
|
17
20
|
kbds?: KbdProps['value'][] | KbdProps[];
|
|
18
21
|
/**
|
|
19
22
|
* The item type.
|
|
@@ -27,10 +30,10 @@ export interface DropdownMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'cust
|
|
|
27
30
|
open?: boolean;
|
|
28
31
|
defaultOpen?: boolean;
|
|
29
32
|
children?: ArrayOrNested<DropdownMenuItem>;
|
|
30
|
-
onSelect
|
|
31
|
-
onUpdateChecked
|
|
33
|
+
onSelect?: (e: Event) => void;
|
|
34
|
+
onUpdateChecked?: (checked: boolean) => void;
|
|
32
35
|
class?: any;
|
|
33
|
-
ui?: Pick<DropdownMenu['slots'], 'item' | 'label' | 'separator' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLabel' | 'itemLabelExternalIcon' | 'itemTrailing' | 'itemTrailingIcon' | 'itemTrailingKbds' | 'itemTrailingKbdsSize'>;
|
|
36
|
+
ui?: Pick<DropdownMenu['slots'], 'content' | 'item' | 'label' | 'separator' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemLabelExternalIcon' | 'itemTrailing' | 'itemTrailingIcon' | 'itemTrailingKbds' | 'itemTrailingKbdsSize'>;
|
|
34
37
|
[key: string]: any;
|
|
35
38
|
}
|
|
36
39
|
export interface DropdownMenuProps<T extends ArrayOrNested<DropdownMenuItem> = ArrayOrNested<DropdownMenuItem>> extends Omit<DropdownMenuRootProps, 'dir'> {
|
|
@@ -78,6 +81,11 @@ export interface DropdownMenuProps<T extends ArrayOrNested<DropdownMenuItem> = A
|
|
|
78
81
|
* @defaultValue 'label'
|
|
79
82
|
*/
|
|
80
83
|
labelKey?: GetItemKeys<T>;
|
|
84
|
+
/**
|
|
85
|
+
* The key used to get the description from the item.
|
|
86
|
+
* @defaultValue 'description'
|
|
87
|
+
*/
|
|
88
|
+
descriptionKey?: GetItemKeys<T>;
|
|
81
89
|
disabled?: boolean;
|
|
82
90
|
class?: any;
|
|
83
91
|
ui?: DropdownMenu['slots'];
|
|
@@ -88,6 +96,7 @@ type SlotProps<T extends DropdownMenuItem> = (props: {
|
|
|
88
96
|
item: T;
|
|
89
97
|
active?: boolean;
|
|
90
98
|
index: number;
|
|
99
|
+
ui: DropdownMenu['ui'];
|
|
91
100
|
}) => any;
|
|
92
101
|
export type DropdownMenuSlots<A extends ArrayOrNested<DropdownMenuItem> = ArrayOrNested<DropdownMenuItem>, T extends NestedItem<A> = NestedItem<A>> = {
|
|
93
102
|
'default'(props: {
|
|
@@ -95,13 +104,26 @@ export type DropdownMenuSlots<A extends ArrayOrNested<DropdownMenuItem> = ArrayO
|
|
|
95
104
|
}): any;
|
|
96
105
|
'item': SlotProps<T>;
|
|
97
106
|
'item-leading': SlotProps<T>;
|
|
98
|
-
'item-label':
|
|
107
|
+
'item-label': (props: {
|
|
108
|
+
item: T;
|
|
109
|
+
active?: boolean;
|
|
110
|
+
index: number;
|
|
111
|
+
}) => any;
|
|
112
|
+
'item-description': (props: {
|
|
113
|
+
item: T;
|
|
114
|
+
active?: boolean;
|
|
115
|
+
index: number;
|
|
116
|
+
}) => any;
|
|
99
117
|
'item-trailing': SlotProps<T>;
|
|
100
118
|
'content-top': (props?: {}) => any;
|
|
101
119
|
'content-bottom': (props?: {}) => any;
|
|
102
|
-
} & DynamicSlots<MergeTypes<T>, '
|
|
120
|
+
} & DynamicSlots<MergeTypes<T>, 'label' | 'description', {
|
|
121
|
+
active?: boolean;
|
|
122
|
+
index: number;
|
|
123
|
+
}> & DynamicSlots<MergeTypes<T>, 'leading' | 'trailing', {
|
|
103
124
|
active?: boolean;
|
|
104
125
|
index: number;
|
|
126
|
+
ui: DropdownMenu['ui'];
|
|
105
127
|
}>;
|
|
106
128
|
declare const __VLS_export: <T extends ArrayOrNested<DropdownMenuItem>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
107
129
|
props: __VLS_PrettifyLocal<DropdownMenuProps<T> & {
|
|
@@ -21,6 +21,7 @@ const props = defineProps({
|
|
|
21
21
|
arrow: { type: [Boolean, Object], required: false },
|
|
22
22
|
portal: { type: [Boolean, String], required: false, skipCheck: true, default: true },
|
|
23
23
|
labelKey: { type: null, required: false, default: "label" },
|
|
24
|
+
descriptionKey: { type: null, required: false, default: "description" },
|
|
24
25
|
disabled: { type: Boolean, required: false },
|
|
25
26
|
class: { type: null, required: false },
|
|
26
27
|
ui: { type: null, required: false },
|
|
@@ -54,6 +55,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.dropdownMenu
|
|
|
54
55
|
:items="items"
|
|
55
56
|
:portal="portal"
|
|
56
57
|
:label-key="labelKey"
|
|
58
|
+
:description-key="descriptionKey"
|
|
57
59
|
:checked-icon="checkedIcon"
|
|
58
60
|
:loading-icon="loadingIcon"
|
|
59
61
|
:external-icon="externalIcon"
|
|
@@ -7,13 +7,16 @@ import type { ComponentConfig } from '../types/tv';
|
|
|
7
7
|
type DropdownMenu = ComponentConfig<typeof theme, AppConfig, 'dropdownMenu'>;
|
|
8
8
|
export interface DropdownMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custom'> {
|
|
9
9
|
label?: string;
|
|
10
|
+
description?: string;
|
|
10
11
|
/**
|
|
11
12
|
* @IconifyIcon
|
|
12
13
|
*/
|
|
13
14
|
icon?: IconProps['name'];
|
|
14
15
|
color?: DropdownMenu['variants']['color'];
|
|
15
16
|
avatar?: AvatarProps;
|
|
16
|
-
content?: Omit<DropdownMenuContentProps, 'as' | 'asChild' | 'forceMount'> &
|
|
17
|
+
content?: Omit<DropdownMenuContentProps, 'as' | 'asChild' | 'forceMount'> & {
|
|
18
|
+
class?: any;
|
|
19
|
+
} & Partial<EmitsToProps<DropdownMenuContentEmits>>;
|
|
17
20
|
kbds?: KbdProps['value'][] | KbdProps[];
|
|
18
21
|
/**
|
|
19
22
|
* The item type.
|
|
@@ -27,10 +30,10 @@ export interface DropdownMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'cust
|
|
|
27
30
|
open?: boolean;
|
|
28
31
|
defaultOpen?: boolean;
|
|
29
32
|
children?: ArrayOrNested<DropdownMenuItem>;
|
|
30
|
-
onSelect
|
|
31
|
-
onUpdateChecked
|
|
33
|
+
onSelect?: (e: Event) => void;
|
|
34
|
+
onUpdateChecked?: (checked: boolean) => void;
|
|
32
35
|
class?: any;
|
|
33
|
-
ui?: Pick<DropdownMenu['slots'], 'item' | 'label' | 'separator' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLabel' | 'itemLabelExternalIcon' | 'itemTrailing' | 'itemTrailingIcon' | 'itemTrailingKbds' | 'itemTrailingKbdsSize'>;
|
|
36
|
+
ui?: Pick<DropdownMenu['slots'], 'content' | 'item' | 'label' | 'separator' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemLabelExternalIcon' | 'itemTrailing' | 'itemTrailingIcon' | 'itemTrailingKbds' | 'itemTrailingKbdsSize'>;
|
|
34
37
|
[key: string]: any;
|
|
35
38
|
}
|
|
36
39
|
export interface DropdownMenuProps<T extends ArrayOrNested<DropdownMenuItem> = ArrayOrNested<DropdownMenuItem>> extends Omit<DropdownMenuRootProps, 'dir'> {
|
|
@@ -78,6 +81,11 @@ export interface DropdownMenuProps<T extends ArrayOrNested<DropdownMenuItem> = A
|
|
|
78
81
|
* @defaultValue 'label'
|
|
79
82
|
*/
|
|
80
83
|
labelKey?: GetItemKeys<T>;
|
|
84
|
+
/**
|
|
85
|
+
* The key used to get the description from the item.
|
|
86
|
+
* @defaultValue 'description'
|
|
87
|
+
*/
|
|
88
|
+
descriptionKey?: GetItemKeys<T>;
|
|
81
89
|
disabled?: boolean;
|
|
82
90
|
class?: any;
|
|
83
91
|
ui?: DropdownMenu['slots'];
|
|
@@ -88,6 +96,7 @@ type SlotProps<T extends DropdownMenuItem> = (props: {
|
|
|
88
96
|
item: T;
|
|
89
97
|
active?: boolean;
|
|
90
98
|
index: number;
|
|
99
|
+
ui: DropdownMenu['ui'];
|
|
91
100
|
}) => any;
|
|
92
101
|
export type DropdownMenuSlots<A extends ArrayOrNested<DropdownMenuItem> = ArrayOrNested<DropdownMenuItem>, T extends NestedItem<A> = NestedItem<A>> = {
|
|
93
102
|
'default'(props: {
|
|
@@ -95,13 +104,26 @@ export type DropdownMenuSlots<A extends ArrayOrNested<DropdownMenuItem> = ArrayO
|
|
|
95
104
|
}): any;
|
|
96
105
|
'item': SlotProps<T>;
|
|
97
106
|
'item-leading': SlotProps<T>;
|
|
98
|
-
'item-label':
|
|
107
|
+
'item-label': (props: {
|
|
108
|
+
item: T;
|
|
109
|
+
active?: boolean;
|
|
110
|
+
index: number;
|
|
111
|
+
}) => any;
|
|
112
|
+
'item-description': (props: {
|
|
113
|
+
item: T;
|
|
114
|
+
active?: boolean;
|
|
115
|
+
index: number;
|
|
116
|
+
}) => any;
|
|
99
117
|
'item-trailing': SlotProps<T>;
|
|
100
118
|
'content-top': (props?: {}) => any;
|
|
101
119
|
'content-bottom': (props?: {}) => any;
|
|
102
|
-
} & DynamicSlots<MergeTypes<T>, '
|
|
120
|
+
} & DynamicSlots<MergeTypes<T>, 'label' | 'description', {
|
|
121
|
+
active?: boolean;
|
|
122
|
+
index: number;
|
|
123
|
+
}> & DynamicSlots<MergeTypes<T>, 'leading' | 'trailing', {
|
|
103
124
|
active?: boolean;
|
|
104
125
|
index: number;
|
|
126
|
+
ui: DropdownMenu['ui'];
|
|
105
127
|
}>;
|
|
106
128
|
declare const __VLS_export: <T extends ArrayOrNested<DropdownMenuItem>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
107
129
|
props: __VLS_PrettifyLocal<DropdownMenuProps<T> & {
|
|
@@ -11,6 +11,7 @@ interface DropdownMenuContentProps<T extends ArrayOrNested<DropdownMenuItem>> ex
|
|
|
11
11
|
portal?: boolean | string | HTMLElement;
|
|
12
12
|
sub?: boolean;
|
|
13
13
|
labelKey: GetItemKeys<T>;
|
|
14
|
+
descriptionKey: GetItemKeys<T>;
|
|
14
15
|
/**
|
|
15
16
|
* @IconifyIcon
|
|
16
17
|
*/
|
|
@@ -24,16 +25,18 @@ interface DropdownMenuContentProps<T extends ArrayOrNested<DropdownMenuItem>> ex
|
|
|
24
25
|
*/
|
|
25
26
|
externalIcon?: boolean | IconProps['name'];
|
|
26
27
|
class?: any;
|
|
27
|
-
ui:
|
|
28
|
-
[K in keyof Required<DropdownMenu['slots']>]: (props?: Record<string, any>) => string;
|
|
29
|
-
};
|
|
28
|
+
ui: DropdownMenu['ui'];
|
|
30
29
|
uiOverride?: DropdownMenu['slots'];
|
|
31
30
|
}
|
|
32
|
-
type DropdownMenuContentSlots<A extends ArrayOrNested<DropdownMenuItem> = ArrayOrNested<DropdownMenuItem>, T extends NestedItem<A> = NestedItem<A>> = Pick<DropdownMenuSlots<A>, 'item' | 'item-leading' | 'item-label' | 'item-trailing' | 'content-top' | 'content-bottom'> & {
|
|
31
|
+
type DropdownMenuContentSlots<A extends ArrayOrNested<DropdownMenuItem> = ArrayOrNested<DropdownMenuItem>, T extends NestedItem<A> = NestedItem<A>> = Pick<DropdownMenuSlots<A>, 'item' | 'item-leading' | 'item-label' | 'item-description' | 'item-trailing' | 'content-top' | 'content-bottom'> & {
|
|
33
32
|
default(props?: {}): any;
|
|
34
|
-
} & DynamicSlots<MergeTypes<T>, '
|
|
33
|
+
} & DynamicSlots<MergeTypes<T>, 'label' | 'description', {
|
|
35
34
|
active?: boolean;
|
|
36
35
|
index: number;
|
|
36
|
+
}> & DynamicSlots<MergeTypes<T>, 'leading' | 'trailing', {
|
|
37
|
+
active?: boolean;
|
|
38
|
+
index: number;
|
|
39
|
+
ui: DropdownMenu['ui'];
|
|
37
40
|
}>;
|
|
38
41
|
declare const __VLS_export: <T extends ArrayOrNested<DropdownMenuItem>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
39
42
|
props: __VLS_PrettifyLocal<DropdownMenuContentProps<T> & {
|
|
@@ -23,6 +23,7 @@ const props = defineProps({
|
|
|
23
23
|
portal: { type: [Boolean, String], required: false, skipCheck: true },
|
|
24
24
|
sub: { type: Boolean, required: false },
|
|
25
25
|
labelKey: { type: null, required: true },
|
|
26
|
+
descriptionKey: { type: null, required: true },
|
|
26
27
|
checkedIcon: { type: [String, Object], required: false },
|
|
27
28
|
loadingIcon: { type: [String, Object], required: false },
|
|
28
29
|
externalIcon: { type: [Boolean, String, Object], required: false },
|
|
@@ -53,7 +54,7 @@ const slots = defineSlots();
|
|
|
53
54
|
const { dir } = useLocale();
|
|
54
55
|
const appConfig = useAppConfig();
|
|
55
56
|
const portalProps = usePortal(toRef(() => props.portal));
|
|
56
|
-
const contentProps = useForwardPropsEmits(reactiveOmit(props, "sub", "items", "portal", "labelKey", "checkedIcon", "loadingIcon", "externalIcon", "class", "ui", "uiOverride"), emits);
|
|
57
|
+
const contentProps = useForwardPropsEmits(reactiveOmit(props, "sub", "items", "portal", "labelKey", "descriptionKey", "checkedIcon", "loadingIcon", "externalIcon", "class", "ui", "uiOverride"), emits);
|
|
57
58
|
const getProxySlots = () => omit(slots, ["default"]);
|
|
58
59
|
const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate();
|
|
59
60
|
const childrenIcon = computed(() => dir.value === "rtl" ? appConfig.ui.icons.chevronLeft : appConfig.ui.icons.chevronRight);
|
|
@@ -64,23 +65,31 @@ const groups = computed(
|
|
|
64
65
|
|
|
65
66
|
<template>
|
|
66
67
|
<DefineItemTemplate v-slot="{ item, active, index }">
|
|
67
|
-
<slot :name="item.slot || 'item'" :item="item" :index="index">
|
|
68
|
-
<slot :name="item.slot ? `${item.slot}-leading` : 'item-leading'" :item="item" :active="active" :index="index">
|
|
68
|
+
<slot :name="item.slot || 'item'" :item="item" :index="index" :ui="ui">
|
|
69
|
+
<slot :name="item.slot ? `${item.slot}-leading` : 'item-leading'" :item="item" :active="active" :index="index" :ui="ui">
|
|
69
70
|
<UIcon v-if="item.loading" :name="loadingIcon || appConfig.ui.icons.loading" :class="ui.itemLeadingIcon({ class: [uiOverride?.itemLeadingIcon, item.ui?.itemLeadingIcon], color: item?.color, loading: true })" />
|
|
70
71
|
<UIcon v-else-if="item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: [uiOverride?.itemLeadingIcon, item.ui?.itemLeadingIcon], color: item?.color, active })" />
|
|
71
72
|
<UAvatar v-else-if="item.avatar" :size="item.ui?.itemLeadingAvatarSize || uiOverride?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: [uiOverride?.itemLeadingAvatar, item.ui?.itemLeadingAvatar], active })" />
|
|
72
73
|
</slot>
|
|
73
74
|
|
|
74
|
-
<span v-if="get(item, props.labelKey) || !!slots[item.slot ? `${item.slot}-label` : 'item-label']" :class="ui.
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
<span v-if="get(item, props.labelKey) || !!slots[item.slot ? `${item.slot}-label` : 'item-label'] || (get(item, props.descriptionKey) || !!slots[item.slot ? `${item.slot}-description` : 'item-description'])" :class="ui.itemWrapper({ class: [uiOverride?.itemWrapper, item.ui?.itemWrapper] })">
|
|
76
|
+
<span :class="ui.itemLabel({ class: [uiOverride?.itemLabel, item.ui?.itemLabel], active })">
|
|
77
|
+
<slot :name="item.slot ? `${item.slot}-label` : 'item-label'" :item="item" :active="active" :index="index">
|
|
78
|
+
{{ get(item, props.labelKey) }}
|
|
79
|
+
</slot>
|
|
80
|
+
|
|
81
|
+
<UIcon v-if="item.target === '_blank' && externalIcon !== false" :name="typeof externalIcon === 'string' ? externalIcon : appConfig.ui.icons.external" :class="ui.itemLabelExternalIcon({ class: [uiOverride?.itemLabelExternalIcon, item.ui?.itemLabelExternalIcon], color: item?.color, active })" />
|
|
82
|
+
</span>
|
|
78
83
|
|
|
79
|
-
<
|
|
84
|
+
<span v-if="get(item, props.descriptionKey)" :class="ui.itemDescription({ class: [uiOverride?.itemDescription, item.ui?.itemDescription] })">
|
|
85
|
+
<slot :name="item.slot ? `${item.slot}-description` : 'item-description'" :item="item" :active="active" :index="index">
|
|
86
|
+
{{ get(item, props.descriptionKey) }}
|
|
87
|
+
</slot>
|
|
88
|
+
</span>
|
|
80
89
|
</span>
|
|
81
90
|
|
|
82
91
|
<span :class="ui.itemTrailing({ class: [uiOverride?.itemTrailing, item.ui?.itemTrailing] })">
|
|
83
|
-
<slot :name="item.slot ? `${item.slot}-trailing` : 'item-trailing'" :item="item" :active="active" :index="index">
|
|
92
|
+
<slot :name="item.slot ? `${item.slot}-trailing` : 'item-trailing'" :item="item" :active="active" :index="index" :ui="ui">
|
|
84
93
|
<UIcon v-if="item.children?.length" :name="childrenIcon" :class="ui.itemTrailingIcon({ class: [uiOverride?.itemTrailingIcon, item.ui?.itemTrailingIcon], color: item?.color, active })" />
|
|
85
94
|
<span v-else-if="item.kbds?.length" :class="ui.itemTrailingKbds({ class: [uiOverride?.itemTrailingKbds, item.ui?.itemTrailingKbds] })">
|
|
86
95
|
<UKbd v-for="(kbd, kbdIndex) in item.kbds" :key="kbdIndex" :size="item.ui?.itemTrailingKbdsSize || uiOverride?.itemTrailingKbdsSize || ui.itemTrailingKbdsSize()" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
|
|
@@ -95,7 +104,7 @@ const groups = computed(
|
|
|
95
104
|
</DefineItemTemplate>
|
|
96
105
|
|
|
97
106
|
<DropdownMenu.Portal v-bind="portalProps">
|
|
98
|
-
<component :is="sub ? DropdownMenu.SubContent : DropdownMenu.Content" :class="props.class" v-bind="contentProps">
|
|
107
|
+
<component :is="sub ? DropdownMenu.SubContent : DropdownMenu.Content" :class="ui.content({ class: [uiOverride?.content, props.class] })" v-bind="contentProps">
|
|
99
108
|
<slot name="content-top" />
|
|
100
109
|
|
|
101
110
|
<div role="presentation" :class="ui.viewport({ class: uiOverride?.viewport })">
|
|
@@ -118,7 +127,7 @@ const groups = computed(
|
|
|
118
127
|
|
|
119
128
|
<UDropdownMenuContent
|
|
120
129
|
sub
|
|
121
|
-
:class="
|
|
130
|
+
:class="item.ui?.content"
|
|
122
131
|
:ui="ui"
|
|
123
132
|
:ui-override="uiOverride"
|
|
124
133
|
:portal="portal"
|
|
@@ -127,6 +136,7 @@ const groups = computed(
|
|
|
127
136
|
:align-offset="-4"
|
|
128
137
|
:side-offset="3"
|
|
129
138
|
:label-key="labelKey"
|
|
139
|
+
:description-key="descriptionKey"
|
|
130
140
|
:checked-icon="checkedIcon"
|
|
131
141
|
:loading-icon="loadingIcon"
|
|
132
142
|
:external-icon="externalIcon"
|