@byyuurin/ui 0.3.0 → 0.4.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 (82) hide show
  1. package/LICENSE +20 -20
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +2 -2
  4. package/dist/runtime/components/Accordion.vue +43 -43
  5. package/dist/runtime/components/Alert.vue +65 -64
  6. package/dist/runtime/components/App.vue +10 -10
  7. package/dist/runtime/components/Avatar.vue +31 -30
  8. package/dist/runtime/components/AvatarGroup.vue +6 -5
  9. package/dist/runtime/components/Badge.vue +36 -35
  10. package/dist/runtime/components/Breadcrumb.vue +51 -51
  11. package/dist/runtime/components/Button.vue +54 -55
  12. package/dist/runtime/components/Calendar.vue +76 -75
  13. package/dist/runtime/components/Card.vue +43 -42
  14. package/dist/runtime/components/Carousel.vue +68 -67
  15. package/dist/runtime/components/Checkbox.vue +50 -48
  16. package/dist/runtime/components/CheckboxGroup.vue +33 -32
  17. package/dist/runtime/components/Chip.vue +20 -16
  18. package/dist/runtime/components/Collapsible.vue +16 -15
  19. package/dist/runtime/components/Drawer.vue +78 -77
  20. package/dist/runtime/components/DropdownMenu.vue +29 -29
  21. package/dist/runtime/components/DropdownMenuContent.vue +152 -152
  22. package/dist/runtime/components/FieldGroup.vue +5 -4
  23. package/dist/runtime/components/FileUpload.vue +267 -0
  24. package/dist/runtime/components/FileUpload.vue.d.ts +178 -0
  25. package/dist/runtime/components/Form.vue +11 -10
  26. package/dist/runtime/components/FormField.vue +39 -38
  27. package/dist/runtime/components/Icon.vue +2 -2
  28. package/dist/runtime/components/Input.vue +52 -52
  29. package/dist/runtime/components/InputNumber.vue +50 -49
  30. package/dist/runtime/components/InputTags.vue +55 -55
  31. package/dist/runtime/components/Kbd.vue +5 -4
  32. package/dist/runtime/components/Link.vue +25 -24
  33. package/dist/runtime/components/LinkBase.vue +3 -3
  34. package/dist/runtime/components/Marquee.vue +7 -6
  35. package/dist/runtime/components/Modal.vue +76 -75
  36. package/dist/runtime/components/NavigationMenu.vue +230 -230
  37. package/dist/runtime/components/OverlayProvider.vue +9 -9
  38. package/dist/runtime/components/Pagination.vue +49 -48
  39. package/dist/runtime/components/PinInput.vue +25 -25
  40. package/dist/runtime/components/Popover.vue +23 -23
  41. package/dist/runtime/components/Progress.vue +27 -26
  42. package/dist/runtime/components/RadioGroup.vue +53 -53
  43. package/dist/runtime/components/ScrollArea.vue +34 -33
  44. package/dist/runtime/components/Select.vue +203 -203
  45. package/dist/runtime/components/Separator.vue +32 -31
  46. package/dist/runtime/components/Skeleton.vue +13 -12
  47. package/dist/runtime/components/Slider.vue +27 -26
  48. package/dist/runtime/components/Stepper.vue +53 -52
  49. package/dist/runtime/components/Stepper.vue.d.ts +2 -2
  50. package/dist/runtime/components/Switch.vue +33 -34
  51. package/dist/runtime/components/Table.vue +139 -138
  52. package/dist/runtime/components/Tabs.vue +76 -76
  53. package/dist/runtime/components/Textarea.vue +50 -50
  54. package/dist/runtime/components/Timeline.vue +49 -48
  55. package/dist/runtime/components/Toast.vue +95 -94
  56. package/dist/runtime/components/ToastProvider.vue +31 -31
  57. package/dist/runtime/components/Tooltip.vue +26 -25
  58. package/dist/runtime/components/Tree.vue +133 -133
  59. package/dist/runtime/composables/useFileUpload.d.ts +19 -0
  60. package/dist/runtime/composables/useFileUpload.js +79 -0
  61. package/dist/runtime/composables/useLocale.d.ts +6 -0
  62. package/dist/runtime/locale/en.d.ts +3 -0
  63. package/dist/runtime/locale/en.js +3 -0
  64. package/dist/runtime/locale/zh_tw.d.ts +3 -0
  65. package/dist/runtime/locale/zh_tw.js +3 -0
  66. package/dist/runtime/types/index.d.ts +1 -0
  67. package/dist/runtime/types/index.js +1 -0
  68. package/dist/runtime/types/locale.d.ts +3 -0
  69. package/dist/runtime/types/unocss.d.ts +4 -4
  70. package/dist/runtime/types/utils.d.ts +1 -1
  71. package/dist/runtime/vue/components/Icon.vue +2 -2
  72. package/dist/setup.d.mts +1 -1
  73. package/dist/shared/{ui.D8Bg1HWt.d.mts → ui.CGCKYv7g.d.mts} +4 -2
  74. package/dist/shared/{ui.9kQouwss.mjs → ui.DYMXCXO6.mjs} +4 -2
  75. package/dist/shared/{ui.DpkP12cX.mjs → ui.DcEKQd0n.mjs} +230 -5
  76. package/dist/unocss.mjs +1 -1
  77. package/dist/unplugin.d.mts +1 -1
  78. package/dist/unplugin.mjs +2 -2
  79. package/dist/vite.d.mts +1 -1
  80. package/dist/vite.mjs +2 -2
  81. package/package.json +10 -10
  82. package/vue-plugin.d.ts +5 -5
@@ -8,7 +8,7 @@ import { defu } from "defu";
8
8
  import { AccordionContent, AccordionItem, AccordionRoot, AccordionTrigger, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuRoot, NavigationMenuTrigger, NavigationMenuViewport, useForwardPropsEmits } from "reka-ui";
9
9
  import { computed, toRef } from "vue";
10
10
  import { useAppConfig } from "#imports";
11
- import { get, isArrayOfArray, pickLinkProps } from "../utils";
11
+ import { get, isArrayOfArray, pick, pickLinkProps } from "../utils";
12
12
  import { cv, merge } from "../utils/style";
13
13
  import Avatar from "./Avatar.vue";
14
14
  import Badge from "./Badge.vue";
@@ -80,7 +80,7 @@ const appConfig = useAppConfig();
80
80
  const ui = computed(() => {
81
81
  const styler = cv(merge(theme, appConfig.ui.navigationMenu));
82
82
  return styler({
83
- ...props,
83
+ ...pick(props, ["orientation", "collapsed", "color", "variant", "highlight"]),
84
84
  contentOrientation: props.orientation === "vertical" ? void 0 : props.contentOrientation,
85
85
  highlightColor: props.highlightColor || props.color
86
86
  });
@@ -96,210 +96,210 @@ function getAccordionDefaultValue(list, level = 0) {
96
96
  </script>
97
97
 
98
98
  <template>
99
- <DefineLinkTemplate v-slot="{ item, active, index }">
100
- <slot :name="item.slot || 'item'" :item="item" :index="index" :active="active" :ui="ui">
101
- <slot :name="`${item.slot || 'item'}-leading`" :item="item" :active="active" :index="index" :ui="ui">
102
- <Avatar
103
- v-if="item.avatar"
104
- :size="item.ui?.linkLeadingAvatarSize || props.ui?.linkLeadingAvatarSize || ui.linkLeadingAvatarSize()"
105
- v-bind="item.avatar"
106
- :class="ui.linkLeadingAvatar({ class: [props.ui?.linkLeadingAvatar, item.ui?.linkLeadingAvatar], active, disabled: item.disabled })"
107
- data-part="linkLeadingAvatar"
108
- />
109
- <Icon
110
- v-else-if="item.icon"
111
- :name="item.icon"
112
- :class="ui.linkLeadingIcon({ class: [props.ui?.linkLeadingIcon, item.ui?.linkLeadingIcon], active, disabled: !!item.disabled })"
113
- data-part="linkLeadingIcon"
114
- />
115
- </slot>
116
-
117
- <span
118
- v-if="get(item, props.labelKey) || slots[`${item.slot || 'item'}-label`]"
119
- :class="ui.linkLabel({ class: [props.ui?.linkLabel, item.ui?.linkLabel] })"
120
- data-part="linkLabel"
121
- >
122
- <slot :name="`${item.slot || 'item'}-label`" :item="item" :active="active" :index="index">
123
- {{ get(item, props.labelKey) }}
124
- </slot>
125
-
126
- <Icon
127
- v-if="item.target === '_blank' && props.externalIcon !== false"
128
- :name="typeof props.externalIcon === 'string' ? props.externalIcon : appConfig.ui.icons.external"
129
- :class="ui.linkLabelExternalIcon({ class: [props.ui?.linkLabelExternalIcon, item.ui?.linkLabelExternalIcon], active })"
130
- data-part="linkLabelExternalIcon"
131
- />
132
- </span>
133
-
134
- <component
135
- :is="props.orientation === 'vertical' && item.children?.length && !props.collapsed ? AccordionTrigger : 'span'"
136
- v-if="item.badge !== void 0 || orientation === 'horizontal' && (item.children?.length || !!slots[`${item.slot || 'item'}-content`]) || orientation === 'vertical' && item.children?.length || item.trailingIcon || !!slots[`${item.slot || 'item'}-trailing`]"
137
- as="span"
138
- :class="ui.linkTrailing({ class: [props.ui?.linkTrailing, item.ui?.linkTrailing] })"
139
- data-part="linkTrailing"
140
- @click.stop.prevent
141
- >
142
- <slot :name="`${item.slot || 'item'}-trailing`" :item="item" :active="active" :index="index" :ui="ui">
143
- <Badge
144
- v-if="item.badge !== void 0"
145
- color="neutral"
146
- variant="outline"
147
- :size="item.ui?.linkTrailingBadgeSize || props.ui?.linkTrailingBadgeSize || ui.linkTrailingBadgeSize()"
148
- v-bind="typeof item.badge === 'string' || typeof item.badge === 'number' ? { label: item.badge } : item.badge"
149
- :class="ui.linkTrailingBadge({ class: [props.ui?.linkTrailingBadge, item.ui?.linkTrailingBadge] })"
150
- data-part="linkTrailingBadge"
151
- />
152
-
153
- <Icon
154
- v-if="orientation === 'horizontal' && (item.children?.length || !!slots[`${item.slot || 'item'}-content`]) || orientation === 'vertical' && item.children?.length"
155
- :name="item.trailingIcon || props.trailingIcon || appConfig.ui.icons.chevronDown"
156
- :class="ui.linkTrailingIcon({ class: [props.ui?.linkTrailingIcon, item.ui?.linkTrailingIcon], active })"
157
- data-part="linkTrailingIcon"
158
- />
159
- <Icon
160
- v-else-if="item.trailingIcon"
161
- :name="item.trailingIcon"
162
- :class="ui.linkTrailingIcon({ class: [props.ui?.linkTrailingIcon, item.ui?.linkTrailingIcon], active })"
163
- data-part="linkTrailingIcon"
164
- />
165
- </slot>
166
- </component>
167
- </slot>
168
- </DefineLinkTemplate>
169
-
170
- <DefineItemTemplate v-slot="{ item, index, level = 0 }">
171
- <component
172
- :is="props.orientation === 'vertical' && !props.collapsed ? AccordionItem : NavigationMenuItem"
173
- as="li"
174
- :value="item.value || (level > 0 ? `item-${level}-${index}` : `item-${index}`)"
175
- >
176
- <div v-if="props.orientation === 'vertical' && item.type === 'label' && !props.collapsed" :class="ui.label({ class: [props.ui?.label, item.ui?.label, item.class] })" data-part="label">
177
- <ReuseLinkTemplate :item="item" :index="index" />
178
- </div>
179
- <Link
180
- v-else-if="item.type !== 'label'"
181
- v-slot="{ active, ...slotProps }"
182
- v-bind="props.orientation === 'vertical' && item.children?.length && !props.collapsed && item.type === 'trigger' ? {} : pickLinkProps(item)"
183
- custom
184
- >
185
- <component
99
+ <DefineLinkTemplate v-slot="{ item, active, index }">
100
+ <slot :name="item.slot || 'item'" :item="item" :index="index" :active="active" :ui="ui">
101
+ <slot :name="`${item.slot || 'item'}-leading`" :item="item" :active="active" :index="index" :ui="ui">
102
+ <Avatar
103
+ v-if="item.avatar"
104
+ :size="item.ui?.linkLeadingAvatarSize || props.ui?.linkLeadingAvatarSize || ui.linkLeadingAvatarSize()"
105
+ v-bind="item.avatar"
106
+ :class="ui.linkLeadingAvatar({ class: [props.ui?.linkLeadingAvatar, item.ui?.linkLeadingAvatar], active, disabled: item.disabled })"
107
+ data-part="linkLeadingAvatar"
108
+ />
109
+ <Icon
110
+ v-else-if="item.icon"
111
+ :name="item.icon"
112
+ :class="ui.linkLeadingIcon({ class: [props.ui?.linkLeadingIcon, item.ui?.linkLeadingIcon], active, disabled: !!item.disabled })"
113
+ data-part="linkLeadingIcon"
114
+ />
115
+ </slot>
116
+
117
+ <span
118
+ v-if="get(item, props.labelKey) || slots[`${item.slot || 'item'}-label`]"
119
+ :class="ui.linkLabel({ class: [props.ui?.linkLabel, item.ui?.linkLabel] })"
120
+ data-part="linkLabel"
121
+ >
122
+ <slot :name="`${item.slot || 'item'}-label`" :item="item" :active="active" :index="index">
123
+ {{ get(item, props.labelKey) }}
124
+ </slot>
125
+
126
+ <Icon
127
+ v-if="item.target === '_blank' && props.externalIcon !== false"
128
+ :name="typeof props.externalIcon === 'string' ? props.externalIcon : appConfig.ui.icons.external"
129
+ :class="ui.linkLabelExternalIcon({ class: [props.ui?.linkLabelExternalIcon, item.ui?.linkLabelExternalIcon], active })"
130
+ data-part="linkLabelExternalIcon"
131
+ />
132
+ </span>
133
+
134
+ <component
135
+ :is="props.orientation === 'vertical' && item.children?.length && !props.collapsed ? AccordionTrigger : 'span'"
136
+ v-if="item.badge !== void 0 || orientation === 'horizontal' && (item.children?.length || !!slots[`${item.slot || 'item'}-content`]) || orientation === 'vertical' && item.children?.length || item.trailingIcon || !!slots[`${item.slot || 'item'}-trailing`]"
137
+ as="span"
138
+ :class="ui.linkTrailing({ class: [props.ui?.linkTrailing, item.ui?.linkTrailing] })"
139
+ data-part="linkTrailing"
140
+ @click.stop.prevent
141
+ >
142
+ <slot :name="`${item.slot || 'item'}-trailing`" :item="item" :active="active" :index="index" :ui="ui">
143
+ <Badge
144
+ v-if="item.badge !== void 0"
145
+ color="neutral"
146
+ variant="outline"
147
+ :size="item.ui?.linkTrailingBadgeSize || props.ui?.linkTrailingBadgeSize || ui.linkTrailingBadgeSize()"
148
+ v-bind="typeof item.badge === 'string' || typeof item.badge === 'number' ? { label: item.badge } : item.badge"
149
+ :class="ui.linkTrailingBadge({ class: [props.ui?.linkTrailingBadge, item.ui?.linkTrailingBadge] })"
150
+ data-part="linkTrailingBadge"
151
+ />
152
+
153
+ <Icon
154
+ v-if="orientation === 'horizontal' && (item.children?.length || !!slots[`${item.slot || 'item'}-content`]) || orientation === 'vertical' && item.children?.length"
155
+ :name="item.trailingIcon || props.trailingIcon || appConfig.ui.icons.chevronDown"
156
+ :class="ui.linkTrailingIcon({ class: [props.ui?.linkTrailingIcon, item.ui?.linkTrailingIcon], active })"
157
+ data-part="linkTrailingIcon"
158
+ />
159
+ <Icon
160
+ v-else-if="item.trailingIcon"
161
+ :name="item.trailingIcon"
162
+ :class="ui.linkTrailingIcon({ class: [props.ui?.linkTrailingIcon, item.ui?.linkTrailingIcon], active })"
163
+ data-part="linkTrailingIcon"
164
+ />
165
+ </slot>
166
+ </component>
167
+ </slot>
168
+ </DefineLinkTemplate>
169
+
170
+ <DefineItemTemplate v-slot="{ item, index, level = 0 }">
171
+ <component
172
+ :is="props.orientation === 'vertical' && !props.collapsed ? AccordionItem : NavigationMenuItem"
173
+ as="li"
174
+ :value="item.value || (level > 0 ? `item-${level}-${index}` : `item-${index}`)"
175
+ >
176
+ <div v-if="props.orientation === 'vertical' && item.type === 'label' && !props.collapsed" :class="ui.label({ class: [props.ui?.label, item.ui?.label, item.class] })" data-part="label">
177
+ <ReuseLinkTemplate :item="item" :index="index" />
178
+ </div>
179
+ <Link
180
+ v-else-if="item.type !== 'label'"
181
+ v-slot="{ active, ...slotProps }"
182
+ v-bind="props.orientation === 'vertical' && item.children?.length && !props.collapsed && item.type === 'trigger' ? {} : pickLinkProps(item)"
183
+ custom
184
+ >
185
+ <component
186
186
  :is="
187
187
  props.orientation === 'horizontal' && (item.children?.length || slots[`${item.slot || 'item'}-content`]) ? NavigationMenuTrigger : orientation === 'vertical' && item.children?.length && !props.collapsed && !slotProps.href ? AccordionTrigger : NavigationMenuLink
188
- "
189
- :active="active || item.active"
190
- :disabled="item.disabled"
191
- as-child
192
- @select="item.onSelect"
193
- >
194
- <Popover
195
- v-if="props.orientation === 'vertical' && props.collapsed && item.children?.length && (!!props.popover || !!item.popover)"
196
- v-bind="{ ...popoverProps, ...typeof item.popover === 'boolean' ? {} : item.popover || {} }"
197
- :ui="{ content: ui.content({ class: [props.ui?.content, item.ui?.content] }) }"
198
- data-part="content"
199
- >
200
- <LinkBase
201
- v-bind="slotProps"
188
+ "
189
+ :active="active || item.active"
190
+ :disabled="item.disabled"
191
+ as-child
192
+ @select="item.onSelect"
193
+ >
194
+ <Popover
195
+ v-if="props.orientation === 'vertical' && props.collapsed && item.children?.length && (!!props.popover || !!item.popover)"
196
+ v-bind="{ ...popoverProps, ...typeof item.popover === 'boolean' ? {} : item.popover || {} }"
197
+ :ui="{ content: ui.content({ class: [props.ui?.content, item.ui?.content] }) }"
198
+ data-part="content"
199
+ >
200
+ <LinkBase
201
+ v-bind="slotProps"
202
202
  :class="ui.link({
203
203
  class: [props.ui?.link, item.ui?.link, item.class],
204
204
  active: active || item.active,
205
205
  disabled: item.disabled,
206
206
  level: level > 0
207
- })"
208
- data-part="link"
209
- >
210
- <ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" />
211
- </LinkBase>
212
-
213
- <template #content="{ close }">
214
- <slot :name="`${item.slot || 'item'}-content`" :item="item" :active="active || item.active" :index="index" :ui="ui" :close="close">
215
- <ul :class="ui.childList({ class: [props.ui?.childList, item.ui?.childList] })" data-part="childList">
216
- <li :class="ui.childLabel({ class: [props.ui?.childLabel, item.ui?.childLabel] })" data-part="childLabel">
217
- {{ get(item, props.labelKey) }}
218
- </li>
219
- <li v-for="(childItem, childIndex) in item.children" :key="childIndex" :class="ui.childItem({ class: [props.ui?.childItem, item.ui?.childItem] })" data-part="childItem">
220
- <Link v-slot="{ active: childActive, ...childSlotProps }" v-bind="pickLinkProps(childItem)" custom>
221
- <NavigationMenuLink :active="childActive" as-child @select="childItem.onSelect">
222
- <LinkBase v-bind="childSlotProps" :class="ui.childLink({ class: [props.ui?.childLink, item.ui?.childLink, childItem.class], active: childActive })" data-part="childLink">
223
- <Icon v-if="childItem.icon" :name="childItem.icon" :class="ui.childLinkIcon({ class: [props.ui?.childLinkIcon, item.ui?.childLinkIcon], active: childActive })" data-part="childLinkIcon" />
224
-
225
- <span :class="ui.childLinkLabel({ class: [props.ui?.childLinkLabel, item.ui?.childLinkLabel], active: childActive })" data-part="childLinkLabel">
226
- {{ get(childItem, props.labelKey) }}
227
-
228
- <Icon v-if="childItem.target === '_blank' && props.externalIcon !== false" :name="typeof props.externalIcon === 'string' ? props.externalIcon : appConfig.ui.icons.external" :class="ui.childLinkLabelExternalIcon({ class: [props.ui?.childLinkLabelExternalIcon, item.ui?.childLinkLabelExternalIcon], active: childActive })" data-part="childLinkLabelExternalIcon" />
229
- </span>
230
- </LinkBase>
231
- </NavigationMenuLink>
232
- </Link>
233
- </li>
234
- </ul>
235
- </slot>
236
- </template>
237
- </Popover>
238
- <Tooltip v-else-if="props.orientation === 'vertical' && props.collapsed && (!!props.tooltip || !!item.tooltip)" :text="get(item, props.labelKey)" v-bind="{ ...tooltipProps, ...typeof item.tooltip === 'boolean' ? {} : item.tooltip || {} }">
239
- <LinkBase v-bind="slotProps" :class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active: active || item.active, disabled: item.disabled, level: level > 0 })" data-part="link">
240
- <ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" />
241
- </LinkBase>
242
- </Tooltip>
243
- <LinkBase v-else v-bind="slotProps" :class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active: active || item.active, disabled: item.disabled, level: props.orientation === 'horizontal' || level > 0 })" data-part="link">
244
- <ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" />
245
- </LinkBase>
246
- </component>
247
-
248
- <NavigationMenuContent
249
- v-if="props.orientation === 'horizontal' && (item.children?.length || slots[`${item.slot || 'item'}-content`])"
250
- v-bind="contentProps"
251
- :class="ui.content({ class: [props.ui?.content, item.ui?.content] })"
252
- data-part="content"
253
- >
254
- <slot :name="`${item.slot || 'item'}-content`" :item="item" :active="active" :index="index" :ui="ui">
255
- <ul :class="ui.childList({ class: [props.ui?.childList, item.ui?.childList] })" data-part="childList">
256
- <li v-for="(childItem, childIndex) in item.children" :key="childIndex" :class="ui.childItem({ class: [props.ui?.childItem, item.ui?.childItem] })" data-part="childItem">
257
- <Link v-slot="{ active: childActive, ...childSlotProps }" v-bind="pickLinkProps(childItem)" custom>
258
- <NavigationMenuLink :active="childActive" as-child @select="childItem.onSelect">
259
- <LinkBase v-bind="childSlotProps" :class="ui.childLink({ class: [props.ui?.childLink, item.ui?.childLink, childItem.class], active: childActive })" data-part="childLink">
260
- <Icon v-if="childItem.icon" :name="childItem.icon" :class="ui.childLinkIcon({ class: [props.ui?.childLinkIcon, item.ui?.childLinkIcon], active: childActive })" data-part="childLinkIcon" />
261
-
262
- <div :class="ui.childLinkWrapper({ class: [props.ui?.childLinkWrapper, item.ui?.childLinkWrapper] })" data-part="childLinkWrapper">
263
- <p :class="ui.childLinkLabel({ class: [props.ui?.childLinkLabel, item.ui?.childLinkLabel], active: childActive })" data-part="childLinkLabel">
264
- {{ get(childItem, props.labelKey) }}
265
-
266
- <Icon v-if="childItem.target === '_blank' && props.externalIcon !== false" :name="typeof props.externalIcon === 'string' ? props.externalIcon : appConfig.ui.icons.external" :class="ui.childLinkLabelExternalIcon({ class: [props.ui?.childLinkLabelExternalIcon, item.ui?.childLinkLabelExternalIcon], active: childActive })" data-part="childLinkLabelExternalIcon" />
267
- </p>
268
- <p v-if="childItem.description" :class="ui.childLinkDescription({ class: [props.ui?.childLinkDescription, item.ui?.childLinkDescription], active: childActive })" data-part="childLinkDescription">
269
- {{ childItem.description }}
270
- </p>
271
- </div>
272
- </LinkBase>
273
- </NavigationMenuLink>
274
- </Link>
275
- </li>
276
- </ul>
277
- </slot>
278
- </NavigationMenuContent>
279
- </Link>
280
-
281
- <AccordionContent v-if="props.orientation === 'vertical' && item.children?.length && !props.collapsed" :class="ui.content({ class: [props.ui?.content, item.ui?.content] })" data-part="content">
282
- <AccordionRoot
283
- v-bind="{ ...accordionProps, defaultValue: getAccordionDefaultValue(item.children, level + 1) }"
284
- as="ul"
285
- :class="ui.childList({ class: [props.ui?.childList, item.ui?.childList] })"
286
- data-part="childList"
287
- >
288
- <ReuseItemTemplate
289
- v-for="(childItem, childIndex) in item.children"
290
- :key="childIndex"
291
- :item="childItem"
292
- :index="childIndex"
293
- :level="level + 1"
294
- :class="ui.childItem({ class: [props.ui?.childItem, item.ui?.childItem] })"
295
- data-part="childItem"
296
- />
297
- </AccordionRoot>
298
- </AccordionContent>
299
- </component>
300
- </DefineItemTemplate>
301
-
302
- <NavigationMenuRoot
207
+ })"
208
+ data-part="link"
209
+ >
210
+ <ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" />
211
+ </LinkBase>
212
+
213
+ <template #content="{ close }">
214
+ <slot :name="`${item.slot || 'item'}-content`" :item="item" :active="active || item.active" :index="index" :ui="ui" :close="close">
215
+ <ul :class="ui.childList({ class: [props.ui?.childList, item.ui?.childList] })" data-part="childList">
216
+ <li :class="ui.childLabel({ class: [props.ui?.childLabel, item.ui?.childLabel] })" data-part="childLabel">
217
+ {{ get(item, props.labelKey) }}
218
+ </li>
219
+ <li v-for="(childItem, childIndex) in item.children" :key="childIndex" :class="ui.childItem({ class: [props.ui?.childItem, item.ui?.childItem] })" data-part="childItem">
220
+ <Link v-slot="{ active: childActive, ...childSlotProps }" v-bind="pickLinkProps(childItem)" custom>
221
+ <NavigationMenuLink :active="childActive" as-child @select="childItem.onSelect">
222
+ <LinkBase v-bind="childSlotProps" :class="ui.childLink({ class: [props.ui?.childLink, item.ui?.childLink, childItem.class], active: childActive })" data-part="childLink">
223
+ <Icon v-if="childItem.icon" :name="childItem.icon" :class="ui.childLinkIcon({ class: [props.ui?.childLinkIcon, item.ui?.childLinkIcon], active: childActive })" data-part="childLinkIcon" />
224
+
225
+ <span :class="ui.childLinkLabel({ class: [props.ui?.childLinkLabel, item.ui?.childLinkLabel], active: childActive })" data-part="childLinkLabel">
226
+ {{ get(childItem, props.labelKey) }}
227
+
228
+ <Icon v-if="childItem.target === '_blank' && props.externalIcon !== false" :name="typeof props.externalIcon === 'string' ? props.externalIcon : appConfig.ui.icons.external" :class="ui.childLinkLabelExternalIcon({ class: [props.ui?.childLinkLabelExternalIcon, item.ui?.childLinkLabelExternalIcon], active: childActive })" data-part="childLinkLabelExternalIcon" />
229
+ </span>
230
+ </LinkBase>
231
+ </NavigationMenuLink>
232
+ </Link>
233
+ </li>
234
+ </ul>
235
+ </slot>
236
+ </template>
237
+ </Popover>
238
+ <Tooltip v-else-if="props.orientation === 'vertical' && props.collapsed && (!!props.tooltip || !!item.tooltip)" :text="get(item, props.labelKey)" v-bind="{ ...tooltipProps, ...typeof item.tooltip === 'boolean' ? {} : item.tooltip || {} }">
239
+ <LinkBase v-bind="slotProps" :class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active: active || item.active, disabled: item.disabled, level: level > 0 })" data-part="link">
240
+ <ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" />
241
+ </LinkBase>
242
+ </Tooltip>
243
+ <LinkBase v-else v-bind="slotProps" :class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active: active || item.active, disabled: item.disabled, level: props.orientation === 'horizontal' || level > 0 })" data-part="link">
244
+ <ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" />
245
+ </LinkBase>
246
+ </component>
247
+
248
+ <NavigationMenuContent
249
+ v-if="props.orientation === 'horizontal' && (item.children?.length || slots[`${item.slot || 'item'}-content`])"
250
+ v-bind="contentProps"
251
+ :class="ui.content({ class: [props.ui?.content, item.ui?.content] })"
252
+ data-part="content"
253
+ >
254
+ <slot :name="`${item.slot || 'item'}-content`" :item="item" :active="active" :index="index" :ui="ui">
255
+ <ul :class="ui.childList({ class: [props.ui?.childList, item.ui?.childList] })" data-part="childList">
256
+ <li v-for="(childItem, childIndex) in item.children" :key="childIndex" :class="ui.childItem({ class: [props.ui?.childItem, item.ui?.childItem] })" data-part="childItem">
257
+ <Link v-slot="{ active: childActive, ...childSlotProps }" v-bind="pickLinkProps(childItem)" custom>
258
+ <NavigationMenuLink :active="childActive" as-child @select="childItem.onSelect">
259
+ <LinkBase v-bind="childSlotProps" :class="ui.childLink({ class: [props.ui?.childLink, item.ui?.childLink, childItem.class], active: childActive })" data-part="childLink">
260
+ <Icon v-if="childItem.icon" :name="childItem.icon" :class="ui.childLinkIcon({ class: [props.ui?.childLinkIcon, item.ui?.childLinkIcon], active: childActive })" data-part="childLinkIcon" />
261
+
262
+ <div :class="ui.childLinkWrapper({ class: [props.ui?.childLinkWrapper, item.ui?.childLinkWrapper] })" data-part="childLinkWrapper">
263
+ <p :class="ui.childLinkLabel({ class: [props.ui?.childLinkLabel, item.ui?.childLinkLabel], active: childActive })" data-part="childLinkLabel">
264
+ {{ get(childItem, props.labelKey) }}
265
+
266
+ <Icon v-if="childItem.target === '_blank' && props.externalIcon !== false" :name="typeof props.externalIcon === 'string' ? props.externalIcon : appConfig.ui.icons.external" :class="ui.childLinkLabelExternalIcon({ class: [props.ui?.childLinkLabelExternalIcon, item.ui?.childLinkLabelExternalIcon], active: childActive })" data-part="childLinkLabelExternalIcon" />
267
+ </p>
268
+ <p v-if="childItem.description" :class="ui.childLinkDescription({ class: [props.ui?.childLinkDescription, item.ui?.childLinkDescription], active: childActive })" data-part="childLinkDescription">
269
+ {{ childItem.description }}
270
+ </p>
271
+ </div>
272
+ </LinkBase>
273
+ </NavigationMenuLink>
274
+ </Link>
275
+ </li>
276
+ </ul>
277
+ </slot>
278
+ </NavigationMenuContent>
279
+ </Link>
280
+
281
+ <AccordionContent v-if="props.orientation === 'vertical' && item.children?.length && !props.collapsed" :class="ui.content({ class: [props.ui?.content, item.ui?.content] })" data-part="content">
282
+ <AccordionRoot
283
+ v-bind="{ ...accordionProps, defaultValue: getAccordionDefaultValue(item.children, level + 1) }"
284
+ as="ul"
285
+ :class="ui.childList({ class: [props.ui?.childList, item.ui?.childList] })"
286
+ data-part="childList"
287
+ >
288
+ <ReuseItemTemplate
289
+ v-for="(childItem, childIndex) in item.children"
290
+ :key="childIndex"
291
+ :item="childItem"
292
+ :index="childIndex"
293
+ :level="level + 1"
294
+ :class="ui.childItem({ class: [props.ui?.childItem, item.ui?.childItem] })"
295
+ data-part="childItem"
296
+ />
297
+ </AccordionRoot>
298
+ </AccordionContent>
299
+ </component>
300
+ </DefineItemTemplate>
301
+
302
+ <NavigationMenuRoot
303
303
  v-bind="{
304
304
  ...rootProps,
305
305
  ...props.orientation === 'horizontal' ? {
@@ -307,39 +307,39 @@ function getAccordionDefaultValue(list, level = 0) {
307
307
  defaultValue: props.defaultValue
308
308
  } : {},
309
309
  ...$attrs
310
- }"
311
- :class="ui.root({ class: [props.ui?.root, props.class] })"
312
- :data-collapsed="props.collapsed"
313
- data-part="root"
314
- >
315
- <slot name="list-leading"></slot>
316
-
317
- <template v-for="(list, listIndex) in lists" :key="`list-${listIndex}`">
318
- <component
310
+ }"
311
+ :class="ui.root({ class: [props.ui?.root, props.class] })"
312
+ :data-collapsed="props.collapsed"
313
+ data-part="root"
314
+ >
315
+ <slot name="list-leading"></slot>
316
+
317
+ <template v-for="(list, listIndex) in lists" :key="`list-${listIndex}`">
318
+ <component
319
319
  v-bind="props.orientation === 'vertical' && !props.collapsed ? {
320
320
  ...accordionProps,
321
321
  modelValue: props.modelValue,
322
322
  defaultValue: props.defaultValue ?? getAccordionDefaultValue(list)
323
- } : {}"
324
- :is="props.orientation === 'vertical' ? AccordionRoot : NavigationMenuList"
325
- as="ul"
326
- :class="ui.list({ class: props.ui?.list })"
327
- data-part="list"
328
- >
329
- <ReuseItemTemplate v-for="(item, index) in list" :key="`list-${listIndex}-${index}`" :item="item" :index="index" :class="ui.item({ class: [props.ui?.item, item.ui?.item] })" data-part="item" />
330
- </component>
331
-
332
- <div v-if="props.orientation === 'vertical' && listIndex < lists.length - 1" :class="ui.separator({ class: props.ui?.separator })" data-part="separator"></div>
333
- </template>
334
-
335
- <slot name="list-trailing"></slot>
336
-
337
- <div v-if="props.orientation === 'horizontal'" :class="ui.viewportWrapper({ class: props.ui?.viewportWrapper })" data-part="viewportWrapper">
338
- <NavigationMenuIndicator v-if="props.arrow" :class="ui.indicator({ class: props.ui?.indicator })" data-part="indicator">
339
- <div :class="ui.arrow({ class: props.ui?.arrow })" data-part="arrow"></div>
340
- </NavigationMenuIndicator>
341
-
342
- <NavigationMenuViewport :class="ui.viewport({ class: props.ui?.viewport })" data-part="viewport" />
343
- </div>
344
- </NavigationMenuRoot>
323
+ } : {}"
324
+ :is="props.orientation === 'vertical' ? AccordionRoot : NavigationMenuList"
325
+ as="ul"
326
+ :class="ui.list({ class: props.ui?.list })"
327
+ data-part="list"
328
+ >
329
+ <ReuseItemTemplate v-for="(item, index) in list" :key="`list-${listIndex}-${index}`" :item="item" :index="index" :class="ui.item({ class: [props.ui?.item, item.ui?.item] })" data-part="item" />
330
+ </component>
331
+
332
+ <div v-if="props.orientation === 'vertical' && listIndex < lists.length - 1" :class="ui.separator({ class: props.ui?.separator })" data-part="separator"></div>
333
+ </template>
334
+
335
+ <slot name="list-trailing"></slot>
336
+
337
+ <div v-if="props.orientation === 'horizontal'" :class="ui.viewportWrapper({ class: props.ui?.viewportWrapper })" data-part="viewportWrapper">
338
+ <NavigationMenuIndicator v-if="props.arrow" :class="ui.indicator({ class: props.ui?.indicator })" data-part="indicator">
339
+ <div :class="ui.arrow({ class: props.ui?.arrow })" data-part="arrow"></div>
340
+ </NavigationMenuIndicator>
341
+
342
+ <NavigationMenuViewport :class="ui.viewport({ class: props.ui?.viewport })" data-part="viewport" />
343
+ </div>
344
+ </NavigationMenuRoot>
345
345
  </template>
@@ -13,13 +13,13 @@ function onClose(id, value) {
13
13
  </script>
14
14
 
15
15
  <template>
16
- <component
17
- :is="overlay.component"
18
- v-for="overlay in mountedOverlays"
19
- :key="overlay.id"
20
- v-bind="overlay.props"
21
- v-model:open="overlay.isOpen"
22
- @close="onClose(overlay.id, $event)"
23
- @after-leave="onAfterLeave(overlay.id)"
24
- />
16
+ <component
17
+ :is="overlay.component"
18
+ v-for="overlay in mountedOverlays"
19
+ :key="overlay.id"
20
+ v-bind="overlay.props"
21
+ v-model:open="overlay.isOpen"
22
+ @close="onClose(overlay.id, $event)"
23
+ @after-leave="onAfterLeave(overlay.id)"
24
+ />
25
25
  </template>