@pantoken/react 0.1.11 → 0.1.13
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 +5 -2
- package/dist/index.mjs +5 -3
- package/package.json +2 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { register } from "@pantoken/web-components";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
+
import { LocaleBundle, registerLocalized } from "@pantoken/i18n";
|
|
3
4
|
//#region src/index.d.ts
|
|
4
5
|
/**
|
|
5
6
|
* Read a resolved token value from the document. Returns `fallback` on the server.
|
|
@@ -46,6 +47,8 @@ declare function Icon({ name, size, color }: IconProps): ReactNode;
|
|
|
46
47
|
/** Props for {@link TokenProvider}. */
|
|
47
48
|
interface TokenProviderProps {
|
|
48
49
|
children?: ReactNode;
|
|
50
|
+
/** BCP47 locale tag or a pre-built {@link LocaleBundle}. When set, uses `registerLocalized`. */
|
|
51
|
+
locale?: string | LocaleBundle;
|
|
49
52
|
}
|
|
50
53
|
/**
|
|
51
54
|
* Register the pantoken custom elements (client-side) and render children.
|
|
@@ -64,6 +67,6 @@ interface TokenProviderProps {
|
|
|
64
67
|
* }
|
|
65
68
|
* ```
|
|
66
69
|
*/
|
|
67
|
-
declare function TokenProvider({ children }: TokenProviderProps): ReactNode;
|
|
70
|
+
declare function TokenProvider({ children, locale }: TokenProviderProps): ReactNode;
|
|
68
71
|
//#endregion
|
|
69
|
-
export { Icon, IconProps, TokenProvider, TokenProviderProps, readToken, register, useToken };
|
|
72
|
+
export { Icon, IconProps, TokenProvider, TokenProviderProps, readToken, register, registerLocalized, useToken };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { register, register as register$1 } from "@pantoken/web-components";
|
|
2
2
|
import { createElement, useEffect, useState } from "react";
|
|
3
|
+
import { registerLocalized, registerLocalized as registerLocalized$1 } from "@pantoken/i18n";
|
|
3
4
|
//#region src/index.tsx
|
|
4
5
|
/**
|
|
5
6
|
* `@pantoken/react` — thin React helpers over `@pantoken/web-components` and the token CSS.
|
|
@@ -80,11 +81,12 @@ function Icon({ name, size, color }) {
|
|
|
80
81
|
* }
|
|
81
82
|
* ```
|
|
82
83
|
*/
|
|
83
|
-
function TokenProvider({ children }) {
|
|
84
|
+
function TokenProvider({ children, locale }) {
|
|
84
85
|
useEffect(() => {
|
|
85
|
-
|
|
86
|
+
if (locale) registerLocalized$1(locale);
|
|
87
|
+
else register$1();
|
|
86
88
|
}, []);
|
|
87
89
|
return children ?? null;
|
|
88
90
|
}
|
|
89
91
|
//#endregion
|
|
90
|
-
export { Icon, TokenProvider, readToken, register, useToken };
|
|
92
|
+
export { Icon, TokenProvider, readToken, register, registerLocalized, useToken };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pantoken/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"description": "React helpers for pantoken: <Icon>, useToken, and TokenProvider over the web components + token CSS.",
|
|
5
5
|
"homepage": "https://pantoken.iywahl.com",
|
|
6
6
|
"bugs": "https://github.com/thedannywahl/pantoken/issues",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"check": "vp check"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
+
"@pantoken/i18n": "workspace:*",
|
|
36
37
|
"@pantoken/web-components": "workspace:*"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|