gt-next 0.2.0 → 0.2.1
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/server/rendering/renderTranslatedChildren.js +4 -4
- package/dist/server/rendering/renderTranslatedChildren.js.map +1 -1
- package/dist/variables/Currency.d.ts +4 -4
- package/dist/variables/Currency.d.ts.map +1 -1
- package/dist/variables/Currency.js +7 -7
- package/dist/variables/Currency.js.map +1 -1
- package/dist/variables/DateTime.d.ts +4 -4
- package/dist/variables/DateTime.d.ts.map +1 -1
- package/dist/variables/DateTime.js +12 -12
- package/dist/variables/DateTime.js.map +1 -1
- package/dist/variables/Num.d.ts +4 -4
- package/dist/variables/Num.d.ts.map +1 -1
- package/dist/variables/Num.js +7 -7
- package/dist/variables/Num.js.map +1 -1
- package/dist/variables/Var.d.ts +8 -8
- package/dist/variables/Var.d.ts.map +1 -1
- package/dist/variables/Var.js +9 -9
- package/dist/variables/Var.js.map +1 -1
- package/package.json +2 -2
|
@@ -27,15 +27,15 @@ var getGTProp_1 = __importDefault(require("../../utils/getGTProp"));
|
|
|
27
27
|
function renderVariable(_a) {
|
|
28
28
|
var variableType = _a.variableType, variableName = _a.variableName, variableValue = _a.variableValue, variableOptions = _a.variableOptions;
|
|
29
29
|
if (variableType === "number") {
|
|
30
|
-
return ((0, jsx_runtime_1.jsx)(Num_1.default, { name: variableName,
|
|
30
|
+
return ((0, jsx_runtime_1.jsx)(Num_1.default, { name: variableName, value: variableValue, options: variableOptions }));
|
|
31
31
|
}
|
|
32
32
|
else if (variableType === "datetime") {
|
|
33
|
-
return ((0, jsx_runtime_1.jsx)(DateTime_1.default, { name: variableName,
|
|
33
|
+
return ((0, jsx_runtime_1.jsx)(DateTime_1.default, { name: variableName, value: variableValue, options: variableOptions }));
|
|
34
34
|
}
|
|
35
35
|
else if (variableType === "currency") {
|
|
36
|
-
return ((0, jsx_runtime_1.jsx)(Currency_1.default, { name: variableName,
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(Currency_1.default, { name: variableName, value: variableValue, options: variableOptions }));
|
|
37
37
|
}
|
|
38
|
-
return ((0, jsx_runtime_1.jsx)(Var_1.default, { name: variableName,
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)(Var_1.default, { name: variableName, value: variableValue }));
|
|
39
39
|
}
|
|
40
40
|
function renderTranslatedElement(_a) {
|
|
41
41
|
var sourceElement = _a.sourceElement, targetElement = _a.targetElement, _b = _a.variables, variables = _b === void 0 ? {} : _b, _c = _a.variablesOptions, variablesOptions = _c === void 0 ? {} : _c, _d = _a.locales, locales = _d === void 0 ? [internal_1.primitives.libraryDefaultLocale] : _d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderTranslatedChildren.js","sourceRoot":"","sources":["../../../src/server/rendering/renderTranslatedChildren.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AASA,wCAoCC;AAqED,2CAuHC;;AAzOD,gDAAuD;AAEvD,4DAAsC;AACtC,4DAAsC;AACtC,sEAAgD;AAChD,sEAAgD;AAChD,8CAAkG;AAClG,oEAA8C;AAE9C,SAAgB,cAAc,CAAC,EAO9B;QANG,YAAY,kBAAA,EAAE,YAAY,kBAAA,EAAE,aAAa,mBAAA,EAAE,eAAe,qBAAA;IAO1D,IAAI,YAAY,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,CACH,uBAAC,aAAG,IACA,IAAI,EAAE,YAAY,EAClB,
|
|
1
|
+
{"version":3,"file":"renderTranslatedChildren.js","sourceRoot":"","sources":["../../../src/server/rendering/renderTranslatedChildren.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AASA,wCAoCC;AAqED,2CAuHC;;AAzOD,gDAAuD;AAEvD,4DAAsC;AACtC,4DAAsC;AACtC,sEAAgD;AAChD,sEAAgD;AAChD,8CAAkG;AAClG,oEAA8C;AAE9C,SAAgB,cAAc,CAAC,EAO9B;QANG,YAAY,kBAAA,EAAE,YAAY,kBAAA,EAAE,aAAa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;IAED,2GAA2G;IAC3G,gFAAgF;AAEpF,CAAC"}
|
|
@@ -13,18 +13,18 @@
|
|
|
13
13
|
*
|
|
14
14
|
* @param {any} [children] - Optional content to render inside the currency component.
|
|
15
15
|
* @param {string} [name] - Optional name for the currency field.
|
|
16
|
-
* @param {any} [
|
|
16
|
+
* @param {any} [value] - The default value to be used.
|
|
17
17
|
* @param {string} [currency] - The currency type (e.g., USD, EUR, etc.).
|
|
18
18
|
* @param {Intl.NumberFormatOptions} [options] - Optional formatting options to customize how the currency is displayed.
|
|
19
19
|
* @returns {JSX.Element} The formatted currency component.
|
|
20
20
|
*/
|
|
21
|
-
declare function Currency({ children, name,
|
|
21
|
+
declare function Currency({ children, name, value, currency, options, ...props }: {
|
|
22
22
|
children?: any;
|
|
23
23
|
name?: string;
|
|
24
|
-
|
|
24
|
+
value?: any;
|
|
25
25
|
currency?: string;
|
|
26
26
|
options?: Intl.NumberFormatOptions;
|
|
27
|
-
|
|
27
|
+
'data-generaltranslation'?: any;
|
|
28
28
|
}): JSX.Element;
|
|
29
29
|
declare namespace Currency {
|
|
30
30
|
var gtTransformation: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Currency.d.ts","sourceRoot":"","sources":["../../src/variables/Currency.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,iBAAS,QAAQ,CAAC,EACd,QAAQ,EAAE,IAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"Currency.d.ts","sourceRoot":"","sources":["../../src/variables/Currency.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,iBAAS,QAAQ,CAAC,EACd,QAAQ,EAAE,IAAa,EAAE,KAAK,EAAE,QAAgB,EAAE,OAAY,EAAE,GAAG,KAAK,EAC3E,EAAE;IACC,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC;IACnC,yBAAyB,CAAC,EAAE,GAAG,CAAA;CAClC,GAAG,GAAG,CAAC,OAAO,CA2Bd;kBApCQ,QAAQ;;;AAwCjB,eAAe,QAAQ,CAAC"}
|
|
@@ -44,23 +44,23 @@ var getLocale_1 = __importDefault(require("../request/getLocale"));
|
|
|
44
44
|
*
|
|
45
45
|
* @param {any} [children] - Optional content to render inside the currency component.
|
|
46
46
|
* @param {string} [name] - Optional name for the currency field.
|
|
47
|
-
* @param {any} [
|
|
47
|
+
* @param {any} [value] - The default value to be used.
|
|
48
48
|
* @param {string} [currency] - The currency type (e.g., USD, EUR, etc.).
|
|
49
49
|
* @param {Intl.NumberFormatOptions} [options] - Optional formatting options to customize how the currency is displayed.
|
|
50
50
|
* @returns {JSX.Element} The formatted currency component.
|
|
51
51
|
*/
|
|
52
52
|
function Currency(_a) {
|
|
53
|
-
var children = _a.children, _b = _a.name, name = _b === void 0 ? "cost" : _b,
|
|
53
|
+
var children = _a.children, _b = _a.name, name = _b === void 0 ? "cost" : _b, value = _a.value, _c = _a.currency, currency = _c === void 0 ? "USD" : _c, _d = _a.options, options = _d === void 0 ? {} : _d, props = __rest(_a, ["children", "name", "value", "currency", "options"]);
|
|
54
54
|
var I18NConfig = (0, getI18NConfig_1.default)();
|
|
55
55
|
var locales = [(0, getLocale_1.default)(), I18NConfig.getDefaultLocale()];
|
|
56
56
|
var generaltranslation = props["data-generaltranslation"];
|
|
57
57
|
// Determine the value to be formatted
|
|
58
|
-
var
|
|
59
|
-
|
|
58
|
+
var renderedValue = (typeof children !== 'undefined' && typeof value === 'undefined') ? children : value;
|
|
59
|
+
renderedValue = (typeof renderedValue === 'string') ? parseFloat(renderedValue) : renderedValue;
|
|
60
60
|
// Format the number as currency according to the locale
|
|
61
|
-
var formattedValue = (typeof
|
|
62
|
-
? (0, generaltranslation_1.formatCurrency)({ value:
|
|
63
|
-
:
|
|
61
|
+
var formattedValue = (typeof renderedValue === 'number')
|
|
62
|
+
? (0, generaltranslation_1.formatCurrency)({ value: renderedValue, currency: currency, languages: locales, options: options })
|
|
63
|
+
: renderedValue;
|
|
64
64
|
return ((0, jsx_runtime_1.jsx)("span", { "data-generaltranslation": generaltranslation, "data-gt-variable-name": name, "data-gt-variable-type": "currency", "data-gt-variable-options": __assign({ style: 'currency', currency: currency }, options), "data-gt-unformatted-value": typeof value === 'number' && !isNaN(value) ? value : undefined, children: typeof formattedValue === 'string' ? formattedValue : undefined }));
|
|
65
65
|
}
|
|
66
66
|
;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Currency.js","sourceRoot":"","sources":["../../src/variables/Currency.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAAoD;AACpD,yEAAmD;AACnD,mEAA6C;AAE7C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAS,QAAQ,CAAC,EASjB;IARG,IAAA,QAAQ,cAAA,EAAE,YAAa,EAAb,IAAI,mBAAG,MAAM,KAAA,EAAE,
|
|
1
|
+
{"version":3,"file":"Currency.js","sourceRoot":"","sources":["../../src/variables/Currency.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAAoD;AACpD,yEAAmD;AACnD,mEAA6C;AAE7C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAS,QAAQ,CAAC,EASjB;IARG,IAAA,QAAQ,cAAA,EAAE,YAAa,EAAb,IAAI,mBAAG,MAAM,KAAA,EAAE,KAAK,WAAA,EAAE,gBAAgB,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAAE,eAAY,EAAZ,OAAO,mBAAG,EAAE,KAAA,EAAK,KAAK,cAD1D,oDAEjB,CAD2E;IAUxE,IAAM,UAAU,GAAG,IAAA,uBAAa,GAAE,CAAC;IACnC,IAAM,OAAO,GAAG,CAAE,IAAA,mBAAS,GAAE,EAAE,UAAU,CAAC,gBAAgB,EAAE,CAAE,CAAC;IAEvD,IAA2B,kBAAkB,GAAK,KAAK,2BAAV,CAAW;IAEhE,sCAAsC;IACtC,IAAI,aAAa,GAAG,CAAC,OAAO,QAAQ,KAAK,WAAW,IAAI,OAAO,KAAK,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;IACzG,aAAa,GAAG,CAAC,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;IAEhG,wDAAwD;IACxD,IAAM,cAAc,GAAG,CAAC,OAAO,aAAa,KAAK,QAAQ,CAAC;QACtD,CAAC,CAAC,IAAA,mCAAc,EAAC,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,UAAA,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,SAAA,EAAE,CAAC;QACjF,CAAC,CAAC,aAAa,CAAC;IAEpB,OAAO,CACH,4DAC6B,kBAAkB,2BACpB,IAAI,2BACJ,UAAU,yCACL,KAAK,EAAE,UAAU,EAAE,QAAQ,UAAA,IAAK,OAAO,gCACxC,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,YAExF,OAAO,cAAc,KAAK,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,GAC7D,CACV,CAAC;AACN,CAAC;AAAA,CAAC;AAEF,QAAQ,CAAC,gBAAgB,GAAG,mBAAmB,CAAC;AAEhD,kBAAe,QAAQ,CAAC"}
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
*
|
|
14
14
|
* @param {any} [children] - Optional content (typically a date) to render inside the component.
|
|
15
15
|
* @param {string} [name="date"] - Optional name for the date field, used for metadata purposes.
|
|
16
|
-
* @param {string|number|Date} [
|
|
16
|
+
* @param {string|number|Date} [value] - The default value for the date. Can be a string, number (timestamp), or `Date` object.
|
|
17
17
|
* @param {Intl.DateTimeFormatOptions} [options={}] - Optional formatting options for the date, following `Intl.DateTimeFormatOptions` specifications.
|
|
18
18
|
* @returns {JSX.Element} The formatted date or time component.
|
|
19
19
|
*/
|
|
20
|
-
declare function DateTime({ children, name,
|
|
20
|
+
declare function DateTime({ children, name, value, options, ...props }: {
|
|
21
21
|
children?: any;
|
|
22
22
|
name?: string;
|
|
23
|
-
|
|
23
|
+
value?: any;
|
|
24
24
|
options?: Intl.DateTimeFormatOptions;
|
|
25
|
-
|
|
25
|
+
'data-generaltranslation'?: any;
|
|
26
26
|
}): JSX.Element;
|
|
27
27
|
declare namespace DateTime {
|
|
28
28
|
var gtTransformation: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTime.d.ts","sourceRoot":"","sources":["../../src/variables/DateTime.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AACH,iBAAS,QAAQ,CAAC,EAAE,QAAQ,EAAE,IAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"DateTime.d.ts","sourceRoot":"","sources":["../../src/variables/DateTime.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AACH,iBAAS,QAAQ,CAAC,EAAE,QAAQ,EAAE,IAAa,EAAE,KAAK,EAAE,OAAY,EAAE,GAAG,KAAK,EAAE,EAAE;IAC1E,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,OAAO,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC;IACrC,yBAAyB,CAAC,EAAE,GAAG,CAAA;CAClC,GAAG,GAAG,CAAC,OAAO,CAkDd;kBAxDQ,QAAQ;;;AA4DjB,eAAe,QAAQ,CAAC"}
|
|
@@ -33,33 +33,33 @@ var getLocale_1 = __importDefault(require("../request/getLocale"));
|
|
|
33
33
|
*
|
|
34
34
|
* @param {any} [children] - Optional content (typically a date) to render inside the component.
|
|
35
35
|
* @param {string} [name="date"] - Optional name for the date field, used for metadata purposes.
|
|
36
|
-
* @param {string|number|Date} [
|
|
36
|
+
* @param {string|number|Date} [value] - The default value for the date. Can be a string, number (timestamp), or `Date` object.
|
|
37
37
|
* @param {Intl.DateTimeFormatOptions} [options={}] - Optional formatting options for the date, following `Intl.DateTimeFormatOptions` specifications.
|
|
38
38
|
* @returns {JSX.Element} The formatted date or time component.
|
|
39
39
|
*/
|
|
40
40
|
function DateTime(_a) {
|
|
41
|
-
var children = _a.children, _b = _a.name, name = _b === void 0 ? "date" : _b,
|
|
41
|
+
var children = _a.children, _b = _a.name, name = _b === void 0 ? "date" : _b, value = _a.value, _c = _a.options, options = _c === void 0 ? {} : _c, props = __rest(_a, ["children", "name", "value", "options"]);
|
|
42
42
|
var I18NConfig = (0, getI18NConfig_1.default)();
|
|
43
43
|
var locales = [(0, getLocale_1.default)(), I18NConfig.getDefaultLocale()];
|
|
44
44
|
// Extract general translation data from props
|
|
45
45
|
var generaltranslation = props["data-generaltranslation"];
|
|
46
46
|
// Determine the default value to use
|
|
47
|
-
if (typeof children !== 'undefined' && typeof
|
|
48
|
-
|
|
47
|
+
if (typeof children !== 'undefined' && typeof value === 'undefined') {
|
|
48
|
+
value = children;
|
|
49
49
|
}
|
|
50
|
-
if (!
|
|
50
|
+
if (!value) {
|
|
51
51
|
return ((0, jsx_runtime_1.jsx)("span", { "data-generaltranslation": generaltranslation, "data-gt-variable-name": name, "data-gt-variable-type": "date", "data-gt-variable-options": options }));
|
|
52
52
|
}
|
|
53
|
-
// Convert
|
|
53
|
+
// Convert value to a Date object if it's a Unix time, string, or Date object
|
|
54
54
|
var dateValue;
|
|
55
|
-
if (typeof
|
|
56
|
-
dateValue = new Date(
|
|
55
|
+
if (typeof value === 'number') {
|
|
56
|
+
dateValue = new Date(value * 1000); // Assuming Unix time is in seconds
|
|
57
57
|
}
|
|
58
|
-
else if (typeof
|
|
59
|
-
dateValue = new Date(
|
|
58
|
+
else if (typeof value === 'string') {
|
|
59
|
+
dateValue = new Date(value);
|
|
60
60
|
}
|
|
61
|
-
else if (
|
|
62
|
-
dateValue =
|
|
61
|
+
else if (value instanceof Date) {
|
|
62
|
+
dateValue = value;
|
|
63
63
|
}
|
|
64
64
|
// Format the date according to the locale and options
|
|
65
65
|
var dateString = dateValue ? (0, generaltranslation_1.formatDateTime)({ value: dateValue, languages: locales, options: options }) : '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTime.js","sourceRoot":"","sources":["../../src/variables/DateTime.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAoD;AACpD,yEAAmD;AACnD,mEAA6C;AAE7C;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAS,QAAQ,CAAC,EAMjB;IANmB,IAAA,QAAQ,cAAA,EAAE,YAAa,EAAb,IAAI,mBAAG,MAAM,KAAA,EAAE,
|
|
1
|
+
{"version":3,"file":"DateTime.js","sourceRoot":"","sources":["../../src/variables/DateTime.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAoD;AACpD,yEAAmD;AACnD,mEAA6C;AAE7C;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAS,QAAQ,CAAC,EAMjB;IANmB,IAAA,QAAQ,cAAA,EAAE,YAAa,EAAb,IAAI,mBAAG,MAAM,KAAA,EAAE,KAAK,WAAA,EAAE,eAAY,EAAZ,OAAO,mBAAG,EAAE,KAAA,EAAK,KAAK,cAAxD,wCAA0D,CAAF;IAQtE,IAAM,UAAU,GAAG,IAAA,uBAAa,GAAE,CAAC;IACnC,IAAM,OAAO,GAAG,CAAE,IAAA,mBAAS,GAAE,EAAE,UAAU,CAAC,gBAAgB,EAAE,CAAE,CAAC;IAE/D,8CAA8C;IACtC,IAA2B,kBAAkB,GAAK,KAAK,2BAAV,CA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;;GAIG;AACH,SAAS,WAAW,CAAC,KAAU;IAC3B,IAAM,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7B,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;AAClC,CAAC"}
|
package/dist/variables/Num.d.ts
CHANGED
|
@@ -14,16 +14,16 @@
|
|
|
14
14
|
*
|
|
15
15
|
* @param {any} [children] - Optional content (typically a number) to render inside the component.
|
|
16
16
|
* @param {string} [name="n"] - Optional name for the number field, used for metadata purposes.
|
|
17
|
-
* @param {string|number} [
|
|
17
|
+
* @param {string|number} [value] - The default value for the number. Can be a string or number. Strings will be parsed to numbers.
|
|
18
18
|
* @param {Intl.NumberFormatOptions} [options={}] - Optional formatting options for the number, following `Intl.NumberFormatOptions` specifications.
|
|
19
19
|
* @returns {JSX.Element} The formatted number component.
|
|
20
20
|
*/
|
|
21
|
-
declare function Num({ children, name,
|
|
21
|
+
declare function Num({ children, name, value, options, ...props }: {
|
|
22
22
|
children?: any;
|
|
23
23
|
name?: string;
|
|
24
|
-
|
|
24
|
+
value?: any;
|
|
25
25
|
options?: Intl.NumberFormatOptions;
|
|
26
|
-
|
|
26
|
+
'data-generaltranslation'?: any;
|
|
27
27
|
}): JSX.Element;
|
|
28
28
|
declare namespace Num {
|
|
29
29
|
var gtTransformation: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Num.d.ts","sourceRoot":"","sources":["../../src/variables/Num.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,iBAAS,GAAG,CAAC,EACT,QAAQ,EAAE,IAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"Num.d.ts","sourceRoot":"","sources":["../../src/variables/Num.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,iBAAS,GAAG,CAAC,EACT,QAAQ,EAAE,IAAU,EAAE,KAAK,EAAE,OAAY,EAAE,GAAG,KAAK,EACtD,EAAE;IACC,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAA;IAClC,yBAAyB,CAAC,EAAE,GAAG,CAAA;CAClC,GAAG,GAAG,CAAC,OAAO,CA4Bd;kBApCQ,GAAG;;;AAwCZ,eAAe,GAAG,CAAC"}
|
package/dist/variables/Num.js
CHANGED
|
@@ -34,22 +34,22 @@ var getLocale_1 = __importDefault(require("../request/getLocale"));
|
|
|
34
34
|
*
|
|
35
35
|
* @param {any} [children] - Optional content (typically a number) to render inside the component.
|
|
36
36
|
* @param {string} [name="n"] - Optional name for the number field, used for metadata purposes.
|
|
37
|
-
* @param {string|number} [
|
|
37
|
+
* @param {string|number} [value] - The default value for the number. Can be a string or number. Strings will be parsed to numbers.
|
|
38
38
|
* @param {Intl.NumberFormatOptions} [options={}] - Optional formatting options for the number, following `Intl.NumberFormatOptions` specifications.
|
|
39
39
|
* @returns {JSX.Element} The formatted number component.
|
|
40
40
|
*/
|
|
41
41
|
function Num(_a) {
|
|
42
|
-
var children = _a.children, _b = _a.name, name = _b === void 0 ? "n" : _b,
|
|
42
|
+
var children = _a.children, _b = _a.name, name = _b === void 0 ? "n" : _b, value = _a.value, _c = _a.options, options = _c === void 0 ? {} : _c, props = __rest(_a, ["children", "name", "value", "options"]);
|
|
43
43
|
var I18NConfig = (0, getI18NConfig_1.default)();
|
|
44
44
|
var locales = [(0, getLocale_1.default)(), I18NConfig.getDefaultLocale()];
|
|
45
45
|
var generaltranslation = props["data-generaltranslation"];
|
|
46
46
|
// Determine the value to be used
|
|
47
|
-
var
|
|
48
|
-
|
|
47
|
+
var renderedValue = (typeof children !== 'undefined' && typeof value === 'undefined') ? children : value;
|
|
48
|
+
renderedValue = (typeof renderedValue === 'string') ? parseFloat(renderedValue) : renderedValue;
|
|
49
49
|
// Format the number according to the locale
|
|
50
|
-
var formattedValue = (typeof
|
|
51
|
-
(0, generaltranslation_1.formatNum)({ value:
|
|
52
|
-
|
|
50
|
+
var formattedValue = (typeof renderedValue === 'number') ?
|
|
51
|
+
(0, generaltranslation_1.formatNum)({ value: renderedValue, languages: locales, options: options }) :
|
|
52
|
+
renderedValue;
|
|
53
53
|
return ((0, jsx_runtime_1.jsx)("span", { "data-generaltranslation": generaltranslation, "data-gt-variable-name": name, "data-gt-variable-type": "number", "data-gt-variable-options": options, "data-gt-unformatted-value": typeof value === 'number' && !isNaN(value) ? value : undefined, children: formattedValue }));
|
|
54
54
|
}
|
|
55
55
|
;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Num.js","sourceRoot":"","sources":["../../src/variables/Num.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAA+C;AAC/C,yEAAmD;AACnD,mEAA6C;AAE7C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAS,GAAG,CAAC,EAQZ;IAPG,IAAA,QAAQ,cAAA,EAAE,YAAU,EAAV,IAAI,mBAAG,GAAG,KAAA,EAAE,
|
|
1
|
+
{"version":3,"file":"Num.js","sourceRoot":"","sources":["../../src/variables/Num.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAA+C;AAC/C,yEAAmD;AACnD,mEAA6C;AAE7C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAS,GAAG,CAAC,EAQZ;IAPG,IAAA,QAAQ,cAAA,EAAE,YAAU,EAAV,IAAI,mBAAG,GAAG,KAAA,EAAE,KAAK,WAAA,EAAE,eAAY,EAAZ,OAAO,mBAAG,EAAE,KAAA,EAAK,KAAK,cAD1C,wCAEZ,CADsD;IASnD,IAAM,UAAU,GAAG,IAAA,uBAAa,GAAE,CAAC;IACnC,IAAM,OAAO,GAAG,CAAE,IAAA,mBAAS,GAAE,EAAE,UAAU,CAAC,gBAAgB,EAAE,CAAE,CAAA;IAEtD,IAA2B,kBAAkB,GAAK,KAAK,2BAAV,CAAW;IAEhE,iCAAiC;IACjC,IAAI,aAAa,GAAG,CAAC,OAAO,QAAQ,KAAK,WAAW,IAAI,OAAO,KAAK,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;IACzG,aAAa,GAAG,CAAC,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;IAEhG,4CAA4C;IAC5C,IAAM,cAAc,GAAG,CAAC,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC;QACxD,IAAA,8BAAS,EAAC,EAAE,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC,CAAC;QAC9D,aAAa,CAAC;IAEtB,OAAO,CACH,4DAC6B,kBAAkB,2BACpB,IAAI,2BACJ,QAAQ,8BACL,OAAO,+BACN,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,YAExF,cAAc,GACZ,CACV,CAAC;AAEN,CAAC;AAAA,CAAC;AAEF,GAAG,CAAC,gBAAgB,GAAG,iBAAiB,CAAC;AAEzC,kBAAe,GAAG,CAAC"}
|
package/dist/variables/Var.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `<Var>` component renders a variable value, which can either be passed as `children` or a `
|
|
3
|
-
* If `children` is provided, it will be used; otherwise, the `
|
|
2
|
+
* The `<Var>` component renders a variable value, which can either be passed as `children` or a `value`.
|
|
3
|
+
* If `children` is provided, it will be used; otherwise, the `value` is rendered.
|
|
4
4
|
*
|
|
5
5
|
* @example
|
|
6
6
|
* ```jsx
|
|
@@ -11,16 +11,16 @@
|
|
|
11
11
|
* </Var>
|
|
12
12
|
* ```
|
|
13
13
|
*
|
|
14
|
-
* @param {any} [children] - The content to render inside the component. If provided, it will take precedence over `
|
|
14
|
+
* @param {any} [children] - The content to render inside the component. If provided, it will take precedence over `value`.
|
|
15
15
|
* @param {string} [name] - Optional name for the variable, used for metadata purposes.
|
|
16
|
-
* @param {any} [
|
|
17
|
-
* @returns {JSX.Element} The rendered variable component with either `children` or `
|
|
16
|
+
* @param {any} [value] - The default value to be displayed if `children` is not provided.
|
|
17
|
+
* @returns {JSX.Element} The rendered variable component with either `children` or `value`.
|
|
18
18
|
*/
|
|
19
|
-
declare function Var({ children, name,
|
|
19
|
+
declare function Var({ children, name, value, ...props }: {
|
|
20
20
|
children?: any;
|
|
21
21
|
name?: string;
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
value?: any;
|
|
23
|
+
'data-generaltranslation'?: any;
|
|
24
24
|
}): JSX.Element;
|
|
25
25
|
declare namespace Var {
|
|
26
26
|
var gtTransformation: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Var.d.ts","sourceRoot":"","sources":["../../src/variables/Var.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,iBAAS,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"Var.d.ts","sourceRoot":"","sources":["../../src/variables/Var.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,iBAAS,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAc,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE;IACxD,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,yBAAyB,CAAC,EAAE,GAAG,CAAA;CAClC,GAAG,GAAG,CAAC,OAAO,CAiBd;kBAtBQ,GAAG;;;AA0BZ,eAAe,GAAG,CAAC"}
|
package/dist/variables/Var.js
CHANGED
|
@@ -13,8 +13,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
15
|
/**
|
|
16
|
-
* The `<Var>` component renders a variable value, which can either be passed as `children` or a `
|
|
17
|
-
* If `children` is provided, it will be used; otherwise, the `
|
|
16
|
+
* The `<Var>` component renders a variable value, which can either be passed as `children` or a `value`.
|
|
17
|
+
* If `children` is provided, it will be used; otherwise, the `value` is rendered.
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* ```jsx
|
|
@@ -25,17 +25,17 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
25
25
|
* </Var>
|
|
26
26
|
* ```
|
|
27
27
|
*
|
|
28
|
-
* @param {any} [children] - The content to render inside the component. If provided, it will take precedence over `
|
|
28
|
+
* @param {any} [children] - The content to render inside the component. If provided, it will take precedence over `value`.
|
|
29
29
|
* @param {string} [name] - Optional name for the variable, used for metadata purposes.
|
|
30
|
-
* @param {any} [
|
|
31
|
-
* @returns {JSX.Element} The rendered variable component with either `children` or `
|
|
30
|
+
* @param {any} [value] - The default value to be displayed if `children` is not provided.
|
|
31
|
+
* @returns {JSX.Element} The rendered variable component with either `children` or `value`.
|
|
32
32
|
*/
|
|
33
33
|
function Var(_a) {
|
|
34
|
-
var children = _a.children, _b = _a.name, name = _b === void 0 ? "value" : _b,
|
|
34
|
+
var children = _a.children, _b = _a.name, name = _b === void 0 ? "value" : _b, value = _a.value, props = __rest(_a, ["children", "name", "value"]);
|
|
35
35
|
var generaltranslation = props["data-generaltranslation"];
|
|
36
|
-
if (typeof children !== 'undefined' && typeof
|
|
37
|
-
|
|
38
|
-
return ((0, jsx_runtime_1.jsx)("span", { "data-generaltranslation": generaltranslation, "data-gt-variable-name": name, "data-gt-variable-type": "variable", "data-gt-unformatted-value":
|
|
36
|
+
if (typeof children !== 'undefined' && typeof value === 'undefined')
|
|
37
|
+
value = children;
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)("span", { "data-generaltranslation": generaltranslation, "data-gt-variable-name": name, "data-gt-variable-type": "variable", "data-gt-unformatted-value": value !== null && value !== void 0 ? value : undefined, children: value }));
|
|
39
39
|
}
|
|
40
40
|
;
|
|
41
41
|
Var.gtTransformation = "variable-variable"; // keep this because Var is imported in other functions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Var.js","sourceRoot":"","sources":["../../src/variables/Var.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAS,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"Var.js","sourceRoot":"","sources":["../../src/variables/Var.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAS,GAAG,CAAC,EAKZ;IALc,IAAA,QAAQ,cAAA,EAAE,YAAc,EAAd,IAAI,mBAAG,OAAO,KAAA,EAAE,KAAK,WAAA,EAAK,KAAK,cAA3C,6BAA6C,CAAF;IAO5C,IAA2B,kBAAkB,GAAK,KAAK,2BAAV,CAAW;IAEhE,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,OAAO,KAAK,KAAK,WAAW;QAAE,KAAK,GAAG,QAAQ,CAAC;IAEtF,OAAO,CACH,4DAC6B,kBAAkB,2BACpB,IAAI,2BACJ,UAAU,+BACN,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,SAAS,YAE5C,KAAK,GACH,CACV,CAAC;AAEN,CAAC;AAAA,CAAC;AAEF,GAAG,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,CAAC,uDAAuD;AAEnG,kBAAe,GAAG,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gt-next",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.server.js",
|
|
6
6
|
"peerDependencies": {
|
|
@@ -120,6 +120,6 @@
|
|
|
120
120
|
],
|
|
121
121
|
"dependencies": {
|
|
122
122
|
"generaltranslation": "^2.0.70",
|
|
123
|
-
"gt-react": "^4.2.
|
|
123
|
+
"gt-react": "^4.2.3"
|
|
124
124
|
}
|
|
125
125
|
}
|