@dxos/react-ui 0.3.11-main.ff3a851 → 0.3.11-next.e28df4f
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/lib/browser/index.mjs +10 -22
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/Avatars/Avatar.d.ts +2 -2
- package/dist/types/src/components/Input/Input.stories.d.ts +1 -1
- package/dist/types/src/components/List/List.stories.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +1 -108
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/index.d.ts +0 -1
- package/dist/types/src/components/ThemeProvider/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useTranslationsContext.d.ts +0 -1
- package/dist/types/src/hooks/useTranslationsContext.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/package.json +6 -7
- package/src/components/List/List.stories.tsx +3 -10
- package/src/components/ThemeProvider/TranslationsProvider.tsx +4 -20
- package/src/components/ThemeProvider/index.ts +0 -1
- package/src/index.ts +1 -1
- package/src/playground/Surfaces.stories.tsx +6 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// packages/ui/react-ui/src/index.ts
|
|
2
|
-
import { Trans } from "react-i18next";
|
|
2
|
+
import { useTranslation, Trans } from "react-i18next";
|
|
3
3
|
export * from "@dxos/react-ui-types";
|
|
4
4
|
export * from "@dxos/react-hooks";
|
|
5
5
|
|
|
@@ -23,16 +23,14 @@ var useElevationContext = (propsElevation) => {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
// packages/ui/react-ui/src/hooks/useTranslationsContext.ts
|
|
26
|
-
import { useContext as
|
|
26
|
+
import { useContext as useContext3 } from "react";
|
|
27
27
|
|
|
28
28
|
// packages/ui/react-ui/src/components/ThemeProvider/TranslationsProvider.tsx
|
|
29
|
-
import { enUS as dtLocaleEnUs } from "date-fns/locale";
|
|
30
29
|
import i18Next from "i18next";
|
|
31
|
-
import React, { useEffect, createContext, useState, Suspense
|
|
32
|
-
import { initReactI18next
|
|
30
|
+
import React, { useEffect, createContext, useState, Suspense } from "react";
|
|
31
|
+
import { initReactI18next } from "react-i18next";
|
|
33
32
|
var initialLng = "en-US";
|
|
34
33
|
var initialNs = "dxos-common";
|
|
35
|
-
var initialDtLocale = dtLocaleEnUs;
|
|
36
34
|
var resources = {
|
|
37
35
|
[initialLng]: {
|
|
38
36
|
[initialNs]: {
|
|
@@ -49,18 +47,9 @@ void i18Next.use(initReactI18next).init({
|
|
|
49
47
|
}
|
|
50
48
|
});
|
|
51
49
|
var TranslationsContext = /* @__PURE__ */ createContext({
|
|
52
|
-
appNs: initialNs
|
|
53
|
-
dtLocale: initialDtLocale
|
|
50
|
+
appNs: initialNs
|
|
54
51
|
});
|
|
55
|
-
var
|
|
56
|
-
const result = useI18NextTranslation(...args);
|
|
57
|
-
const { dtLocale } = useContext3(TranslationsContext);
|
|
58
|
-
return {
|
|
59
|
-
...result,
|
|
60
|
-
dtLocale
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
var TranslationsProvider = ({ fallback, resourceExtensions, children, appNs, dtLocale }) => {
|
|
52
|
+
var TranslationsProvider = ({ fallback, resourceExtensions, children, appNs }) => {
|
|
64
53
|
const [loaded, setLoaded] = useState(false);
|
|
65
54
|
useEffect(() => {
|
|
66
55
|
setLoaded(false);
|
|
@@ -79,8 +68,7 @@ var TranslationsProvider = ({ fallback, resourceExtensions, children, appNs, dtL
|
|
|
79
68
|
]);
|
|
80
69
|
return /* @__PURE__ */ React.createElement(TranslationsContext.Provider, {
|
|
81
70
|
value: {
|
|
82
|
-
appNs: appNs ?? initialNs
|
|
83
|
-
dtLocale: dtLocale ?? initialDtLocale
|
|
71
|
+
appNs: appNs ?? initialNs
|
|
84
72
|
}
|
|
85
73
|
}, /* @__PURE__ */ React.createElement(Suspense, {
|
|
86
74
|
fallback
|
|
@@ -88,11 +76,11 @@ var TranslationsProvider = ({ fallback, resourceExtensions, children, appNs, dtL
|
|
|
88
76
|
};
|
|
89
77
|
|
|
90
78
|
// packages/ui/react-ui/src/hooks/useTranslationsContext.ts
|
|
91
|
-
var useTranslationsContext = () =>
|
|
79
|
+
var useTranslationsContext = () => useContext3(TranslationsContext);
|
|
92
80
|
|
|
93
81
|
// packages/ui/react-ui/src/hooks/useThemeContext.ts
|
|
94
|
-
import { useContext as
|
|
95
|
-
var useThemeContext = () =>
|
|
82
|
+
import { useContext as useContext4 } from "react";
|
|
83
|
+
var useThemeContext = () => useContext4(ThemeContext);
|
|
96
84
|
|
|
97
85
|
// packages/ui/react-ui/src/hooks/useVisualViewport.ts
|
|
98
86
|
import { useEffect as useEffect2, useState as useState2 } from "react";
|