@nuxt/ui 4.6.1 → 4.7.1

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 (175) hide show
  1. package/README.md +7 -4
  2. package/cli/package.json +1 -1
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +3 -2
  5. package/dist/runtime/components/Accordion.d.vue.ts +6 -1
  6. package/dist/runtime/components/Accordion.vue +1 -1
  7. package/dist/runtime/components/Accordion.vue.d.ts +6 -1
  8. package/dist/runtime/components/AuthForm.d.vue.ts +22 -29
  9. package/dist/runtime/components/AuthForm.vue +8 -6
  10. package/dist/runtime/components/AuthForm.vue.d.ts +22 -29
  11. package/dist/runtime/components/Button.vue +1 -0
  12. package/dist/runtime/components/Calendar.vue +4 -4
  13. package/dist/runtime/components/Card.d.vue.ts +4 -0
  14. package/dist/runtime/components/Card.vue +16 -2
  15. package/dist/runtime/components/Card.vue.d.ts +4 -0
  16. package/dist/runtime/components/ChatMessage.d.vue.ts +27 -17
  17. package/dist/runtime/components/ChatMessage.vue +10 -16
  18. package/dist/runtime/components/ChatMessage.vue.d.ts +27 -17
  19. package/dist/runtime/components/ChatMessages.d.vue.ts +27 -21
  20. package/dist/runtime/components/ChatMessages.vue +22 -23
  21. package/dist/runtime/components/ChatMessages.vue.d.ts +27 -21
  22. package/dist/runtime/components/ChatPromptSubmit.vue +3 -1
  23. package/dist/runtime/components/Checkbox.vue +5 -3
  24. package/dist/runtime/components/CommandPalette.d.vue.ts +18 -3
  25. package/dist/runtime/components/CommandPalette.vue +11 -7
  26. package/dist/runtime/components/CommandPalette.vue.d.ts +18 -3
  27. package/dist/runtime/components/ContextMenuContent.vue +68 -65
  28. package/dist/runtime/components/DashboardSearch.d.vue.ts +8 -37
  29. package/dist/runtime/components/DashboardSearch.vue +11 -10
  30. package/dist/runtime/components/DashboardSearch.vue.d.ts +8 -37
  31. package/dist/runtime/components/DashboardSidebar.vue +1 -5
  32. package/dist/runtime/components/Drawer.vue +44 -41
  33. package/dist/runtime/components/DropdownMenuContent.vue +90 -87
  34. package/dist/runtime/components/EditorEmojiMenu.d.vue.ts +1 -1
  35. package/dist/runtime/components/EditorEmojiMenu.vue +2 -0
  36. package/dist/runtime/components/EditorEmojiMenu.vue.d.ts +1 -1
  37. package/dist/runtime/components/EditorMentionMenu.d.vue.ts +1 -1
  38. package/dist/runtime/components/EditorMentionMenu.vue +2 -0
  39. package/dist/runtime/components/EditorMentionMenu.vue.d.ts +1 -1
  40. package/dist/runtime/components/EditorSuggestionMenu.d.vue.ts +1 -1
  41. package/dist/runtime/components/EditorSuggestionMenu.vue +2 -0
  42. package/dist/runtime/components/EditorSuggestionMenu.vue.d.ts +1 -1
  43. package/dist/runtime/components/FileUpload.vue +7 -5
  44. package/dist/runtime/components/FormField.d.vue.ts +1 -1
  45. package/dist/runtime/components/FormField.vue.d.ts +1 -1
  46. package/dist/runtime/components/Header.vue +1 -5
  47. package/dist/runtime/components/Input.vue +2 -2
  48. package/dist/runtime/components/InputDate.vue +6 -6
  49. package/dist/runtime/components/InputMenu.d.vue.ts +3 -3
  50. package/dist/runtime/components/InputMenu.vue +40 -38
  51. package/dist/runtime/components/InputMenu.vue.d.ts +3 -3
  52. package/dist/runtime/components/InputNumber.vue +2 -2
  53. package/dist/runtime/components/InputTags.vue +2 -2
  54. package/dist/runtime/components/InputTime.vue +2 -2
  55. package/dist/runtime/components/Link.d.vue.ts +10 -1
  56. package/dist/runtime/components/Link.vue +74 -9
  57. package/dist/runtime/components/Link.vue.d.ts +10 -1
  58. package/dist/runtime/components/Listbox.d.vue.ts +228 -0
  59. package/dist/runtime/components/Listbox.vue +242 -0
  60. package/dist/runtime/components/Listbox.vue.d.ts +228 -0
  61. package/dist/runtime/components/Modal.vue +13 -10
  62. package/dist/runtime/components/Popover.vue +7 -4
  63. package/dist/runtime/components/PricingTable.vue +60 -58
  64. package/dist/runtime/components/RadioGroup.vue +5 -3
  65. package/dist/runtime/components/Select.d.vue.ts +1 -1
  66. package/dist/runtime/components/Select.vue +84 -73
  67. package/dist/runtime/components/Select.vue.d.ts +1 -1
  68. package/dist/runtime/components/SelectMenu.d.vue.ts +3 -3
  69. package/dist/runtime/components/SelectMenu.vue +54 -52
  70. package/dist/runtime/components/SelectMenu.vue.d.ts +3 -3
  71. package/dist/runtime/components/Sidebar.vue +1 -4
  72. package/dist/runtime/components/Slideover.vue +67 -64
  73. package/dist/runtime/components/Table.d.vue.ts +1 -2
  74. package/dist/runtime/components/Table.vue +17 -29
  75. package/dist/runtime/components/Table.vue.d.ts +1 -2
  76. package/dist/runtime/components/Tabs.d.vue.ts +5 -1
  77. package/dist/runtime/components/Tabs.vue +2 -2
  78. package/dist/runtime/components/Tabs.vue.d.ts +5 -1
  79. package/dist/runtime/components/Textarea.d.vue.ts +1 -0
  80. package/dist/runtime/components/Textarea.vue +2 -1
  81. package/dist/runtime/components/Textarea.vue.d.ts +1 -0
  82. package/dist/runtime/components/Tooltip.vue +12 -9
  83. package/dist/runtime/components/content/ContentSearch.d.vue.ts +19 -35
  84. package/dist/runtime/components/content/ContentSearch.vue +10 -9
  85. package/dist/runtime/components/content/ContentSearch.vue.d.ts +19 -35
  86. package/dist/runtime/components/content/ContentToc.vue +19 -9
  87. package/dist/runtime/components/prose/Img.vue +7 -1
  88. package/dist/runtime/components/prose/Pre.vue +8 -3
  89. package/dist/runtime/components/prose/Prompt.d.vue.ts +32 -0
  90. package/dist/runtime/components/prose/Prompt.vue +88 -0
  91. package/dist/runtime/components/prose/Prompt.vue.d.ts +32 -0
  92. package/dist/runtime/composables/index.d.ts +1 -0
  93. package/dist/runtime/composables/index.js +1 -0
  94. package/dist/runtime/composables/useContentSearch.js +19 -5
  95. package/dist/runtime/composables/useEditorMenu.d.ts +5 -0
  96. package/dist/runtime/composables/useEditorMenu.js +3 -1
  97. package/dist/runtime/composables/useFieldGroup.d.ts +3 -0
  98. package/dist/runtime/composables/useFieldGroup.js +11 -1
  99. package/dist/runtime/composables/useResolvedVariants.d.ts +21 -0
  100. package/dist/runtime/composables/useResolvedVariants.js +14 -0
  101. package/dist/runtime/locale/ar.js +9 -0
  102. package/dist/runtime/locale/az.js +9 -0
  103. package/dist/runtime/locale/be.js +9 -0
  104. package/dist/runtime/locale/bg.js +9 -0
  105. package/dist/runtime/locale/bn.js +9 -0
  106. package/dist/runtime/locale/ca.js +9 -0
  107. package/dist/runtime/locale/ckb.js +10 -1
  108. package/dist/runtime/locale/cs.js +9 -0
  109. package/dist/runtime/locale/da.js +9 -0
  110. package/dist/runtime/locale/de.js +9 -0
  111. package/dist/runtime/locale/de_ch.js +9 -0
  112. package/dist/runtime/locale/el.js +9 -0
  113. package/dist/runtime/locale/en.js +10 -1
  114. package/dist/runtime/locale/es.js +9 -0
  115. package/dist/runtime/locale/et.js +9 -0
  116. package/dist/runtime/locale/eu.js +11 -2
  117. package/dist/runtime/locale/fa_ir.js +9 -0
  118. package/dist/runtime/locale/fi.js +9 -0
  119. package/dist/runtime/locale/fr.js +9 -0
  120. package/dist/runtime/locale/gl.js +9 -0
  121. package/dist/runtime/locale/he.js +9 -0
  122. package/dist/runtime/locale/hi.js +9 -0
  123. package/dist/runtime/locale/hr.js +9 -0
  124. package/dist/runtime/locale/hu.js +9 -0
  125. package/dist/runtime/locale/hy.js +9 -0
  126. package/dist/runtime/locale/id.js +9 -0
  127. package/dist/runtime/locale/is.js +9 -0
  128. package/dist/runtime/locale/it.js +9 -0
  129. package/dist/runtime/locale/ja.js +9 -0
  130. package/dist/runtime/locale/ka.js +9 -0
  131. package/dist/runtime/locale/kk.js +9 -0
  132. package/dist/runtime/locale/km.js +9 -0
  133. package/dist/runtime/locale/ko.js +9 -0
  134. package/dist/runtime/locale/ky.js +9 -0
  135. package/dist/runtime/locale/lb.js +11 -2
  136. package/dist/runtime/locale/lo.js +15 -6
  137. package/dist/runtime/locale/lt.js +9 -0
  138. package/dist/runtime/locale/mn.js +9 -0
  139. package/dist/runtime/locale/ms.js +9 -0
  140. package/dist/runtime/locale/nb_no.js +9 -0
  141. package/dist/runtime/locale/nl.js +9 -0
  142. package/dist/runtime/locale/pl.js +9 -0
  143. package/dist/runtime/locale/pt.js +9 -0
  144. package/dist/runtime/locale/pt_br.js +9 -0
  145. package/dist/runtime/locale/ro.js +9 -0
  146. package/dist/runtime/locale/ru.js +9 -0
  147. package/dist/runtime/locale/sk.js +9 -0
  148. package/dist/runtime/locale/sl.js +9 -0
  149. package/dist/runtime/locale/sq.js +9 -0
  150. package/dist/runtime/locale/sv.js +9 -0
  151. package/dist/runtime/locale/th.js +9 -0
  152. package/dist/runtime/locale/tj.js +9 -0
  153. package/dist/runtime/locale/tr.js +9 -0
  154. package/dist/runtime/locale/ug_cn.js +9 -0
  155. package/dist/runtime/locale/uk.js +9 -0
  156. package/dist/runtime/locale/ur.js +9 -0
  157. package/dist/runtime/locale/uz.js +9 -0
  158. package/dist/runtime/locale/vi.js +9 -0
  159. package/dist/runtime/locale/zh_cn.js +9 -0
  160. package/dist/runtime/locale/zh_tw.js +9 -0
  161. package/dist/runtime/plugins/colors.js +1 -1
  162. package/dist/runtime/types/index.d.ts +1 -0
  163. package/dist/runtime/types/index.js +1 -0
  164. package/dist/runtime/types/locale.d.ts +9 -0
  165. package/dist/runtime/types/prose.d.ts +1 -0
  166. package/dist/runtime/types/prose.js +1 -0
  167. package/dist/runtime/utils/link.d.ts +1 -1
  168. package/dist/runtime/utils/link.js +1 -0
  169. package/dist/runtime/vue/overrides/inertia/Link.vue +3 -3
  170. package/dist/runtime/vue/overrides/none/Link.vue +3 -2
  171. package/dist/runtime/vue/overrides/vue-router/Link.vue +27 -31
  172. package/dist/shared/{ui.DJUbBpE2.mjs → ui.C6mn7iap.mjs} +189 -37
  173. package/dist/unplugin.mjs +1 -1
  174. package/dist/vite.mjs +1 -1
  175. package/package.json +49 -40
@@ -57,9 +57,9 @@ const { t } = useLocale();
57
57
  const appConfig = useAppConfig();
58
58
  const uiProp = useComponentUI("inputNumber", props);
59
59
  const rootProps = useForwardPropsEmits(reactivePick(props, "as", "stepSnapping", "formatOptions", "disableWheelChange", "invertWheelChange", "required", "readonly", "focusOnChange"), emits);
60
- const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, id, color, size: formGroupSize, name, highlight, disabled, ariaAttrs } = useFormField(props);
60
+ const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, id, color, size: formFieldSize, name, highlight, disabled, ariaAttrs } = useFormField(props);
61
61
  const { orientation, size: fieldGroupSize } = useFieldGroup(props);
62
- const inputSize = computed(() => fieldGroupSize.value || formGroupSize.value);
62
+ const inputSize = computed(() => fieldGroupSize.value || formFieldSize.value);
63
63
  const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.inputNumber || {} })({
64
64
  color: color.value,
65
65
  variant: props.variant,
@@ -57,10 +57,10 @@ const slots = defineSlots();
57
57
  const appConfig = useAppConfig();
58
58
  const uiProp = useComponentUI("inputTags", props);
59
59
  const rootProps = useForwardPropsEmits(reactivePick(props, "as", "addOnPaste", "addOnTab", "addOnBlur", "duplicate", "delimiter", "max", "convertValue", "displayValue", "required"), emits);
60
- const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, size: formGroupSize, color, id, name, highlight, disabled, ariaAttrs } = useFormField(props);
60
+ const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, size: formFieldSize, color, id, name, highlight, disabled, ariaAttrs } = useFormField(props);
61
61
  const { orientation, size: fieldGroupSize } = useFieldGroup(props);
62
62
  const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(props);
63
- const inputSize = computed(() => fieldGroupSize.value || formGroupSize.value);
63
+ const inputSize = computed(() => fieldGroupSize.value || formFieldSize.value);
64
64
  const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.inputTags || {} })({
65
65
  color: color.value,
66
66
  variant: props.variant,
@@ -60,10 +60,10 @@ const slots = defineSlots();
60
60
  const appConfig = useAppConfig();
61
61
  const uiProp = useComponentUI("inputTime", props);
62
62
  const rootProps = useForwardPropsEmits(reactiveOmit(props, "id", "name", "range", "modelValue", "defaultValue", "color", "variant", "size", "highlight", "fixed", "disabled", "autofocus", "autofocusDelay", "icon", "avatar", "leading", "leadingIcon", "trailing", "trailingIcon", "loading", "loadingIcon", "separatorIcon", "class", "ui"), emits);
63
- const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, id, color, size: formGroupSize, name, highlight, disabled, ariaAttrs } = useFormField(props);
63
+ const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, id, color, size: formFieldSize, name, highlight, disabled, ariaAttrs } = useFormField(props);
64
64
  const { orientation, size: fieldGroupSize } = useFieldGroup(props);
65
65
  const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(props);
66
- const inputSize = computed(() => fieldGroupSize.value || formGroupSize.value);
66
+ const inputSize = computed(() => fieldGroupSize.value || formFieldSize.value);
67
67
  const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.inputTime || {} })({
68
68
  color: color.value,
69
69
  variant: props.variant,
@@ -76,13 +76,22 @@ export interface LinkProps extends NuxtLinkProps, /** @vue-ignore */ Omit<Button
76
76
  custom?: boolean;
77
77
  /** When `true`, only styles from `class`, `activeClass`, and `inactiveClass` will be applied. */
78
78
  raw?: boolean;
79
+ /**
80
+ * Control i18n auto-localization when `@nuxtjs/i18n` is installed.
81
+ * - `undefined` / `true` (default): auto-localizes to the current locale using `$localePath`.
82
+ * Paths already carrying a locale prefix (from e.g. `switchLocalePath()`) are detected
83
+ * and left untouched to prevent double-prefixing.
84
+ * - `false`: explicitly disables auto-localization.
85
+ * - `string`: localizes to a specific locale (e.g. `'fr'`).
86
+ */
87
+ locale?: boolean | string;
79
88
  class?: any;
80
89
  }
81
90
  /**
82
91
  * Link-related props that can be omitted from ButtonProps when link functionality is not needed.
83
92
  * Use this with `Omit<ButtonProps, LinkPropsKeys>` in components where buttons should not act as links.
84
93
  */
85
- export type LinkPropsKeys = 'to' | 'href' | 'target' | 'rel' | 'noRel' | 'external' | 'prefetch' | 'prefetchOn' | 'prefetchedClass' | 'noPrefetch' | 'trailingSlash' | 'replace' | 'ariaCurrentValue' | 'active' | 'activeClass' | 'exact' | 'exactQuery' | 'exactHash' | 'inactiveClass' | 'download' | 'ping' | 'referrerpolicy' | 'hreflang' | 'media';
94
+ export type LinkPropsKeys = 'to' | 'href' | 'target' | 'rel' | 'noRel' | 'external' | 'prefetch' | 'prefetchOn' | 'prefetchedClass' | 'noPrefetch' | 'trailingSlash' | 'replace' | 'ariaCurrentValue' | 'active' | 'activeClass' | 'exact' | 'exactQuery' | 'exactHash' | 'inactiveClass' | 'locale' | 'download' | 'ping' | 'referrerpolicy' | 'hreflang' | 'media';
86
95
  export interface LinkSlots {
87
96
  default?(props: {
88
97
  active: boolean;
@@ -5,10 +5,11 @@ import theme from "#build/ui/link";
5
5
  <script setup>
6
6
  import { computed } from "vue";
7
7
  import { isEqual } from "ohash/utils";
8
- import { useForwardProps } from "reka-ui";
8
+ import { useForwardProps, Slot } from "reka-ui";
9
9
  import { defu } from "defu";
10
+ import { hasProtocol } from "ufo";
10
11
  import { reactiveOmit } from "@vueuse/core";
11
- import { useRoute, useAppConfig } from "#imports";
12
+ import { useRoute, useAppConfig, useNuxtApp } from "#imports";
12
13
  import { mergeClasses } from "../utils";
13
14
  import { tv } from "../utils/tv";
14
15
  import { isPartiallyEqual } from "../utils/link";
@@ -25,6 +26,7 @@ const props = defineProps({
25
26
  inactiveClass: { type: String, required: false },
26
27
  custom: { type: Boolean, required: false },
27
28
  raw: { type: Boolean, required: false },
29
+ locale: { type: [Boolean, String], required: false },
28
30
  class: { type: null, required: false },
29
31
  to: { type: null, required: false },
30
32
  href: { type: null, required: false },
@@ -46,7 +48,8 @@ const props = defineProps({
46
48
  defineSlots();
47
49
  const route = useRoute();
48
50
  const appConfig = useAppConfig();
49
- const nuxtLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "exactQuery", "exactHash", "activeClass", "inactiveClass", "to", "href", "raw", "custom", "class"));
51
+ const nuxtApp = useNuxtApp();
52
+ const nuxtLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "exactQuery", "exactHash", "activeClass", "inactiveClass", "to", "href", "raw", "custom", "locale", "class"));
50
53
  const ui = computed(() => tv({
51
54
  extend: tv(theme),
52
55
  ...defu({
@@ -58,11 +61,47 @@ const ui = computed(() => tv({
58
61
  }
59
62
  }, appConfig.ui?.link || {})
60
63
  }));
61
- const to = computed(() => props.to ?? props.href);
62
- function isLinkActive({ route: linkRoute, isActive, isExactActive }) {
64
+ const to = computed(() => {
65
+ const path = props.to ?? props.href;
66
+ if (!path) return path;
67
+ if (typeof path !== "string") return path;
68
+ if (props.external || hasProtocol(path, { acceptRelative: true })) {
69
+ return path;
70
+ }
71
+ if (props.locale === false) {
72
+ return path;
73
+ }
74
+ const localePath = nuxtApp.$localePath;
75
+ if (!localePath) {
76
+ return path;
77
+ }
78
+ const i18n = nuxtApp.$i18n;
79
+ const codes = i18n?.localeCodes?.value;
80
+ if (codes?.length && new RegExp(`^/(${codes.join("|")})($|[/?#])`).test(path)) {
81
+ return path;
82
+ }
83
+ return localePath(path, typeof props.locale === "string" ? props.locale : void 0);
84
+ });
85
+ const isInternalLink = computed(() => {
86
+ if (!to.value) return false;
87
+ if (props.external) return false;
88
+ if (typeof to.value !== "string") return true;
89
+ if (hasProtocol(to.value, { acceptRelative: true })) return false;
90
+ if (props.target && props.target !== "_self") return false;
91
+ return true;
92
+ });
93
+ const externalRel = computed(() => {
94
+ if (props.noRel) return null;
95
+ if (props.rel) return props.rel;
96
+ return "noopener noreferrer";
97
+ });
98
+ function isLinkActive({ route: linkRoute, isActive, isExactActive } = {}) {
63
99
  if (props.active !== void 0) {
64
100
  return props.active;
65
101
  }
102
+ if (!to.value) {
103
+ return false;
104
+ }
66
105
  if (props.exactQuery === "partial") {
67
106
  if (!isPartiallyEqual(linkRoute.query, route.query)) return false;
68
107
  } else if (props.exactQuery === true) {
@@ -79,7 +118,7 @@ function isLinkActive({ route: linkRoute, isActive, isExactActive }) {
79
118
  }
80
119
  return false;
81
120
  }
82
- function resolveLinkClass({ route: route2, isActive, isExactActive }) {
121
+ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
83
122
  const active = isLinkActive({ route: route2, isActive, isExactActive });
84
123
  if (props.raw) {
85
124
  return [props.class, active ? props.activeClass : props.inactiveClass];
@@ -89,8 +128,8 @@ function resolveLinkClass({ route: route2, isActive, isExactActive }) {
89
128
  </script>
90
129
 
91
130
  <template>
92
- <NuxtLink v-slot="{ href, navigate, route: linkRoute, isActive, isExactActive, ...rest }" v-bind="nuxtLinkProps" :to="to" custom>
93
- <template v-if="custom">
131
+ <NuxtLink v-if="isInternalLink" v-slot="{ href, navigate, route: linkRoute, isActive, isExactActive, ...rest }" v-bind="nuxtLinkProps" :to="to" custom>
132
+ <Slot v-if="custom">
94
133
  <slot
95
134
  v-bind="{
96
135
  ...$attrs,
@@ -106,7 +145,7 @@ function resolveLinkClass({ route: route2, isActive, isExactActive }) {
106
145
  active: isLinkActive({ route: linkRoute, isActive, isExactActive })
107
146
  }"
108
147
  />
109
- </template>
148
+ </Slot>
110
149
  <ULinkBase
111
150
  v-else
112
151
  v-bind="{
@@ -126,4 +165,30 @@ function resolveLinkClass({ route: route2, isActive, isExactActive }) {
126
165
  <slot :active="isLinkActive({ route: linkRoute, isActive, isExactActive })" />
127
166
  </ULinkBase>
128
167
  </NuxtLink>
168
+
169
+ <Slot v-else-if="custom">
170
+ <slot
171
+ v-bind="{
172
+ ...$attrs,
173
+ as,
174
+ type,
175
+ disabled,
176
+ ...to ? { href: String(to), target: props.target, rel: externalRel, isExternal: true } : {},
177
+ active: active ?? false
178
+ }"
179
+ />
180
+ </Slot>
181
+ <ULinkBase
182
+ v-else
183
+ v-bind="{
184
+ ...$attrs,
185
+ as,
186
+ type,
187
+ disabled,
188
+ ...to ? { href: String(to), target: props.target, rel: externalRel, isExternal: true } : {}
189
+ }"
190
+ :class="resolveLinkClass()"
191
+ >
192
+ <slot :active="active ?? false" />
193
+ </ULinkBase>
129
194
  </template>
@@ -76,13 +76,22 @@ export interface LinkProps extends NuxtLinkProps, /** @vue-ignore */ Omit<Button
76
76
  custom?: boolean;
77
77
  /** When `true`, only styles from `class`, `activeClass`, and `inactiveClass` will be applied. */
78
78
  raw?: boolean;
79
+ /**
80
+ * Control i18n auto-localization when `@nuxtjs/i18n` is installed.
81
+ * - `undefined` / `true` (default): auto-localizes to the current locale using `$localePath`.
82
+ * Paths already carrying a locale prefix (from e.g. `switchLocalePath()`) are detected
83
+ * and left untouched to prevent double-prefixing.
84
+ * - `false`: explicitly disables auto-localization.
85
+ * - `string`: localizes to a specific locale (e.g. `'fr'`).
86
+ */
87
+ locale?: boolean | string;
79
88
  class?: any;
80
89
  }
81
90
  /**
82
91
  * Link-related props that can be omitted from ButtonProps when link functionality is not needed.
83
92
  * Use this with `Omit<ButtonProps, LinkPropsKeys>` in components where buttons should not act as links.
84
93
  */
85
- export type LinkPropsKeys = 'to' | 'href' | 'target' | 'rel' | 'noRel' | 'external' | 'prefetch' | 'prefetchOn' | 'prefetchedClass' | 'noPrefetch' | 'trailingSlash' | 'replace' | 'ariaCurrentValue' | 'active' | 'activeClass' | 'exact' | 'exactQuery' | 'exactHash' | 'inactiveClass' | 'download' | 'ping' | 'referrerpolicy' | 'hreflang' | 'media';
94
+ export type LinkPropsKeys = 'to' | 'href' | 'target' | 'rel' | 'noRel' | 'external' | 'prefetch' | 'prefetchOn' | 'prefetchedClass' | 'noPrefetch' | 'trailingSlash' | 'replace' | 'ariaCurrentValue' | 'active' | 'activeClass' | 'exact' | 'exactQuery' | 'exactHash' | 'inactiveClass' | 'locale' | 'download' | 'ping' | 'referrerpolicy' | 'hreflang' | 'media';
86
95
  export interface LinkSlots {
87
96
  default?(props: {
88
97
  active: boolean;
@@ -0,0 +1,228 @@
1
+ import type { VNode } from 'vue';
2
+ import type { ListboxRootEmits, ListboxRootProps } from 'reka-ui';
3
+ import type { AppConfig } from '@nuxt/schema';
4
+ import theme from '#build/ui/listbox';
5
+ import type { AvatarProps, ChipProps, IconProps, InputProps } from '../types';
6
+ import type { ModelModifiers, ApplyModifiers } from '../types/input';
7
+ import type { ArrayOrNested, GetItemKeys, GetModelValue, NestedItem } from '../types/utils';
8
+ import type { ComponentConfig } from '../types/tv';
9
+ type Listbox = ComponentConfig<typeof theme, AppConfig, 'listbox'>;
10
+ export interface ListboxItem {
11
+ label?: string;
12
+ description?: string;
13
+ /**
14
+ * @IconifyIcon
15
+ */
16
+ icon?: IconProps['name'];
17
+ avatar?: AvatarProps;
18
+ chip?: ChipProps;
19
+ /**
20
+ * The item type.
21
+ * @defaultValue 'item'
22
+ */
23
+ type?: 'label' | 'separator' | 'item';
24
+ disabled?: boolean;
25
+ onSelect?: (e: Event) => void;
26
+ class?: any;
27
+ ui?: Pick<Listbox['slots'], 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatar' | 'itemLeadingAvatarSize' | 'itemLeadingChip' | 'itemLeadingChipSize' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemTrailing' | 'itemTrailingIcon'>;
28
+ [key: string]: any;
29
+ }
30
+ export interface ListboxProps<T extends ArrayOrNested<ListboxItem> = ArrayOrNested<ListboxItem>, VK extends GetItemKeys<T> | undefined = undefined, M extends boolean = false, Mod extends Omit<ModelModifiers, 'lazy'> = Omit<ModelModifiers, 'lazy'>> extends Pick<ListboxRootProps, 'by' | 'disabled' | 'highlightOnHover' | 'name' | 'orientation' | 'required' | 'selectionBehavior'> {
31
+ id?: string;
32
+ /**
33
+ * The element or component this component should render as.
34
+ * @defaultValue 'div'
35
+ */
36
+ as?: any;
37
+ /**
38
+ * @defaultValue 'md'
39
+ */
40
+ size?: Listbox['variants']['size'];
41
+ /**
42
+ * The items to display in the list.
43
+ */
44
+ items?: T;
45
+ /**
46
+ * The controlled value of the Listbox. Can be bound with `v-model`.
47
+ */
48
+ modelValue?: ApplyModifiers<GetModelValue<T, VK, M>, Mod>;
49
+ modelModifiers?: Mod;
50
+ /**
51
+ * The default value when not controlled.
52
+ */
53
+ defaultValue?: ApplyModifiers<GetModelValue<T, VK, M>, Mod>;
54
+ /**
55
+ * Whether multiple items can be selected.
56
+ * @defaultValue false
57
+ */
58
+ multiple?: M & boolean;
59
+ /**
60
+ * When `items` is an array of objects, select the field to use as the value instead of the object itself.
61
+ * @defaultValue undefined
62
+ */
63
+ valueKey?: VK;
64
+ /**
65
+ * The key used to get the label from the item.
66
+ * @defaultValue 'label'
67
+ */
68
+ labelKey?: GetItemKeys<T>;
69
+ /**
70
+ * The key used to get the description from the item.
71
+ * @defaultValue 'description'
72
+ */
73
+ descriptionKey?: GetItemKeys<T>;
74
+ /**
75
+ * Whether the list is in a loading state.
76
+ */
77
+ loading?: boolean;
78
+ /**
79
+ * The icon displayed when loading.
80
+ * @defaultValue appConfig.ui.icons.loading
81
+ * @IconifyIcon
82
+ */
83
+ loadingIcon?: IconProps['name'];
84
+ /**
85
+ * Whether to display a filter input or not.
86
+ * Can be an object to pass additional props to the input.
87
+ * `{ placeholder: 'Search...', variant: 'none' }`{lang="ts-type"}
88
+ * @defaultValue false
89
+ */
90
+ filter?: boolean | Omit<InputProps, 'modelValue' | 'defaultValue'>;
91
+ /**
92
+ * The fields to filter by.
93
+ * @defaultValue [labelKey]
94
+ */
95
+ filterFields?: string[];
96
+ /**
97
+ * When `true`, disable the default filters, useful for custom filtering (useAsyncData, useFetch, etc.).
98
+ * @defaultValue false
99
+ */
100
+ ignoreFilter?: boolean;
101
+ /**
102
+ * The icon displayed when an item is selected.
103
+ * @defaultValue appConfig.ui.icons.check
104
+ * @IconifyIcon
105
+ */
106
+ selectedIcon?: IconProps['name'];
107
+ /**
108
+ * Enable virtualization for large lists.
109
+ * @defaultValue false
110
+ */
111
+ virtualize?: boolean | {
112
+ /**
113
+ * Number of items rendered outside the visible area
114
+ * @defaultValue 12
115
+ */
116
+ overscan?: number;
117
+ /**
118
+ * Estimated size (in px) of each item, or a function that returns the size for a given index
119
+ * @defaultValue 32
120
+ */
121
+ estimateSize?: number | ((index: number) => number);
122
+ };
123
+ /** Highlight the ring color like a focus state. */
124
+ highlight?: boolean;
125
+ autofocus?: boolean;
126
+ autofocusDelay?: number;
127
+ class?: any;
128
+ ui?: Listbox['slots'];
129
+ }
130
+ export type ListboxEmits<T extends ArrayOrNested<ListboxItem> = ArrayOrNested<ListboxItem>, VK extends GetItemKeys<T> | undefined = undefined, M extends boolean = false, Mod extends Omit<ModelModifiers, 'lazy'> = Omit<ModelModifiers, 'lazy'>> = Pick<ListboxRootEmits, 'entryFocus' | 'highlight' | 'leave'> & {
131
+ 'change': [event: Event];
132
+ 'update:modelValue': [value: ApplyModifiers<GetModelValue<T, VK, M>, Mod>];
133
+ };
134
+ type SlotProps<T> = (props: {
135
+ item: T;
136
+ index: number;
137
+ ui: Listbox['ui'];
138
+ }) => VNode[];
139
+ export type ListboxSlots<T extends ArrayOrNested<ListboxItem> = ArrayOrNested<ListboxItem>> = {
140
+ 'loading'?(props?: {}): VNode[];
141
+ 'empty'?(props: {
142
+ searchTerm: string;
143
+ }): VNode[];
144
+ 'item'?: SlotProps<NestedItem<T>>;
145
+ 'item-leading'?: SlotProps<NestedItem<T>>;
146
+ 'item-label'?(props: {
147
+ item: NestedItem<T>;
148
+ index: number;
149
+ }): VNode[];
150
+ 'item-description'?(props: {
151
+ item: NestedItem<T>;
152
+ index: number;
153
+ }): VNode[];
154
+ 'item-trailing'?: SlotProps<NestedItem<T>>;
155
+ };
156
+ declare const _default: typeof __VLS_export;
157
+ export default _default;
158
+ declare const __VLS_export: <T extends ArrayOrNested<ListboxItem>, VK extends GetItemKeys<T> | undefined = undefined, M extends boolean = false, Mod extends Omit<ModelModifiers, "lazy"> = Omit<ModelModifiers, "lazy">>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
159
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<(ListboxProps<T, VK, M, Mod> & {
160
+ searchTerm?: string;
161
+ }) & {
162
+ onChange?: ((event: Event) => any) | undefined;
163
+ onHighlight?: ((payload: {
164
+ ref: HTMLElement;
165
+ value: import("reka-ui").AcceptableValue;
166
+ } | undefined) => any) | undefined;
167
+ "onUpdate:modelValue"?: ((value: Mod extends {
168
+ number: true;
169
+ } ? (Mod extends {
170
+ optional: true;
171
+ } ? (Mod extends {
172
+ nullable: true;
173
+ } ? GetModelValue<T, VK, M, undefined> | null : GetModelValue<T, VK, M, undefined>) | undefined : Mod extends {
174
+ nullable: true;
175
+ } ? GetModelValue<T, VK, M, undefined> | null : GetModelValue<T, VK, M, undefined>) extends infer T_1 ? T_1 extends (Mod extends {
176
+ optional: true;
177
+ } ? (Mod extends {
178
+ nullable: true;
179
+ } ? GetModelValue<T, VK, M, undefined> | null : GetModelValue<T, VK, M, undefined>) | undefined : Mod extends {
180
+ nullable: true;
181
+ } ? GetModelValue<T, VK, M, undefined> | null : GetModelValue<T, VK, M, undefined>) ? T_1 extends string ? number | T_1 : T_1 : never : never : Mod extends {
182
+ optional: true;
183
+ } ? (Mod extends {
184
+ nullable: true;
185
+ } ? GetModelValue<T, VK, M, undefined> | null : GetModelValue<T, VK, M, undefined>) | undefined : Mod extends {
186
+ nullable: true;
187
+ } ? GetModelValue<T, VK, M, undefined> | null : GetModelValue<T, VK, M, undefined>) => any) | undefined;
188
+ "onUpdate:searchTerm"?: ((value: string) => any) | undefined;
189
+ onEntryFocus?: ((event: CustomEvent<any>) => any) | undefined;
190
+ onLeave?: ((event: Event) => any) | undefined;
191
+ }> & (typeof globalThis extends {
192
+ __VLS_PROPS_FALLBACK: infer P;
193
+ } ? P : {});
194
+ expose: (exposed: {}) => void;
195
+ attrs: any;
196
+ slots: ListboxSlots<T>;
197
+ emit: (((evt: "change", event: Event) => void) & ((evt: "highlight", payload: {
198
+ ref: HTMLElement;
199
+ value: import("reka-ui").AcceptableValue;
200
+ } | undefined) => void) & ((evt: "update:modelValue", value: Mod extends {
201
+ number: true;
202
+ } ? (Mod extends {
203
+ optional: true;
204
+ } ? (Mod extends {
205
+ nullable: true;
206
+ } ? GetModelValue<T, VK, M, undefined> | null : GetModelValue<T, VK, M, undefined>) | undefined : Mod extends {
207
+ nullable: true;
208
+ } ? GetModelValue<T, VK, M, undefined> | null : GetModelValue<T, VK, M, undefined>) extends infer T_1 ? T_1 extends (Mod extends {
209
+ optional: true;
210
+ } ? (Mod extends {
211
+ nullable: true;
212
+ } ? GetModelValue<T, VK, M, undefined> | null : GetModelValue<T, VK, M, undefined>) | undefined : Mod extends {
213
+ nullable: true;
214
+ } ? GetModelValue<T, VK, M, undefined> | null : GetModelValue<T, VK, M, undefined>) ? T_1 extends string ? number | T_1 : T_1 : never : never : Mod extends {
215
+ optional: true;
216
+ } ? (Mod extends {
217
+ nullable: true;
218
+ } ? GetModelValue<T, VK, M, undefined> | null : GetModelValue<T, VK, M, undefined>) | undefined : Mod extends {
219
+ nullable: true;
220
+ } ? GetModelValue<T, VK, M, undefined> | null : GetModelValue<T, VK, M, undefined>) => void) & ((evt: "entryFocus", event: CustomEvent<any>) => void) & ((evt: "leave", event: Event) => void)) & ((event: "update:searchTerm", value: string) => void);
221
+ }>) => import("vue").VNode & {
222
+ __ctx?: Awaited<typeof __VLS_setup>;
223
+ };
224
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
225
+ [K in keyof T]: T[K];
226
+ } : {
227
+ [K in keyof T as K]: T[K];
228
+ }) & {};