gt-react 4.0.13 → 4.0.16
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/hooks/useGT.d.ts.map +1 -1
- package/dist/hooks/useGT.js +13 -3
- package/dist/hooks/useGT.js.map +1 -1
- package/dist/variables/DateTime.d.ts +9 -9
- package/dist/variables/DateTime.d.ts.map +1 -1
- package/dist/variables/DateTime.js +3 -2
- package/dist/variables/DateTime.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGT.d.ts","sourceRoot":"","sources":["../../src/hooks/useGT.ts"],"names":[],"mappings":"AAEA,OAAc,EAAE,SAAS,EAAe,MAAM,OAAO,CAAC;AAGtD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,GAAE,MAAW,GACzC,CACI,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,CAAC,CAAC,EAAE,QAAQ,KACX,SAAS,
|
|
1
|
+
{"version":3,"file":"useGT.d.ts","sourceRoot":"","sources":["../../src/hooks/useGT.ts"],"names":[],"mappings":"AAEA,OAAc,EAAE,SAAS,EAAe,MAAM,OAAO,CAAC;AAGtD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,GAAE,MAAW,GACzC,CACI,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,CAAC,CAAC,EAAE,QAAQ,KACX,SAAS,CAmCjB"}
|
package/dist/hooks/useGT.js
CHANGED
|
@@ -29,8 +29,16 @@ function useGT(id) {
|
|
|
29
29
|
};
|
|
30
30
|
// Get the translation context
|
|
31
31
|
var translate = (0, GTContext_1.default)("useGT('".concat(id, "'): No context provided. You're trying to get the t() function on the client, which can only be done inside a <GTProvider>.")).translate;
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Translates a dictionary item based on its `id` and options.
|
|
34
|
+
*
|
|
35
|
+
* @param {string} [id=''] - The ID of the item in the dictionary to translate.
|
|
36
|
+
* @param {Record<string, any>} [options={}] - Variables or parameters (e.g., `n`) passed into the translation for dynamic content.
|
|
37
|
+
* @param {Function} [f] - `f` is executed with `options` as parameters, and its result is translated based on the dictionary value of `id`. You likely don't need this parameter unless you are using `gt-next`.
|
|
38
|
+
*
|
|
39
|
+
* @returns {string | JSX.Element}
|
|
40
|
+
*/
|
|
41
|
+
function t(id, options, f) {
|
|
34
42
|
if (id === void 0) { id = ''; }
|
|
35
43
|
if (options === void 0) { options = {}; }
|
|
36
44
|
var prefixedID = getID(id);
|
|
@@ -38,6 +46,8 @@ function useGT(id) {
|
|
|
38
46
|
if (!translation)
|
|
39
47
|
console.warn("t('".concat(id, "') finding no translation for dictionary item ").concat(prefixedID, " !"));
|
|
40
48
|
return translation;
|
|
41
|
-
}
|
|
49
|
+
}
|
|
50
|
+
;
|
|
51
|
+
return t;
|
|
42
52
|
}
|
|
43
53
|
//# sourceMappingURL=useGT.js.map
|
package/dist/hooks/useGT.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGT.js","sourceRoot":"","sources":["../../src/hooks/useGT.ts"],"names":[],"mappings":";AAAA,YAAY,CAAA;;;;;AAkBZ,
|
|
1
|
+
{"version":3,"file":"useGT.js","sourceRoot":"","sources":["../../src/hooks/useGT.ts"],"names":[],"mappings":";AAAA,YAAY,CAAA;;;;;AAkBZ,wBAwCC;AAvDD,oEAAiD;AAEjD;;;;;;;;;;;;GAYG;AACH,SAAwB,KAAK,CAAC,EAAe;IAAf,mBAAA,EAAA,OAAe;IAOzC,4DAA4D;IAC5D,IAAM,KAAK,GAAG,UAAC,MAAc;QACzB,IAAI,EAAE,IAAI,MAAM;YAAE,OAAO,UAAG,EAAE,cAAI,MAAM,CAAE,CAAC;QAC3C,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;IAC5B,CAAC,CAAA;IAED,8BAA8B;IACtB,IAAA,SAAS,GAAK,IAAA,mBAAY,EAC9B,iBAAU,EAAE,gIAA6H,CAC5I,UAFgB,CAEf;IAGF;;;;;;;;MAQE;IACF,SAAS,CAAC,CACN,EAAe,EACf,OAAiC,EACjC,CAAY;QAFZ,mBAAA,EAAA,OAAe;QACf,wBAAA,EAAA,YAAiC;QAGjC,IAAM,UAAU,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC;QAC7B,IAAM,WAAW,GAAG,SAAS,CAAC,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;QACtD,IAAI,CAAC,WAAW;YAAE,OAAO,CAAC,IAAI,CAAC,aAAM,EAAE,2DAAiD,UAAU,OAAI,CAAC,CAAA;QACvG,OAAO,WAAW,CAAC;IACvB,CAAC;IAAA,CAAC;IAEF,OAAO,CAAC,CAAC;AACb,CAAC"}
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
* @param {Intl.DateTimeFormatOptions} [options={}] - Optional formatting options for the date, following `Intl.DateTimeFormatOptions` specifications.
|
|
19
19
|
* @returns {JSX.Element} The formatted date or time component.
|
|
20
20
|
*/
|
|
21
|
-
declare
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
gtTransformation: string;
|
|
29
|
-
}
|
|
21
|
+
declare function DateTime({ children, name, defaultValue, options }?: {
|
|
22
|
+
children?: any;
|
|
23
|
+
name?: string;
|
|
24
|
+
defaultValue?: any;
|
|
25
|
+
options?: Intl.DateTimeFormatOptions;
|
|
26
|
+
}): JSX.Element;
|
|
27
|
+
declare namespace DateTime {
|
|
28
|
+
var gtTransformation: string;
|
|
29
|
+
}
|
|
30
30
|
export default DateTime;
|
|
31
31
|
//# sourceMappingURL=DateTime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTime.d.ts","sourceRoot":"","sources":["../../src/variables/DateTime.tsx"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,
|
|
1
|
+
{"version":3,"file":"DateTime.d.ts","sourceRoot":"","sources":["../../src/variables/DateTime.tsx"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,iBAAS,QAAQ,CAAC,EAAE,QAAQ,EAAE,IAAa,EAAE,YAAY,EAAE,OAAY,EAAE,GAAE;IACvE,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,OAAO,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CAyBjC;kBA9BQ,QAAQ;;;AAmCjB,eAAe,QAAQ,CAAC"}
|
|
@@ -28,7 +28,7 @@ var useDefaultLocale_1 = __importDefault(require("../hooks/useDefaultLocale"));
|
|
|
28
28
|
* @param {Intl.DateTimeFormatOptions} [options={}] - Optional formatting options for the date, following `Intl.DateTimeFormatOptions` specifications.
|
|
29
29
|
* @returns {JSX.Element} The formatted date or time component.
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
function DateTime(_a) {
|
|
32
32
|
var _b = _a === void 0 ? { name: "date" } : _a, children = _b.children, _c = _b.name, name = _c === void 0 ? "date" : _c, defaultValue = _b.defaultValue, _d = _b.options, options = _d === void 0 ? {} : _d;
|
|
33
33
|
var locales = [(0, useLocale_1.default)(), (0, useDefaultLocale_1.default)()];
|
|
34
34
|
var final;
|
|
@@ -48,7 +48,8 @@ var DateTime = function (_a) {
|
|
|
48
48
|
}
|
|
49
49
|
// Render the formatted date within a span element
|
|
50
50
|
return ((0, jsx_runtime_1.jsx)("span", { "data-gt-variable-name": name, "data-gt-variable-type": "date", "data-gt-variable-options": options, children: final }));
|
|
51
|
-
}
|
|
51
|
+
}
|
|
52
|
+
;
|
|
52
53
|
// Static property for transformation type
|
|
53
54
|
DateTime.gtTransformation = "variable-datetime";
|
|
54
55
|
exports.default = DateTime;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTime.js","sourceRoot":"","sources":["../../src/variables/DateTime.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAA;;;;;;AAEZ,yDAAoD;AACpD,iEAA2C;AAC3C,+EAAyD;AAEzD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,
|
|
1
|
+
{"version":3,"file":"DateTime.js","sourceRoot":"","sources":["../../src/variables/DateTime.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAA;;;;;;AAEZ,yDAAoD;AACpD,iEAA2C;AAC3C,+EAAyD;AAEzD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAS,QAAQ,CAAC,EAKE;QALF,qBAKd,EAAE,IAAI,EAAE,MAAM,EAAE,KAAA,EALA,QAAQ,cAAA,EAAE,YAAa,EAAb,IAAI,mBAAG,MAAM,KAAA,EAAE,YAAY,kBAAA,EAAE,eAAY,EAAZ,OAAO,mBAAG,EAAE,KAAA;IAOnE,IAAM,OAAO,GAAG,CAAC,IAAA,mBAAS,GAAE,EAAE,IAAA,0BAAgB,GAAE,CAAC,CAAA;IAEjD,IAAI,KAAK,CAAC;IAEV,IAAI,SAA2B,CAAC;IAChC,YAAY,GAAG,CAAC,OAAO,QAAQ,KAAK,WAAW,IAAI,OAAO,YAAY,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC;IAClH,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;QACnC,SAAS,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;IACvC,CAAC;SAAM,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;QAC1C,SAAS,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;IACvC,CAAC;SAAM,IAAI,YAAY,YAAY,IAAI,EAAE,CAAC;QACtC,SAAS,GAAG,YAAY,CAAC;IAC7B,CAAC;IACD,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE,CAAC;QACnC,KAAK,GAAG,CAAC,IAAA,mCAAc,EAAC,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC;IACrH,CAAC;IAED,kDAAkD;IAClD,OAAO,CACH,0DAA6B,IAAI,2BAAyB,MAAM,8BAA4B,OAAO,YAC9F,KAAK,GACH,CACV,CAAC;AACN,CAAC;AAAA,CAAC;AAEF,0CAA0C;AAC1C,QAAQ,CAAC,gBAAgB,GAAG,mBAAmB,CAAC;AAEhD,kBAAe,QAAQ,CAAC"}
|