@bitrix24/b24ui-nuxt 0.5.11 → 0.6.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.
Files changed (199) hide show
  1. package/.nuxt/b24ui/input-menu.ts +2 -2
  2. package/.nuxt/b24ui/select-menu.ts +4 -4
  3. package/.nuxt/b24ui/select.ts +2 -2
  4. package/dist/meta.d.mts +5208 -5061
  5. package/dist/meta.mjs +5208 -5061
  6. package/dist/module.json +3 -3
  7. package/dist/module.mjs +2 -2
  8. package/dist/runtime/components/Advice.vue +27 -54
  9. package/dist/runtime/components/Advice.vue.d.ts +170 -0
  10. package/dist/runtime/components/Alert.vue +35 -96
  11. package/dist/runtime/components/Alert.vue.d.ts +464 -0
  12. package/dist/runtime/components/App.vue +24 -34
  13. package/dist/runtime/components/App.vue.d.ts +23 -0
  14. package/dist/runtime/components/Avatar.vue +43 -81
  15. package/dist/runtime/components/Avatar.vue.d.ts +281 -0
  16. package/dist/runtime/components/AvatarGroup.vue +40 -76
  17. package/dist/runtime/components/AvatarGroup.vue.d.ts +204 -0
  18. package/dist/runtime/components/Badge.vue +40 -83
  19. package/dist/runtime/components/Badge.vue.d.ts +517 -0
  20. package/dist/runtime/components/Button.vue +96 -155
  21. package/dist/runtime/components/Button.vue.d.ts +640 -0
  22. package/dist/runtime/components/ButtonGroup.vue +19 -51
  23. package/dist/runtime/components/ButtonGroup.vue.d.ts +116 -0
  24. package/dist/runtime/components/Calendar.vue +73 -152
  25. package/dist/runtime/components/Calendar.vue.d.ts +437 -0
  26. package/dist/runtime/components/Checkbox.vue +42 -73
  27. package/dist/runtime/components/Checkbox.vue.d.ts +354 -0
  28. package/dist/runtime/components/Chip.vue +26 -74
  29. package/dist/runtime/components/Chip.vue.d.ts +271 -0
  30. package/dist/runtime/components/Collapsible.vue +22 -41
  31. package/dist/runtime/components/Collapsible.vue.d.ts +118 -0
  32. package/dist/runtime/components/Container.vue +13 -27
  33. package/dist/runtime/components/Container.vue.d.ts +27 -0
  34. package/dist/runtime/components/Countdown.vue +153 -378
  35. package/dist/runtime/components/Countdown.vue.d.ts +356 -0
  36. package/dist/runtime/components/DescriptionList.vue +78 -149
  37. package/dist/runtime/components/DescriptionList.vue.d.ts +379 -0
  38. package/dist/runtime/components/DropdownMenu.vue +38 -139
  39. package/dist/runtime/components/DropdownMenu.vue.d.ts +533 -0
  40. package/dist/runtime/components/DropdownMenuContent.vue +68 -80
  41. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +228 -0
  42. package/dist/runtime/components/Form.vue +130 -217
  43. package/dist/runtime/components/Form.vue.d.ts +55 -0
  44. package/dist/runtime/components/FormField.vue +36 -80
  45. package/dist/runtime/components/FormField.vue.d.ts +282 -0
  46. package/dist/runtime/components/Input.vue +79 -179
  47. package/dist/runtime/components/Input.vue.d.ts +755 -0
  48. package/dist/runtime/components/InputMenu.vue +185 -381
  49. package/dist/runtime/components/InputMenu.vue.d.ts +1523 -0
  50. package/dist/runtime/components/InputNumber.vue +77 -175
  51. package/dist/runtime/components/InputNumber.vue.d.ts +658 -0
  52. package/dist/runtime/components/Kbd.vue +18 -45
  53. package/dist/runtime/components/Kbd.vue.d.ts +109 -0
  54. package/dist/runtime/components/Link.vue +92 -173
  55. package/dist/runtime/components/Link.vue.d.ts +129 -0
  56. package/dist/runtime/components/LinkBase.vue +33 -42
  57. package/dist/runtime/components/LinkBase.vue.d.ts +48 -0
  58. package/dist/runtime/components/Modal.vue +48 -127
  59. package/dist/runtime/components/Modal.vue.d.ts +327 -0
  60. package/dist/runtime/components/ModalDialogClose.vue +5 -8
  61. package/dist/runtime/components/ModalDialogClose.vue.d.ts +10 -0
  62. package/dist/runtime/components/Navbar.vue +15 -33
  63. package/dist/runtime/components/Navbar.vue.d.ts +101 -0
  64. package/dist/runtime/components/NavbarDivider.vue +15 -33
  65. package/dist/runtime/components/NavbarDivider.vue.d.ts +101 -0
  66. package/dist/runtime/components/NavbarSection.vue +15 -33
  67. package/dist/runtime/components/NavbarSection.vue.d.ts +101 -0
  68. package/dist/runtime/components/NavbarSpacer.vue +15 -33
  69. package/dist/runtime/components/NavbarSpacer.vue.d.ts +101 -0
  70. package/dist/runtime/components/NavigationMenu.vue +74 -208
  71. package/dist/runtime/components/NavigationMenu.vue.d.ts +824 -0
  72. package/dist/runtime/components/OverlayProvider.vue +14 -18
  73. package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
  74. package/dist/runtime/components/Popover.vue +40 -81
  75. package/dist/runtime/components/Popover.vue.d.ts +147 -0
  76. package/dist/runtime/components/Progress.vue +70 -136
  77. package/dist/runtime/components/Progress.vue.d.ts +592 -0
  78. package/dist/runtime/components/RadioGroup.vue +59 -134
  79. package/dist/runtime/components/RadioGroup.vue.d.ts +723 -0
  80. package/dist/runtime/components/Range.vue +46 -85
  81. package/dist/runtime/components/Range.vue.d.ts +417 -0
  82. package/dist/runtime/components/Select.vue +110 -260
  83. package/dist/runtime/components/Select.vue.d.ts +1201 -0
  84. package/dist/runtime/components/SelectMenu.vue +161 -347
  85. package/dist/runtime/components/SelectMenu.vue.d.ts +1298 -0
  86. package/dist/runtime/components/Separator.vue +28 -71
  87. package/dist/runtime/components/Separator.vue.d.ts +400 -0
  88. package/dist/runtime/components/Sidebar.vue +15 -33
  89. package/dist/runtime/components/Sidebar.vue.d.ts +101 -0
  90. package/dist/runtime/components/SidebarBody.vue +17 -38
  91. package/dist/runtime/components/SidebarBody.vue.d.ts +90 -0
  92. package/dist/runtime/components/SidebarFooter.vue +15 -33
  93. package/dist/runtime/components/SidebarFooter.vue.d.ts +101 -0
  94. package/dist/runtime/components/SidebarHeader.vue +15 -33
  95. package/dist/runtime/components/SidebarHeader.vue.d.ts +101 -0
  96. package/dist/runtime/components/SidebarHeading.vue +15 -33
  97. package/dist/runtime/components/SidebarHeading.vue.d.ts +101 -0
  98. package/dist/runtime/components/SidebarLayout.vue +34 -70
  99. package/dist/runtime/components/SidebarLayout.vue.d.ts +222 -0
  100. package/dist/runtime/components/SidebarSection.vue +15 -33
  101. package/dist/runtime/components/SidebarSection.vue.d.ts +101 -0
  102. package/dist/runtime/components/SidebarSpacer.vue +15 -33
  103. package/dist/runtime/components/SidebarSpacer.vue.d.ts +101 -0
  104. package/dist/runtime/components/Skeleton.vue +12 -22
  105. package/dist/runtime/components/Skeleton.vue.d.ts +26 -0
  106. package/dist/runtime/components/Slideover.vue +50 -131
  107. package/dist/runtime/components/Slideover.vue.d.ts +360 -0
  108. package/dist/runtime/components/StackedLayout.vue +34 -73
  109. package/dist/runtime/components/StackedLayout.vue.d.ts +192 -0
  110. package/dist/runtime/components/Switch.vue +46 -95
  111. package/dist/runtime/components/Switch.vue.d.ts +587 -0
  112. package/dist/runtime/components/Tabs.vue +37 -105
  113. package/dist/runtime/components/Tabs.vue.d.ts +453 -0
  114. package/dist/runtime/components/Textarea.vue +92 -201
  115. package/dist/runtime/components/Textarea.vue.d.ts +601 -0
  116. package/dist/runtime/components/Toast.vue +47 -105
  117. package/dist/runtime/components/Toast.vue.d.ts +438 -0
  118. package/dist/runtime/components/Toaster.vue +70 -115
  119. package/dist/runtime/components/Toaster.vue.d.ts +219 -0
  120. package/dist/runtime/components/Tooltip.vue +36 -64
  121. package/dist/runtime/components/Tooltip.vue.d.ts +186 -0
  122. package/dist/runtime/components/content/TableWrapper.vue +24 -70
  123. package/dist/runtime/components/content/TableWrapper.vue.d.ts +237 -0
  124. package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
  125. package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
  126. package/dist/runtime/composables/useComponentIcons.d.ts +3 -3
  127. package/dist/runtime/composables/useFormField.d.ts +2 -2
  128. package/dist/runtime/composables/useOverlay.d.ts +14 -7
  129. package/dist/runtime/composables/useOverlay.js +14 -6
  130. package/dist/runtime/prose/A.vue +12 -23
  131. package/dist/runtime/prose/A.vue.d.ts +84 -0
  132. package/dist/runtime/prose/Blockquote.vue +12 -23
  133. package/dist/runtime/prose/Blockquote.vue.d.ts +84 -0
  134. package/dist/runtime/prose/Code.vue +14 -31
  135. package/dist/runtime/prose/Code.vue.d.ts +97 -0
  136. package/dist/runtime/prose/Em.vue +12 -23
  137. package/dist/runtime/prose/Em.vue.d.ts +84 -0
  138. package/dist/runtime/prose/H1.vue +12 -23
  139. package/dist/runtime/prose/H1.vue.d.ts +97 -0
  140. package/dist/runtime/prose/H2.vue +12 -23
  141. package/dist/runtime/prose/H2.vue.d.ts +123 -0
  142. package/dist/runtime/prose/H3.vue +12 -23
  143. package/dist/runtime/prose/H3.vue.d.ts +123 -0
  144. package/dist/runtime/prose/H4.vue +12 -23
  145. package/dist/runtime/prose/H4.vue.d.ts +123 -0
  146. package/dist/runtime/prose/H5.vue +12 -23
  147. package/dist/runtime/prose/H5.vue.d.ts +123 -0
  148. package/dist/runtime/prose/H6.vue +12 -23
  149. package/dist/runtime/prose/H6.vue.d.ts +123 -0
  150. package/dist/runtime/prose/Hr.vue +12 -19
  151. package/dist/runtime/prose/Hr.vue.d.ts +74 -0
  152. package/dist/runtime/prose/Img.vue +12 -23
  153. package/dist/runtime/prose/Img.vue.d.ts +77 -0
  154. package/dist/runtime/prose/Li.vue +12 -23
  155. package/dist/runtime/prose/Li.vue.d.ts +84 -0
  156. package/dist/runtime/prose/Ol.vue +12 -23
  157. package/dist/runtime/prose/Ol.vue.d.ts +84 -0
  158. package/dist/runtime/prose/P.vue +12 -23
  159. package/dist/runtime/prose/P.vue.d.ts +84 -0
  160. package/dist/runtime/prose/Pre.vue +16 -33
  161. package/dist/runtime/prose/Pre.vue.d.ts +117 -0
  162. package/dist/runtime/prose/Strong.vue +12 -23
  163. package/dist/runtime/prose/Strong.vue.d.ts +84 -0
  164. package/dist/runtime/prose/Table.vue +19 -54
  165. package/dist/runtime/prose/Table.vue.d.ts +144 -0
  166. package/dist/runtime/prose/Tbody.vue +12 -23
  167. package/dist/runtime/prose/Tbody.vue.d.ts +84 -0
  168. package/dist/runtime/prose/Td.vue +12 -23
  169. package/dist/runtime/prose/Td.vue.d.ts +84 -0
  170. package/dist/runtime/prose/Th.vue +12 -23
  171. package/dist/runtime/prose/Th.vue.d.ts +84 -0
  172. package/dist/runtime/prose/Thead.vue +12 -23
  173. package/dist/runtime/prose/Thead.vue.d.ts +84 -0
  174. package/dist/runtime/prose/Tr.vue +12 -23
  175. package/dist/runtime/prose/Tr.vue.d.ts +84 -0
  176. package/dist/runtime/prose/Ul.vue +12 -23
  177. package/dist/runtime/prose/Ul.vue.d.ts +84 -0
  178. package/dist/runtime/utils/link.d.ts +3 -3
  179. package/dist/runtime/vue/components/Link.vue +115 -202
  180. package/dist/runtime/vue/components/Link.vue.d.ts +129 -0
  181. package/dist/shared/{b24ui-nuxt.CS9Lf0os.mjs → b24ui-nuxt.BA6Y2FnC.mjs} +6 -6
  182. package/dist/types.d.mts +3 -5
  183. package/dist/unplugin.mjs +1 -1
  184. package/dist/vite.mjs +1 -1
  185. package/package.json +14 -22
  186. package/dist/meta.cjs +0 -72112
  187. package/dist/meta.d.cts +0 -72110
  188. package/dist/meta.d.ts +0 -72110
  189. package/dist/module.cjs +0 -63
  190. package/dist/module.d.cts +0 -15
  191. package/dist/module.d.ts +0 -15
  192. package/dist/shared/b24ui-nuxt.DrKwIWoc.cjs +0 -7721
  193. package/dist/types.d.ts +0 -7
  194. package/dist/unplugin.cjs +0 -236
  195. package/dist/unplugin.d.cts +0 -33
  196. package/dist/unplugin.d.ts +0 -33
  197. package/dist/vite.cjs +0 -21
  198. package/dist/vite.d.cts +0 -14
  199. package/dist/vite.d.ts +0 -14
@@ -1,176 +1,51 @@
1
- <!-- eslint-disable vue/block-tag-newline -->
2
- <script lang="ts">
3
- import type { VariantProps } from 'tailwind-variants'
4
- import type { NavigationMenuRootProps, NavigationMenuRootEmits, NavigationMenuContentProps, NavigationMenuContentEmits, CollapsibleRootProps } from 'reka-ui'
5
- import type { AppConfig } from '@nuxt/schema'
6
- import _appConfig from '#build/app.config'
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 lang="ts" generic="T extends ArrayOrNested<NavigationMenuItem>">
151
- import { computed, toRef } from 'vue'
152
- import { NavigationMenuRoot, NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink, NavigationMenuIndicator, NavigationMenuViewport, useForwardPropsEmits } from 'reka-ui'
153
- import { createReusableTemplate } from '@vueuse/core'
154
- import { get, isArrayOfArray } from '../utils'
155
- import { pickLinkProps } from '../utils/link'
156
- import icons from '../dictionary/icons'
157
- import B24LinkBase from './LinkBase.vue'
158
- import B24Link from './Link.vue'
159
- import B24Avatar from './Avatar.vue'
160
- import B24Badge from './Badge.vue'
161
- import B24Collapsible from './Collapsible.vue'
162
-
163
- const props = withDefaults(defineProps<NavigationMenuProps<T>>(), {
164
- orientation: 'horizontal',
165
- contentOrientation: 'vertical',
166
- externalIcon: true,
167
- delayDuration: 0,
168
- unmountOnHide: true,
169
- labelKey: 'label'
170
- })
171
- const emits = defineEmits<NavigationMenuEmits>()
172
- const slots = defineSlots<NavigationMenuSlots<T>>()
173
-
9
+ <script setup>
10
+ import { computed, toRef } from "vue";
11
+ import { NavigationMenuRoot, NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink, NavigationMenuIndicator, NavigationMenuViewport, useForwardPropsEmits } from "reka-ui";
12
+ import { createReusableTemplate } from "@vueuse/core";
13
+ import { get, isArrayOfArray } from "../utils";
14
+ import { pickLinkProps } from "../utils/link";
15
+ import icons from "../dictionary/icons";
16
+ import B24LinkBase from "./LinkBase.vue";
17
+ import B24Link from "./Link.vue";
18
+ import B24Avatar from "./Avatar.vue";
19
+ import B24Badge from "./Badge.vue";
20
+ import B24Collapsible from "./Collapsible.vue";
21
+ const props = defineProps({
22
+ as: { type: null, required: false },
23
+ trailingIcon: { type: [Function, Object], required: false },
24
+ externalIcon: { type: [Boolean, Function, Object], required: false, default: true },
25
+ items: { type: null, required: false },
26
+ color: { type: null, required: false },
27
+ variant: { type: null, required: false },
28
+ orientation: { type: null, required: false, default: "horizontal" },
29
+ collapsed: { type: Boolean, required: false },
30
+ highlight: { type: Boolean, required: false },
31
+ highlightColor: { type: null, required: false },
32
+ content: { type: Object, required: false },
33
+ contentOrientation: { type: null, required: false, default: "vertical" },
34
+ arrow: { type: Boolean, required: false },
35
+ labelKey: { type: null, required: false, default: "label" },
36
+ class: { type: null, required: false },
37
+ b24ui: { type: null, required: false },
38
+ modelValue: { type: String, required: false },
39
+ defaultValue: { type: String, required: false },
40
+ delayDuration: { type: Number, required: false, default: 0 },
41
+ disableClickTrigger: { type: Boolean, required: false },
42
+ disableHoverTrigger: { type: Boolean, required: false },
43
+ skipDelayDuration: { type: Number, required: false },
44
+ disablePointerLeaveClose: { type: Boolean, required: false },
45
+ unmountOnHide: { type: Boolean, required: false, default: true }
46
+ });
47
+ const emits = defineEmits(["update:modelValue"]);
48
+ const slots = defineSlots();
174
49
  const rootProps = useForwardPropsEmits(computed(() => ({
175
50
  as: props.as,
176
51
  modelValue: props.modelValue,
@@ -182,12 +57,10 @@ const rootProps = useForwardPropsEmits(computed(() => ({
182
57
  disableHoverTrigger: props.disableHoverTrigger,
183
58
  disablePointerLeaveClose: props.disablePointerLeaveClose,
184
59
  unmountOnHide: props.unmountOnHide
185
- })), emits)
186
-
187
- const contentProps = toRef(() => props.content)
188
-
189
- const [DefineLinkTemplate, ReuseLinkTemplate] = createReusableTemplate<{ item: NavigationMenuItem, index: number, active?: boolean }>()
190
- const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate<{ item: NavigationMenuItem, index: number, level?: number }>({
60
+ })), emits);
61
+ const contentProps = toRef(() => props.content);
62
+ const [DefineLinkTemplate, ReuseLinkTemplate] = createReusableTemplate();
63
+ const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate({
191
64
  props: {
192
65
  item: Object,
193
66
  index: Number,
@@ -197,12 +70,10 @@ const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate<{ item: N
197
70
  default: 0
198
71
  }
199
72
  }
200
- })
201
-
202
- const getLabel = (item: NavigationMenuItem) => {
203
- return get(item, props.labelKey as string)
204
- }
205
-
73
+ });
74
+ const getLabel = (item) => {
75
+ return get(item, props.labelKey);
76
+ };
206
77
  const b24ui = computed(() => navigationMenu({
207
78
  orientation: props.orientation,
208
79
  contentOrientation: props.contentOrientation,
@@ -211,35 +82,30 @@ const b24ui = computed(() => navigationMenu({
211
82
  variant: props.variant,
212
83
  highlight: props.highlight,
213
84
  highlightColor: props.highlightColor || props.color
214
- }))
215
-
216
- const lists = computed<NavigationMenuItem[][]>(() =>
217
- props.items?.length
218
- ? isArrayOfArray(props.items)
219
- ? props.items
220
- : [props.items]
221
- : []
222
- )
85
+ }));
86
+ const lists = computed(
87
+ () => props.items?.length ? isArrayOfArray(props.items) ? props.items : [props.items] : []
88
+ );
223
89
  </script>
224
90
 
225
91
  <template>
226
92
  <DefineLinkTemplate v-slot="{ item, active, index }">
227
- <slot :name="((item.slot || 'item') as keyof NavigationMenuSlots<T>)" :item="item" :index="index">
93
+ <slot :name="item.slot || 'item'" :item="item" :index="index">
228
94
  <span :class="b24ui.linkLabelWrapper({ class: props.b24ui?.linkLabelWrapper, active })">
229
- <slot :name="((item.slot ? `${item.slot}-leading` : 'item-leading') as keyof NavigationMenuSlots<T>)" :item="item" :active="active" :index="index">
95
+ <slot :name="item.slot ? `${item.slot}-leading` : 'item-leading'" :item="item" :active="active" :index="index">
230
96
  <Component
231
97
  :is="item.icon"
232
98
  v-if="item.icon"
233
99
  :class="b24ui.linkLeadingIcon({ class: props.b24ui?.linkLeadingIcon, active, disabled: !!item.disabled })"
234
100
  />
235
- <B24Avatar v-else-if="item.avatar" :size="((props.b24ui?.linkLeadingAvatarSize || b24ui.linkLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="b24ui.linkLeadingAvatar({ class: props.b24ui?.linkLeadingAvatar, active, disabled: !!item.disabled })" />
101
+ <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 })" />
236
102
  </slot>
237
103
 
238
104
  <span
239
- v-if="(!collapsed || orientation !== 'vertical') && (getLabel(item) || !!slots[(item.slot ? `${item.slot}-label` : 'item-label') as keyof NavigationMenuSlots<T>])"
105
+ v-if="(!collapsed || orientation !== 'vertical') && (getLabel(item) || !!slots[item.slot ? `${item.slot}-label` : 'item-label'])"
240
106
  :class="b24ui.linkLabel({ class: props.b24ui?.linkLabel, active })"
241
107
  >
242
- <slot :name="((item.slot ? `${item.slot}-label` : 'item-label') as keyof NavigationMenuSlots<T>)" :item="item" :active="active" :index="index">
108
+ <slot :name="item.slot ? `${item.slot}-label` : 'item-label'" :item="item" :active="active" :index="index">
243
109
  {{ getLabel(item) }}
244
110
  </slot>
245
111
 
@@ -250,11 +116,11 @@ const lists = computed<NavigationMenuItem[][]>(() =>
250
116
  />
251
117
  </span>
252
118
  </span>
253
- <span v-if="(!collapsed || orientation !== 'vertical') && (item.badge || (orientation === 'horizontal' && (item.children?.length || !!slots[(item.slot ? `${item.slot}-content` : 'item-content') as keyof NavigationMenuSlots<T>])) || (orientation === 'vertical' && item.children?.length) || item.trailingIcon || !!slots[(item.slot ? `${item.slot}-trailing` : 'item-trailing') as keyof NavigationMenuSlots<T>])" :class="b24ui.linkTrailing({ class: props.b24ui?.linkTrailing })">
254
- <slot :name="((item.slot ? `${item.slot}-trailing` : 'item-trailing') as keyof NavigationMenuSlots<T>)" :item="item" :active="active" :index="index">
119
+ <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 })">
120
+ <slot :name="item.slot ? `${item.slot}-trailing` : 'item-trailing'" :item="item" :active="active" :index="index">
255
121
  <Component
256
122
  :is="item.trailingIcon || trailingIcon || icons.chevronDown"
257
- v-if="(orientation === 'horizontal' && (item.children?.length || !!slots[(item.slot ? `${item.slot}-content` : 'item-content') as keyof NavigationMenuSlots<T>])) || (orientation === 'vertical' && item.children?.length)"
123
+ v-if="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content']) || orientation === 'vertical' && item.children?.length"
258
124
  :class="b24ui.linkTrailingIcon({ class: props.b24ui?.linkTrailingIcon, active })"
259
125
  />
260
126
  <Component
@@ -268,8 +134,8 @@ const lists = computed<NavigationMenuItem[][]>(() =>
268
134
  color="danger"
269
135
  depth="dark"
270
136
  :use-fill="true"
271
- :size="((props.b24ui?.linkTrailingBadgeSize || b24ui.linkTrailingBadgeSize()) as BadgeProps['size'])"
272
- v-bind="(typeof item.badge === 'string' || typeof item.badge === 'number') ? { label: item.badge } : item.badge"
137
+ :size="props.b24ui?.linkTrailingBadgeSize || b24ui.linkTrailingBadgeSize()"
138
+ v-bind="typeof item.badge === 'string' || typeof item.badge === 'number' ? { label: item.badge } : item.badge"
273
139
  :class="b24ui.linkTrailingBadge({ class: props.b24ui?.linkTrailingBadge })"
274
140
  />
275
141
  </slot>
@@ -279,19 +145,19 @@ const lists = computed<NavigationMenuItem[][]>(() =>
279
145
 
280
146
  <DefineItemTemplate v-slot="{ item, index, level }">
281
147
  <component
282
- :is="(orientation === 'vertical' && item.children?.length && !collapsed) ? B24Collapsible : NavigationMenuItem"
148
+ :is="orientation === 'vertical' && item.children?.length && !collapsed ? B24Collapsible : NavigationMenuItem"
283
149
  as="li"
284
150
  :value="item.value || String(index)"
285
151
  :default-open="item.defaultOpen"
286
- :unmount-on-hide="(orientation === 'vertical' && item.children?.length && !collapsed) ? unmountOnHide : undefined"
152
+ :unmount-on-hide="orientation === 'vertical' && item.children?.length && !collapsed ? unmountOnHide : void 0"
287
153
  :open="item.open"
288
154
  >
289
155
  <div v-if="orientation === 'vertical' && item.type === 'label'" :class="b24ui.label({ class: props.b24ui?.label })">
290
156
  <ReuseLinkTemplate :item="item" :index="index" />
291
157
  </div>
292
- <B24Link v-else-if="item.type !== 'label'" v-slot="{ active, ...slotProps }" v-bind="(orientation === 'vertical' && item.children?.length && !collapsed) ? {} : pickLinkProps(item as Omit<NavigationMenuItem, 'type'>)" custom>
158
+ <B24Link v-else-if="item.type !== 'label'" v-slot="{ active, ...slotProps }" v-bind="orientation === 'vertical' && item.children?.length && !collapsed ? {} : pickLinkProps(item)" custom>
293
159
  <component
294
- :is="(orientation === 'horizontal' && (item.children?.length || !!slots[(item.slot ? `${item.slot}-content` : 'item-content') as keyof NavigationMenuSlots<T>])) ? NavigationMenuTrigger : NavigationMenuLink"
160
+ :is="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content']) ? NavigationMenuTrigger : NavigationMenuLink"
295
161
  as-child
296
162
  :active="active || item.active"
297
163
  :disabled="item.disabled"
@@ -303,12 +169,12 @@ const lists = computed<NavigationMenuItem[][]>(() =>
303
169
  </component>
304
170
 
305
171
  <NavigationMenuContent
306
- v-if="orientation === 'horizontal' && (item.children?.length || !!slots[(item.slot ? `${item.slot}-content` : 'item-content') as keyof NavigationMenuSlots<T>])"
172
+ v-if="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content'])"
307
173
  v-bind="contentProps"
308
174
  :data-viewport="item.viewportRtl ? 'rtl' : 'ltr'"
309
175
  :class="b24ui.content({ class: props.b24ui?.content })"
310
176
  >
311
- <slot :name="((item.slot ? `${item.slot}-content` : 'item-content') as keyof NavigationMenuSlots<T>)" :item="item" :active="active" :index="index">
177
+ <slot :name="item.slot ? `${item.slot}-content` : 'item-content'" :item="item" :active="active" :index="index">
312
178
  <ul :class="b24ui.childList({ class: props.b24ui?.childList })">
313
179
  <li v-for="(childItem, childIndex) in item.children" :key="childIndex" :class="b24ui.childItem({ class: props.b24ui?.childItem })">
314
180
  <B24Link v-slot="{ active: childActive, ...childSlotProps }" v-bind="pickLinkProps(childItem)" custom>