@nuxt/ui 3.1.1 → 3.1.2

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 (105) hide show
  1. package/.nuxt/ui/alert.ts +0 -5
  2. package/.nuxt/ui/badge.ts +30 -7
  3. package/.nuxt/ui/button-group.ts +0 -13
  4. package/.nuxt/ui/button.ts +2 -7
  5. package/.nuxt/ui/calendar.ts +1 -1
  6. package/.nuxt/ui/carousel.ts +0 -5
  7. package/.nuxt/ui/checkbox-group.ts +144 -1
  8. package/.nuxt/ui/color-picker.ts +2 -2
  9. package/.nuxt/ui/input-menu.ts +2 -11
  10. package/.nuxt/ui/input-number.ts +10 -0
  11. package/.nuxt/ui/input.ts +2 -11
  12. package/.nuxt/ui/link.ts +12 -5
  13. package/.nuxt/ui/select-menu.ts +2 -11
  14. package/.nuxt/ui/select.ts +2 -11
  15. package/.nuxt/ui/tabs.ts +4 -3
  16. package/.nuxt/ui/textarea.ts +2 -11
  17. package/.nuxt/ui/toast.ts +0 -5
  18. package/cli/templates.mjs +2 -2
  19. package/dist/module.json +1 -1
  20. package/dist/module.mjs +14 -5
  21. package/dist/runtime/components/Accordion.vue +9 -9
  22. package/dist/runtime/components/Accordion.vue.d.ts +2 -0
  23. package/dist/runtime/components/Alert.vue +1 -1
  24. package/dist/runtime/components/Avatar.vue +2 -2
  25. package/dist/runtime/components/AvatarGroup.vue +1 -1
  26. package/dist/runtime/components/Badge.vue +5 -3
  27. package/dist/runtime/components/Badge.vue.d.ts +2 -0
  28. package/dist/runtime/components/Breadcrumb.vue +8 -8
  29. package/dist/runtime/components/Breadcrumb.vue.d.ts +2 -0
  30. package/dist/runtime/components/Button.vue +2 -3
  31. package/dist/runtime/components/Button.vue.d.ts +1 -1
  32. package/dist/runtime/components/Calendar.vue +2 -1
  33. package/dist/runtime/components/Card.vue +1 -1
  34. package/dist/runtime/components/Carousel.vue +5 -2
  35. package/dist/runtime/components/Carousel.vue.d.ts +6 -1
  36. package/dist/runtime/components/Checkbox.vue +2 -2
  37. package/dist/runtime/components/CheckboxGroup.vue +8 -5
  38. package/dist/runtime/components/CheckboxGroup.vue.d.ts +7 -1
  39. package/dist/runtime/components/Chip.vue +1 -1
  40. package/dist/runtime/components/Collapsible.vue +1 -1
  41. package/dist/runtime/components/ColorPicker.vue +1 -1
  42. package/dist/runtime/components/CommandPalette.vue +17 -17
  43. package/dist/runtime/components/CommandPalette.vue.d.ts +2 -0
  44. package/dist/runtime/components/ContextMenu.vue.d.ts +2 -0
  45. package/dist/runtime/components/ContextMenuContent.vue +15 -15
  46. package/dist/runtime/components/DropdownMenu.vue.d.ts +2 -0
  47. package/dist/runtime/components/DropdownMenuContent.vue +15 -15
  48. package/dist/runtime/components/FormField.vue +5 -5
  49. package/dist/runtime/components/Input.vue +2 -2
  50. package/dist/runtime/components/Input.vue.d.ts +23 -29
  51. package/dist/runtime/components/InputMenu.vue +17 -17
  52. package/dist/runtime/components/InputMenu.vue.d.ts +210 -0
  53. package/dist/runtime/components/InputNumber.vue +13 -7
  54. package/dist/runtime/components/InputNumber.vue.d.ts +78 -0
  55. package/dist/runtime/components/Link.vue +5 -14
  56. package/dist/runtime/components/NavigationMenu.vue +35 -28
  57. package/dist/runtime/components/NavigationMenu.vue.d.ts +20 -2
  58. package/dist/runtime/components/Pagination.vue +1 -1
  59. package/dist/runtime/components/PinInput.vue +1 -1
  60. package/dist/runtime/components/Progress.vue +1 -1
  61. package/dist/runtime/components/RadioGroup.vue +8 -8
  62. package/dist/runtime/components/RadioGroup.vue.d.ts +2 -0
  63. package/dist/runtime/components/Select.vue +12 -12
  64. package/dist/runtime/components/Select.vue.d.ts +3 -1
  65. package/dist/runtime/components/SelectMenu.vue +13 -13
  66. package/dist/runtime/components/SelectMenu.vue.d.ts +2 -0
  67. package/dist/runtime/components/Separator.vue +1 -1
  68. package/dist/runtime/components/Slider.vue +16 -4
  69. package/dist/runtime/components/Slider.vue.d.ts +26 -20
  70. package/dist/runtime/components/Stepper.vue +10 -10
  71. package/dist/runtime/components/Stepper.vue.d.ts +2 -0
  72. package/dist/runtime/components/Switch.vue +1 -1
  73. package/dist/runtime/components/Table.vue +2 -2
  74. package/dist/runtime/components/Tabs.vue +6 -6
  75. package/dist/runtime/components/Tabs.vue.d.ts +2 -0
  76. package/dist/runtime/components/Textarea.vue +3 -3
  77. package/dist/runtime/components/Textarea.vue.d.ts +23 -30
  78. package/dist/runtime/components/Toast.vue +3 -2
  79. package/dist/runtime/components/Toast.vue.d.ts +6 -0
  80. package/dist/runtime/components/Toaster.vue +4 -4
  81. package/dist/runtime/components/Toaster.vue.d.ts +6 -0
  82. package/dist/runtime/components/Tree.vue +10 -10
  83. package/dist/runtime/components/Tree.vue.d.ts +2 -0
  84. package/dist/runtime/composables/useFormField.d.ts +1 -1
  85. package/dist/runtime/composables/useFormField.js +2 -1
  86. package/dist/runtime/inertia/components/Link.vue +46 -60
  87. package/dist/runtime/inertia/components/Link.vue.d.ts +1 -1
  88. package/dist/runtime/inertia/components/LinkBase.vue +68 -0
  89. package/dist/runtime/inertia/components/LinkBase.vue.d.ts +25 -0
  90. package/dist/runtime/inertia/stubs.d.ts +1 -1
  91. package/dist/runtime/inertia/stubs.js +1 -1
  92. package/dist/runtime/locale/index.d.ts +1 -0
  93. package/dist/runtime/locale/index.js +1 -0
  94. package/dist/runtime/locale/sl.d.ts +3 -0
  95. package/dist/runtime/locale/sl.js +54 -0
  96. package/dist/runtime/utils/link.d.ts +1 -0
  97. package/dist/runtime/utils/link.js +12 -0
  98. package/dist/runtime/vue/components/Link.vue +27 -40
  99. package/dist/runtime/vue/composables/useAppConfig.js +3 -1
  100. package/dist/runtime/vue/stubs.d.ts +1 -1
  101. package/dist/runtime/vue/stubs.js +1 -1
  102. package/dist/shared/{ui.CbtTMMzt.mjs → ui.BvUP-pSb.mjs} +103 -16
  103. package/dist/unplugin.mjs +1 -1
  104. package/dist/vite.mjs +1 -1
  105. package/package.json +21 -21
@@ -33,6 +33,8 @@ export interface InputNumberProps extends Pick<NumberFieldRootProps, 'modelValue
33
33
  * @IconifyIcon
34
34
  */
35
35
  incrementIcon?: string;
36
+ /** Disable the increment button. */
37
+ incrementDisabled?: boolean;
36
38
  /**
37
39
  * Configure the decrement button. The `color` and `size` are inherited.
38
40
  * @defaultValue { variant: 'link' }
@@ -44,6 +46,8 @@ export interface InputNumberProps extends Pick<NumberFieldRootProps, 'modelValue
44
46
  * @IconifyIcon
45
47
  */
46
48
  decrementIcon?: string;
49
+ /** Disable the decrement button. */
50
+ decrementDisabled?: boolean;
47
51
  autofocus?: boolean;
48
52
  autofocusDelay?: number;
49
53
  /**
@@ -76,6 +80,43 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<InputNumbe
76
80
  };
77
81
  $refs: {
78
82
  [x: string]: unknown;
83
+ } & {
84
+ primitiveElement: import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
85
+ asChild: {
86
+ type: BooleanConstructor;
87
+ default: boolean;
88
+ };
89
+ as: {
90
+ type: import("vue").PropType<import("reka-ui").AsTag | import("vue").Component>;
91
+ default: string;
92
+ };
93
+ }>> & Readonly<{}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
94
+ [key: string]: any;
95
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
96
+ asChild: boolean;
97
+ as: import("reka-ui").AsTag | import("vue").Component;
98
+ }, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
99
+ P: {};
100
+ B: {};
101
+ D: {};
102
+ C: {};
103
+ M: {};
104
+ Defaults: {};
105
+ }, Readonly<import("vue").ExtractPropTypes<{
106
+ asChild: {
107
+ type: BooleanConstructor;
108
+ default: boolean;
109
+ };
110
+ as: {
111
+ type: import("vue").PropType<import("reka-ui").AsTag | import("vue").Component>;
112
+ default: string;
113
+ };
114
+ }>> & Readonly<{}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
115
+ [key: string]: any;
116
+ }>, {}, {}, {}, {
117
+ asChild: boolean;
118
+ as: import("reka-ui").AsTag | import("vue").Component;
119
+ }> | null;
79
120
  };
80
121
  $slots: Readonly<{
81
122
  [name: string]: import("vue").Slot<any> | undefined;
@@ -125,6 +166,43 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<InputNumbe
125
166
  };
126
167
  $refs: {
127
168
  [x: string]: unknown;
169
+ } & {
170
+ primitiveElement: import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
171
+ asChild: {
172
+ type: BooleanConstructor;
173
+ default: boolean;
174
+ };
175
+ as: {
176
+ type: import("vue").PropType<import("reka-ui").AsTag | import("vue").Component>;
177
+ default: string;
178
+ };
179
+ }>> & Readonly<{}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
180
+ [key: string]: any;
181
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
182
+ asChild: boolean;
183
+ as: import("reka-ui").AsTag | import("vue").Component;
184
+ }, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
185
+ P: {};
186
+ B: {};
187
+ D: {};
188
+ C: {};
189
+ M: {};
190
+ Defaults: {};
191
+ }, Readonly<import("vue").ExtractPropTypes<{
192
+ asChild: {
193
+ type: BooleanConstructor;
194
+ default: boolean;
195
+ };
196
+ as: {
197
+ type: import("vue").PropType<import("reka-ui").AsTag | import("vue").Component>;
198
+ default: string;
199
+ };
200
+ }>> & Readonly<{}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
201
+ [key: string]: any;
202
+ }>, {}, {}, {}, {
203
+ asChild: boolean;
204
+ as: import("reka-ui").AsTag | import("vue").Component;
205
+ }> | null;
128
206
  };
129
207
  $slots: Readonly<{
130
208
  [name: string]: import("vue").Slot<any> | undefined;
@@ -5,11 +5,12 @@ import theme from "#build/ui/link";
5
5
  <script setup>
6
6
  import { computed } from "vue";
7
7
  import { defu } from "defu";
8
- import { isEqual, diff } from "ohash/utils";
8
+ import { isEqual } from "ohash/utils";
9
9
  import { useForwardProps } from "reka-ui";
10
10
  import { reactiveOmit } from "@vueuse/core";
11
11
  import { useRoute, useAppConfig } from "#imports";
12
12
  import { tv } from "../utils/tv";
13
+ import { isPartiallyEqual } from "../utils/link";
13
14
  import ULinkBase from "./LinkBase.vue";
14
15
  defineOptions({ inheritAttrs: false });
15
16
  const props = defineProps({
@@ -43,7 +44,7 @@ const props = defineProps({
43
44
  defineSlots();
44
45
  const route = useRoute();
45
46
  const appConfig = useAppConfig();
46
- const nuxtLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "exactQuery", "exactHash", "activeClass", "inactiveClass", "raw", "class"));
47
+ const nuxtLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "exactQuery", "exactHash", "activeClass", "inactiveClass", "to", "href", "raw", "custom", "class"));
47
48
  const ui = computed(() => tv({
48
49
  extend: tv(theme),
49
50
  ...defu({
@@ -55,17 +56,7 @@ const ui = computed(() => tv({
55
56
  }
56
57
  }, appConfig.ui?.link || {})
57
58
  }));
58
- function isPartiallyEqual(item1, item2) {
59
- const diffedKeys = diff(item1, item2).reduce((filtered, q) => {
60
- if (q.type === "added") {
61
- filtered.add(q.key);
62
- }
63
- return filtered;
64
- }, /* @__PURE__ */ new Set());
65
- const item1Filtered = Object.fromEntries(Object.entries(item1).filter(([key]) => !diffedKeys.has(key)));
66
- const item2Filtered = Object.fromEntries(Object.entries(item2).filter(([key]) => !diffedKeys.has(key)));
67
- return isEqual(item1Filtered, item2Filtered);
68
- }
59
+ const to = computed(() => props.to ?? props.href);
69
60
  function isLinkActive({ route: linkRoute, isActive, isExactActive }) {
70
61
  if (props.active !== void 0) {
71
62
  return props.active;
@@ -96,7 +87,7 @@ function resolveLinkClass({ route: route2, isActive, isExactActive }) {
96
87
  </script>
97
88
 
98
89
  <template>
99
- <NuxtLink v-slot="{ href, navigate, route: linkRoute, rel, target, isExternal, isActive, isExactActive }" v-bind="nuxtLinkProps" custom>
90
+ <NuxtLink v-slot="{ href, navigate, route: linkRoute, rel, target, isExternal, isActive, isExactActive }" v-bind="nuxtLinkProps" :to="to" custom>
100
91
  <template v-if="custom">
101
92
  <slot
102
93
  v-bind="{
@@ -16,6 +16,7 @@ import UAvatar from "./Avatar.vue";
16
16
  import UIcon from "./Icon.vue";
17
17
  import UBadge from "./Badge.vue";
18
18
  import UCollapsible from "./Collapsible.vue";
19
+ import UTooltip from "./Tooltip.vue";
19
20
  const props = defineProps({
20
21
  as: { type: null, required: false },
21
22
  trailingIcon: { type: String, required: false },
@@ -84,34 +85,34 @@ const lists = computed(
84
85
  <DefineLinkTemplate v-slot="{ item, active, index }">
85
86
  <slot :name="item.slot || 'item'" :item="item" :index="index">
86
87
  <slot :name="item.slot ? `${item.slot}-leading` : 'item-leading'" :item="item" :active="active" :index="index">
87
- <UAvatar v-if="item.avatar" :size="props.ui?.linkLeadingAvatarSize || ui.linkLeadingAvatarSize()" v-bind="item.avatar" :class="ui.linkLeadingAvatar({ class: props.ui?.linkLeadingAvatar, active, disabled: !!item.disabled })" />
88
- <UIcon v-else-if="item.icon" :name="item.icon" :class="ui.linkLeadingIcon({ class: props.ui?.linkLeadingIcon, active, disabled: !!item.disabled })" />
88
+ <UAvatar v-if="item.avatar" :size="item.ui?.linkLeadingAvatarSize || props.ui?.linkLeadingAvatarSize || ui.linkLeadingAvatarSize()" v-bind="item.avatar" :class="ui.linkLeadingAvatar({ class: [props.ui?.linkLeadingAvatar, item.ui?.linkLeadingAvatar], active, disabled: !!item.disabled })" />
89
+ <UIcon v-else-if="item.icon" :name="item.icon" :class="ui.linkLeadingIcon({ class: [props.ui?.linkLeadingIcon, item.ui?.linkLeadingIcon], active, disabled: !!item.disabled })" />
89
90
  </slot>
90
91
 
91
92
  <span
92
93
  v-if="(!collapsed || orientation !== 'vertical') && (get(item, props.labelKey) || !!slots[item.slot ? `${item.slot}-label` : 'item-label'])"
93
- :class="ui.linkLabel({ class: props.ui?.linkLabel })"
94
+ :class="ui.linkLabel({ class: [props.ui?.linkLabel, item.ui?.linkLabel] })"
94
95
  >
95
96
  <slot :name="item.slot ? `${item.slot}-label` : 'item-label'" :item="item" :active="active" :index="index">
96
97
  {{ get(item, props.labelKey) }}
97
98
  </slot>
98
99
 
99
- <UIcon v-if="item.target === '_blank' && externalIcon !== false" :name="typeof externalIcon === 'string' ? externalIcon : appConfig.ui.icons.external" :class="ui.linkLabelExternalIcon({ class: props.ui?.linkLabelExternalIcon, active })" />
100
+ <UIcon v-if="item.target === '_blank' && externalIcon !== false" :name="typeof externalIcon === 'string' ? externalIcon : appConfig.ui.icons.external" :class="ui.linkLabelExternalIcon({ class: [props.ui?.linkLabelExternalIcon, item.ui?.linkLabelExternalIcon], active })" />
100
101
  </span>
101
102
 
102
- <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="ui.linkTrailing({ class: props.ui?.linkTrailing })">
103
+ <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="ui.linkTrailing({ class: [props.ui?.linkTrailing, item.ui?.linkTrailing] })">
103
104
  <slot :name="item.slot ? `${item.slot}-trailing` : 'item-trailing'" :item="item" :active="active" :index="index">
104
105
  <UBadge
105
106
  v-if="item.badge"
106
107
  color="neutral"
107
108
  variant="outline"
108
- :size="props.ui?.linkTrailingBadgeSize || ui.linkTrailingBadgeSize()"
109
+ :size="item.ui?.linkTrailingBadgeSize || props.ui?.linkTrailingBadgeSize || ui.linkTrailingBadgeSize()"
109
110
  v-bind="typeof item.badge === 'string' || typeof item.badge === 'number' ? { label: item.badge } : item.badge"
110
- :class="ui.linkTrailingBadge({ class: props.ui?.linkTrailingBadge })"
111
+ :class="ui.linkTrailingBadge({ class: [props.ui?.linkTrailingBadge, item.ui?.linkTrailingBadge] })"
111
112
  />
112
113
 
113
- <UIcon v-if="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content']) || orientation === 'vertical' && item.children?.length" :name="item.trailingIcon || trailingIcon || appConfig.ui.icons.chevronDown" :class="ui.linkTrailingIcon({ class: props.ui?.linkTrailingIcon, active })" />
114
- <UIcon v-else-if="item.trailingIcon" :name="item.trailingIcon" :class="ui.linkTrailingIcon({ class: props.ui?.linkTrailingIcon, active })" />
114
+ <UIcon v-if="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content']) || orientation === 'vertical' && item.children?.length && item.collapsible !== false" :name="item.trailingIcon || trailingIcon || appConfig.ui.icons.chevronDown" :class="ui.linkTrailingIcon({ class: [props.ui?.linkTrailingIcon, item.ui?.linkTrailingIcon], active })" />
115
+ <UIcon v-else-if="item.trailingIcon" :name="item.trailingIcon" :class="ui.linkTrailingIcon({ class: [props.ui?.linkTrailingIcon, item.ui?.linkTrailingIcon], active })" />
115
116
  </slot>
116
117
  </span>
117
118
  </slot>
@@ -119,17 +120,18 @@ const lists = computed(
119
120
 
120
121
  <DefineItemTemplate v-slot="{ item, index, level = 0 }">
121
122
  <component
122
- :is="orientation === 'vertical' && item.children?.length && !collapsed ? UCollapsible : NavigationMenuItem"
123
+ :is="orientation === 'vertical' && item.children?.length ? UCollapsible : NavigationMenuItem"
123
124
  as="li"
124
- :value="item.value || String(index)"
125
+ :value="item.value || `item-${index}`"
125
126
  :default-open="item.defaultOpen"
126
- :unmount-on-hide="orientation === 'vertical' && item.children?.length && !collapsed ? unmountOnHide : void 0"
127
+ :disabled="orientation === 'vertical' && item.children?.length ? item.collapsible === false : void 0"
128
+ :unmount-on-hide="orientation === 'vertical' && item.children?.length ? unmountOnHide : void 0"
127
129
  :open="item.open"
128
130
  >
129
- <div v-if="orientation === 'vertical' && item.type === 'label'" :class="ui.label({ class: props.ui?.label })">
131
+ <div v-if="orientation === 'vertical' && item.type === 'label'" :class="ui.label({ class: [props.ui?.label, item.ui?.label, item.class] })">
130
132
  <ReuseLinkTemplate :item="item" :index="index" />
131
133
  </div>
132
- <ULink v-else-if="item.type !== 'label'" v-slot="{ active, ...slotProps }" v-bind="orientation === 'vertical' && item.children?.length && !collapsed ? {} : pickLinkProps(item)" custom>
134
+ <ULink v-else-if="item.type !== 'label'" v-slot="{ active, ...slotProps }" v-bind="orientation === 'vertical' && item.children?.length && item.collapsible !== false ? {} : pickLinkProps(item)" custom>
133
135
  <component
134
136
  :is="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content']) ? NavigationMenuTrigger : NavigationMenuLink"
135
137
  as-child
@@ -137,27 +139,32 @@ const lists = computed(
137
139
  :disabled="item.disabled"
138
140
  @select="item.onSelect"
139
141
  >
140
- <ULinkBase v-bind="slotProps" :class="ui.link({ class: [props.ui?.link, item.class], active: active || item.active, disabled: !!item.disabled, level: orientation === 'horizontal' || level > 0 })">
142
+ <UTooltip v-if="!!item.tooltip" :content="{ side: 'right' }" v-bind="item.tooltip">
143
+ <ULinkBase v-bind="slotProps" :class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active: active || item.active, disabled: !!item.disabled, level: orientation === 'horizontal' || level > 0 })">
144
+ <ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" />
145
+ </ULinkBase>
146
+ </UTooltip>
147
+ <ULinkBase 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: orientation === 'horizontal' || level > 0 })">
141
148
  <ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" />
142
149
  </ULinkBase>
143
150
  </component>
144
151
 
145
- <NavigationMenuContent v-if="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content'])" v-bind="contentProps" :class="ui.content({ class: props.ui?.content })">
152
+ <NavigationMenuContent v-if="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content'])" v-bind="contentProps" :class="ui.content({ class: [props.ui?.content, item.ui?.content] })">
146
153
  <slot :name="item.slot ? `${item.slot}-content` : 'item-content'" :item="item" :active="active" :index="index">
147
- <ul :class="ui.childList({ class: props.ui?.childList })">
148
- <li v-for="(childItem, childIndex) in item.children" :key="childIndex" :class="ui.childItem({ class: props.ui?.childItem })">
154
+ <ul :class="ui.childList({ class: [props.ui?.childList, item.ui?.childList] })">
155
+ <li v-for="(childItem, childIndex) in item.children" :key="childIndex" :class="ui.childItem({ class: [props.ui?.childItem, item.ui?.childItem] })">
149
156
  <ULink v-slot="{ active: childActive, ...childSlotProps }" v-bind="pickLinkProps(childItem)" custom>
150
157
  <NavigationMenuLink as-child :active="childActive" @select="childItem.onSelect">
151
- <ULinkBase v-bind="childSlotProps" :class="ui.childLink({ class: [props.ui?.childLink, childItem.class], active: childActive })">
152
- <UIcon v-if="childItem.icon" :name="childItem.icon" :class="ui.childLinkIcon({ class: props.ui?.childLinkIcon, active: childActive })" />
158
+ <ULinkBase v-bind="childSlotProps" :class="ui.childLink({ class: [props.ui?.childLink, item.ui?.childLink, childItem.class], active: childActive })">
159
+ <UIcon v-if="childItem.icon" :name="childItem.icon" :class="ui.childLinkIcon({ class: [props.ui?.childLinkIcon, item.ui?.childLinkIcon], active: childActive })" />
153
160
 
154
- <div :class="ui.childLinkWrapper({ class: props.ui?.childLinkWrapper })">
155
- <p :class="ui.childLinkLabel({ class: props.ui?.childLinkLabel, active: childActive })">
161
+ <div :class="ui.childLinkWrapper({ class: [props.ui?.childLinkWrapper, item.ui?.childLinkWrapper] })">
162
+ <p :class="ui.childLinkLabel({ class: [props.ui?.childLinkLabel, item.ui?.childLinkLabel], active: childActive })">
156
163
  {{ get(childItem, props.labelKey) }}
157
164
 
158
- <UIcon v-if="childItem.target === '_blank' && externalIcon !== false" :name="typeof externalIcon === 'string' ? externalIcon : appConfig.ui.icons.external" :class="ui.childLinkLabelExternalIcon({ class: props.ui?.childLinkLabelExternalIcon, active: childActive })" />
165
+ <UIcon v-if="childItem.target === '_blank' && externalIcon !== false" :name="typeof externalIcon === 'string' ? externalIcon : appConfig.ui.icons.external" :class="ui.childLinkLabelExternalIcon({ class: [props.ui?.childLinkLabelExternalIcon, item.ui?.childLinkLabelExternalIcon], active: childActive })" />
159
166
  </p>
160
- <p v-if="childItem.description" :class="ui.childLinkDescription({ class: props.ui?.childLinkDescription, active: childActive })">
167
+ <p v-if="childItem.description" :class="ui.childLinkDescription({ class: [props.ui?.childLinkDescription, item.ui?.childLinkDescription], active: childActive })">
161
168
  {{ childItem.description }}
162
169
  </p>
163
170
  </div>
@@ -170,7 +177,7 @@ const lists = computed(
170
177
  </NavigationMenuContent>
171
178
  </ULink>
172
179
 
173
- <template v-if="orientation === 'vertical' && item.children?.length && !collapsed" #content>
180
+ <template v-if="orientation === 'vertical' && item.children?.length" #content>
174
181
  <ul :class="ui.childList({ class: props.ui?.childList })">
175
182
  <ReuseItemTemplate
176
183
  v-for="(childItem, childIndex) in item.children"
@@ -178,19 +185,19 @@ const lists = computed(
178
185
  :item="childItem"
179
186
  :index="childIndex"
180
187
  :level="level + 1"
181
- :class="ui.childItem({ class: props.ui?.childItem })"
188
+ :class="ui.childItem({ class: [props.ui?.childItem, childItem.ui?.childItem] })"
182
189
  />
183
190
  </ul>
184
191
  </template>
185
192
  </component>
186
193
  </DefineItemTemplate>
187
194
 
188
- <NavigationMenuRoot v-bind="rootProps" :data-collapsed="collapsed" :class="ui.root({ class: [props.class, props.ui?.root] })">
195
+ <NavigationMenuRoot v-bind="rootProps" :data-collapsed="collapsed" :class="ui.root({ class: [props.ui?.root, props.class] })">
189
196
  <slot name="list-leading" />
190
197
 
191
198
  <template v-for="(list, listIndex) in lists" :key="`list-${listIndex}`">
192
199
  <NavigationMenuList :class="ui.list({ class: props.ui?.list })">
193
- <ReuseItemTemplate v-for="(item, index) in list" :key="`list-${listIndex}-${index}`" :item="item" :index="index" :class="ui.item({ class: props.ui?.item })" />
200
+ <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] })" />
194
201
  </NavigationMenuList>
195
202
 
196
203
  <div v-if="orientation === 'vertical' && listIndex < lists.length - 1" :class="ui.separator({ class: props.ui?.separator })" />
@@ -1,10 +1,10 @@
1
1
  import type { NavigationMenuRootProps, NavigationMenuRootEmits, NavigationMenuContentProps, NavigationMenuContentEmits, CollapsibleRootProps } from 'reka-ui';
2
2
  import type { AppConfig } from '@nuxt/schema';
3
3
  import theme from '#build/ui/navigation-menu';
4
- import type { AvatarProps, BadgeProps, LinkProps } from '../types';
4
+ import type { AvatarProps, BadgeProps, LinkProps, TooltipProps } from '../types';
5
5
  import type { ArrayOrNested, DynamicSlots, MergeTypes, NestedItem, EmitsToProps, ComponentConfig } from '../types/utils';
6
6
  type NavigationMenu = ComponentConfig<typeof theme, AppConfig, 'navigationMenu'>;
7
- export interface NavigationMenuChildItem extends Omit<NavigationMenuItem, 'type'> {
7
+ export interface NavigationMenuChildItem extends Omit<NavigationMenuItem, 'type' | 'ui'> {
8
8
  /** Description is only used when `orientation` is `horizontal`. */
9
9
  description?: string;
10
10
  [key: string]: any;
@@ -21,6 +21,12 @@ export interface NavigationMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'cu
21
21
  * `{ size: 'sm', color: 'neutral', variant: 'outline' }`{lang="ts-type"}
22
22
  */
23
23
  badge?: string | number | BadgeProps;
24
+ /**
25
+ * Display a tooltip on the item.
26
+ * Only works when `type` is `link`.
27
+ * `{ content: { side: 'right' } }`{lang="ts-type"}
28
+ */
29
+ tooltip?: TooltipProps;
24
30
  /**
25
31
  * @IconifyIcon
26
32
  */
@@ -32,9 +38,21 @@ export interface NavigationMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'cu
32
38
  */
33
39
  type?: 'label' | 'link';
34
40
  slot?: string;
41
+ /**
42
+ * The value of the item. Avoid using `index` as the value to prevent conflicts in horizontal orientation with Reka UI.
43
+ * @defaultValue `item-${index}`
44
+ */
35
45
  value?: string;
46
+ /**
47
+ * Make the item collapsible.
48
+ * Only works when `orientation` is `vertical`.
49
+ * @defaultValue true
50
+ */
51
+ collapsible?: boolean;
36
52
  children?: NavigationMenuChildItem[];
37
53
  onSelect?(e: Event): void;
54
+ class?: any;
55
+ ui?: Pick<NavigationMenu['slots'], 'item' | 'linkLeadingAvatarSize' | 'linkLeadingAvatar' | 'linkLeadingIcon' | 'linkLabel' | 'linkLabelExternalIcon' | 'linkTrailing' | 'linkTrailingBadgeSize' | 'linkTrailingBadge' | 'linkTrailingIcon' | 'label' | 'link' | 'content' | 'childList' | 'childItem' | 'childLink' | 'childLinkIcon' | 'childLinkWrapper' | 'childLinkLabel' | 'childLinkLabelExternalIcon' | 'childLinkDescription'>;
38
56
  [key: string]: any;
39
57
  }
40
58
  export interface NavigationMenuProps<T extends ArrayOrNested<NavigationMenuItem> = ArrayOrNested<NavigationMenuItem>> extends Pick<NavigationMenuRootProps, 'modelValue' | 'defaultValue' | 'delayDuration' | 'disableClickTrigger' | 'disableHoverTrigger' | 'skipDelayDuration' | 'disablePointerLeaveClose' | 'unmountOnHide'> {
@@ -47,7 +47,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.pagination ||
47
47
  </script>
48
48
 
49
49
  <template>
50
- <PaginationRoot v-slot="{ page, pageCount }" v-bind="rootProps" :class="ui.root({ class: [props.class, props.ui?.root] })">
50
+ <PaginationRoot v-slot="{ page, pageCount }" v-bind="rootProps" :class="ui.root({ class: [props.ui?.root, props.class] })">
51
51
  <PaginationList v-slot="{ items }" :class="ui.list({ class: props.ui?.list })">
52
52
  <PaginationFirst v-if="showControls || !!slots.first" as-child :class="ui.first({ class: props.ui?.first })">
53
53
  <slot name="first">
@@ -75,7 +75,7 @@ defineExpose({
75
75
  v-bind="{ ...rootProps, ...ariaAttrs }"
76
76
  :id="id"
77
77
  :name="name"
78
- :class="ui.root({ class: [props.class, props.ui?.root] })"
78
+ :class="ui.root({ class: [props.ui?.root, props.class] })"
79
79
  @update:model-value="emitFormInput()"
80
80
  @complete="onComplete"
81
81
  >
@@ -109,7 +109,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.progress || {
109
109
  </script>
110
110
 
111
111
  <template>
112
- <Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
112
+ <Primitive :as="as" :class="ui.root({ class: [props.ui?.root, props.class] })">
113
113
  <div v-if="!isIndeterminate && (status || !!slots.status)" :class="ui.status({ class: props.ui?.status })" :style="statusStyle">
114
114
  <slot name="status" :percent="percent">
115
115
  {{ percent }}%
@@ -93,7 +93,7 @@ function onUpdate(value) {
93
93
  v-bind="rootProps"
94
94
  :name="name"
95
95
  :disabled="disabled"
96
- :class="ui.root({ class: [props.class, props.ui?.root] })"
96
+ :class="ui.root({ class: [props.ui?.root, props.class] })"
97
97
  @update:model-value="onUpdate"
98
98
  >
99
99
  <fieldset :class="ui.fieldset({ class: props.ui?.fieldset })" v-bind="ariaAttrs">
@@ -103,25 +103,25 @@ function onUpdate(value) {
103
103
  </slot>
104
104
  </legend>
105
105
 
106
- <component :is="variant === 'list' ? 'div' : Label" v-for="item in normalizedItems" :key="item.value" :class="ui.item({ class: props.ui?.item })">
107
- <div :class="ui.container({ class: props.ui?.container })">
106
+ <component :is="!variant || variant === 'list' ? 'div' : Label" v-for="item in normalizedItems" :key="item.value" :class="ui.item({ class: [props.ui?.item, item.ui?.item, item.class] })">
107
+ <div :class="ui.container({ class: [props.ui?.container, item.ui?.container] })">
108
108
  <RadioGroupItem
109
109
  :id="item.id"
110
110
  :value="item.value"
111
111
  :disabled="item.disabled"
112
- :class="ui.base({ class: props.ui?.base, disabled: item.disabled })"
112
+ :class="ui.base({ class: [props.ui?.base, item.ui?.base], disabled: item.disabled })"
113
113
  >
114
- <RadioGroupIndicator :class="ui.indicator({ class: props.ui?.indicator })" />
114
+ <RadioGroupIndicator :class="ui.indicator({ class: [props.ui?.indicator, item.ui?.indicator] })" />
115
115
  </RadioGroupItem>
116
116
  </div>
117
117
 
118
- <div v-if="item.label || !!slots.label || (item.description || !!slots.description)" :class="ui.wrapper({ class: props.ui?.wrapper })">
119
- <component :is="variant === 'list' ? Label : 'p'" v-if="item.label || !!slots.label" :for="item.id" :class="ui.label({ class: props.ui?.label })">
118
+ <div v-if="item.label || !!slots.label || (item.description || !!slots.description)" :class="ui.wrapper({ class: [props.ui?.wrapper, item.ui?.wrapper] })">
119
+ <component :is="!variant || variant === 'list' ? Label : 'p'" v-if="item.label || !!slots.label" :for="item.id" :class="ui.label({ class: [props.ui?.label, item.ui?.label] })">
120
120
  <slot name="label" :item="item" :model-value="modelValue">
121
121
  {{ item.label }}
122
122
  </slot>
123
123
  </component>
124
- <p v-if="item.description || !!slots.description" :class="ui.description({ class: props.ui?.description })">
124
+ <p v-if="item.description || !!slots.description" :class="ui.description({ class: [props.ui?.description, item.ui?.description] })">
125
125
  <slot name="description" :item="item" :model-value="modelValue">
126
126
  {{ item.description }}
127
127
  </slot>
@@ -9,6 +9,8 @@ export type RadioGroupItem = {
9
9
  description?: string;
10
10
  disabled?: boolean;
11
11
  value?: RadioGroupValue;
12
+ class?: any;
13
+ ui?: Pick<RadioGroup['slots'], 'item' | 'container' | 'base' | 'indicator' | 'wrapper' | 'label' | 'description'>;
12
14
  [key: string]: any;
13
15
  } | RadioGroupValue;
14
16
  export interface RadioGroupProps<T extends RadioGroupItem = RadioGroupItem> extends Pick<RadioGroupRootProps, 'defaultValue' | 'disabled' | 'loop' | 'modelValue' | 'name' | 'required'> {
@@ -118,7 +118,7 @@ function isSelectItem(item) {
118
118
  @update:model-value="onUpdate"
119
119
  @update:open="onUpdateOpen"
120
120
  >
121
- <SelectTrigger :id="id" :class="ui.base({ class: [props.class, props.ui?.base] })" v-bind="{ ...$attrs, ...ariaAttrs }">
121
+ <SelectTrigger :id="id" :class="ui.base({ class: [props.ui?.base, props.class] })" v-bind="{ ...$attrs, ...ariaAttrs }">
122
122
  <span v-if="isLeading || !!avatar || !!slots.leading" :class="ui.leading({ class: props.ui?.leading })">
123
123
  <slot name="leading" :model-value="modelValue" :open="open" :ui="ui">
124
124
  <UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
@@ -132,7 +132,7 @@ function isSelectItem(item) {
132
132
  {{ displayedModelValue }}
133
133
  </span>
134
134
  <span v-else :class="ui.placeholder({ class: props.ui?.placeholder })">
135
- {{ placeholder ?? '\xA0' }}
135
+ {{ placeholder ?? "\xA0" }}
136
136
  </span>
137
137
  </template>
138
138
  </slot>
@@ -151,44 +151,44 @@ function isSelectItem(item) {
151
151
  <SelectViewport :class="ui.viewport({ class: props.ui?.viewport })">
152
152
  <SelectGroup v-for="(group, groupIndex) in groups" :key="`group-${groupIndex}`" :class="ui.group({ class: props.ui?.group })">
153
153
  <template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
154
- <SelectLabel v-if="isSelectItem(item) && item.type === 'label'" :class="ui.label({ class: props.ui?.label })">
154
+ <SelectLabel v-if="isSelectItem(item) && item.type === 'label'" :class="ui.label({ class: [props.ui?.label, item.ui?.label, item.class] })">
155
155
  {{ get(item, props.labelKey) }}
156
156
  </SelectLabel>
157
157
 
158
- <SelectSeparator v-else-if="isSelectItem(item) && item.type === 'separator'" :class="ui.separator({ class: props.ui?.separator })" />
158
+ <SelectSeparator v-else-if="isSelectItem(item) && item.type === 'separator'" :class="ui.separator({ class: [props.ui?.separator, item.ui?.separator, item.class] })" />
159
159
 
160
160
  <SelectItem
161
161
  v-else
162
- :class="ui.item({ class: props.ui?.item })"
162
+ :class="ui.item({ class: [props.ui?.item, isSelectItem(item) && item.ui?.item, isSelectItem(item) && item.class] })"
163
163
  :disabled="isSelectItem(item) && item.disabled"
164
164
  :value="isSelectItem(item) ? get(item, props.valueKey) : item"
165
165
  @select="isSelectItem(item) && item.onSelect?.($event)"
166
166
  >
167
167
  <slot name="item" :item="item" :index="index">
168
168
  <slot name="item-leading" :item="item" :index="index">
169
- <UIcon v-if="isSelectItem(item) && item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: props.ui?.itemLeadingIcon })" />
170
- <UAvatar v-else-if="isSelectItem(item) && item.avatar" :size="props.ui?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: props.ui?.itemLeadingAvatar })" />
169
+ <UIcon v-if="isSelectItem(item) && item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: [props.ui?.itemLeadingIcon, item.ui?.itemLeadingIcon] })" />
170
+ <UAvatar v-else-if="isSelectItem(item) && item.avatar" :size="item.ui?.itemLeadingAvatarSize || props.ui?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: [props.ui?.itemLeadingAvatar, item.ui?.itemLeadingAvatar] })" />
171
171
  <UChip
172
172
  v-else-if="isSelectItem(item) && item.chip"
173
- :size="props.ui?.itemLeadingChipSize || ui.itemLeadingChipSize()"
173
+ :size="item.ui?.itemLeadingChipSize || props.ui?.itemLeadingChipSize || ui.itemLeadingChipSize()"
174
174
  inset
175
175
  standalone
176
176
  v-bind="item.chip"
177
- :class="ui.itemLeadingChip({ class: props.ui?.itemLeadingChip })"
177
+ :class="ui.itemLeadingChip({ class: [props.ui?.itemLeadingChip, item.ui?.itemLeadingChip] })"
178
178
  />
179
179
  </slot>
180
180
 
181
- <SelectItemText :class="ui.itemLabel({ class: props.ui?.itemLabel })">
181
+ <SelectItemText :class="ui.itemLabel({ class: [props.ui?.itemLabel, isSelectItem(item) && item.ui?.itemLabel] })">
182
182
  <slot name="item-label" :item="item" :index="index">
183
183
  {{ isSelectItem(item) ? get(item, props.labelKey) : item }}
184
184
  </slot>
185
185
  </SelectItemText>
186
186
 
187
- <span :class="ui.itemTrailing({ class: props.ui?.itemTrailing })">
187
+ <span :class="ui.itemTrailing({ class: [props.ui?.itemTrailing, isSelectItem(item) && item.ui?.itemTrailing] })">
188
188
  <slot name="item-trailing" :item="item" :index="index" />
189
189
 
190
190
  <SelectItemIndicator as-child>
191
- <UIcon :name="selectedIcon || appConfig.ui.icons.check" :class="ui.itemTrailingIcon({ class: props.ui?.itemTrailingIcon })" />
191
+ <UIcon :name="selectedIcon || appConfig.ui.icons.check" :class="ui.itemTrailingIcon({ class: [props.ui?.itemTrailingIcon, isSelectItem(item) && item.ui?.itemTrailingIcon] })" />
192
192
  </SelectItemIndicator>
193
193
  </span>
194
194
  </slot>
@@ -18,9 +18,11 @@ interface SelectItemBase {
18
18
  * @defaultValue 'item'
19
19
  */
20
20
  type?: 'label' | 'separator' | 'item';
21
- value?: string | number;
21
+ value?: AcceptableValue | boolean;
22
22
  disabled?: boolean;
23
23
  onSelect?(e?: Event): void;
24
+ class?: any;
25
+ ui?: Pick<Select['slots'], 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChipSize' | 'itemLeadingChip' | 'itemLabel' | 'itemTrailing' | 'itemTrailingIcon'>;
24
26
  [key: string]: any;
25
27
  }
26
28
  export type SelectItem = SelectItemBase | AcceptableValue | boolean;