next-language-selector 0.1.3 → 0.1.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.
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/{index.cjs → index.js} +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +7 -3
package/dist/index.d.mts
CHANGED
|
@@ -8,7 +8,7 @@ interface LocaleConfig {
|
|
|
8
8
|
interface LanguageSelectorProps {
|
|
9
9
|
locales: LocaleConfig[];
|
|
10
10
|
defaultLocale: string;
|
|
11
|
-
isDropdown
|
|
11
|
+
isDropdown?: boolean;
|
|
12
12
|
cookieName?: string;
|
|
13
13
|
activeColor?: string;
|
|
14
14
|
className?: string;
|
|
@@ -19,7 +19,7 @@ interface LanguageSelectorProps {
|
|
|
19
19
|
}) => ReactNode;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
declare
|
|
22
|
+
declare function LanguageSelector({ locales, defaultLocale, cookieName, isDropdown, renderCustom, className, activeColor, }: LanguageSelectorProps): React.JSX.Element;
|
|
23
23
|
|
|
24
24
|
declare const setLocaleCookie: (locale: string, cookieName?: string) => void;
|
|
25
25
|
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ interface LocaleConfig {
|
|
|
8
8
|
interface LanguageSelectorProps {
|
|
9
9
|
locales: LocaleConfig[];
|
|
10
10
|
defaultLocale: string;
|
|
11
|
-
isDropdown
|
|
11
|
+
isDropdown?: boolean;
|
|
12
12
|
cookieName?: string;
|
|
13
13
|
activeColor?: string;
|
|
14
14
|
className?: string;
|
|
@@ -19,7 +19,7 @@ interface LanguageSelectorProps {
|
|
|
19
19
|
}) => ReactNode;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
declare
|
|
22
|
+
declare function LanguageSelector({ locales, defaultLocale, cookieName, isDropdown, renderCustom, className, activeColor, }: LanguageSelectorProps): React.JSX.Element;
|
|
23
23
|
|
|
24
24
|
declare const setLocaleCookie: (locale: string, cookieName?: string) => void;
|
|
25
25
|
|
|
@@ -37,7 +37,7 @@ var setLocaleCookie = (locale, cookieName = "NEXT_LOCALE") => {
|
|
|
37
37
|
|
|
38
38
|
// src/selector.tsx
|
|
39
39
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
-
|
|
40
|
+
function LanguageSelector({
|
|
41
41
|
locales,
|
|
42
42
|
defaultLocale,
|
|
43
43
|
cookieName = "NEXT_LOCALE",
|
|
@@ -45,7 +45,7 @@ var LanguageSelector = ({
|
|
|
45
45
|
renderCustom,
|
|
46
46
|
className,
|
|
47
47
|
activeColor = "red"
|
|
48
|
-
})
|
|
48
|
+
}) {
|
|
49
49
|
const [current, setCurrent] = (0, import_react.useState)(defaultLocale);
|
|
50
50
|
(0, import_react.useEffect)(() => {
|
|
51
51
|
const saved = document.cookie.split("; ").find((row) => row.startsWith(`${cookieName}=`))?.split("=")[1];
|
|
@@ -105,7 +105,7 @@ var LanguageSelector = ({
|
|
|
105
105
|
] }, l.code))
|
|
106
106
|
}
|
|
107
107
|
);
|
|
108
|
-
}
|
|
108
|
+
}
|
|
109
109
|
// Annotate the CommonJS export names for ESM import in node:
|
|
110
110
|
0 && (module.exports = {
|
|
111
111
|
LanguageSelector,
|
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ var setLocaleCookie = (locale, cookieName = "NEXT_LOCALE") => {
|
|
|
10
10
|
|
|
11
11
|
// src/selector.tsx
|
|
12
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
|
|
13
|
+
function LanguageSelector({
|
|
14
14
|
locales,
|
|
15
15
|
defaultLocale,
|
|
16
16
|
cookieName = "NEXT_LOCALE",
|
|
@@ -18,7 +18,7 @@ var LanguageSelector = ({
|
|
|
18
18
|
renderCustom,
|
|
19
19
|
className,
|
|
20
20
|
activeColor = "red"
|
|
21
|
-
})
|
|
21
|
+
}) {
|
|
22
22
|
const [current, setCurrent] = useState(defaultLocale);
|
|
23
23
|
useEffect(() => {
|
|
24
24
|
const saved = document.cookie.split("; ").find((row) => row.startsWith(`${cookieName}=`))?.split("=")[1];
|
|
@@ -78,7 +78,7 @@ var LanguageSelector = ({
|
|
|
78
78
|
] }, l.code))
|
|
79
79
|
}
|
|
80
80
|
);
|
|
81
|
-
}
|
|
81
|
+
}
|
|
82
82
|
export {
|
|
83
83
|
LanguageSelector,
|
|
84
84
|
setLocaleCookie
|
package/package.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-language-selector",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Configurable language selector for Next.js",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
10
11
|
"import": "./dist/index.mjs",
|
|
11
|
-
"require": "./dist/index.cjs"
|
|
12
|
+
"require": "./dist/index.cjs",
|
|
13
|
+
"default": "./dist/index.mjs"
|
|
12
14
|
}
|
|
13
15
|
},
|
|
14
16
|
"scripts": {
|
|
@@ -25,6 +27,7 @@
|
|
|
25
27
|
"keywords": [
|
|
26
28
|
"next.js",
|
|
27
29
|
"i18n",
|
|
30
|
+
"language",
|
|
28
31
|
"language-selector",
|
|
29
32
|
"internationalization",
|
|
30
33
|
"react",
|
|
@@ -46,5 +49,6 @@
|
|
|
46
49
|
"tslib": "^2.8.1",
|
|
47
50
|
"tsup": "^8.5.1",
|
|
48
51
|
"typescript": "^5.9.3"
|
|
49
|
-
}
|
|
52
|
+
},
|
|
53
|
+
"sideEffects": false
|
|
50
54
|
}
|