next-intl 2.14.2 → 2.14.4

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.
@@ -1,4 +1,4 @@
1
- import { ComponentProps } from 'react';
1
+ import React, { ComponentProps } from 'react';
2
2
  import BaseLink from '../shared/BaseLink';
3
3
  type Props = Omit<ComponentProps<typeof BaseLink>, 'locale'> & {
4
4
  locale?: string;
@@ -23,5 +23,5 @@ type Props = Omit<ComponentProps<typeof BaseLink>, 'locale'> & {
23
23
  * the `set-cookie` response header would cause the locale cookie on the current
24
24
  * page to be overwritten before the user even decides to change the locale.
25
25
  */
26
- export default function Link({ locale, ...rest }: Props): JSX.Element;
27
- export {};
26
+ declare const _default: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
27
+ export default _default;
@@ -1,4 +1,4 @@
1
- import { ComponentProps } from 'react';
1
+ import React, { ComponentProps } from 'react';
2
2
  import BaseLink from '../shared/BaseLink';
3
3
  type Props = Omit<ComponentProps<typeof BaseLink>, 'locale'> & {
4
4
  locale?: string;
@@ -23,5 +23,5 @@ type Props = Omit<ComponentProps<typeof BaseLink>, 'locale'> & {
23
23
  * the `set-cookie` response header would cause the locale cookie on the current
24
24
  * page to be overwritten before the user even decides to change the locale.
25
25
  */
26
- export default function Link({ locale, ...rest }: Props): JSX.Element;
27
- export {};
26
+ declare const _default: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
27
+ export default _default;
@@ -1,6 +1,10 @@
1
- import React from 'react';
1
+ import React, { forwardRef } from 'react';
2
2
  import useClientLocale from '../client/useClientLocale';
3
3
  import BaseLink from '../shared/BaseLink';
4
+ function Link({ locale, ...rest }, ref) {
5
+ const defaultLocale = useClientLocale();
6
+ return React.createElement(BaseLink, { ref: ref, locale: locale || defaultLocale, ...rest });
7
+ }
4
8
  /**
5
9
  * Wraps `next/link` and prefixes the `href` with the current locale if
6
10
  * necessary.
@@ -21,8 +25,5 @@ import BaseLink from '../shared/BaseLink';
21
25
  * the `set-cookie` response header would cause the locale cookie on the current
22
26
  * page to be overwritten before the user even decides to change the locale.
23
27
  */
24
- export default function Link({ locale, ...rest }) {
25
- const defaultLocale = useClientLocale();
26
- return React.createElement(BaseLink, { locale: locale || defaultLocale, ...rest });
27
- }
28
+ export default forwardRef(Link);
28
29
  //# sourceMappingURL=Link.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Link.js","sourceRoot":"","sources":["../../../src/link/Link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuB,MAAM,OAAO,CAAC;AAC5C,OAAO,eAAe,MAAM,2BAA2B,CAAC;AACxD,OAAO,QAAQ,MAAM,oBAAoB,CAAC;AAM1C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAAC,MAAM,EAAE,GAAG,IAAI,EAAQ;IACnD,MAAM,aAAa,GAAG,eAAe,EAAE,CAAC;IACxC,OAAO,oBAAC,QAAQ,IAAC,MAAM,EAAE,MAAM,IAAI,aAAa,KAAM,IAAI,GAAI,CAAC;AACjE,CAAC"}
1
+ {"version":3,"file":"Link.js","sourceRoot":"","sources":["../../../src/link/Link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,UAAU,EAAC,MAAM,OAAO,CAAC;AACxD,OAAO,eAAe,MAAM,2BAA2B,CAAC;AACxD,OAAO,QAAQ,MAAM,oBAAoB,CAAC;AAM1C,SAAS,IAAI,CAAC,EAAC,MAAM,EAAE,GAAG,IAAI,EAAQ,EAAE,GAAiB;IACvD,MAAM,aAAa,GAAG,eAAe,EAAE,CAAC;IACxC,OAAO,oBAAC,QAAQ,IAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,IAAI,aAAa,KAAM,IAAI,GAAI,CAAC;AAC3E,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAe,UAAU,CAAC,IAAI,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-intl",
3
- "version": "2.14.2",
3
+ "version": "2.14.4",
4
4
  "sideEffects": false,
5
5
  "author": "Jan Amann <jan@amann.work>",
6
6
  "description": "A minimal, but complete solution for internationalization in Next.js apps.",
@@ -10,6 +10,15 @@
10
10
  "type": "git",
11
11
  "url": "https://github.com/amannn/next-intl"
12
12
  },
13
+ "scripts": {
14
+ "build": "pnpm build:default && pnpm build:rsc",
15
+ "build:default": "rm -rf dist && dts build",
16
+ "build:rsc": "tsc && rm -rf dist/test",
17
+ "test": "TZ=Europe/Berlin dts test --testPathIgnorePatterns=dist",
18
+ "lint": "eslint src test && tsc --noEmit",
19
+ "prepublishOnly": "turbo test && turbo lint && turbo build && cp ../../README.md .",
20
+ "postpublish": "git checkout . && rm ./README.md"
21
+ },
13
22
  "main": "dist/index.js",
14
23
  "module": "dist/next-intl.esm.js",
15
24
  "typings": "dist/index.d.ts",
@@ -50,7 +59,7 @@
50
59
  "dependencies": {
51
60
  "@formatjs/intl-localematcher": "^0.2.32",
52
61
  "negotiator": "^0.6.3",
53
- "use-intl": "^2.14.2"
62
+ "use-intl": "^2.14.3"
54
63
  },
55
64
  "peerDependencies": {
56
65
  "next": "^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0",
@@ -75,11 +84,5 @@
75
84
  "engines": {
76
85
  "node": ">=10"
77
86
  },
78
- "scripts": {
79
- "build": "pnpm build:default && pnpm build:rsc",
80
- "build:default": "rm -rf dist && dts build",
81
- "build:rsc": "tsc && rm -rf dist/test",
82
- "test": "TZ=Europe/Berlin dts test --testPathIgnorePatterns=dist",
83
- "lint": "eslint src test && tsc --noEmit"
84
- }
85
- }
87
+ "gitHead": "b7a03d5fa48e44e0d0aecac190c11702819a9a86"
88
+ }
package/src/link/Link.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import React, {ComponentProps} from 'react';
1
+ import React, {ComponentProps, forwardRef} from 'react';
2
2
  import useClientLocale from '../client/useClientLocale';
3
3
  import BaseLink from '../shared/BaseLink';
4
4
 
@@ -6,6 +6,11 @@ type Props = Omit<ComponentProps<typeof BaseLink>, 'locale'> & {
6
6
  locale?: string;
7
7
  };
8
8
 
9
+ function Link({locale, ...rest}: Props, ref: Props['ref']) {
10
+ const defaultLocale = useClientLocale();
11
+ return <BaseLink ref={ref} locale={locale || defaultLocale} {...rest} />;
12
+ }
13
+
9
14
  /**
10
15
  * Wraps `next/link` and prefixes the `href` with the current locale if
11
16
  * necessary.
@@ -26,7 +31,4 @@ type Props = Omit<ComponentProps<typeof BaseLink>, 'locale'> & {
26
31
  * the `set-cookie` response header would cause the locale cookie on the current
27
32
  * page to be overwritten before the user even decides to change the locale.
28
33
  */
29
- export default function Link({locale, ...rest}: Props) {
30
- const defaultLocale = useClientLocale();
31
- return <BaseLink locale={locale || defaultLocale} {...rest} />;
32
- }
34
+ export default forwardRef(Link);