@bitrix24/b24ui-nuxt 0.5.8 → 0.5.10
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/b24ui/navigation-menu.ts +0 -2
- package/.nuxt/b24ui/popover.ts +1 -1
- package/.nuxt/b24ui/textarea.ts +43 -0
- package/dist/meta.d.mts +5090 -4900
- package/dist/meta.mjs +5090 -4900
- package/dist/module.json +5 -5
- package/dist/module.mjs +11 -7
- package/dist/runtime/components/Advice.vue +47 -54
- package/dist/runtime/components/Advice.vue.d.ts +170 -0
- package/dist/runtime/components/Alert.vue +71 -96
- package/dist/runtime/components/Alert.vue.d.ts +464 -0
- package/dist/runtime/components/App.vue +37 -34
- package/dist/runtime/components/App.vue.d.ts +23 -0
- package/dist/runtime/components/Avatar.vue +69 -81
- package/dist/runtime/components/Avatar.vue.d.ts +281 -0
- package/dist/runtime/components/AvatarGroup.vue +53 -76
- package/dist/runtime/components/AvatarGroup.vue.d.ts +204 -0
- package/dist/runtime/components/Badge.vue +83 -83
- package/dist/runtime/components/Badge.vue.d.ts +517 -0
- package/dist/runtime/components/Button.vue +219 -149
- package/dist/runtime/components/Button.vue.d.ts +640 -0
- package/dist/runtime/components/ButtonGroup.vue +35 -51
- package/dist/runtime/components/ButtonGroup.vue.d.ts +116 -0
- package/dist/runtime/components/Calendar.vue +186 -152
- package/dist/runtime/components/Calendar.vue.d.ts +437 -0
- package/dist/runtime/components/Checkbox.vue +84 -73
- package/dist/runtime/components/Checkbox.vue.d.ts +354 -0
- package/dist/runtime/components/Chip.vue +59 -74
- package/dist/runtime/components/Chip.vue.d.ts +271 -0
- package/dist/runtime/components/Collapsible.vue +44 -41
- package/dist/runtime/components/Collapsible.vue.d.ts +118 -0
- package/dist/runtime/components/Container.vue +18 -27
- package/dist/runtime/components/Container.vue.d.ts +27 -0
- package/dist/runtime/components/Countdown.vue +198 -378
- package/dist/runtime/components/Countdown.vue.d.ts +356 -0
- package/dist/runtime/components/DescriptionList.vue +102 -149
- package/dist/runtime/components/DescriptionList.vue.d.ts +379 -0
- package/dist/runtime/components/DropdownMenu.vue +83 -139
- package/dist/runtime/components/DropdownMenu.vue.d.ts +533 -0
- package/dist/runtime/components/DropdownMenuContent.vue +137 -81
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +228 -0
- package/dist/runtime/components/Form.vue +162 -216
- package/dist/runtime/components/Form.vue.d.ts +55 -0
- package/dist/runtime/components/FormField.vue +76 -80
- package/dist/runtime/components/FormField.vue.d.ts +282 -0
- package/dist/runtime/components/Input.vue +166 -185
- package/dist/runtime/components/Input.vue.d.ts +755 -0
- package/dist/runtime/components/InputMenu.vue +300 -381
- package/dist/runtime/components/InputMenu.vue.d.ts +1504 -0
- package/dist/runtime/components/InputNumber.vue +180 -177
- package/dist/runtime/components/InputNumber.vue.d.ts +658 -0
- package/dist/runtime/components/Kbd.vue +33 -45
- package/dist/runtime/components/Kbd.vue.d.ts +109 -0
- package/dist/runtime/components/Link.vue +179 -173
- package/dist/runtime/components/Link.vue.d.ts +129 -0
- package/dist/runtime/components/LinkBase.vue +64 -42
- package/dist/runtime/components/LinkBase.vue.d.ts +48 -0
- package/dist/runtime/components/Modal.vue +105 -127
- package/dist/runtime/components/Modal.vue.d.ts +327 -0
- package/dist/runtime/components/ModalDialogClose.vue +4 -8
- package/dist/runtime/components/ModalDialogClose.vue.d.ts +10 -0
- package/dist/runtime/components/Navbar.vue +24 -33
- package/dist/runtime/components/Navbar.vue.d.ts +101 -0
- package/dist/runtime/components/NavbarDivider.vue +24 -33
- package/dist/runtime/components/NavbarDivider.vue.d.ts +101 -0
- package/dist/runtime/components/NavbarSection.vue +24 -33
- package/dist/runtime/components/NavbarSection.vue.d.ts +101 -0
- package/dist/runtime/components/NavbarSpacer.vue +24 -33
- package/dist/runtime/components/NavbarSpacer.vue.d.ts +101 -0
- package/dist/runtime/components/NavigationMenu.vue +152 -216
- package/dist/runtime/components/NavigationMenu.vue.d.ts +824 -0
- package/dist/runtime/components/OverlayProvider.vue +13 -17
- package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
- package/dist/runtime/components/Popover.vue +81 -81
- package/dist/runtime/components/Popover.vue.d.ts +147 -0
- package/dist/runtime/components/Progress.vue +109 -136
- package/dist/runtime/components/Progress.vue.d.ts +592 -0
- package/dist/runtime/components/RadioGroup.vue +120 -134
- package/dist/runtime/components/RadioGroup.vue.d.ts +723 -0
- package/dist/runtime/components/Range.vue +94 -85
- package/dist/runtime/components/Range.vue.d.ts +417 -0
- package/dist/runtime/components/Select.vue +212 -260
- package/dist/runtime/components/Select.vue.d.ts +1200 -0
- package/dist/runtime/components/SelectMenu.vue +272 -366
- package/dist/runtime/components/SelectMenu.vue.d.ts +1298 -0
- package/dist/runtime/components/Separator.vue +61 -71
- package/dist/runtime/components/Separator.vue.d.ts +400 -0
- package/dist/runtime/components/Sidebar.vue +24 -33
- package/dist/runtime/components/Sidebar.vue.d.ts +101 -0
- package/dist/runtime/components/SidebarBody.vue +30 -38
- package/dist/runtime/components/SidebarBody.vue.d.ts +90 -0
- package/dist/runtime/components/SidebarFooter.vue +24 -33
- package/dist/runtime/components/SidebarFooter.vue.d.ts +101 -0
- package/dist/runtime/components/SidebarHeader.vue +24 -33
- package/dist/runtime/components/SidebarHeader.vue.d.ts +101 -0
- package/dist/runtime/components/SidebarHeading.vue +24 -33
- package/dist/runtime/components/SidebarHeading.vue.d.ts +101 -0
- package/dist/runtime/components/SidebarLayout.vue +40 -70
- package/dist/runtime/components/SidebarLayout.vue.d.ts +222 -0
- package/dist/runtime/components/SidebarSection.vue +24 -33
- package/dist/runtime/components/SidebarSection.vue.d.ts +101 -0
- package/dist/runtime/components/SidebarSpacer.vue +24 -33
- package/dist/runtime/components/SidebarSpacer.vue.d.ts +101 -0
- package/dist/runtime/components/Skeleton.vue +17 -22
- package/dist/runtime/components/Skeleton.vue.d.ts +26 -0
- package/dist/runtime/components/Slideover.vue +108 -131
- package/dist/runtime/components/Slideover.vue.d.ts +360 -0
- package/dist/runtime/components/StackedLayout.vue +40 -73
- package/dist/runtime/components/StackedLayout.vue.d.ts +192 -0
- package/dist/runtime/components/Switch.vue +100 -95
- package/dist/runtime/components/Switch.vue.d.ts +587 -0
- package/dist/runtime/components/Tabs.vue +83 -105
- package/dist/runtime/components/Tabs.vue.d.ts +453 -0
- package/dist/runtime/components/Textarea.vue +215 -203
- package/dist/runtime/components/Textarea.vue.d.ts +601 -0
- package/dist/runtime/components/Toast.vue +94 -105
- package/dist/runtime/components/Toast.vue.d.ts +438 -0
- package/dist/runtime/components/Toaster.vue +94 -111
- package/dist/runtime/components/Toaster.vue.d.ts +219 -0
- package/dist/runtime/components/Tooltip.vue +78 -64
- package/dist/runtime/components/Tooltip.vue.d.ts +186 -0
- package/dist/runtime/components/content/TableWrapper.vue +58 -70
- package/dist/runtime/components/content/TableWrapper.vue.d.ts +237 -0
- package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
- package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
- package/dist/runtime/composables/useComponentIcons.d.ts +3 -3
- package/dist/runtime/composables/useFormField.d.ts +1 -1
- package/dist/runtime/prose/A.vue +18 -23
- package/dist/runtime/prose/A.vue.d.ts +84 -0
- package/dist/runtime/prose/Blockquote.vue +18 -23
- package/dist/runtime/prose/Blockquote.vue.d.ts +84 -0
- package/dist/runtime/prose/Code.vue +23 -31
- package/dist/runtime/prose/Code.vue.d.ts +97 -0
- package/dist/runtime/prose/Em.vue +18 -23
- package/dist/runtime/prose/Em.vue.d.ts +84 -0
- package/dist/runtime/prose/H1.vue +18 -23
- package/dist/runtime/prose/H1.vue.d.ts +97 -0
- package/dist/runtime/prose/H2.vue +18 -23
- package/dist/runtime/prose/H2.vue.d.ts +123 -0
- package/dist/runtime/prose/H3.vue +18 -23
- package/dist/runtime/prose/H3.vue.d.ts +123 -0
- package/dist/runtime/prose/H4.vue +18 -23
- package/dist/runtime/prose/H4.vue.d.ts +123 -0
- package/dist/runtime/prose/H5.vue +18 -23
- package/dist/runtime/prose/H5.vue.d.ts +123 -0
- package/dist/runtime/prose/H6.vue +18 -23
- package/dist/runtime/prose/H6.vue.d.ts +123 -0
- package/dist/runtime/prose/Hr.vue +18 -19
- package/dist/runtime/prose/Hr.vue.d.ts +74 -0
- package/dist/runtime/prose/Img.vue +18 -23
- package/dist/runtime/prose/Img.vue.d.ts +77 -0
- package/dist/runtime/prose/Li.vue +18 -23
- package/dist/runtime/prose/Li.vue.d.ts +84 -0
- package/dist/runtime/prose/Ol.vue +18 -23
- package/dist/runtime/prose/Ol.vue.d.ts +84 -0
- package/dist/runtime/prose/P.vue +18 -23
- package/dist/runtime/prose/P.vue.d.ts +84 -0
- package/dist/runtime/prose/Pre.vue +28 -33
- package/dist/runtime/prose/Pre.vue.d.ts +117 -0
- package/dist/runtime/prose/Strong.vue +18 -23
- package/dist/runtime/prose/Strong.vue.d.ts +84 -0
- package/dist/runtime/prose/Table.vue +44 -54
- package/dist/runtime/prose/Table.vue.d.ts +144 -0
- package/dist/runtime/prose/Tbody.vue +18 -23
- package/dist/runtime/prose/Tbody.vue.d.ts +84 -0
- package/dist/runtime/prose/Td.vue +18 -23
- package/dist/runtime/prose/Td.vue.d.ts +84 -0
- package/dist/runtime/prose/Th.vue +18 -23
- package/dist/runtime/prose/Th.vue.d.ts +84 -0
- package/dist/runtime/prose/Thead.vue +18 -23
- package/dist/runtime/prose/Thead.vue.d.ts +84 -0
- package/dist/runtime/prose/Tr.vue +18 -23
- package/dist/runtime/prose/Tr.vue.d.ts +84 -0
- package/dist/runtime/prose/Ul.vue +18 -23
- package/dist/runtime/prose/Ul.vue.d.ts +84 -0
- package/dist/runtime/vue/components/Link.vue +201 -202
- package/dist/runtime/vue/components/Link.vue.d.ts +129 -0
- package/dist/runtime/vue/stubs.d.ts +2 -2
- package/dist/shared/{b24ui-nuxt.DBFS6LH7.mjs → b24ui-nuxt.CS9Lf0os.mjs} +54 -4
- package/dist/types.d.mts +3 -5
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +62 -35
- package/dist/meta.cjs +0 -71922
- package/dist/meta.d.cts +0 -71920
- package/dist/meta.d.ts +0 -71920
- package/dist/module.cjs +0 -59
- package/dist/module.d.cts +0 -15
- package/dist/module.d.ts +0 -15
- package/dist/shared/b24ui-nuxt.B9fPD5yO.cjs +0 -7671
- package/dist/types.d.ts +0 -7
- package/dist/unplugin.cjs +0 -236
- package/dist/unplugin.d.cts +0 -33
- package/dist/unplugin.d.ts +0 -33
- package/dist/vite.cjs +0 -21
- package/dist/vite.d.cts +0 -14
- package/dist/vite.d.ts +0 -14
|
@@ -1,176 +1,122 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import theme from '#build/b24ui/navigation-menu'
|
|
8
|
-
import { tv } from '../utils/tv'
|
|
9
|
-
import type { AvatarProps, BadgeProps, LinkProps, IconComponent } from '../types'
|
|
10
|
-
import type {
|
|
11
|
-
ArrayOrNested,
|
|
12
|
-
DynamicSlots,
|
|
13
|
-
MergeTypes,
|
|
14
|
-
NestedItem,
|
|
15
|
-
PartialString,
|
|
16
|
-
EmitsToProps
|
|
17
|
-
} from '../types/utils'
|
|
18
|
-
|
|
19
|
-
const appConfigNavigationMenu = _appConfig as AppConfig & { b24ui: { navigationMenu: Partial<typeof theme> } }
|
|
20
|
-
|
|
21
|
-
const navigationMenu = tv({ extend: tv(theme), ...(appConfigNavigationMenu.b24ui?.navigationMenu || {}) })
|
|
22
|
-
|
|
23
|
-
export interface NavigationMenuChildItem extends Omit<NavigationMenuItem, 'type'> {
|
|
24
|
-
/** Description is only used when `orientation` is `horizontal`. */
|
|
25
|
-
description?: string
|
|
26
|
-
[key: string]: any
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface NavigationMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custom'>, Pick<CollapsibleRootProps, 'defaultOpen' | 'open'> {
|
|
30
|
-
label?: string
|
|
31
|
-
/**
|
|
32
|
-
* @IconComponent
|
|
33
|
-
*/
|
|
34
|
-
icon?: IconComponent
|
|
35
|
-
avatar?: AvatarProps
|
|
36
|
-
/**
|
|
37
|
-
* Display a badge on the item.
|
|
38
|
-
* `{ size: 'sm', color: 'neutral', variant: 'outline' }`{lang="ts-type"}
|
|
39
|
-
*/
|
|
40
|
-
badge?: string | number | BadgeProps
|
|
41
|
-
/**
|
|
42
|
-
* @IconComponent
|
|
43
|
-
*/
|
|
44
|
-
trailingIcon?: IconComponent
|
|
45
|
-
/**
|
|
46
|
-
* The type of the item.
|
|
47
|
-
* The `label` type only works on `vertical` orientation.
|
|
48
|
-
* @defaultValue 'link'
|
|
49
|
-
*/
|
|
50
|
-
type?: 'label' | 'link'
|
|
51
|
-
slot?: string
|
|
52
|
-
value?: string
|
|
53
|
-
children?: NavigationMenuChildItem[]
|
|
54
|
-
/**
|
|
55
|
-
* With orientation=`horizontal` if `true` it will position the dropdown menu correctly
|
|
56
|
-
*/
|
|
57
|
-
viewportRtl?: boolean
|
|
58
|
-
onSelect?(e: Event): void
|
|
59
|
-
[key: string]: any
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
type NavigationMenuVariants = VariantProps<typeof navigationMenu>
|
|
63
|
-
|
|
64
|
-
export interface NavigationMenuProps<T extends ArrayOrNested<NavigationMenuItem> = ArrayOrNested<NavigationMenuItem>> extends Pick<NavigationMenuRootProps, 'modelValue' | 'defaultValue' | 'delayDuration' | 'disableClickTrigger' | 'disableHoverTrigger' | 'skipDelayDuration' | 'disablePointerLeaveClose' | 'unmountOnHide'> {
|
|
65
|
-
/**
|
|
66
|
-
* The element or component this component should render as.
|
|
67
|
-
* @defaultValue 'div'
|
|
68
|
-
*/
|
|
69
|
-
as?: any
|
|
70
|
-
/**
|
|
71
|
-
* The icon displayed to open the menu.
|
|
72
|
-
* @defaultValue icons.chevronDown
|
|
73
|
-
* @IconComponent
|
|
74
|
-
*/
|
|
75
|
-
trailingIcon?: IconComponent
|
|
76
|
-
/**
|
|
77
|
-
* The icon displayed when the item is an external link.
|
|
78
|
-
* Set to `false` to hide the external icon.
|
|
79
|
-
* @defaultValue icons.external
|
|
80
|
-
* @IconComponent
|
|
81
|
-
*/
|
|
82
|
-
externalIcon?: boolean | IconComponent
|
|
83
|
-
items?: T
|
|
84
|
-
/**
|
|
85
|
-
* @defaultValue 'primary'
|
|
86
|
-
*/
|
|
87
|
-
color?: NavigationMenuVariants['color']
|
|
88
|
-
/**
|
|
89
|
-
* @defaultValue 'pill'
|
|
90
|
-
*/
|
|
91
|
-
variant?: NavigationMenuVariants['variant']
|
|
92
|
-
/**
|
|
93
|
-
* The orientation of the menu.
|
|
94
|
-
* @defaultValue 'horizontal'
|
|
95
|
-
*/
|
|
96
|
-
orientation?: NavigationMenuRootProps['orientation']
|
|
97
|
-
/**
|
|
98
|
-
* Collapse the navigation menu to only show icons.
|
|
99
|
-
* Only works when `orientation` is `vertical`.
|
|
100
|
-
* @defaultValue false
|
|
101
|
-
*/
|
|
102
|
-
collapsed?: boolean
|
|
103
|
-
/** Display a line next to the active item. */
|
|
104
|
-
highlight?: boolean
|
|
105
|
-
/**
|
|
106
|
-
* @defaultValue 'primary'
|
|
107
|
-
*/
|
|
108
|
-
highlightColor?: NavigationMenuVariants['highlightColor']
|
|
109
|
-
/**
|
|
110
|
-
* The content of the menu.
|
|
111
|
-
*/
|
|
112
|
-
content?: Omit<NavigationMenuContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<NavigationMenuContentEmits>>
|
|
113
|
-
/**
|
|
114
|
-
* The orientation of the content.
|
|
115
|
-
* Only works when `orientation` is `horizontal`.
|
|
116
|
-
* @defaultValue 'vertical'
|
|
117
|
-
*/
|
|
118
|
-
contentOrientation?: NavigationMenuVariants['contentOrientation']
|
|
119
|
-
/**
|
|
120
|
-
* Display an arrow alongside the menu.
|
|
121
|
-
* @defaultValue false
|
|
122
|
-
*/
|
|
123
|
-
arrow?: boolean
|
|
124
|
-
/**
|
|
125
|
-
* The key used to get the label from the item.
|
|
126
|
-
* @defaultValue 'label'
|
|
127
|
-
*/
|
|
128
|
-
labelKey?: keyof NestedItem<T>
|
|
129
|
-
class?: any
|
|
130
|
-
b24ui?: PartialString<typeof navigationMenu.slots>
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export interface NavigationMenuEmits extends NavigationMenuRootEmits {}
|
|
134
|
-
|
|
135
|
-
type SlotProps<T extends NavigationMenuItem> = (props: { item: T, index: number, active?: boolean }) => any
|
|
136
|
-
|
|
137
|
-
export type NavigationMenuSlots<
|
|
138
|
-
A extends ArrayOrNested<NavigationMenuItem> = ArrayOrNested<NavigationMenuItem>,
|
|
139
|
-
T extends NestedItem<A> = NestedItem<A>
|
|
140
|
-
> = {
|
|
141
|
-
'item': SlotProps<T>
|
|
142
|
-
'item-leading': SlotProps<T>
|
|
143
|
-
'item-label': SlotProps<T>
|
|
144
|
-
'item-trailing': SlotProps<T>
|
|
145
|
-
'item-content': SlotProps<T>
|
|
146
|
-
} & DynamicSlots<MergeTypes<T>, 'leading' | 'label' | 'trailing' | 'content', { index: number, active?: boolean }>
|
|
147
|
-
|
|
1
|
+
<script>
|
|
2
|
+
import _appConfig from "#build/app.config";
|
|
3
|
+
import theme from "#build/b24ui/navigation-menu";
|
|
4
|
+
import { tv } from "../utils/tv";
|
|
5
|
+
const appConfigNavigationMenu = _appConfig;
|
|
6
|
+
const navigationMenu = tv({ extend: tv(theme), ...appConfigNavigationMenu.b24ui?.navigationMenu || {} });
|
|
148
7
|
</script>
|
|
149
8
|
|
|
150
|
-
<script setup
|
|
151
|
-
import { computed, toRef } from
|
|
152
|
-
import {
|
|
153
|
-
import { createReusableTemplate } from
|
|
154
|
-
import {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
9
|
+
<script setup>
|
|
10
|
+
import { computed, toRef } from "vue";
|
|
11
|
+
import { useForwardPropsEmits } from "reka-ui";
|
|
12
|
+
import { createReusableTemplate } from "@vueuse/core";
|
|
13
|
+
import { isArrayOfArray } from "../utils";
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
as: {
|
|
16
|
+
type: null,
|
|
17
|
+
required: false
|
|
18
|
+
},
|
|
19
|
+
trailingIcon: {
|
|
20
|
+
type: [Function, Object],
|
|
21
|
+
required: false
|
|
22
|
+
},
|
|
23
|
+
externalIcon: {
|
|
24
|
+
type: [Boolean, Function, Object],
|
|
25
|
+
required: false,
|
|
26
|
+
default: true
|
|
27
|
+
},
|
|
28
|
+
items: {
|
|
29
|
+
type: null,
|
|
30
|
+
required: false
|
|
31
|
+
},
|
|
32
|
+
color: {
|
|
33
|
+
type: null,
|
|
34
|
+
required: false
|
|
35
|
+
},
|
|
36
|
+
variant: {
|
|
37
|
+
type: null,
|
|
38
|
+
required: false
|
|
39
|
+
},
|
|
40
|
+
orientation: {
|
|
41
|
+
type: null,
|
|
42
|
+
required: false,
|
|
43
|
+
default: "horizontal"
|
|
44
|
+
},
|
|
45
|
+
collapsed: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
required: false
|
|
48
|
+
},
|
|
49
|
+
highlight: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
required: false
|
|
52
|
+
},
|
|
53
|
+
highlightColor: {
|
|
54
|
+
type: null,
|
|
55
|
+
required: false
|
|
56
|
+
},
|
|
57
|
+
content: {
|
|
58
|
+
type: Object,
|
|
59
|
+
required: false
|
|
60
|
+
},
|
|
61
|
+
contentOrientation: {
|
|
62
|
+
type: null,
|
|
63
|
+
required: false,
|
|
64
|
+
default: "vertical"
|
|
65
|
+
},
|
|
66
|
+
arrow: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
required: false
|
|
69
|
+
},
|
|
70
|
+
labelKey: {
|
|
71
|
+
type: null,
|
|
72
|
+
required: false,
|
|
73
|
+
default: "label"
|
|
74
|
+
},
|
|
75
|
+
class: {
|
|
76
|
+
type: null,
|
|
77
|
+
required: false
|
|
78
|
+
},
|
|
79
|
+
b24ui: {
|
|
80
|
+
type: null,
|
|
81
|
+
required: false
|
|
82
|
+
},
|
|
83
|
+
modelValue: {
|
|
84
|
+
type: String,
|
|
85
|
+
required: false
|
|
86
|
+
},
|
|
87
|
+
defaultValue: {
|
|
88
|
+
type: String,
|
|
89
|
+
required: false
|
|
90
|
+
},
|
|
91
|
+
delayDuration: {
|
|
92
|
+
type: Number,
|
|
93
|
+
required: false,
|
|
94
|
+
default: 0
|
|
95
|
+
},
|
|
96
|
+
disableClickTrigger: {
|
|
97
|
+
type: Boolean,
|
|
98
|
+
required: false
|
|
99
|
+
},
|
|
100
|
+
disableHoverTrigger: {
|
|
101
|
+
type: Boolean,
|
|
102
|
+
required: false
|
|
103
|
+
},
|
|
104
|
+
skipDelayDuration: {
|
|
105
|
+
type: Number,
|
|
106
|
+
required: false
|
|
107
|
+
},
|
|
108
|
+
disablePointerLeaveClose: {
|
|
109
|
+
type: Boolean,
|
|
110
|
+
required: false
|
|
111
|
+
},
|
|
112
|
+
unmountOnHide: {
|
|
113
|
+
type: Boolean,
|
|
114
|
+
required: false,
|
|
115
|
+
default: true
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
const emits = defineEmits(["update:modelValue"]);
|
|
119
|
+
const slots = defineSlots();
|
|
174
120
|
const rootProps = useForwardPropsEmits(computed(() => ({
|
|
175
121
|
as: props.as,
|
|
176
122
|
modelValue: props.modelValue,
|
|
@@ -182,25 +128,20 @@ const rootProps = useForwardPropsEmits(computed(() => ({
|
|
|
182
128
|
disableHoverTrigger: props.disableHoverTrigger,
|
|
183
129
|
disablePointerLeaveClose: props.disablePointerLeaveClose,
|
|
184
130
|
unmountOnHide: props.unmountOnHide
|
|
185
|
-
})), emits)
|
|
186
|
-
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
const [DefineLinkTemplate, ReuseLinkTemplate] = createReusableTemplate<
|
|
190
|
-
{ item: NavigationMenuItem, index: number, active?: boolean },
|
|
191
|
-
NavigationMenuSlots<T>
|
|
192
|
-
>()
|
|
193
|
-
const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate<
|
|
194
|
-
{ item: NavigationMenuItem, index: number, level?: number },
|
|
195
|
-
NavigationMenuSlots<T>
|
|
196
|
-
>({
|
|
131
|
+
})), emits);
|
|
132
|
+
const contentProps = toRef(() => props.content);
|
|
133
|
+
const [DefineLinkTemplate, ReuseLinkTemplate] = createReusableTemplate();
|
|
134
|
+
const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate({
|
|
197
135
|
props: {
|
|
198
136
|
item: Object,
|
|
199
137
|
index: Number,
|
|
200
|
-
|
|
138
|
+
// @memo problem compile
|
|
139
|
+
level: {
|
|
140
|
+
type: Number,
|
|
141
|
+
default: 0
|
|
142
|
+
}
|
|
201
143
|
}
|
|
202
|
-
})
|
|
203
|
-
|
|
144
|
+
});
|
|
204
145
|
const b24ui = computed(() => navigationMenu({
|
|
205
146
|
orientation: props.orientation,
|
|
206
147
|
contentOrientation: props.contentOrientation,
|
|
@@ -209,36 +150,31 @@ const b24ui = computed(() => navigationMenu({
|
|
|
209
150
|
variant: props.variant,
|
|
210
151
|
highlight: props.highlight,
|
|
211
152
|
highlightColor: props.highlightColor || props.color
|
|
212
|
-
}))
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
? isArrayOfArray(props.items)
|
|
217
|
-
? props.items
|
|
218
|
-
: [props.items]
|
|
219
|
-
: []
|
|
220
|
-
)
|
|
153
|
+
}));
|
|
154
|
+
const lists = computed(
|
|
155
|
+
() => props.items?.length ? isArrayOfArray(props.items) ? props.items : [props.items] : []
|
|
156
|
+
);
|
|
221
157
|
</script>
|
|
222
158
|
|
|
223
159
|
<template>
|
|
224
160
|
<DefineLinkTemplate v-slot="{ item, active, index }">
|
|
225
|
-
<slot :name="
|
|
161
|
+
<slot :name="item.slot || 'item'" :item="item" :index="index">
|
|
226
162
|
<span :class="b24ui.linkLabelWrapper({ class: props.b24ui?.linkLabelWrapper, active })">
|
|
227
|
-
<slot :name="
|
|
163
|
+
<slot :name="item.slot ? `${item.slot}-leading` : 'item-leading'" :item="item" :active="active" :index="index">
|
|
228
164
|
<Component
|
|
229
165
|
:is="item.icon"
|
|
230
166
|
v-if="item.icon"
|
|
231
167
|
:class="b24ui.linkLeadingIcon({ class: props.b24ui?.linkLeadingIcon, active, disabled: !!item.disabled })"
|
|
232
168
|
/>
|
|
233
|
-
<B24Avatar v-else-if="item.avatar" :size="
|
|
169
|
+
<B24Avatar v-else-if="item.avatar" :size="props.b24ui?.linkLeadingAvatarSize || b24ui.linkLeadingAvatarSize()" v-bind="item.avatar" :class="b24ui.linkLeadingAvatar({ class: props.b24ui?.linkLeadingAvatar, active, disabled: !!item.disabled })" />
|
|
234
170
|
</slot>
|
|
235
171
|
|
|
236
172
|
<span
|
|
237
|
-
v-if="(!collapsed || orientation !== 'vertical') && (get(item, props.labelKey
|
|
173
|
+
v-if="(!collapsed || orientation !== 'vertical') && (get(item, props.labelKey) || !!slots[item.slot ? `${item.slot}-label` : 'item-label'])"
|
|
238
174
|
:class="b24ui.linkLabel({ class: props.b24ui?.linkLabel, active })"
|
|
239
175
|
>
|
|
240
|
-
<slot :name="
|
|
241
|
-
{{ get(item, props.labelKey
|
|
176
|
+
<slot :name="item.slot ? `${item.slot}-label` : 'item-label'" :item="item" :active="active" :index="index">
|
|
177
|
+
{{ get(item, props.labelKey) }}
|
|
242
178
|
</slot>
|
|
243
179
|
|
|
244
180
|
<Component
|
|
@@ -248,11 +184,11 @@ const lists = computed<NavigationMenuItem[][]>(() =>
|
|
|
248
184
|
/>
|
|
249
185
|
</span>
|
|
250
186
|
</span>
|
|
251
|
-
<span v-if="(!collapsed || orientation !== 'vertical') && (item.badge ||
|
|
252
|
-
<slot :name="
|
|
187
|
+
<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="b24ui.linkTrailing({ class: props.b24ui?.linkTrailing })">
|
|
188
|
+
<slot :name="item.slot ? `${item.slot}-trailing` : 'item-trailing'" :item="item" :active="active" :index="index">
|
|
253
189
|
<Component
|
|
254
190
|
:is="item.trailingIcon || trailingIcon || icons.chevronDown"
|
|
255
|
-
v-if="
|
|
191
|
+
v-if="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content']) || orientation === 'vertical' && item.children?.length"
|
|
256
192
|
:class="b24ui.linkTrailingIcon({ class: props.b24ui?.linkTrailingIcon, active })"
|
|
257
193
|
/>
|
|
258
194
|
<Component
|
|
@@ -266,8 +202,8 @@ const lists = computed<NavigationMenuItem[][]>(() =>
|
|
|
266
202
|
color="danger"
|
|
267
203
|
depth="dark"
|
|
268
204
|
:use-fill="true"
|
|
269
|
-
:size="
|
|
270
|
-
v-bind="
|
|
205
|
+
:size="props.b24ui?.linkTrailingBadgeSize || b24ui.linkTrailingBadgeSize()"
|
|
206
|
+
v-bind="typeof item.badge === 'string' || typeof item.badge === 'number' ? { label: item.badge } : item.badge"
|
|
271
207
|
:class="b24ui.linkTrailingBadge({ class: props.b24ui?.linkTrailingBadge })"
|
|
272
208
|
/>
|
|
273
209
|
</slot>
|
|
@@ -275,38 +211,38 @@ const lists = computed<NavigationMenuItem[][]>(() =>
|
|
|
275
211
|
</slot>
|
|
276
212
|
</DefineLinkTemplate>
|
|
277
213
|
|
|
278
|
-
<DefineItemTemplate v-slot="{ item, index, level
|
|
214
|
+
<DefineItemTemplate v-slot="{ item, index, level }">
|
|
279
215
|
<component
|
|
280
|
-
:is="
|
|
216
|
+
:is="orientation === 'vertical' && item.children?.length && !collapsed ? B24Collapsible : NavigationMenuItem"
|
|
281
217
|
as="li"
|
|
282
218
|
:value="item.value || String(index)"
|
|
283
219
|
:default-open="item.defaultOpen"
|
|
284
|
-
:unmount-on-hide="
|
|
220
|
+
:unmount-on-hide="orientation === 'vertical' && item.children?.length && !collapsed ? unmountOnHide : void 0"
|
|
285
221
|
:open="item.open"
|
|
286
222
|
>
|
|
287
223
|
<div v-if="orientation === 'vertical' && item.type === 'label'" :class="b24ui.label({ class: props.b24ui?.label })">
|
|
288
224
|
<ReuseLinkTemplate :item="item" :index="index" />
|
|
289
225
|
</div>
|
|
290
|
-
<B24Link v-else-if="item.type !== 'label'" v-slot="{ active, ...slotProps }" v-bind="
|
|
226
|
+
<B24Link v-else-if="item.type !== 'label'" v-slot="{ active, ...slotProps }" v-bind="orientation === 'vertical' && item.children?.length && !collapsed ? {} : pickLinkProps(item)" custom>
|
|
291
227
|
<component
|
|
292
|
-
:is="
|
|
228
|
+
:is="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content']) ? NavigationMenuTrigger : NavigationMenuLink"
|
|
293
229
|
as-child
|
|
294
230
|
:active="active || item.active"
|
|
295
231
|
:disabled="item.disabled"
|
|
296
232
|
@select="item.onSelect"
|
|
297
233
|
>
|
|
298
|
-
<B24LinkBase v-bind="slotProps" :class="b24ui.link({ class: [props.b24ui?.link, item.class], active: active || item.active, disabled: !!item.disabled, level: orientation === 'horizontal' || level > 0 })">
|
|
234
|
+
<B24LinkBase v-bind="slotProps" :class="b24ui.link({ class: [props.b24ui?.link, item.class], active: active || item.active, disabled: !!item.disabled, level: orientation === 'horizontal' || (level || 0) > 0 })">
|
|
299
235
|
<ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" />
|
|
300
236
|
</B24LinkBase>
|
|
301
237
|
</component>
|
|
302
238
|
|
|
303
239
|
<NavigationMenuContent
|
|
304
|
-
v-if="orientation === 'horizontal' && (item.children?.length || !!slots[
|
|
240
|
+
v-if="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content'])"
|
|
305
241
|
v-bind="contentProps"
|
|
306
242
|
:data-viewport="item.viewportRtl ? 'rtl' : 'ltr'"
|
|
307
243
|
:class="b24ui.content({ class: props.b24ui?.content })"
|
|
308
244
|
>
|
|
309
|
-
<slot :name="
|
|
245
|
+
<slot :name="item.slot ? `${item.slot}-content` : 'item-content'" :item="item" :active="active" :index="index">
|
|
310
246
|
<ul :class="b24ui.childList({ class: props.b24ui?.childList })">
|
|
311
247
|
<li v-for="(childItem, childIndex) in item.children" :key="childIndex" :class="b24ui.childItem({ class: props.b24ui?.childItem })">
|
|
312
248
|
<B24Link v-slot="{ active: childActive, ...childSlotProps }" v-bind="pickLinkProps(childItem)" custom>
|
|
@@ -320,7 +256,7 @@ const lists = computed<NavigationMenuItem[][]>(() =>
|
|
|
320
256
|
|
|
321
257
|
<div :class="b24ui.childLinkWrapper({ class: props.b24ui?.childLinkWrapper })">
|
|
322
258
|
<p :class="b24ui.childLinkLabel({ class: props.b24ui?.childLinkLabel, active: childActive })">
|
|
323
|
-
{{ get(childItem, props.labelKey
|
|
259
|
+
{{ get(childItem, props.labelKey) }}
|
|
324
260
|
|
|
325
261
|
<Component
|
|
326
262
|
:is="typeof externalIcon === 'string' ? externalIcon : icons.external"
|
|
@@ -348,7 +284,7 @@ const lists = computed<NavigationMenuItem[][]>(() =>
|
|
|
348
284
|
:key="childIndex"
|
|
349
285
|
:item="childItem"
|
|
350
286
|
:index="childIndex"
|
|
351
|
-
:level="level + 1"
|
|
287
|
+
:level="(level || 0) + 1"
|
|
352
288
|
:class="b24ui.childItem({ class: props.b24ui?.childItem })"
|
|
353
289
|
/>
|
|
354
290
|
</ul>
|