@nuxt/ui 4.7.0 → 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.
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/ui",
3
- "version": "4.7.0",
3
+ "version": "4.7.1",
4
4
  "docs": "https://ui.nuxt.com/docs/getting-started/installation/nuxt",
5
5
  "configKey": "ui",
6
6
  "compatibility": {
package/dist/module.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defu } from 'defu';
2
2
  import { defineNuxtModule, createResolver, addPlugin, hasNuxtModule, addComponentsDir, addImportsDir, addImports } from '@nuxt/kit';
3
- import { d as defaultOptions, r as resolveColors, a as getDefaultConfig, p as publicComposables, b as addTemplates } from './shared/ui.BIQuJqNV.mjs';
3
+ import { d as defaultOptions, r as resolveColors, a as getDefaultConfig, p as publicComposables, b as addTemplates } from './shared/ui.C6mn7iap.mjs';
4
4
  import '../dist/runtime/utils/index.js';
5
5
  import 'node:url';
6
6
  import 'scule';
@@ -11,7 +11,7 @@ import 'pathe';
11
11
  import 'tinyglobby';
12
12
 
13
13
  const name = "@nuxt/ui";
14
- const version = "4.7.0";
14
+ const version = "4.7.1";
15
15
 
16
16
  const module$1 = defineNuxtModule({
17
17
  meta: {
@@ -47,6 +47,7 @@ const props = defineProps({
47
47
  exactQuery: { type: [Boolean, String], required: false },
48
48
  exactHash: { type: Boolean, required: false },
49
49
  inactiveClass: { type: String, required: false },
50
+ locale: { type: [Boolean, String], required: false },
50
51
  to: { type: null, required: false },
51
52
  href: { type: null, required: false },
52
53
  external: { type: Boolean, required: false },
@@ -11,7 +11,7 @@ export interface FormFieldProps {
11
11
  as?: any;
12
12
  /** The name of the FormField. Also used to match form errors. */
13
13
  name?: string;
14
- /** A regular expression to match form error names. */
14
+ /** A regular expression to match form error names. Useful for components with array values such as InputTags, where errors include array indices in their name (e.g. `tags.0`). */
15
15
  errorPattern?: RegExp;
16
16
  label?: string;
17
17
  description?: string;
@@ -11,7 +11,7 @@ export interface FormFieldProps {
11
11
  as?: any;
12
12
  /** The name of the FormField. Also used to match form errors. */
13
13
  name?: string;
14
- /** A regular expression to match form error names. */
14
+ /** A regular expression to match form error names. Useful for components with array values such as InputTags, where errors include array indices in their name (e.g. `tags.0`). */
15
15
  errorPattern?: RegExp;
16
16
  label?: string;
17
17
  description?: string;
@@ -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;
@@ -26,6 +26,7 @@ const props = defineProps({
26
26
  inactiveClass: { type: String, required: false },
27
27
  custom: { type: Boolean, required: false },
28
28
  raw: { type: Boolean, required: false },
29
+ locale: { type: [Boolean, String], required: false },
29
30
  class: { type: null, required: false },
30
31
  to: { type: null, required: false },
31
32
  href: { type: null, required: false },
@@ -48,7 +49,7 @@ defineSlots();
48
49
  const route = useRoute();
49
50
  const appConfig = useAppConfig();
50
51
  const nuxtApp = useNuxtApp();
51
- const nuxtLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "exactQuery", "exactHash", "activeClass", "inactiveClass", "to", "href", "raw", "custom", "class"));
52
+ const nuxtLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "exactQuery", "exactHash", "activeClass", "inactiveClass", "to", "href", "raw", "custom", "locale", "class"));
52
53
  const ui = computed(() => tv({
53
54
  extend: tv(theme),
54
55
  ...defu({
@@ -67,11 +68,19 @@ const to = computed(() => {
67
68
  if (props.external || hasProtocol(path, { acceptRelative: true })) {
68
69
  return path;
69
70
  }
71
+ if (props.locale === false) {
72
+ return path;
73
+ }
70
74
  const localePath = nuxtApp.$localePath;
71
- if (localePath) {
72
- return localePath(path);
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;
73
82
  }
74
- return path;
83
+ return localePath(path, typeof props.locale === "string" ? props.locale : void 0);
75
84
  });
76
85
  const isInternalLink = computed(() => {
77
86
  if (!to.value) return false;
@@ -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;
@@ -38,6 +38,11 @@ if (props.zoom) {
38
38
  useEventListener(window, "scroll", () => {
39
39
  open.value = false;
40
40
  });
41
+ useEventListener(window, "keydown", (e) => {
42
+ if (e.key === "Escape" && open.value) {
43
+ open.value = false;
44
+ }
45
+ });
41
46
  }
42
47
  </script>
43
48
 
@@ -1,5 +1,5 @@
1
1
  import type { LinkProps } from '../types';
2
- export declare const linkKeys: readonly ["active", "activeClass", "ariaCurrentValue", "as", "disabled", "download", "exact", "exactActiveClass", "exactHash", "exactQuery", "external", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "href", "hreflang", "inactiveClass", "media", "noPrefetch", "noRel", "onClick", "ping", "prefetch", "prefetchOn", "prefetchedClass", "referrerpolicy", "rel", "replace", "target", "title", "to", "trailingSlash", "type", "viewTransition"];
2
+ export declare const linkKeys: readonly ["active", "activeClass", "ariaCurrentValue", "as", "disabled", "download", "exact", "exactActiveClass", "exactHash", "exactQuery", "external", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "href", "hreflang", "inactiveClass", "locale", "media", "noPrefetch", "noRel", "onClick", "ping", "prefetch", "prefetchOn", "prefetchedClass", "referrerpolicy", "rel", "replace", "target", "title", "to", "trailingSlash", "type", "viewTransition"];
3
3
  export declare function pickLinkProps(link: LinkProps & {
4
4
  [key: string]: any;
5
5
  }): import("@vueuse/shared").ReactivePickReturn<LinkProps & {
@@ -21,6 +21,7 @@ export const linkKeys = [
21
21
  "href",
22
22
  "hreflang",
23
23
  "inactiveClass",
24
+ "locale",
24
25
  "media",
25
26
  "noPrefetch",
26
27
  "noRel",
@@ -1242,7 +1242,7 @@ const chatMessage = (options) => ({
1242
1242
  leadingAvatarSize: "",
1243
1243
  files: "flex items-center gap-1.5 mb-1.5",
1244
1244
  content: "relative text-pretty min-w-0 *:first:mt-0 *:last:mb-0",
1245
- actions: ["opacity-0 group-hover/message:opacity-100 absolute bottom-0 flex items-center", options.theme.transitions && "transition-opacity"]
1245
+ actions: ["[@media(hover:hover)]:opacity-0 group-hover/message:opacity-100 absolute bottom-0 flex items-center", options.theme.transitions && "transition-opacity"]
1246
1246
  },
1247
1247
  variants: {
1248
1248
  variant: {
@@ -2237,7 +2237,7 @@ const drawer = (options) => ({
2237
2237
  handle: "mb-4"
2238
2238
  },
2239
2239
  right: {
2240
- content: "flex-row",
2240
+ content: "flex-row rtl:flex-row-reverse",
2241
2241
  handle: "!ml-4"
2242
2242
  },
2243
2243
  bottom: {
@@ -2245,7 +2245,7 @@ const drawer = (options) => ({
2245
2245
  handle: "mt-4"
2246
2246
  },
2247
2247
  left: {
2248
- content: "flex-row-reverse",
2248
+ content: "flex-row-reverse rtl:flex-row",
2249
2249
  handle: "!mr-4"
2250
2250
  }
2251
2251
  },
@@ -7480,11 +7480,11 @@ const pre = {
7480
7480
 
7481
7481
  const prompt = {
7482
7482
  slots: {
7483
- root: "relative flex items-center gap-2 border border-muted bg-muted rounded-md px-4 py-3 my-5 last:mb-0",
7483
+ root: "relative flex flex-wrap items-center gap-2 border border-muted bg-muted rounded-md px-4 py-3 my-5 last:mb-0",
7484
7484
  icon: "size-4 shrink-0 text-highlighted",
7485
- content: "flex-1 min-w-0",
7485
+ content: "min-w-0",
7486
7486
  description: "text-sm/6 text-default font-medium",
7487
- actions: "flex items-center shrink-0 gap-1.5"
7487
+ actions: "flex flex-wrap items-center gap-1.5 ms-auto"
7488
7488
  }
7489
7489
  };
7490
7490
 
package/dist/unplugin.mjs CHANGED
@@ -3,7 +3,7 @@ import { join, normalize } from 'pathe';
3
3
  import { createUnplugin } from 'unplugin';
4
4
  import { defu } from 'defu';
5
5
  import tailwind from '@tailwindcss/vite';
6
- import { g as getTemplates, p as publicComposables, d as defaultOptions, r as resolveColors, a as getDefaultConfig } from './shared/ui.BIQuJqNV.mjs';
6
+ import { g as getTemplates, p as publicComposables, d as defaultOptions, r as resolveColors, a as getDefaultConfig } from './shared/ui.C6mn7iap.mjs';
7
7
  import fs from 'node:fs';
8
8
  import path from 'node:path';
9
9
  import MagicString from 'magic-string';
package/dist/vite.mjs CHANGED
@@ -4,7 +4,7 @@ import 'pathe';
4
4
  import 'unplugin';
5
5
  import 'defu';
6
6
  import '@tailwindcss/vite';
7
- import './shared/ui.BIQuJqNV.mjs';
7
+ import './shared/ui.C6mn7iap.mjs';
8
8
  import '../dist/runtime/utils/index.js';
9
9
  import 'scule';
10
10
  import 'knitwork';
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@nuxt/ui",
3
3
  "description": "A UI Library for Modern Web Apps, powered by Vue & Tailwind CSS.",
4
- "version": "4.7.0",
5
- "packageManager": "pnpm@10.33.1",
4
+ "version": "4.7.1",
5
+ "packageManager": "pnpm@10.33.2",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/nuxt/ui.git"
@@ -200,7 +200,7 @@
200
200
  "@release-it/conventional-changelog": "^10.0.6",
201
201
  "@tanstack/table-core": "^8.21.3",
202
202
  "@vitejs/plugin-vue": "^6.0.5",
203
- "@vue/test-utils": "^2.4.6",
203
+ "@vue/test-utils": "^2.4.8",
204
204
  "ai": "^6.0.168",
205
205
  "embla-carousel": "^8.6.0",
206
206
  "eslint": "^10.2.1",