@mp-front/components 0.0.1-next-6 → 0.0.1-next-8
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/components/modal/modal.component.d.ts +28 -1
- package/dist/components/modal/modal.component.d.ts.map +1 -1
- package/dist/components/modal/modal.overlay.d.ts +16 -1
- package/dist/components/modal/modal.overlay.d.ts.map +1 -1
- package/dist/lang/es_MX/index.d.ts +3 -14
- package/dist/lang/es_MX/index.d.ts.map +1 -1
- package/dist/lang/i18n.d.ts +2 -123
- package/dist/lang/i18n.d.ts.map +1 -1
- package/dist/lang/layout/login/index.d.ts +0 -1
- package/dist/lang/layout/login/index.d.ts.map +1 -1
- package/dist/layout/content.component.d.ts.map +1 -1
- package/dist/layout/root-layout.component.d.ts +1 -1
- package/dist/layout/root-layout.component.d.ts.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/ui-components-hooks.cjs +1 -1
- package/dist/ui-components-hooks.js +1 -1
- package/dist/ui-components-index.cjs +5 -6
- package/dist/ui-components-index.js +9 -9
- package/dist/ui-components-layout.cjs +33 -37
- package/dist/ui-components-layout.js +7722 -6279
- package/dist/useTranslation-QicPQnlv.cjs +1 -0
- package/dist/{useTranslation-DlVfOUdM.js → useTranslation-tTfk6apO.js} +43 -33
- package/package.json +3 -3
- package/dist/lang/components/customer-name-card/en_EN/index.d.ts +0 -8
- package/dist/lang/components/customer-name-card/en_EN/index.d.ts.map +0 -1
- package/dist/lang/components/customer-name-card/es_MX/index.d.ts +0 -8
- package/dist/lang/components/customer-name-card/es_MX/index.d.ts.map +0 -1
- package/dist/lang/components/customer-name-card/index.d.ts +0 -3
- package/dist/lang/components/customer-name-card/index.d.ts.map +0 -1
- package/dist/lang/components/index.d.ts +0 -2
- package/dist/lang/components/index.d.ts.map +0 -1
- package/dist/lang/en_US/index.d.ts +0 -44
- package/dist/lang/en_US/index.d.ts.map +0 -1
- package/dist/lang/layout/login/en_EN/index.d.ts +0 -7
- package/dist/lang/layout/login/en_EN/index.d.ts.map +0 -1
- package/dist/useTranslation-CnSCmJou.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const f=require("react"),U=(e,s,n,a)=>{var t,d,h,m;const r=[n,{code:s,...a||{}}];if((d=(t=e==null?void 0:e.services)==null?void 0:t.logger)!=null&&d.forward)return e.services.logger.forward(r,"warn","react-i18next::",!0);N(r[0])&&(r[0]=`react-i18next:: ${r[0]}`),(m=(h=e==null?void 0:e.services)==null?void 0:h.logger)!=null&&m.warn?e.services.logger.warn(...r):console!=null&&console.warn&&console.warn(...r)},L={},E=(e,s,n,a)=>{N(n)&&L[n]||(N(n)&&(L[n]=new Date),U(e,s,n,a))},P=(e,s)=>()=>{if(e.isInitialized)s();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),s()};e.on("initialized",n)}},S=(e,s,n)=>{e.loadNamespaces(s,P(e,n))},A=(e,s,n,a)=>{if(N(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(s)>-1)return S(e,n,a);n.forEach(r=>{e.options.ns.indexOf(r)<0&&e.options.ns.push(r)}),e.loadLanguages(s,P(e,a))},_=(e,s,n={})=>!s.languages||!s.languages.length?(E(s,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:s.languages}),!0):s.hasLoadedNamespace(e,{lng:n.lng,precheck:(a,r)=>{var t;if(((t=n.bindI18n)==null?void 0:t.indexOf("languageChanging"))>-1&&a.services.backendConnector.backend&&a.isLanguageChangingTo&&!r(a.isLanguageChangingTo,e))return!1}}),N=e=>typeof e=="string",q=e=>typeof e=="object"&&e!==null,G=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,$={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},B=e=>$[e],D=e=>e.replace(G,B);let b={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:D};const W=(e={})=>{b={...b,...e}},J=()=>b;let j;const K=e=>{j=e},X=()=>j,k=f.createContext();class Y{constructor(){this.usedNamespaces={}}addUsedNamespaces(s){s.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const Q=(e,s)=>{const n=f.useRef();return f.useEffect(()=>{n.current=e},[e,s]),n.current},H=(e,s,n,a)=>e.getFixedT(s,n,a),Z=(e,s,n,a)=>f.useCallback(H(e,s,n,a),[e,s,n,a]),V=(e,s={})=>{var R,v,z,F;const{i18n:n}=s,{i18n:a,defaultNS:r}=f.useContext(k)||{},t=n||a||X();if(t&&!t.reportNamespaces&&(t.reportNamespaces=new Y),!t){E(t,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const i=(u,l)=>N(l)?l:q(l)&&N(l.defaultValue)?l.defaultValue:Array.isArray(u)?u[u.length-1]:u,c=[i,{},!1];return c.t=i,c.i18n={},c.ready=!1,c}(R=t.options.react)!=null&&R.wait&&E(t,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const d={...J(),...t.options.react,...s},{useSuspense:h,keyPrefix:m}=d;let o=e||r||((v=t.options)==null?void 0:v.defaultNS);o=N(o)?[o]:o||["translation"],(F=(z=t.reportNamespaces).addUsedNamespaces)==null||F.call(z,o);const g=(t.isInitialized||t.initializedStoreOnce)&&o.every(i=>_(i,t,d)),M=Z(t,s.lng||null,d.nsMode==="fallback"?o:o[0],m),C=()=>M,x=()=>H(t,s.lng||null,d.nsMode==="fallback"?o:o[0],m),[I,y]=f.useState(C);let w=o.join();s.lng&&(w=`${s.lng}${w}`);const O=Q(w),p=f.useRef(!0);f.useEffect(()=>{const{bindI18n:i,bindI18nStore:c}=d;p.current=!0,!g&&!h&&(s.lng?A(t,s.lng,o,()=>{p.current&&y(x)}):S(t,o,()=>{p.current&&y(x)})),g&&O&&O!==w&&p.current&&y(x);const u=()=>{p.current&&y(x)};return i&&(t==null||t.on(i,u)),c&&(t==null||t.store.on(c,u)),()=>{p.current=!1,t&&(i==null||i.split(" ").forEach(l=>t.off(l,u))),c&&t&&c.split(" ").forEach(l=>t.store.off(l,u))}},[t,w]),f.useEffect(()=>{p.current&&g&&y(C)},[t,m,g]);const T=[I,t,g];if(T.t=I,T.i18n=t,T.ready=g,g||!g&&!h)return T;throw new Promise(i=>{s.lng?A(t,s.lng,o,()=>i()):S(t,o,()=>i())})};exports.I18nContext=k;exports.setDefaults=W;exports.setI18n=K;exports.useTranslation=V;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createContext as
|
|
2
|
-
const
|
|
1
|
+
import { createContext as U, useContext as _, useState as G, useRef as P, useEffect as x, useCallback as $ } from "react";
|
|
2
|
+
const q = (e, s, n, a) => {
|
|
3
3
|
var t, d, N, m;
|
|
4
4
|
const r = [n, {
|
|
5
5
|
code: s,
|
|
@@ -8,9 +8,9 @@ const G = (e, s, n, a) => {
|
|
|
8
8
|
if ((d = (t = e == null ? void 0 : e.services) == null ? void 0 : t.logger) != null && d.forward)
|
|
9
9
|
return e.services.logger.forward(r, "warn", "react-i18next::", !0);
|
|
10
10
|
p(r[0]) && (r[0] = `react-i18next:: ${r[0]}`), (m = (N = e == null ? void 0 : e.services) == null ? void 0 : N.logger) != null && m.warn ? e.services.logger.warn(...r) : console != null && console.warn && console.warn(...r);
|
|
11
|
-
},
|
|
12
|
-
p(n) &&
|
|
13
|
-
},
|
|
11
|
+
}, R = {}, S = (e, s, n, a) => {
|
|
12
|
+
p(n) && R[n] || (p(n) && (R[n] = /* @__PURE__ */ new Date()), q(e, s, n, a));
|
|
13
|
+
}, j = (e, s) => () => {
|
|
14
14
|
if (e.isInitialized)
|
|
15
15
|
s();
|
|
16
16
|
else {
|
|
@@ -22,13 +22,13 @@ const G = (e, s, n, a) => {
|
|
|
22
22
|
e.on("initialized", n);
|
|
23
23
|
}
|
|
24
24
|
}, b = (e, s, n) => {
|
|
25
|
-
e.loadNamespaces(s,
|
|
26
|
-
},
|
|
25
|
+
e.loadNamespaces(s, j(e, n));
|
|
26
|
+
}, A = (e, s, n, a) => {
|
|
27
27
|
if (p(n) && (n = [n]), e.options.preload && e.options.preload.indexOf(s) > -1) return b(e, n, a);
|
|
28
28
|
n.forEach((r) => {
|
|
29
29
|
e.options.ns.indexOf(r) < 0 && e.options.ns.push(r);
|
|
30
|
-
}), e.loadLanguages(s,
|
|
31
|
-
},
|
|
30
|
+
}), e.loadLanguages(s, j(e, a));
|
|
31
|
+
}, B = (e, s, n = {}) => !s.languages || !s.languages.length ? (S(s, "NO_LANGUAGES", "i18n.languages were undefined or empty", {
|
|
32
32
|
languages: s.languages
|
|
33
33
|
}), !0) : s.hasLoadedNamespace(e, {
|
|
34
34
|
lng: n.lng,
|
|
@@ -36,7 +36,7 @@ const G = (e, s, n, a) => {
|
|
|
36
36
|
var t;
|
|
37
37
|
if (((t = n.bindI18n) == null ? void 0 : t.indexOf("languageChanging")) > -1 && a.services.backendConnector.backend && a.isLanguageChangingTo && !r(a.isLanguageChangingTo, e)) return !1;
|
|
38
38
|
}
|
|
39
|
-
}), p = (e) => typeof e == "string",
|
|
39
|
+
}), p = (e) => typeof e == "string", W = (e) => typeof e == "object" && e !== null, D = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g, J = {
|
|
40
40
|
"&": "&",
|
|
41
41
|
"&": "&",
|
|
42
42
|
"<": "<",
|
|
@@ -57,8 +57,8 @@ const G = (e, s, n, a) => {
|
|
|
57
57
|
"…": "…",
|
|
58
58
|
"/": "/",
|
|
59
59
|
"/": "/"
|
|
60
|
-
},
|
|
61
|
-
let
|
|
60
|
+
}, K = (e) => J[e], X = (e) => e.replace(D, K);
|
|
61
|
+
let E = {
|
|
62
62
|
bindI18n: "languageChanged",
|
|
63
63
|
bindI18nStore: "",
|
|
64
64
|
transEmptyNodeValue: "",
|
|
@@ -66,11 +66,18 @@ let X = {
|
|
|
66
66
|
transWrapTextNodes: "",
|
|
67
67
|
transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
|
|
68
68
|
useSuspense: !0,
|
|
69
|
-
unescape:
|
|
69
|
+
unescape: X
|
|
70
70
|
};
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
const ne = (e = {}) => {
|
|
72
|
+
E = {
|
|
73
|
+
...E,
|
|
74
|
+
...e
|
|
75
|
+
};
|
|
76
|
+
}, Y = () => E;
|
|
77
|
+
let k;
|
|
78
|
+
const ae = (e) => {
|
|
79
|
+
k = e;
|
|
80
|
+
}, Q = () => k, Z = U();
|
|
74
81
|
class V {
|
|
75
82
|
constructor() {
|
|
76
83
|
this.usedNamespaces = {};
|
|
@@ -85,24 +92,24 @@ class V {
|
|
|
85
92
|
}
|
|
86
93
|
}
|
|
87
94
|
const ee = (e, s) => {
|
|
88
|
-
const n =
|
|
95
|
+
const n = P();
|
|
89
96
|
return x(() => {
|
|
90
97
|
n.current = e;
|
|
91
98
|
}, [e, s]), n.current;
|
|
92
|
-
},
|
|
93
|
-
var
|
|
99
|
+
}, H = (e, s, n, a) => e.getFixedT(s, n, a), te = (e, s, n, a) => $(H(e, s, n, a), [e, s, n, a]), oe = (e, s = {}) => {
|
|
100
|
+
var v, z, F, L;
|
|
94
101
|
const {
|
|
95
102
|
i18n: n
|
|
96
103
|
} = s, {
|
|
97
104
|
i18n: a,
|
|
98
105
|
defaultNS: r
|
|
99
|
-
} =
|
|
106
|
+
} = _(Z) || {}, t = n || a || Q();
|
|
100
107
|
if (t && !t.reportNamespaces && (t.reportNamespaces = new V()), !t) {
|
|
101
108
|
S(t, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
|
|
102
|
-
const i = (l, u) => p(u) ? u :
|
|
109
|
+
const i = (l, u) => p(u) ? u : W(u) && p(u.defaultValue) ? u.defaultValue : Array.isArray(l) ? l[l.length - 1] : l, c = [i, {}, !1];
|
|
103
110
|
return c.t = i, c.i18n = {}, c.ready = !1, c;
|
|
104
111
|
}
|
|
105
|
-
(
|
|
112
|
+
(v = t.options.react) != null && v.wait && S(t, "DEPRECATED_OPTION", "useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
|
|
106
113
|
const d = {
|
|
107
114
|
...Y(),
|
|
108
115
|
...t.options.react,
|
|
@@ -111,22 +118,22 @@ const ee = (e, s) => {
|
|
|
111
118
|
useSuspense: N,
|
|
112
119
|
keyPrefix: m
|
|
113
120
|
} = d;
|
|
114
|
-
let o = e || r || ((
|
|
115
|
-
o = p(o) ? [o] : o || ["translation"], (
|
|
116
|
-
const f = (t.isInitialized || t.initializedStoreOnce) && o.every((i) =>
|
|
121
|
+
let o = e || r || ((z = t.options) == null ? void 0 : z.defaultNS);
|
|
122
|
+
o = p(o) ? [o] : o || ["translation"], (L = (F = t.reportNamespaces).addUsedNamespaces) == null || L.call(F, o);
|
|
123
|
+
const f = (t.isInitialized || t.initializedStoreOnce) && o.every((i) => B(i, t, d)), M = te(t, s.lng || null, d.nsMode === "fallback" ? o : o[0], m), C = () => M, T = () => H(t, s.lng || null, d.nsMode === "fallback" ? o : o[0], m), [I, h] = G(C);
|
|
117
124
|
let y = o.join();
|
|
118
125
|
s.lng && (y = `${s.lng}${y}`);
|
|
119
|
-
const
|
|
126
|
+
const O = ee(y), g = P(!0);
|
|
120
127
|
x(() => {
|
|
121
128
|
const {
|
|
122
129
|
bindI18n: i,
|
|
123
130
|
bindI18nStore: c
|
|
124
131
|
} = d;
|
|
125
|
-
g.current = !0, !f && !N && (s.lng ?
|
|
132
|
+
g.current = !0, !f && !N && (s.lng ? A(t, s.lng, o, () => {
|
|
126
133
|
g.current && h(T);
|
|
127
134
|
}) : b(t, o, () => {
|
|
128
135
|
g.current && h(T);
|
|
129
|
-
})), f &&
|
|
136
|
+
})), f && O && O !== y && g.current && h(T);
|
|
130
137
|
const l = () => {
|
|
131
138
|
g.current && h(T);
|
|
132
139
|
};
|
|
@@ -134,14 +141,17 @@ const ee = (e, s) => {
|
|
|
134
141
|
g.current = !1, t && (i == null || i.split(" ").forEach((u) => t.off(u, l))), c && t && c.split(" ").forEach((u) => t.store.off(u, l));
|
|
135
142
|
};
|
|
136
143
|
}, [t, y]), x(() => {
|
|
137
|
-
g.current && f && h(
|
|
144
|
+
g.current && f && h(C);
|
|
138
145
|
}, [t, m, f]);
|
|
139
|
-
const w = [
|
|
140
|
-
if (w.t =
|
|
146
|
+
const w = [I, t, f];
|
|
147
|
+
if (w.t = I, w.i18n = t, w.ready = f, f || !f && !N) return w;
|
|
141
148
|
throw new Promise((i) => {
|
|
142
|
-
s.lng ?
|
|
149
|
+
s.lng ? A(t, s.lng, o, () => i()) : b(t, o, () => i());
|
|
143
150
|
});
|
|
144
151
|
};
|
|
145
152
|
export {
|
|
146
|
-
|
|
153
|
+
Z as I,
|
|
154
|
+
ae as a,
|
|
155
|
+
ne as s,
|
|
156
|
+
oe as u
|
|
147
157
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mp-front/components",
|
|
3
|
-
"version": "0.0.1-next-
|
|
3
|
+
"version": "0.0.1-next-8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/ui-components-index.cjs",
|
|
@@ -96,7 +96,6 @@
|
|
|
96
96
|
"dependencies": {
|
|
97
97
|
"@glidejs/glide": "3.7.1",
|
|
98
98
|
"@mp-front/icons": "0.0.2",
|
|
99
|
-
"@tailwindcss/vite": "4.1.17",
|
|
100
99
|
"@tanstack/react-table": "8.20.6",
|
|
101
100
|
"chart.js": "4.4.7",
|
|
102
101
|
"class-variance-authority": "0.7.1",
|
|
@@ -130,7 +129,8 @@
|
|
|
130
129
|
"@storybook/react-vite": "10.1.10",
|
|
131
130
|
"@storybook/testing-library": "0.2.1",
|
|
132
131
|
"@svgr/webpack": "8.1.0",
|
|
133
|
-
"@tailwindcss/postcss": "4.1.
|
|
132
|
+
"@tailwindcss/postcss": "4.1.18",
|
|
133
|
+
"@tailwindcss/vite": "4.1.18",
|
|
134
134
|
"@testing-library/react": "16.1.0",
|
|
135
135
|
"@types/d3": "7.4.3",
|
|
136
136
|
"@types/d3-scale-chromatic": "3.1.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/lang/components/customer-name-card/en_EN/index.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,WAAW;;;;;CAKhB,CAAA;AAED,eAAe,WAAW,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/lang/components/customer-name-card/es_MX/index.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,WAAW;;;;;CAKhB,CAAA;AAED,eAAe,WAAW,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/lang/components/customer-name-card/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAC1D,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/lang/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
declare const en: {
|
|
2
|
-
translation: {
|
|
3
|
-
customerNameCard: {
|
|
4
|
-
label: string;
|
|
5
|
-
unknown: string;
|
|
6
|
-
};
|
|
7
|
-
header: {
|
|
8
|
-
signOut: string;
|
|
9
|
-
store: string;
|
|
10
|
-
cashRegister: string;
|
|
11
|
-
roleName: string;
|
|
12
|
-
sessionExp: string;
|
|
13
|
-
continueSessionPrefix: string;
|
|
14
|
-
continueSessionSuffix: string;
|
|
15
|
-
};
|
|
16
|
-
common: {
|
|
17
|
-
yes: string;
|
|
18
|
-
accept: string;
|
|
19
|
-
no: string;
|
|
20
|
-
cancel: string;
|
|
21
|
-
send: string;
|
|
22
|
-
save: string;
|
|
23
|
-
name: string;
|
|
24
|
-
names: string;
|
|
25
|
-
lastName: string;
|
|
26
|
-
secondName: string;
|
|
27
|
-
street: string;
|
|
28
|
-
extNumber: string;
|
|
29
|
-
colony: string;
|
|
30
|
-
CP: string;
|
|
31
|
-
upload: string;
|
|
32
|
-
goBack: string;
|
|
33
|
-
goForward: string;
|
|
34
|
-
goToLoginButton: string;
|
|
35
|
-
search: string;
|
|
36
|
-
htmlTitle: string;
|
|
37
|
-
themedark: string;
|
|
38
|
-
goToMenu: string;
|
|
39
|
-
closeMenu: string;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
export default en;
|
|
44
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/lang/en_US/index.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCP,CAAA;AACD,eAAe,EAAE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/lang/layout/login/en_EN/index.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,WAAW;;;;CAIhB,CAAA;AAED,eAAe,WAAW,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const d=require("react"),k=(e,s,n,a)=>{var t,f,h,m;const r=[n,{code:s,...a||{}}];if((f=(t=e==null?void 0:e.services)==null?void 0:t.logger)!=null&&f.forward)return e.services.logger.forward(r,"warn","react-i18next::",!0);N(r[0])&&(r[0]=`react-i18next:: ${r[0]}`),(m=(h=e==null?void 0:e.services)==null?void 0:h.logger)!=null&&m.warn?e.services.logger.warn(...r):console!=null&&console.warn&&console.warn(...r)},F={},x=(e,s,n,a)=>{N(n)&&F[n]||(N(n)&&(F[n]=new Date),k(e,s,n,a))},A=(e,s)=>()=>{if(e.isInitialized)s();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),s()};e.on("initialized",n)}},S=(e,s,n)=>{e.loadNamespaces(s,A(e,n))},L=(e,s,n,a)=>{if(N(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(s)>-1)return S(e,n,a);n.forEach(r=>{e.options.ns.indexOf(r)<0&&e.options.ns.push(r)}),e.loadLanguages(s,A(e,a))},H=(e,s,n={})=>!s.languages||!s.languages.length?(x(s,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:s.languages}),!0):s.hasLoadedNamespace(e,{lng:n.lng,precheck:(a,r)=>{var t;if(((t=n.bindI18n)==null?void 0:t.indexOf("languageChanging"))>-1&&a.services.backendConnector.backend&&a.isLanguageChangingTo&&!r(a.isLanguageChangingTo,e))return!1}}),N=e=>typeof e=="string",M=e=>typeof e=="object"&&e!==null,U=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,_={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},q=e=>_[e],G=e=>e.replace(U,q);let $={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:G};const B=()=>$;let W;const J=()=>W,K=d.createContext();class X{constructor(){this.usedNamespaces={}}addUsedNamespaces(s){s.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const Y=(e,s)=>{const n=d.useRef();return d.useEffect(()=>{n.current=e},[e,s]),n.current},P=(e,s,n,a)=>e.getFixedT(s,n,a),D=(e,s,n,a)=>d.useCallback(P(e,s,n,a),[e,s,n,a]),Q=(e,s={})=>{var O,R,v,z;const{i18n:n}=s,{i18n:a,defaultNS:r}=d.useContext(K)||{},t=n||a||J();if(t&&!t.reportNamespaces&&(t.reportNamespaces=new X),!t){x(t,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const i=(u,l)=>N(l)?l:M(l)&&N(l.defaultValue)?l.defaultValue:Array.isArray(u)?u[u.length-1]:u,c=[i,{},!1];return c.t=i,c.i18n={},c.ready=!1,c}(O=t.options.react)!=null&&O.wait&&x(t,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const f={...B(),...t.options.react,...s},{useSuspense:h,keyPrefix:m}=f;let o=e||r||((R=t.options)==null?void 0:R.defaultNS);o=N(o)?[o]:o||["translation"],(z=(v=t.reportNamespaces).addUsedNamespaces)==null||z.call(v,o);const g=(t.isInitialized||t.initializedStoreOnce)&&o.every(i=>H(i,t,f)),j=D(t,s.lng||null,f.nsMode==="fallback"?o:o[0],m),b=()=>j,E=()=>P(t,s.lng||null,f.nsMode==="fallback"?o:o[0],m),[C,y]=d.useState(b);let w=o.join();s.lng&&(w=`${s.lng}${w}`);const I=Y(w),p=d.useRef(!0);d.useEffect(()=>{const{bindI18n:i,bindI18nStore:c}=f;p.current=!0,!g&&!h&&(s.lng?L(t,s.lng,o,()=>{p.current&&y(E)}):S(t,o,()=>{p.current&&y(E)})),g&&I&&I!==w&&p.current&&y(E);const u=()=>{p.current&&y(E)};return i&&(t==null||t.on(i,u)),c&&(t==null||t.store.on(c,u)),()=>{p.current=!1,t&&(i==null||i.split(" ").forEach(l=>t.off(l,u))),c&&t&&c.split(" ").forEach(l=>t.store.off(l,u))}},[t,w]),d.useEffect(()=>{p.current&&g&&y(b)},[t,m,g]);const T=[C,t,g];if(T.t=C,T.i18n=t,T.ready=g,g||!g&&!h)return T;throw new Promise(i=>{s.lng?L(t,s.lng,o,()=>i()):S(t,o,()=>i())})};exports.useTranslation=Q;
|