gt-next 5.2.36 → 5.2.37
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/CHANGELOG.md +9 -0
- package/dist/client.d.ts +2 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/errors/createErrors.d.ts +3 -0
- package/dist/errors/createErrors.d.ts.map +1 -1
- package/dist/errors/createErrors.js +8 -1
- package/dist/errors/createErrors.js.map +1 -1
- package/dist/index.client.d.ts +8 -5
- package/dist/index.client.d.ts.map +1 -1
- package/dist/index.client.js +19 -10
- package/dist/index.client.js.map +1 -1
- package/dist/index.server.d.ts +1 -0
- package/dist/index.server.d.ts.map +1 -1
- package/dist/index.server.js +13 -1
- package/dist/index.server.js.map +1 -1
- package/dist/index.types.d.ts +288 -0
- package/dist/index.types.d.ts.map +1 -0
- package/dist/index.types.js +353 -0
- package/dist/index.types.js.map +1 -0
- package/dist/provider/GTProvider.d.ts +2 -15
- package/dist/provider/GTProvider.d.ts.map +1 -1
- package/dist/provider/GTProvider.js +0 -9
- package/dist/provider/GTProvider.js.map +1 -1
- package/dist/server-dir/runtime/_Tx.d.ts +2 -36
- package/dist/server-dir/runtime/_Tx.d.ts.map +1 -1
- package/dist/server-dir/runtime/_Tx.js +0 -30
- package/dist/server-dir/runtime/_Tx.js.map +1 -1
- package/dist/utils/types.d.ts +13 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/types.js +3 -0
- package/dist/utils/types.js.map +1 -0
- package/dist/variables/Currency.d.ts +0 -17
- package/dist/variables/Currency.d.ts.map +1 -1
- package/dist/variables/Currency.js +0 -17
- package/dist/variables/Currency.js.map +1 -1
- package/dist/variables/DateTime.d.ts +0 -15
- package/dist/variables/DateTime.d.ts.map +1 -1
- package/dist/variables/DateTime.js +0 -15
- package/dist/variables/DateTime.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLocaleProperties = exports.useGTClass = exports.useLocaleSelector = exports.useDefaultLocale = exports.useSetLocale = exports.useLocales = exports.useLocale = exports.useDict = exports.useTranslations = exports.useGT = exports.LocaleSelector = exports.Plural = exports.Branch = exports.Var = exports.Num = exports.DateTime = exports.Currency = exports.T = exports.GTProvider = void 0;
|
|
4
|
+
var createErrors_1 = require("./errors/createErrors");
|
|
5
|
+
/**
|
|
6
|
+
* Provides General Translation context to its children, which can then access `useGT`, `useLocale`, and `useDefaultLocale`.
|
|
7
|
+
*
|
|
8
|
+
* @param {React.ReactNode} children - The children components that will use the translation context.
|
|
9
|
+
* @param {string} id - ID of a nested dictionary, so that only a subset of a large dictionary needs to be sent to the client.
|
|
10
|
+
* @param {string} locale - The locale to use for the translation context.
|
|
11
|
+
*
|
|
12
|
+
* @returns {JSX.Element} The provider component for General Translation context.
|
|
13
|
+
*/
|
|
14
|
+
var GTProvider = function () {
|
|
15
|
+
throw new Error(createErrors_1.typesFileError);
|
|
16
|
+
};
|
|
17
|
+
exports.GTProvider = GTProvider;
|
|
18
|
+
/**
|
|
19
|
+
* Build-time translation component that renders its children in the user's given locale.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```jsx
|
|
23
|
+
* // Basic usage:
|
|
24
|
+
* <T id="welcome_message">
|
|
25
|
+
* Hello, <Var>{name}</Var>!
|
|
26
|
+
* </T>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```jsx
|
|
31
|
+
* // Translating a plural
|
|
32
|
+
* <T id="item_count">
|
|
33
|
+
* <Plural n={3} singular={<>You have <Num children={n}/> item.</>}>
|
|
34
|
+
* You have <Num children={n}/> items.
|
|
35
|
+
* </Plural>
|
|
36
|
+
* </T>
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @param {React.ReactNode} children - The content to be translated or displayed.
|
|
40
|
+
* @param {string} [id] - Optional identifier for the translation string. If not provided, a hash will be generated from the content.
|
|
41
|
+
* @param {any} [context] - Additional context for translation key generation.
|
|
42
|
+
*
|
|
43
|
+
* @returns {JSX.Element} The rendered translation or fallback content based on the provided configuration.
|
|
44
|
+
*
|
|
45
|
+
* @throws {Error} If a plural translation is requested but the `n` option is not provided.
|
|
46
|
+
*/
|
|
47
|
+
var T = function () {
|
|
48
|
+
throw new Error(createErrors_1.typesFileError);
|
|
49
|
+
};
|
|
50
|
+
exports.T = T;
|
|
51
|
+
exports.T.gtTransformation = 'translate-type';
|
|
52
|
+
/**
|
|
53
|
+
* The `<Currency>` component renders a formatted currency string, allowing customization of name, default value, currency type, and formatting options.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```jsx
|
|
57
|
+
* <Currency
|
|
58
|
+
* currency="USD"
|
|
59
|
+
* >
|
|
60
|
+
* 1000
|
|
61
|
+
* </Currency>
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @param {any} [children] - Optional content to render inside the currency component.
|
|
65
|
+
* @param {string} [currency] - The currency type (e.g., USD, EUR, etc.).
|
|
66
|
+
* @param {Intl.NumberFormatOptions} [options] - Optional formatting options to customize how the currency is displayed.
|
|
67
|
+
* @returns {React.JSX.Element} The formatted currency component.
|
|
68
|
+
*/
|
|
69
|
+
var Currency = function () {
|
|
70
|
+
throw new Error(createErrors_1.typesFileError);
|
|
71
|
+
};
|
|
72
|
+
exports.Currency = Currency;
|
|
73
|
+
exports.Currency.gtTransformation = 'variable-currency';
|
|
74
|
+
/**
|
|
75
|
+
* The `<DateTime>` component renders a formatted date or time string, allowing customization of the name, default value, and formatting options.
|
|
76
|
+
* It utilizes the current locale and optional format settings to display the date.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```jsx
|
|
80
|
+
* <DateTime>
|
|
81
|
+
* {new Date()}
|
|
82
|
+
* </DateTime>
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @param {any} [children] - Optional content (typically a date) to render inside the component.
|
|
86
|
+
* @param {Intl.DateTimeFormatOptions} [options={}] - Optional formatting options for the date, following `Intl.DateTimeFormatOptions` specifications.
|
|
87
|
+
* @returns {Promise<React.JSX.Element>} The formatted date or time component.
|
|
88
|
+
*/
|
|
89
|
+
var DateTime = function () {
|
|
90
|
+
throw new Error(createErrors_1.typesFileError);
|
|
91
|
+
};
|
|
92
|
+
exports.DateTime = DateTime;
|
|
93
|
+
exports.DateTime.gtTransformation = 'variable-datetime';
|
|
94
|
+
/**
|
|
95
|
+
* The `<Num>` component renders a formatted number string, allowing customization of the name, default value, and formatting options.
|
|
96
|
+
* It formats the number according to the current locale and optionally passed formatting options.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```jsx
|
|
100
|
+
* <Num
|
|
101
|
+
* options={{ style: "decimal", maximumFractionDigits: 2 }}
|
|
102
|
+
* >
|
|
103
|
+
* 1000
|
|
104
|
+
* </Num>
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* @param {any} [children] - Optional content (typically a number) to render inside the component.
|
|
108
|
+
* @param {Intl.NumberFormatOptions} [options={}] - Optional formatting options for the number, following `Intl.NumberFormatOptions` specifications.
|
|
109
|
+
* @returns {Promise<React.JSX.Element>} The formatted number component.
|
|
110
|
+
*/
|
|
111
|
+
var Num = function () {
|
|
112
|
+
throw new Error(createErrors_1.typesFileError);
|
|
113
|
+
};
|
|
114
|
+
exports.Num = Num;
|
|
115
|
+
exports.Num.gtTransformation = 'variable-number';
|
|
116
|
+
/**
|
|
117
|
+
* The `<Var>` component renders a variable value, which can either be passed as `children` or a `value`.
|
|
118
|
+
* If `children` is provided, it will be used; otherwise, the `value` is rendered.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```jsx
|
|
122
|
+
* <Var>
|
|
123
|
+
* John
|
|
124
|
+
* </Var>
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* @param {any} [children] - The content to render inside the component. If provided, it will take precedence over `value`.
|
|
128
|
+
* @returns {React.JSX.Element} The rendered variable component with either `children` or `value`.
|
|
129
|
+
*/
|
|
130
|
+
var Var = function () {
|
|
131
|
+
throw new Error(createErrors_1.typesFileError);
|
|
132
|
+
};
|
|
133
|
+
exports.Var = Var;
|
|
134
|
+
exports.Var.gtTransformation = 'variable-variable';
|
|
135
|
+
/**
|
|
136
|
+
* The `<Branch>` component dynamically renders a specified branch of content or a fallback child component.
|
|
137
|
+
* It allows for flexible content switching based on the `branch` prop and an object of possible branches (`...branches`).
|
|
138
|
+
* If the specified `branch` is present in the `branches` object, it renders the content of that branch.
|
|
139
|
+
* If the `branch` is not found, it renders the provided `children` as fallback content.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```jsx
|
|
143
|
+
* <Branch
|
|
144
|
+
* branch="summary"
|
|
145
|
+
* summary={<p>This is a summary</p>}
|
|
146
|
+
* details={<p>Details here</p>}
|
|
147
|
+
* >
|
|
148
|
+
* <p>Fallback content</p>
|
|
149
|
+
* </Branch>
|
|
150
|
+
* ```
|
|
151
|
+
* If the `branch` prop is set to `"summary"`, it will render `<p>This is a summary</p>`. If the `branch` is not set or does not match any keys in the branches object, it renders the fallback content `<p>Fallback content</p>`.
|
|
152
|
+
*
|
|
153
|
+
* @param {any} [children] - Fallback content to render if no matching branch is found.
|
|
154
|
+
* @param {string} [name="branch"] - Optional name for the component, used for metadata or tracking purposes.
|
|
155
|
+
* @param {string} [branch] - The name of the branch to render. The component looks for this key in the `...branches` object.
|
|
156
|
+
* @param {...{[key: string]: any}} [branches] - A spread object containing possible branches as keys and their corresponding content as values.
|
|
157
|
+
* @returns {React.JSX.Element} The rendered branch or fallback content.
|
|
158
|
+
*/
|
|
159
|
+
var Branch = function () {
|
|
160
|
+
throw new Error(createErrors_1.typesFileError);
|
|
161
|
+
};
|
|
162
|
+
exports.Branch = Branch;
|
|
163
|
+
exports.Branch.gtTransformation = 'branch-type';
|
|
164
|
+
/**
|
|
165
|
+
* The `<Plural>` component dynamically renders content based on the plural form of the given number (`n`).
|
|
166
|
+
* It determines which content to display by matching the value of `n` to the appropriate pluralization branch,
|
|
167
|
+
* based on the current locale or a default locale. If no matching plural branch is found, the component renders
|
|
168
|
+
* the fallback `children` content.
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```jsx
|
|
172
|
+
* <Plural
|
|
173
|
+
* n={1}
|
|
174
|
+
* one="There is 1 item"
|
|
175
|
+
* other="There are {n} items"
|
|
176
|
+
* />
|
|
177
|
+
* ```
|
|
178
|
+
* In this example, if `n` is 1, it renders `"There is 1 item"`. If `n` is a different number, it renders
|
|
179
|
+
* `"There are {n} items"`.
|
|
180
|
+
*
|
|
181
|
+
* @param {any} [children] - Fallback content to render if no matching plural branch is found.
|
|
182
|
+
* @param {number} [n] - The number used to determine the plural form. This is required for pluralization to work.
|
|
183
|
+
* @param {string} [locale] - Optional parameter, the locale to use for pluralization format. If not provided and wrapped
|
|
184
|
+
* in <GTProvider> will automatically populate this value as user's current locale. If not provided and not wrapped in
|
|
185
|
+
* <GTProvider>, will use the library default locale (en-US).
|
|
186
|
+
* @param {...{[key: string]: any}} [branches] - A spread object containing possible plural branches, typically including `one` for singular
|
|
187
|
+
* and `other` for plural forms, but it may vary depending on the locale.
|
|
188
|
+
* @returns {React.JSX.Element} The rendered content corresponding to the plural form of `n`, or the fallback content.
|
|
189
|
+
* @throws {Error} If `n` is not provided or not a valid number.
|
|
190
|
+
*/
|
|
191
|
+
var Plural = function () {
|
|
192
|
+
throw new Error(createErrors_1.typesFileError);
|
|
193
|
+
};
|
|
194
|
+
exports.Plural = Plural;
|
|
195
|
+
exports.Plural.gtTransformation = 'plural-type';
|
|
196
|
+
/**
|
|
197
|
+
* A dropdown component that allows users to select a locale.
|
|
198
|
+
* @param {string[]} locales - An optional list of locales to use for the dropdown. If not provided, the list of locales from the `<GTProvider>` context is used.
|
|
199
|
+
* @param {object} customNames - An optional object to map locales to custom names.
|
|
200
|
+
* @returns {React.ReactElement | null} The rendered locale dropdown component or null to prevent rendering.
|
|
201
|
+
*/
|
|
202
|
+
var LocaleSelector = function () {
|
|
203
|
+
throw new Error(createErrors_1.typesFileError);
|
|
204
|
+
};
|
|
205
|
+
exports.LocaleSelector = LocaleSelector;
|
|
206
|
+
/**
|
|
207
|
+
* Gets the translation function `t` provided by `<GTProvider>`.
|
|
208
|
+
*
|
|
209
|
+
* @returns {Function} A translation function that accepts a key string and returns the translated value.
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* const t = useGT();
|
|
213
|
+
* console.log(t('To be or not to be...'));
|
|
214
|
+
*
|
|
215
|
+
* const t = useGT();
|
|
216
|
+
* return (<>
|
|
217
|
+
* {
|
|
218
|
+
* t('My name is {customName}', { variables: { customName: "Brian" } } )
|
|
219
|
+
* }
|
|
220
|
+
* </>);
|
|
221
|
+
*
|
|
222
|
+
*/
|
|
223
|
+
var useGT = function () {
|
|
224
|
+
throw new Error(createErrors_1.typesFileError);
|
|
225
|
+
};
|
|
226
|
+
exports.useGT = useGT;
|
|
227
|
+
/**
|
|
228
|
+
* Gets the dictionary access function `t` provided by `<GTProvider>`.
|
|
229
|
+
*
|
|
230
|
+
* @param {string} [id] - Optional prefix to prepend to the translation keys.
|
|
231
|
+
* @returns {Function} A translation function that accepts a key string and returns the translated value.
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* const t = useTranslations('user');
|
|
235
|
+
* console.log(t('name')); // Translates item 'user.name'
|
|
236
|
+
*
|
|
237
|
+
* const t = useTranslations();
|
|
238
|
+
* console.log(t('hello')); // Translates item 'hello'
|
|
239
|
+
*/
|
|
240
|
+
var useTranslations = function () {
|
|
241
|
+
throw new Error(createErrors_1.typesFileError);
|
|
242
|
+
};
|
|
243
|
+
exports.useTranslations = useTranslations;
|
|
244
|
+
/**
|
|
245
|
+
* Gets the dictionary access function `d` provided by `<GTProvider>`.
|
|
246
|
+
* @deprecated Use useTranslations instead
|
|
247
|
+
*
|
|
248
|
+
* @param {string} [id] - Optional prefix to prepend to the translation keys.
|
|
249
|
+
* @returns {Function} A translation function that accepts a key string and returns the translated value.
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* const d = useDict('user');
|
|
253
|
+
* console.log(t('name')); // Translates item 'user.name'
|
|
254
|
+
*
|
|
255
|
+
* const d = useDict();
|
|
256
|
+
* console.log(t('hello')); // Translates item 'hello'
|
|
257
|
+
*/
|
|
258
|
+
var useDict = function () {
|
|
259
|
+
throw new Error(createErrors_1.typesFileError);
|
|
260
|
+
};
|
|
261
|
+
exports.useDict = useDict;
|
|
262
|
+
/**
|
|
263
|
+
* Retrieves the user's locale from the `<GTProvider>` context.
|
|
264
|
+
*
|
|
265
|
+
* @returns {string} The user's locale, e.g., 'en-US'.
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* const locale = useLocale();
|
|
269
|
+
* console.log(locale); // 'en-US'
|
|
270
|
+
*/
|
|
271
|
+
var useLocale = function () {
|
|
272
|
+
throw new Error(createErrors_1.typesFileError);
|
|
273
|
+
};
|
|
274
|
+
exports.useLocale = useLocale;
|
|
275
|
+
/**
|
|
276
|
+
* Retrieves the user's list of supported locales from the `<GTProvider>` context.
|
|
277
|
+
*
|
|
278
|
+
* @returns {string[]} The user's locales, e.g., ['en-US', 'fr', 'jp'].
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* const locales = useLocales();
|
|
282
|
+
* console.log(locale); // ['en-US', 'fr', 'jp]
|
|
283
|
+
*/
|
|
284
|
+
var useLocales = function () {
|
|
285
|
+
throw new Error(createErrors_1.typesFileError);
|
|
286
|
+
};
|
|
287
|
+
exports.useLocales = useLocales;
|
|
288
|
+
/**
|
|
289
|
+
* Sets the user's locale in the `<GTProvider>` context.
|
|
290
|
+
* If the locale passed is not supported, will fallback on current locale and then defaultLocale if necessary.
|
|
291
|
+
* @note Unless a locale has explicitly been passed to the `<GTProvider>`, this will override the user's browser preferences. The locale passed to `<GTProvider>` will always take priority.
|
|
292
|
+
*
|
|
293
|
+
* @returns {(locale: string) => void} A function that sets the user's locale.
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* setLocale('en-US');
|
|
297
|
+
*/
|
|
298
|
+
var useSetLocale = function () {
|
|
299
|
+
throw new Error(createErrors_1.typesFileError);
|
|
300
|
+
};
|
|
301
|
+
exports.useSetLocale = useSetLocale;
|
|
302
|
+
/**
|
|
303
|
+
* Retrieves the application's default locale from the `<GTProvider>` context.
|
|
304
|
+
*
|
|
305
|
+
* If no default locale is passed to the `<GTProvider>`, it defaults to providing 'en'.
|
|
306
|
+
*
|
|
307
|
+
* @returns {string} The application's default locale, e.g., 'en-US'.
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* const locale = useDefaultLocale();
|
|
311
|
+
* console.log(locale); // 'en-US'
|
|
312
|
+
*/
|
|
313
|
+
var useDefaultLocale = function () {
|
|
314
|
+
throw new Error(createErrors_1.typesFileError);
|
|
315
|
+
};
|
|
316
|
+
exports.useDefaultLocale = useDefaultLocale;
|
|
317
|
+
/**
|
|
318
|
+
* Gets the list of properties for using a locale selector.
|
|
319
|
+
* @param locales an optional list of locales to use for the drop down. These locales must be a subset of the locales provided by the `<GTProvider>` context. When not provided, the list of locales from the `<GTProvider>` context is used.
|
|
320
|
+
* @returns {object} The locale, locales, and setLocale function.
|
|
321
|
+
*/
|
|
322
|
+
var useLocaleSelector = function () {
|
|
323
|
+
throw new Error(createErrors_1.typesFileError);
|
|
324
|
+
};
|
|
325
|
+
exports.useLocaleSelector = useLocaleSelector;
|
|
326
|
+
/**
|
|
327
|
+
* Returns the configured GT class instance.
|
|
328
|
+
*
|
|
329
|
+
* @returns {GT} The configured GT class instance.
|
|
330
|
+
*
|
|
331
|
+
* @example
|
|
332
|
+
* const gt = useGTClass();
|
|
333
|
+
* console.log(gt.getLocaleProperties('en-US'));
|
|
334
|
+
*/
|
|
335
|
+
var useGTClass = function () {
|
|
336
|
+
throw new Error(createErrors_1.typesFileError);
|
|
337
|
+
};
|
|
338
|
+
exports.useGTClass = useGTClass;
|
|
339
|
+
/**
|
|
340
|
+
* Returns the locale properties for the given locale.
|
|
341
|
+
*
|
|
342
|
+
* @param {string} locale - The locale to get the properties for.
|
|
343
|
+
* @returns {LocaleProperties} The locale properties for the given locale.
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* const localeProperties = useLocaleProperties('en-US');
|
|
347
|
+
* console.log(localeProperties);
|
|
348
|
+
*/
|
|
349
|
+
var useLocaleProperties = function () {
|
|
350
|
+
throw new Error(createErrors_1.typesFileError);
|
|
351
|
+
};
|
|
352
|
+
exports.useLocaleProperties = useLocaleProperties;
|
|
353
|
+
//# sourceMappingURL=index.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.types.js","sourceRoot":"","sources":["../src/index.types.ts"],"names":[],"mappings":";;;AAAA,sDAAuD;AAsBvD;;;;;;;;GAQG;AACI,IAAM,UAAU,GAAuB;IAC5C,MAAM,IAAI,KAAK,CAAC,6BAAc,CAAC,CAAC;AAClC,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACI,IAAM,CAAC,GAAc;IAC1B,MAAM,IAAI,KAAK,CAAC,6BAAc,CAAC,CAAC;AAClC,CAAC,CAAC;AAFW,QAAA,CAAC,KAEZ;AACF,SAAC,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;AAEtC;;;;;;;;;;;;;;;;GAgBG;AACI,IAAM,QAAQ,GAAqB;IACxC,MAAM,IAAI,KAAK,CAAC,6BAAc,CAAC,CAAC;AAClC,CAAC,CAAC;AAFW,QAAA,QAAQ,YAEnB;AACF,gBAAQ,CAAC,gBAAgB,GAAG,mBAAmB,CAAC;AAEhD;;;;;;;;;;;;;;GAcG;AACI,IAAM,QAAQ,GAAqB;IACxC,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,uBAE9B"}
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
* Provides General Translation context to its children, which can then access `useGT`, `useLocale`, and `useDefaultLocale`.
|
|
4
|
-
*
|
|
5
|
-
* @param {React.ReactNode} children - The children components that will use the translation context.
|
|
6
|
-
* @param {string} id - ID of a nested dictionary, so that only a subset of a large dictionary needs to be sent to the client.
|
|
7
|
-
* @param {string} locale - The locale to use for the translation context.
|
|
8
|
-
*
|
|
9
|
-
* @returns {JSX.Element} The provider component for General Translation context.
|
|
10
|
-
*/
|
|
11
|
-
export default function GTProvider({ children, id: prefixId, locale: _locale, }: {
|
|
12
|
-
children?: ReactNode;
|
|
13
|
-
id?: string;
|
|
14
|
-
locale?: string;
|
|
15
|
-
}): Promise<import("react/jsx-runtime").JSX.Element>;
|
|
1
|
+
import { GTProviderProps } from '../utils/types';
|
|
2
|
+
export default function GTProvider({ children, id: prefixId, locale: _locale, }: GTProviderProps): Promise<import("react/jsx-runtime").JSX.Element>;
|
|
16
3
|
//# sourceMappingURL=GTProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTProvider.d.ts","sourceRoot":"","sources":["../../src/provider/GTProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GTProvider.d.ts","sourceRoot":"","sources":["../../src/provider/GTProvider.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,wBAA8B,UAAU,CAAC,EACvC,QAAQ,EACR,EAAE,EAAE,QAAQ,EACZ,MAAM,EAAE,OAAO,GAChB,EAAE,eAAe,oDAqEjB"}
|
|
@@ -92,15 +92,6 @@ var getLocale_1 = __importDefault(require("../request/getLocale"));
|
|
|
92
92
|
var getDictionary_1 = __importStar(require("../dictionary/getDictionary"));
|
|
93
93
|
var createErrors_1 = require("../errors/createErrors");
|
|
94
94
|
var ClientProviderWrapper_1 = __importDefault(require("./ClientProviderWrapper"));
|
|
95
|
-
/**
|
|
96
|
-
* Provides General Translation context to its children, which can then access `useGT`, `useLocale`, and `useDefaultLocale`.
|
|
97
|
-
*
|
|
98
|
-
* @param {React.ReactNode} children - The children components that will use the translation context.
|
|
99
|
-
* @param {string} id - ID of a nested dictionary, so that only a subset of a large dictionary needs to be sent to the client.
|
|
100
|
-
* @param {string} locale - The locale to use for the translation context.
|
|
101
|
-
*
|
|
102
|
-
* @returns {JSX.Element} The provider component for General Translation context.
|
|
103
|
-
*/
|
|
104
95
|
function GTProvider(_a) {
|
|
105
96
|
return __awaiter(this, arguments, void 0, function (_b) {
|
|
106
97
|
var I18NConfig, locale, _c, defaultLocale, _d, translationRequired, dialectTranslationRequired, dictionaryTranslations, cachedTranslationsPromise, dictionary, _e, prefixPath, translations;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTProvider.js","sourceRoot":"","sources":["../../src/provider/GTProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"GTProvider.js","sourceRoot":"","sources":["../../src/provider/GTProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,6BAyEC;;AAnFD,8CAAuE;AACvE,+BAAkD;AAClD,8EAAwD;AACxD,mEAA6C;AAC7C,2EAAgF;AAEhF,uDAAqE;AACrE,kFAAqD;AAGrD,SAA8B,UAAU;wDAAC,EAIvB;;YAHhB,QAAQ,cAAA,EACJ,QAAQ,QAAA,EACJ,OAAO,YAAA;;;;oBAGT,UAAU,GAAG,IAAA,uBAAa,GAAE,CAAC;oBACpB,KAAA,OAAO,CAAA;4BAAP,wBAAO;oBAAK,qBAAM,IAAA,mBAAS,GAAE,E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AC;oBAC/B,CAAC;oBAED,gDAAgD;oBAChD,UAAU,GAAG,IAAA,4BAAiB,EAAC,UAAU,EAAE,sBAAsB,CAAC,CAAC;oBAG9C,qBAAM,yBAAyB,EAAA;;oBAA9C,YAAY,GAAG,SAA+B;oBAEpD,sBAAO,CACL,uBAAC,+BAAc,aACb,UAAU,EAAE,UAAU,EACtB,mBAAmB,EAAE,YAAY,EACjC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,UAAU,CAAC,UAAU,EAAE,EAChC,aAAa,EAAE,aAAa,EAC5B,mBAAmB,EAAE,mBAAmB,EACxC,0BAA0B,EAAE,0BAA0B,EACtD,iBAAiB,EACf,OAAO,CAAC,GAAG,CAAC,uCAAuC,KAAK,MAAM,IAE5D,UAAU,CAAC,mBAAmB,EAAE,cAEnC,QAAQ,IACM,CAClB,EAAC;;;;CACH"}
|
|
@@ -1,39 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Can only be used in server components.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```jsx
|
|
7
|
-
* // Basic usage:
|
|
8
|
-
* <Tx id="welcome_message">
|
|
9
|
-
* Hello, <Var>{name}</Var>!
|
|
10
|
-
* </Tx>
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```jsx
|
|
15
|
-
* // Translating a plural
|
|
16
|
-
* <T id="item_count">
|
|
17
|
-
* <Plural n={3} singular={<>You have <Num children={n}/> item.</>}>
|
|
18
|
-
* You have <Num children={n}/> items.
|
|
19
|
-
* </Plural>
|
|
20
|
-
* </T>
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* @param {React.ReactNode} children - The content to be translated or displayed.
|
|
24
|
-
* @param {string} [id] - Optional identifier for the translation string. If not provided, a hash will be generated from the content.
|
|
25
|
-
* @param {any} [context] - Additional context for translation key generation.
|
|
26
|
-
*
|
|
27
|
-
* @returns {JSX.Element} The rendered translation or fallback content based on the provided configuration.
|
|
28
|
-
*
|
|
29
|
-
* @throws {Error} If a plural translation is requested but the `n` option is not provided.
|
|
30
|
-
*/
|
|
31
|
-
declare function Tx({ children, id, context, locale, }: {
|
|
32
|
-
children: any;
|
|
33
|
-
id?: string;
|
|
34
|
-
context?: string;
|
|
35
|
-
locale?: string;
|
|
36
|
-
}): Promise<any>;
|
|
1
|
+
import { TxProps } from '../../utils/types';
|
|
2
|
+
declare function Tx({ children, id, context, locale }: TxProps): Promise<any>;
|
|
37
3
|
declare namespace Tx {
|
|
38
4
|
var gtTransformation: string;
|
|
39
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_Tx.d.ts","sourceRoot":"","sources":["../../../src/server-dir/runtime/_Tx.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_Tx.d.ts","sourceRoot":"","sources":["../../../src/server-dir/runtime/_Tx.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAM5C,iBAAe,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAyH1E;kBAzHc,EAAE;;;AA6HjB,eAAe,EAAE,CAAC"}
|
|
@@ -68,36 +68,6 @@ function Resolver(_a) {
|
|
|
68
68
|
});
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
|
-
/**
|
|
72
|
-
* Runtime translation component that renders its children in the user's given locale.
|
|
73
|
-
* Can only be used in server components.
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* ```jsx
|
|
77
|
-
* // Basic usage:
|
|
78
|
-
* <Tx id="welcome_message">
|
|
79
|
-
* Hello, <Var>{name}</Var>!
|
|
80
|
-
* </Tx>
|
|
81
|
-
* ```
|
|
82
|
-
*
|
|
83
|
-
* @example
|
|
84
|
-
* ```jsx
|
|
85
|
-
* // Translating a plural
|
|
86
|
-
* <T id="item_count">
|
|
87
|
-
* <Plural n={3} singular={<>You have <Num children={n}/> item.</>}>
|
|
88
|
-
* You have <Num children={n}/> items.
|
|
89
|
-
* </Plural>
|
|
90
|
-
* </T>
|
|
91
|
-
* ```
|
|
92
|
-
*
|
|
93
|
-
* @param {React.ReactNode} children - The content to be translated or displayed.
|
|
94
|
-
* @param {string} [id] - Optional identifier for the translation string. If not provided, a hash will be generated from the content.
|
|
95
|
-
* @param {any} [context] - Additional context for translation key generation.
|
|
96
|
-
*
|
|
97
|
-
* @returns {JSX.Element} The rendered translation or fallback content based on the provided configuration.
|
|
98
|
-
*
|
|
99
|
-
* @throws {Error} If a plural translation is requested but the `n` option is not provided.
|
|
100
|
-
*/
|
|
101
71
|
function Tx(_a) {
|
|
102
72
|
return __awaiter(this, arguments, void 0, function (_b) {
|
|
103
73
|
var I18NConfig, _c, defaultLocale, _d, translationRequired, dialectTranslationRequired, taggedChildren, renderDefault, childrenAsObjects, hash, translationEntry, renderTranslation, renderSettings, translationPromise, loadingFallback;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_Tx.js","sourceRoot":"","sources":["../../../src/server-dir/runtime/_Tx.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iFAA2D;AAC3D,sEAAgD;AAChD,+BAAiC;AACjC,8CAO2B;AAC3B,+EAAyD;AAEzD,4CAAwD;
|
|
1
|
+
{"version":3,"file":"_Tx.js","sourceRoot":"","sources":["../../../src/server-dir/runtime/_Tx.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iFAA2D;AAC3D,sEAAgD;AAChD,+BAAiC;AACjC,8CAO2B;AAC3B,+EAAyD;AAEzD,4CAAwD;AAGxD,SAAe,QAAQ;wDAAC,EAA2C;YAAzC,QAAQ,cAAA;;;wBACzB,qBAAM,QAAQ,EAA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;;yBAE1B,CAAC,EAAE,CAAC;oBAKL,IAAI,cAAc,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;wBACxC,eAAe,GAAG,aAAa,EAAE,CAAC;oBACpC,CAAC;yBAAM,IAAI,cAAc,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;wBAChD,eAAe,GAAG,IAAA,yBAAc,GAAE,CAAC;oBACrC,CAAC;yBAAM,CAAC;wBACN,eAAe,GAAG,0BAA0B;4BAC1C,CAAC,CAAC,aAAa,EAAE;4BACjB,CAAC,CAAC,IAAA,yBAAc,GAAE,CAAC;oBACvB,CAAC;oBAED,sBAAO,CACL,uBAAC,gBAAQ,IAAc,QAAQ,EAAE,eAAe,YAC9C,uBAAC,QAAQ,IAAC,QAAQ,EAAE,kBAAkB,GAAI,IAD7B,MAAM,CAEV,CACZ,EAAC;;;;CACH;AAED,EAAE,CAAC,gBAAgB,GAAG,kBAAkB,CAAC;AAEzC,kBAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type GTProviderProps = {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
id?: string;
|
|
5
|
+
locale?: string;
|
|
6
|
+
};
|
|
7
|
+
export type TxProps = {
|
|
8
|
+
children: any;
|
|
9
|
+
id?: string;
|
|
10
|
+
context?: string;
|
|
11
|
+
locale?: string;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,EAAE,GAAG,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `<Currency>` component renders a formatted currency string, allowing customization of name, default value, currency type, and formatting options.
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* ```jsx
|
|
6
|
-
* <Currency
|
|
7
|
-
* currency="USD"
|
|
8
|
-
* >
|
|
9
|
-
* 1000
|
|
10
|
-
* </Currency>
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* @param {any} [children] - Optional content to render inside the currency component.
|
|
14
|
-
* @param {string} [currency] - The currency type (e.g., USD, EUR, etc.).
|
|
15
|
-
* @param {Intl.NumberFormatOptions} [options] - Optional formatting options to customize how the currency is displayed.
|
|
16
|
-
* @returns {Promise<React.JSX.Element>} The formatted currency component.
|
|
17
|
-
*/
|
|
18
1
|
declare function Currency({ children, currency, name, locales, options, }: {
|
|
19
2
|
children?: any;
|
|
20
3
|
currency?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Currency.d.ts","sourceRoot":"","sources":["../../src/variables/Currency.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"Currency.d.ts","sourceRoot":"","sources":["../../src/variables/Currency.tsx"],"names":[],"mappings":"AAIA,iBAAe,QAAQ,CAAC,EACtB,QAAQ,EACR,QAAgB,EAChB,IAAI,EACJ,OAAO,EACP,OAAY,GACb,EAAE;IACD,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAgB7B;kBA5Bc,QAAQ;;;AAgCvB,eAAe,QAAQ,CAAC"}
|
|
@@ -54,23 +54,6 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
54
54
|
var generaltranslation_1 = require("generaltranslation");
|
|
55
55
|
var getI18NConfig_1 = __importDefault(require("../config-dir/getI18NConfig"));
|
|
56
56
|
var getLocale_1 = __importDefault(require("../request/getLocale"));
|
|
57
|
-
/**
|
|
58
|
-
* The `<Currency>` component renders a formatted currency string, allowing customization of name, default value, currency type, and formatting options.
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
* ```jsx
|
|
62
|
-
* <Currency
|
|
63
|
-
* currency="USD"
|
|
64
|
-
* >
|
|
65
|
-
* 1000
|
|
66
|
-
* </Currency>
|
|
67
|
-
* ```
|
|
68
|
-
*
|
|
69
|
-
* @param {any} [children] - Optional content to render inside the currency component.
|
|
70
|
-
* @param {string} [currency] - The currency type (e.g., USD, EUR, etc.).
|
|
71
|
-
* @param {Intl.NumberFormatOptions} [options] - Optional formatting options to customize how the currency is displayed.
|
|
72
|
-
* @returns {Promise<React.JSX.Element>} The formatted currency component.
|
|
73
|
-
*/
|
|
74
57
|
function Currency(_a) {
|
|
75
58
|
return __awaiter(this, arguments, void 0, function (_b) {
|
|
76
59
|
var renderedValue, formattedValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Currency.js","sourceRoot":"","sources":["../../src/variables/Currency.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAAoD;AACpD,8EAAwD;AACxD,mEAA6C;AAE7C
|
|
1
|
+
{"version":3,"file":"Currency.js","sourceRoot":"","sources":["../../src/variables/Currency.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAAoD;AACpD,8EAAwD;AACxD,mEAA6C;AAE7C,SAAe,QAAQ;wDAAC,EAYvB;;YAXC,QAAQ,cAAA,EACR,gBAAgB,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAChB,IAAI,UAAA,EACJ,OAAO,aAAA,EACP,eAAY,EAAZ,OAAO,mBAAG,EAAE,KAAA;;;;yBAQR,CAAC,OAAO,EAAR,wBAAQ;oBACC,qBAAM,IAAA,mBAAS,GAAE,EAAA;;oBAA5B,OAAO,IAAI,SAAiB,EAAE,IAAA,uBAAa,GAAE,CAAC,gBAAgB,EAAE,CAAC,CAAC;;;oBAI9D,aAAa,GACjB,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;oBAG3D,cAAc,GAClB,OAAO,aAAa,KAAK,QAAQ;wBAC/B,CAAC,CAAC,IAAA,mCAAc,EAAC,aAAa,EAAE,QAAQ,aAAI,OAAO,SAAA,IAAK,OAAO,EAAG;wBAClE,CAAC,CAAC,aAAa,CAAC;oBAEpB,sBAAO,2DAAG,cAAc,GAAI,EAAC;;;;CAC9B;AAED,QAAQ,CAAC,gBAAgB,GAAG,mBAAmB,CAAC;AAEhD,kBAAe,QAAQ,CAAC"}
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `<DateTime>` component renders a formatted date or time string, allowing customization of the name, default value, and formatting options.
|
|
3
|
-
* It utilizes the current locale and optional format settings to display the date.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```jsx
|
|
7
|
-
* <DateTime>
|
|
8
|
-
* {new Date()}
|
|
9
|
-
* </DateTime>
|
|
10
|
-
* ```
|
|
11
|
-
*
|
|
12
|
-
* @param {any} [children] - Optional content (typically a date) to render inside the component.
|
|
13
|
-
* @param {Intl.DateTimeFormatOptions} [options={}] - Optional formatting options for the date, following `Intl.DateTimeFormatOptions` specifications.
|
|
14
|
-
* @returns {Promise<React.JSX.Element>} The formatted date or time component.
|
|
15
|
-
*/
|
|
16
1
|
declare function DateTime({ children, name, locales, options, }: {
|
|
17
2
|
children?: any;
|
|
18
3
|
name?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTime.d.ts","sourceRoot":"","sources":["../../src/variables/DateTime.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"DateTime.d.ts","sourceRoot":"","sources":["../../src/variables/DateTime.tsx"],"names":[],"mappings":"AAIA,iBAAe,QAAQ,CAAC,EACtB,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,OAAY,GACb,EAAE;IACD,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CA6B7B;kBAvCc,QAAQ;;;AA2CvB,eAAe,QAAQ,CAAC"}
|
|
@@ -54,21 +54,6 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
54
54
|
var generaltranslation_1 = require("generaltranslation");
|
|
55
55
|
var getI18NConfig_1 = __importDefault(require("../config-dir/getI18NConfig"));
|
|
56
56
|
var getLocale_1 = __importDefault(require("../request/getLocale"));
|
|
57
|
-
/**
|
|
58
|
-
* The `<DateTime>` component renders a formatted date or time string, allowing customization of the name, default value, and formatting options.
|
|
59
|
-
* It utilizes the current locale and optional format settings to display the date.
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* ```jsx
|
|
63
|
-
* <DateTime>
|
|
64
|
-
* {new Date()}
|
|
65
|
-
* </DateTime>
|
|
66
|
-
* ```
|
|
67
|
-
*
|
|
68
|
-
* @param {any} [children] - Optional content (typically a date) to render inside the component.
|
|
69
|
-
* @param {Intl.DateTimeFormatOptions} [options={}] - Optional formatting options for the date, following `Intl.DateTimeFormatOptions` specifications.
|
|
70
|
-
* @returns {Promise<React.JSX.Element>} The formatted date or time component.
|
|
71
|
-
*/
|
|
72
57
|
function DateTime(_a) {
|
|
73
58
|
return __awaiter(this, arguments, void 0, function (_b) {
|
|
74
59
|
var final, dateValue, defaultValue;
|