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