@nocios/crudify-ui 1.0.52 → 1.0.53
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.js +7 -13
- package/dist/index.mjs +7 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -102,19 +102,12 @@ var useTranslationsFromUrl = (url, providedTranslations) => {
|
|
|
102
102
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
103
103
|
var I18nContext = (0, import_react2.createContext)(null);
|
|
104
104
|
var getNestedValue = (obj, path) => {
|
|
105
|
-
if (obj && obj[path])
|
|
106
|
-
return obj[path];
|
|
107
|
-
}
|
|
105
|
+
if (obj && obj[path]) return obj[path];
|
|
108
106
|
return path.split(".").reduce((current, key) => {
|
|
109
107
|
return current && typeof current === "object" ? current[key] : void 0;
|
|
110
108
|
}, obj);
|
|
111
109
|
};
|
|
112
|
-
var I18nProvider = ({
|
|
113
|
-
children,
|
|
114
|
-
translations,
|
|
115
|
-
translationsUrl,
|
|
116
|
-
language = "en"
|
|
117
|
-
}) => {
|
|
110
|
+
var I18nProvider = ({ children, translations, translationsUrl, language = "en" }) => {
|
|
118
111
|
const { translations: loadedTranslations, loading } = useTranslationsFromUrl(translationsUrl, translations);
|
|
119
112
|
const t = (0, import_react2.useMemo)(() => {
|
|
120
113
|
return (key, variables) => {
|
|
@@ -134,9 +127,7 @@ var I18nProvider = ({
|
|
|
134
127
|
}),
|
|
135
128
|
[t, language]
|
|
136
129
|
);
|
|
137
|
-
if (loading) {
|
|
138
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: "Loading translations..." });
|
|
139
|
-
}
|
|
130
|
+
if (loading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: "Loading translations..." });
|
|
140
131
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(I18nContext.Provider, { value: contextValue, children });
|
|
141
132
|
};
|
|
142
133
|
var useTranslation = () => {
|
|
@@ -509,7 +500,10 @@ var LoginForm = ({ config, onNavigate, onLoginSuccess, onError, redirectUrl = "/
|
|
|
509
500
|
}
|
|
510
501
|
)
|
|
511
502
|
] }),
|
|
512
|
-
config.loginActions?.includes("forgotPassword") && /* @__PURE__ */ (0, import_jsx_runtime2.
|
|
503
|
+
config.loginActions?.includes("forgotPassword") && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material.Box, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
504
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material.Link, { sx: { cursor: "pointer" }, onClick: () => onNavigate?.("/login/checkCode"), variant: "body2", color: "primary", children: t("login.alreadyHaveCodeLink") }),
|
|
505
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material.Link, { sx: { cursor: "pointer" }, onClick: () => onNavigate?.("/login/forgotPassword"), variant: "body2", color: "secondary", children: t("login.forgotPasswordLink") })
|
|
506
|
+
] }),
|
|
513
507
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material.Button, { disabled: loading, type: "submit", fullWidth: true, variant: "contained", color: "primary", sx: { mt: 1, mb: 2 }, children: loading ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material.CircularProgress, { size: 20 }) : t("login.loginButton") })
|
|
514
508
|
]
|
|
515
509
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -58,19 +58,12 @@ var useTranslationsFromUrl = (url, providedTranslations) => {
|
|
|
58
58
|
import { jsx } from "react/jsx-runtime";
|
|
59
59
|
var I18nContext = createContext(null);
|
|
60
60
|
var getNestedValue = (obj, path) => {
|
|
61
|
-
if (obj && obj[path])
|
|
62
|
-
return obj[path];
|
|
63
|
-
}
|
|
61
|
+
if (obj && obj[path]) return obj[path];
|
|
64
62
|
return path.split(".").reduce((current, key) => {
|
|
65
63
|
return current && typeof current === "object" ? current[key] : void 0;
|
|
66
64
|
}, obj);
|
|
67
65
|
};
|
|
68
|
-
var I18nProvider = ({
|
|
69
|
-
children,
|
|
70
|
-
translations,
|
|
71
|
-
translationsUrl,
|
|
72
|
-
language = "en"
|
|
73
|
-
}) => {
|
|
66
|
+
var I18nProvider = ({ children, translations, translationsUrl, language = "en" }) => {
|
|
74
67
|
const { translations: loadedTranslations, loading } = useTranslationsFromUrl(translationsUrl, translations);
|
|
75
68
|
const t = useMemo(() => {
|
|
76
69
|
return (key, variables) => {
|
|
@@ -90,9 +83,7 @@ var I18nProvider = ({
|
|
|
90
83
|
}),
|
|
91
84
|
[t, language]
|
|
92
85
|
);
|
|
93
|
-
if (loading) {
|
|
94
|
-
return /* @__PURE__ */ jsx("div", { children: "Loading translations..." });
|
|
95
|
-
}
|
|
86
|
+
if (loading) return /* @__PURE__ */ jsx("div", { children: "Loading translations..." });
|
|
96
87
|
return /* @__PURE__ */ jsx(I18nContext.Provider, { value: contextValue, children });
|
|
97
88
|
};
|
|
98
89
|
var useTranslation = () => {
|
|
@@ -465,7 +456,10 @@ var LoginForm = ({ config, onNavigate, onLoginSuccess, onError, redirectUrl = "/
|
|
|
465
456
|
}
|
|
466
457
|
)
|
|
467
458
|
] }),
|
|
468
|
-
config.loginActions?.includes("forgotPassword") && /* @__PURE__ */
|
|
459
|
+
config.loginActions?.includes("forgotPassword") && /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
460
|
+
/* @__PURE__ */ jsx2(Link, { sx: { cursor: "pointer" }, onClick: () => onNavigate?.("/login/checkCode"), variant: "body2", color: "primary", children: t("login.alreadyHaveCodeLink") }),
|
|
461
|
+
/* @__PURE__ */ jsx2(Link, { sx: { cursor: "pointer" }, onClick: () => onNavigate?.("/login/forgotPassword"), variant: "body2", color: "secondary", children: t("login.forgotPasswordLink") })
|
|
462
|
+
] }),
|
|
469
463
|
/* @__PURE__ */ jsx2(Button, { disabled: loading, type: "submit", fullWidth: true, variant: "contained", color: "primary", sx: { mt: 1, mb: 2 }, children: loading ? /* @__PURE__ */ jsx2(CircularProgress, { size: 20 }) : t("login.loginButton") })
|
|
470
464
|
]
|
|
471
465
|
}
|