@react-aria/i18n 3.12.16 → 3.13.0

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.
Files changed (81) hide show
  1. package/dist/import.mjs +9 -11
  2. package/dist/main.js +19 -21
  3. package/dist/main.js.map +1 -1
  4. package/dist/module.js +9 -11
  5. package/dist/module.js.map +1 -1
  6. package/dist/{useMessageFormatter.main.js → private/useMessageFormatter.cjs} +15 -15
  7. package/dist/{useMessageFormatter.main.js.map → private/useMessageFormatter.cjs.map} +1 -1
  8. package/dist/private/useMessageFormatter.js +43 -0
  9. package/dist/{useMessageFormatter.module.js.map → private/useMessageFormatter.js.map} +1 -1
  10. package/dist/types/src/index.d.ts +15 -0
  11. package/dist/types/src/server.d.ts +1 -0
  12. package/dist/types/src/useMessageFormatter.d.ts +11 -0
  13. package/package.json +15 -21
  14. package/server/index.js +4 -72
  15. package/server/index.js.map +1 -1
  16. package/server/index.mjs +3 -67
  17. package/server/index.mjs.map +1 -1
  18. package/src/index.ts +11 -13
  19. package/src/server.ts +1 -0
  20. package/src/useMessageFormatter.ts +1 -1
  21. package/dist/context.main.js +0 -72
  22. package/dist/context.main.js.map +0 -1
  23. package/dist/context.mjs +0 -62
  24. package/dist/context.module.js +0 -62
  25. package/dist/context.module.js.map +0 -1
  26. package/dist/types.d.ts +0 -95
  27. package/dist/types.d.ts.map +0 -1
  28. package/dist/useCollator.main.js +0 -31
  29. package/dist/useCollator.main.js.map +0 -1
  30. package/dist/useCollator.mjs +0 -26
  31. package/dist/useCollator.module.js +0 -26
  32. package/dist/useCollator.module.js.map +0 -1
  33. package/dist/useDateFormatter.main.js +0 -47
  34. package/dist/useDateFormatter.main.js.map +0 -1
  35. package/dist/useDateFormatter.mjs +0 -42
  36. package/dist/useDateFormatter.module.js +0 -42
  37. package/dist/useDateFormatter.module.js.map +0 -1
  38. package/dist/useDefaultLocale.main.js +0 -70
  39. package/dist/useDefaultLocale.main.js.map +0 -1
  40. package/dist/useDefaultLocale.mjs +0 -65
  41. package/dist/useDefaultLocale.module.js +0 -65
  42. package/dist/useDefaultLocale.module.js.map +0 -1
  43. package/dist/useFilter.main.js +0 -72
  44. package/dist/useFilter.main.js.map +0 -1
  45. package/dist/useFilter.mjs +0 -67
  46. package/dist/useFilter.module.js +0 -67
  47. package/dist/useFilter.module.js.map +0 -1
  48. package/dist/useListFormatter.main.js +0 -31
  49. package/dist/useListFormatter.main.js.map +0 -1
  50. package/dist/useListFormatter.mjs +0 -26
  51. package/dist/useListFormatter.module.js +0 -26
  52. package/dist/useListFormatter.module.js.map +0 -1
  53. package/dist/useLocalizedStringFormatter.main.js +0 -47
  54. package/dist/useLocalizedStringFormatter.main.js.map +0 -1
  55. package/dist/useLocalizedStringFormatter.mjs +0 -41
  56. package/dist/useLocalizedStringFormatter.module.js +0 -41
  57. package/dist/useLocalizedStringFormatter.module.js.map +0 -1
  58. package/dist/useMessageFormatter.mjs +0 -43
  59. package/dist/useMessageFormatter.module.js +0 -43
  60. package/dist/useNumberFormatter.main.js +0 -33
  61. package/dist/useNumberFormatter.main.js.map +0 -1
  62. package/dist/useNumberFormatter.mjs +0 -28
  63. package/dist/useNumberFormatter.module.js +0 -28
  64. package/dist/useNumberFormatter.module.js.map +0 -1
  65. package/dist/utils.main.js +0 -70
  66. package/dist/utils.main.js.map +0 -1
  67. package/dist/utils.mjs +0 -65
  68. package/dist/utils.module.js +0 -65
  69. package/dist/utils.module.js.map +0 -1
  70. package/src/context.tsx +0 -87
  71. package/src/main.js +0 -6
  72. package/src/module.js +0 -6
  73. package/src/server.tsx +0 -99
  74. package/src/useCollator.ts +0 -33
  75. package/src/useDateFormatter.ts +0 -52
  76. package/src/useDefaultLocale.ts +0 -91
  77. package/src/useFilter.ts +0 -83
  78. package/src/useListFormatter.tsx +0 -24
  79. package/src/useLocalizedStringFormatter.ts +0 -44
  80. package/src/useNumberFormatter.ts +0 -25
  81. package/src/utils.ts +0 -43
@@ -1,41 +0,0 @@
1
- import {useLocale as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7} from "./context.mjs";
2
- import {LocalizedStringDictionary as $6ksNp$LocalizedStringDictionary, LocalizedStringFormatter as $6ksNp$LocalizedStringFormatter} from "@internationalized/string";
3
- import {useMemo as $6ksNp$useMemo} from "react";
4
-
5
- /*
6
- * Copyright 2022 Adobe. All rights reserved.
7
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License. You may obtain a copy
9
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software distributed under
12
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
- * OF ANY KIND, either express or implied. See the License for the specific language
14
- * governing permissions and limitations under the License.
15
- */
16
-
17
-
18
- const $fca6afa0e843324b$var$cache = new WeakMap();
19
- function $fca6afa0e843324b$var$getCachedDictionary(strings) {
20
- let dictionary = $fca6afa0e843324b$var$cache.get(strings);
21
- if (!dictionary) {
22
- dictionary = new (0, $6ksNp$LocalizedStringDictionary)(strings);
23
- $fca6afa0e843324b$var$cache.set(strings, dictionary);
24
- }
25
- return dictionary;
26
- }
27
- function $fca6afa0e843324b$export$87b761675e8eaa10(strings, packageName) {
28
- return packageName && (0, $6ksNp$LocalizedStringDictionary).getGlobalDictionaryForPackage(packageName) || $fca6afa0e843324b$var$getCachedDictionary(strings);
29
- }
30
- function $fca6afa0e843324b$export$f12b703ca79dfbb1(strings, packageName) {
31
- let { locale: locale } = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)();
32
- let dictionary = $fca6afa0e843324b$export$87b761675e8eaa10(strings, packageName);
33
- return (0, $6ksNp$useMemo)(()=>new (0, $6ksNp$LocalizedStringFormatter)(locale, dictionary), [
34
- locale,
35
- dictionary
36
- ]);
37
- }
38
-
39
-
40
- export {$fca6afa0e843324b$export$87b761675e8eaa10 as useLocalizedStringDictionary, $fca6afa0e843324b$export$f12b703ca79dfbb1 as useLocalizedStringFormatter};
41
- //# sourceMappingURL=useLocalizedStringFormatter.module.js.map
@@ -1,41 +0,0 @@
1
- import {useLocale as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7} from "./context.module.js";
2
- import {LocalizedStringDictionary as $6ksNp$LocalizedStringDictionary, LocalizedStringFormatter as $6ksNp$LocalizedStringFormatter} from "@internationalized/string";
3
- import {useMemo as $6ksNp$useMemo} from "react";
4
-
5
- /*
6
- * Copyright 2022 Adobe. All rights reserved.
7
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License. You may obtain a copy
9
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software distributed under
12
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
- * OF ANY KIND, either express or implied. See the License for the specific language
14
- * governing permissions and limitations under the License.
15
- */
16
-
17
-
18
- const $fca6afa0e843324b$var$cache = new WeakMap();
19
- function $fca6afa0e843324b$var$getCachedDictionary(strings) {
20
- let dictionary = $fca6afa0e843324b$var$cache.get(strings);
21
- if (!dictionary) {
22
- dictionary = new (0, $6ksNp$LocalizedStringDictionary)(strings);
23
- $fca6afa0e843324b$var$cache.set(strings, dictionary);
24
- }
25
- return dictionary;
26
- }
27
- function $fca6afa0e843324b$export$87b761675e8eaa10(strings, packageName) {
28
- return packageName && (0, $6ksNp$LocalizedStringDictionary).getGlobalDictionaryForPackage(packageName) || $fca6afa0e843324b$var$getCachedDictionary(strings);
29
- }
30
- function $fca6afa0e843324b$export$f12b703ca79dfbb1(strings, packageName) {
31
- let { locale: locale } = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)();
32
- let dictionary = $fca6afa0e843324b$export$87b761675e8eaa10(strings, packageName);
33
- return (0, $6ksNp$useMemo)(()=>new (0, $6ksNp$LocalizedStringFormatter)(locale, dictionary), [
34
- locale,
35
- dictionary
36
- ]);
37
- }
38
-
39
-
40
- export {$fca6afa0e843324b$export$87b761675e8eaa10 as useLocalizedStringDictionary, $fca6afa0e843324b$export$f12b703ca79dfbb1 as useLocalizedStringFormatter};
41
- //# sourceMappingURL=useLocalizedStringFormatter.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAMD,MAAM,8BAAQ,IAAI;AAClB,SAAS,0CAAiE,OAA+B;IACvG,IAAI,aAAa,4BAAM,GAAG,CAAC;IAC3B,IAAI,CAAC,YAAY;QACf,aAAa,IAAI,CAAA,GAAA,gCAAwB,EAAE;QAC3C,4BAAM,GAAG,CAAC,SAAS;IACrB;IAEA,OAAO;AACT;AAKO,SAAS,0CAA4F,OAA+B,EAAE,WAAoB;IAC/J,OAAO,AAAC,eAAe,CAAA,GAAA,gCAAwB,EAAE,6BAA6B,CAAC,gBAAiB,0CAAoB;AACtH;AAOO,SAAS,0CAA2F,OAA+B,EAAE,WAAoB;IAC9J,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,yCAAQ;IACvB,IAAI,aAAa,0CAA6B,SAAS;IACvD,OAAO,CAAA,GAAA,cAAM,EAAE,IAAM,IAAI,CAAA,GAAA,+BAAuB,EAAE,QAAQ,aAAa;QAAC;QAAQ;KAAW;AAC7F","sources":["packages/@react-aria/i18n/src/useLocalizedStringFormatter.ts"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {LocalizedString, LocalizedStringDictionary, LocalizedStringFormatter, LocalizedStrings} from '@internationalized/string';\nimport {useLocale} from './context';\nimport {useMemo} from 'react';\n\nconst cache = new WeakMap();\nfunction getCachedDictionary<K extends string, T extends LocalizedString>(strings: LocalizedStrings<K, T>): LocalizedStringDictionary<K, T> {\n let dictionary = cache.get(strings);\n if (!dictionary) {\n dictionary = new LocalizedStringDictionary(strings);\n cache.set(strings, dictionary);\n }\n\n return dictionary;\n}\n\n/**\n * Returns a cached LocalizedStringDictionary for the given strings.\n */\nexport function useLocalizedStringDictionary<K extends string = string, T extends LocalizedString = string>(strings: LocalizedStrings<K, T>, packageName?: string): LocalizedStringDictionary<K, T> {\n return (packageName && LocalizedStringDictionary.getGlobalDictionaryForPackage(packageName)) || getCachedDictionary(strings);\n}\n\n/**\n * Provides localized string formatting for the current locale. Supports interpolating variables,\n * selecting the correct pluralization, and formatting numbers. Automatically updates when the locale changes.\n * @param strings - A mapping of languages to localized strings by key.\n */\nexport function useLocalizedStringFormatter<K extends string = string, T extends LocalizedString = string>(strings: LocalizedStrings<K, T>, packageName?: string): LocalizedStringFormatter<K, T> {\n let {locale} = useLocale();\n let dictionary = useLocalizedStringDictionary(strings, packageName);\n return useMemo(() => new LocalizedStringFormatter(locale, dictionary), [locale, dictionary]);\n}\n"],"names":[],"version":3,"file":"useLocalizedStringFormatter.module.js.map"}
@@ -1,43 +0,0 @@
1
- import {useLocale as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7} from "./context.mjs";
2
- import {MessageDictionary as $eZWU1$MessageDictionary, MessageFormatter as $eZWU1$MessageFormatter} from "@internationalized/message";
3
- import {useMemo as $eZWU1$useMemo, useCallback as $eZWU1$useCallback} from "react";
4
-
5
- /*
6
- * Copyright 2020 Adobe. All rights reserved.
7
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License. You may obtain a copy
9
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software distributed under
12
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
- * OF ANY KIND, either express or implied. See the License for the specific language
14
- * governing permissions and limitations under the License.
15
- */
16
-
17
-
18
- const $321bc95feeb923dd$var$cache = new WeakMap();
19
- function $321bc95feeb923dd$var$getCachedDictionary(strings) {
20
- let dictionary = $321bc95feeb923dd$var$cache.get(strings);
21
- if (!dictionary) {
22
- dictionary = new (0, $eZWU1$MessageDictionary)(strings);
23
- $321bc95feeb923dd$var$cache.set(strings, dictionary);
24
- }
25
- return dictionary;
26
- }
27
- function $321bc95feeb923dd$export$ec23bf898b1eed85(strings) {
28
- let { locale: locale } = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)();
29
- let dictionary = (0, $eZWU1$useMemo)(()=>$321bc95feeb923dd$var$getCachedDictionary(strings), [
30
- strings
31
- ]);
32
- let formatter = (0, $eZWU1$useMemo)(()=>new (0, $eZWU1$MessageFormatter)(locale, dictionary), [
33
- locale,
34
- dictionary
35
- ]);
36
- return (0, $eZWU1$useCallback)((key, variables)=>formatter.format(key, variables), [
37
- formatter
38
- ]);
39
- }
40
-
41
-
42
- export {$321bc95feeb923dd$export$ec23bf898b1eed85 as useMessageFormatter};
43
- //# sourceMappingURL=useMessageFormatter.module.js.map
@@ -1,43 +0,0 @@
1
- import {useLocale as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7} from "./context.module.js";
2
- import {MessageDictionary as $eZWU1$MessageDictionary, MessageFormatter as $eZWU1$MessageFormatter} from "@internationalized/message";
3
- import {useMemo as $eZWU1$useMemo, useCallback as $eZWU1$useCallback} from "react";
4
-
5
- /*
6
- * Copyright 2020 Adobe. All rights reserved.
7
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License. You may obtain a copy
9
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software distributed under
12
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
- * OF ANY KIND, either express or implied. See the License for the specific language
14
- * governing permissions and limitations under the License.
15
- */
16
-
17
-
18
- const $321bc95feeb923dd$var$cache = new WeakMap();
19
- function $321bc95feeb923dd$var$getCachedDictionary(strings) {
20
- let dictionary = $321bc95feeb923dd$var$cache.get(strings);
21
- if (!dictionary) {
22
- dictionary = new (0, $eZWU1$MessageDictionary)(strings);
23
- $321bc95feeb923dd$var$cache.set(strings, dictionary);
24
- }
25
- return dictionary;
26
- }
27
- function $321bc95feeb923dd$export$ec23bf898b1eed85(strings) {
28
- let { locale: locale } = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)();
29
- let dictionary = (0, $eZWU1$useMemo)(()=>$321bc95feeb923dd$var$getCachedDictionary(strings), [
30
- strings
31
- ]);
32
- let formatter = (0, $eZWU1$useMemo)(()=>new (0, $eZWU1$MessageFormatter)(locale, dictionary), [
33
- locale,
34
- dictionary
35
- ]);
36
- return (0, $eZWU1$useCallback)((key, variables)=>formatter.format(key, variables), [
37
- formatter
38
- ]);
39
- }
40
-
41
-
42
- export {$321bc95feeb923dd$export$ec23bf898b1eed85 as useMessageFormatter};
43
- //# sourceMappingURL=useMessageFormatter.module.js.map
@@ -1,33 +0,0 @@
1
- var $47fa5ec5ff482271$exports = require("./context.main.js");
2
- var $1NItU$internationalizednumber = require("@internationalized/number");
3
- var $1NItU$react = require("react");
4
-
5
-
6
- function $parcel$export(e, n, v, s) {
7
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
8
- }
9
-
10
- $parcel$export(module.exports, "useNumberFormatter", () => $fea93c5b7c90d9f4$export$b7a616150fdb9f44);
11
- /*
12
- * Copyright 2020 Adobe. All rights reserved.
13
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14
- * you may not use this file except in compliance with the License. You may obtain a copy
15
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
16
- *
17
- * Unless required by applicable law or agreed to in writing, software distributed under
18
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
19
- * OF ANY KIND, either express or implied. See the License for the specific language
20
- * governing permissions and limitations under the License.
21
- */
22
-
23
-
24
- function $fea93c5b7c90d9f4$export$b7a616150fdb9f44(options = {}) {
25
- let { locale: locale } = (0, $47fa5ec5ff482271$exports.useLocale)();
26
- return (0, $1NItU$react.useMemo)(()=>new (0, $1NItU$internationalizednumber.NumberFormatter)(locale, options), [
27
- locale,
28
- options
29
- ]);
30
- }
31
-
32
-
33
- //# sourceMappingURL=useNumberFormatter.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAWM,SAAS,0CAAmB,UAA+B,CAAC,CAAC;IAClE,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,mCAAQ;IACvB,OAAO,CAAA,GAAA,oBAAM,EAAE,IAAM,IAAI,CAAA,GAAA,8CAAc,EAAE,QAAQ,UAAU;QAAC;QAAQ;KAAQ;AAC9E","sources":["packages/@react-aria/i18n/src/useNumberFormatter.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {NumberFormatOptions, NumberFormatter} from '@internationalized/number';\nimport {useLocale} from './context';\nimport {useMemo} from 'react';\n\n/**\n * Provides localized number formatting for the current locale. Automatically updates when the locale changes,\n * and handles caching of the number formatter for performance.\n * @param options - Formatting options.\n */\nexport function useNumberFormatter(options: NumberFormatOptions = {}): Intl.NumberFormat {\n let {locale} = useLocale();\n return useMemo(() => new NumberFormatter(locale, options), [locale, options]);\n}\n"],"names":[],"version":3,"file":"useNumberFormatter.main.js.map"}
@@ -1,28 +0,0 @@
1
- import {useLocale as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7} from "./context.mjs";
2
- import {NumberFormatter as $JFEdn$NumberFormatter} from "@internationalized/number";
3
- import {useMemo as $JFEdn$useMemo} from "react";
4
-
5
- /*
6
- * Copyright 2020 Adobe. All rights reserved.
7
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License. You may obtain a copy
9
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software distributed under
12
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
- * OF ANY KIND, either express or implied. See the License for the specific language
14
- * governing permissions and limitations under the License.
15
- */
16
-
17
-
18
- function $a916eb452884faea$export$b7a616150fdb9f44(options = {}) {
19
- let { locale: locale } = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)();
20
- return (0, $JFEdn$useMemo)(()=>new (0, $JFEdn$NumberFormatter)(locale, options), [
21
- locale,
22
- options
23
- ]);
24
- }
25
-
26
-
27
- export {$a916eb452884faea$export$b7a616150fdb9f44 as useNumberFormatter};
28
- //# sourceMappingURL=useNumberFormatter.module.js.map
@@ -1,28 +0,0 @@
1
- import {useLocale as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7} from "./context.module.js";
2
- import {NumberFormatter as $JFEdn$NumberFormatter} from "@internationalized/number";
3
- import {useMemo as $JFEdn$useMemo} from "react";
4
-
5
- /*
6
- * Copyright 2020 Adobe. All rights reserved.
7
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License. You may obtain a copy
9
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software distributed under
12
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
- * OF ANY KIND, either express or implied. See the License for the specific language
14
- * governing permissions and limitations under the License.
15
- */
16
-
17
-
18
- function $a916eb452884faea$export$b7a616150fdb9f44(options = {}) {
19
- let { locale: locale } = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)();
20
- return (0, $JFEdn$useMemo)(()=>new (0, $JFEdn$NumberFormatter)(locale, options), [
21
- locale,
22
- options
23
- ]);
24
- }
25
-
26
-
27
- export {$a916eb452884faea$export$b7a616150fdb9f44 as useNumberFormatter};
28
- //# sourceMappingURL=useNumberFormatter.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAWM,SAAS,0CAAmB,UAA+B,CAAC,CAAC;IAClE,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,yCAAQ;IACvB,OAAO,CAAA,GAAA,cAAM,EAAE,IAAM,IAAI,CAAA,GAAA,sBAAc,EAAE,QAAQ,UAAU;QAAC;QAAQ;KAAQ;AAC9E","sources":["packages/@react-aria/i18n/src/useNumberFormatter.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {NumberFormatOptions, NumberFormatter} from '@internationalized/number';\nimport {useLocale} from './context';\nimport {useMemo} from 'react';\n\n/**\n * Provides localized number formatting for the current locale. Automatically updates when the locale changes,\n * and handles caching of the number formatter for performance.\n * @param options - Formatting options.\n */\nexport function useNumberFormatter(options: NumberFormatOptions = {}): Intl.NumberFormat {\n let {locale} = useLocale();\n return useMemo(() => new NumberFormatter(locale, options), [locale, options]);\n}\n"],"names":[],"version":3,"file":"useNumberFormatter.module.js.map"}
@@ -1,70 +0,0 @@
1
-
2
- function $parcel$export(e, n, v, s) {
3
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
- }
5
-
6
- $parcel$export(module.exports, "isRTL", () => $4d65847630a056a8$export$702d680b21cbd764);
7
- /*
8
- * Copyright 2020 Adobe. All rights reserved.
9
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
- * you may not use this file except in compliance with the License. You may obtain a copy
11
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software distributed under
14
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
- * OF ANY KIND, either express or implied. See the License for the specific language
16
- * governing permissions and limitations under the License.
17
- */ // https://en.wikipedia.org/wiki/Right-to-left
18
- const $4d65847630a056a8$var$RTL_SCRIPTS = new Set([
19
- 'Arab',
20
- 'Syrc',
21
- 'Samr',
22
- 'Mand',
23
- 'Thaa',
24
- 'Mend',
25
- 'Nkoo',
26
- 'Adlm',
27
- 'Rohg',
28
- 'Hebr'
29
- ]);
30
- const $4d65847630a056a8$var$RTL_LANGS = new Set([
31
- 'ae',
32
- 'ar',
33
- 'arc',
34
- 'bcc',
35
- 'bqi',
36
- 'ckb',
37
- 'dv',
38
- 'fa',
39
- 'glk',
40
- 'he',
41
- 'ku',
42
- 'mzn',
43
- 'nqo',
44
- 'pnb',
45
- 'ps',
46
- 'sd',
47
- 'ug',
48
- 'ur',
49
- 'yi'
50
- ]);
51
- function $4d65847630a056a8$export$702d680b21cbd764(localeString) {
52
- // If the Intl.Locale API is available, use it to get the locale's text direction.
53
- if (Intl.Locale) {
54
- let locale = new Intl.Locale(localeString).maximize();
55
- // Use the text info object to get the direction if possible.
56
- // @ts-ignore - this was implemented as a property by some browsers before it was standardized as a function.
57
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo
58
- let textInfo = typeof locale.getTextInfo === 'function' ? locale.getTextInfo() : locale.textInfo;
59
- if (textInfo) return textInfo.direction === 'rtl';
60
- // Fallback: guess using the script.
61
- // This is more accurate than guessing by language, since languages can be written in multiple scripts.
62
- if (locale.script) return $4d65847630a056a8$var$RTL_SCRIPTS.has(locale.script);
63
- }
64
- // If not, just guess by the language (first part of the locale)
65
- let lang = localeString.split('-')[0];
66
- return $4d65847630a056a8$var$RTL_LANGS.has(lang);
67
- }
68
-
69
-
70
- //# sourceMappingURL=utils.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAED,8CAA8C;AAC9C,MAAM,oCAAc,IAAI,IAAI;IAAC;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;CAAO;AAC5G,MAAM,kCAAY,IAAI,IAAI;IAAC;IAAM;IAAM;IAAO;IAAO;IAAO;IAAO;IAAM;IAAM;IAAO;IAAM;IAAM;IAAO;IAAO;IAAO;IAAM;IAAM;IAAM;IAAM;CAAK;AAK7I,SAAS,0CAAM,YAAoB;IACxC,kFAAkF;IAClF,IAAI,KAAK,MAAM,EAAE;QACf,IAAI,SAAS,IAAI,KAAK,MAAM,CAAC,cAAc,QAAQ;QAEnD,6DAA6D;QAC7D,6GAA6G;QAC7G,2GAA2G;QAC3G,IAAI,WAAW,OAAO,OAAO,WAAW,KAAK,aAAa,OAAO,WAAW,KAAK,OAAO,QAAQ;QAChG,IAAI,UACF,OAAO,SAAS,SAAS,KAAK;QAGhC,oCAAoC;QACpC,uGAAuG;QACvG,IAAI,OAAO,MAAM,EACf,OAAO,kCAAY,GAAG,CAAC,OAAO,MAAM;IAExC;IAEA,gEAAgE;IAChE,IAAI,OAAO,aAAa,KAAK,CAAC,IAAI,CAAC,EAAE;IACrC,OAAO,gCAAU,GAAG,CAAC;AACvB","sources":["packages/@react-aria/i18n/src/utils.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// https://en.wikipedia.org/wiki/Right-to-left\nconst RTL_SCRIPTS = new Set(['Arab', 'Syrc', 'Samr', 'Mand', 'Thaa', 'Mend', 'Nkoo', 'Adlm', 'Rohg', 'Hebr']);\nconst RTL_LANGS = new Set(['ae', 'ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', 'ku', 'mzn', 'nqo', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi']);\n\n/**\n * Determines if a locale is read right to left using [Intl.Locale]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale}.\n */\nexport function isRTL(localeString: string): boolean {\n // If the Intl.Locale API is available, use it to get the locale's text direction.\n if (Intl.Locale) {\n let locale = new Intl.Locale(localeString).maximize();\n\n // Use the text info object to get the direction if possible.\n // @ts-ignore - this was implemented as a property by some browsers before it was standardized as a function.\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo\n let textInfo = typeof locale.getTextInfo === 'function' ? locale.getTextInfo() : locale.textInfo;\n if (textInfo) {\n return textInfo.direction === 'rtl';\n }\n\n // Fallback: guess using the script.\n // This is more accurate than guessing by language, since languages can be written in multiple scripts.\n if (locale.script) {\n return RTL_SCRIPTS.has(locale.script);\n }\n }\n\n // If not, just guess by the language (first part of the locale)\n let lang = localeString.split('-')[0];\n return RTL_LANGS.has(lang);\n}\n"],"names":[],"version":3,"file":"utils.main.js.map"}
package/dist/utils.mjs DELETED
@@ -1,65 +0,0 @@
1
- /*
2
- * Copyright 2020 Adobe. All rights reserved.
3
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License. You may obtain a copy
5
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
- *
7
- * Unless required by applicable law or agreed to in writing, software distributed under
8
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- * OF ANY KIND, either express or implied. See the License for the specific language
10
- * governing permissions and limitations under the License.
11
- */ // https://en.wikipedia.org/wiki/Right-to-left
12
- const $148a7a147e38ea7f$var$RTL_SCRIPTS = new Set([
13
- 'Arab',
14
- 'Syrc',
15
- 'Samr',
16
- 'Mand',
17
- 'Thaa',
18
- 'Mend',
19
- 'Nkoo',
20
- 'Adlm',
21
- 'Rohg',
22
- 'Hebr'
23
- ]);
24
- const $148a7a147e38ea7f$var$RTL_LANGS = new Set([
25
- 'ae',
26
- 'ar',
27
- 'arc',
28
- 'bcc',
29
- 'bqi',
30
- 'ckb',
31
- 'dv',
32
- 'fa',
33
- 'glk',
34
- 'he',
35
- 'ku',
36
- 'mzn',
37
- 'nqo',
38
- 'pnb',
39
- 'ps',
40
- 'sd',
41
- 'ug',
42
- 'ur',
43
- 'yi'
44
- ]);
45
- function $148a7a147e38ea7f$export$702d680b21cbd764(localeString) {
46
- // If the Intl.Locale API is available, use it to get the locale's text direction.
47
- if (Intl.Locale) {
48
- let locale = new Intl.Locale(localeString).maximize();
49
- // Use the text info object to get the direction if possible.
50
- // @ts-ignore - this was implemented as a property by some browsers before it was standardized as a function.
51
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo
52
- let textInfo = typeof locale.getTextInfo === 'function' ? locale.getTextInfo() : locale.textInfo;
53
- if (textInfo) return textInfo.direction === 'rtl';
54
- // Fallback: guess using the script.
55
- // This is more accurate than guessing by language, since languages can be written in multiple scripts.
56
- if (locale.script) return $148a7a147e38ea7f$var$RTL_SCRIPTS.has(locale.script);
57
- }
58
- // If not, just guess by the language (first part of the locale)
59
- let lang = localeString.split('-')[0];
60
- return $148a7a147e38ea7f$var$RTL_LANGS.has(lang);
61
- }
62
-
63
-
64
- export {$148a7a147e38ea7f$export$702d680b21cbd764 as isRTL};
65
- //# sourceMappingURL=utils.module.js.map
@@ -1,65 +0,0 @@
1
- /*
2
- * Copyright 2020 Adobe. All rights reserved.
3
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License. You may obtain a copy
5
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
- *
7
- * Unless required by applicable law or agreed to in writing, software distributed under
8
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- * OF ANY KIND, either express or implied. See the License for the specific language
10
- * governing permissions and limitations under the License.
11
- */ // https://en.wikipedia.org/wiki/Right-to-left
12
- const $148a7a147e38ea7f$var$RTL_SCRIPTS = new Set([
13
- 'Arab',
14
- 'Syrc',
15
- 'Samr',
16
- 'Mand',
17
- 'Thaa',
18
- 'Mend',
19
- 'Nkoo',
20
- 'Adlm',
21
- 'Rohg',
22
- 'Hebr'
23
- ]);
24
- const $148a7a147e38ea7f$var$RTL_LANGS = new Set([
25
- 'ae',
26
- 'ar',
27
- 'arc',
28
- 'bcc',
29
- 'bqi',
30
- 'ckb',
31
- 'dv',
32
- 'fa',
33
- 'glk',
34
- 'he',
35
- 'ku',
36
- 'mzn',
37
- 'nqo',
38
- 'pnb',
39
- 'ps',
40
- 'sd',
41
- 'ug',
42
- 'ur',
43
- 'yi'
44
- ]);
45
- function $148a7a147e38ea7f$export$702d680b21cbd764(localeString) {
46
- // If the Intl.Locale API is available, use it to get the locale's text direction.
47
- if (Intl.Locale) {
48
- let locale = new Intl.Locale(localeString).maximize();
49
- // Use the text info object to get the direction if possible.
50
- // @ts-ignore - this was implemented as a property by some browsers before it was standardized as a function.
51
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo
52
- let textInfo = typeof locale.getTextInfo === 'function' ? locale.getTextInfo() : locale.textInfo;
53
- if (textInfo) return textInfo.direction === 'rtl';
54
- // Fallback: guess using the script.
55
- // This is more accurate than guessing by language, since languages can be written in multiple scripts.
56
- if (locale.script) return $148a7a147e38ea7f$var$RTL_SCRIPTS.has(locale.script);
57
- }
58
- // If not, just guess by the language (first part of the locale)
59
- let lang = localeString.split('-')[0];
60
- return $148a7a147e38ea7f$var$RTL_LANGS.has(lang);
61
- }
62
-
63
-
64
- export {$148a7a147e38ea7f$export$702d680b21cbd764 as isRTL};
65
- //# sourceMappingURL=utils.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":"AAAA;;;;;;;;;;CAUC,GAED,8CAA8C;AAC9C,MAAM,oCAAc,IAAI,IAAI;IAAC;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;CAAO;AAC5G,MAAM,kCAAY,IAAI,IAAI;IAAC;IAAM;IAAM;IAAO;IAAO;IAAO;IAAO;IAAM;IAAM;IAAO;IAAM;IAAM;IAAO;IAAO;IAAO;IAAM;IAAM;IAAM;IAAM;CAAK;AAK7I,SAAS,0CAAM,YAAoB;IACxC,kFAAkF;IAClF,IAAI,KAAK,MAAM,EAAE;QACf,IAAI,SAAS,IAAI,KAAK,MAAM,CAAC,cAAc,QAAQ;QAEnD,6DAA6D;QAC7D,6GAA6G;QAC7G,2GAA2G;QAC3G,IAAI,WAAW,OAAO,OAAO,WAAW,KAAK,aAAa,OAAO,WAAW,KAAK,OAAO,QAAQ;QAChG,IAAI,UACF,OAAO,SAAS,SAAS,KAAK;QAGhC,oCAAoC;QACpC,uGAAuG;QACvG,IAAI,OAAO,MAAM,EACf,OAAO,kCAAY,GAAG,CAAC,OAAO,MAAM;IAExC;IAEA,gEAAgE;IAChE,IAAI,OAAO,aAAa,KAAK,CAAC,IAAI,CAAC,EAAE;IACrC,OAAO,gCAAU,GAAG,CAAC;AACvB","sources":["packages/@react-aria/i18n/src/utils.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// https://en.wikipedia.org/wiki/Right-to-left\nconst RTL_SCRIPTS = new Set(['Arab', 'Syrc', 'Samr', 'Mand', 'Thaa', 'Mend', 'Nkoo', 'Adlm', 'Rohg', 'Hebr']);\nconst RTL_LANGS = new Set(['ae', 'ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', 'ku', 'mzn', 'nqo', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi']);\n\n/**\n * Determines if a locale is read right to left using [Intl.Locale]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale}.\n */\nexport function isRTL(localeString: string): boolean {\n // If the Intl.Locale API is available, use it to get the locale's text direction.\n if (Intl.Locale) {\n let locale = new Intl.Locale(localeString).maximize();\n\n // Use the text info object to get the direction if possible.\n // @ts-ignore - this was implemented as a property by some browsers before it was standardized as a function.\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo\n let textInfo = typeof locale.getTextInfo === 'function' ? locale.getTextInfo() : locale.textInfo;\n if (textInfo) {\n return textInfo.direction === 'rtl';\n }\n\n // Fallback: guess using the script.\n // This is more accurate than guessing by language, since languages can be written in multiple scripts.\n if (locale.script) {\n return RTL_SCRIPTS.has(locale.script);\n }\n }\n\n // If not, just guess by the language (first part of the locale)\n let lang = localeString.split('-')[0];\n return RTL_LANGS.has(lang);\n}\n"],"names":[],"version":3,"file":"utils.module.js.map"}
package/src/context.tsx DELETED
@@ -1,87 +0,0 @@
1
- /*
2
- * Copyright 2020 Adobe. All rights reserved.
3
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License. You may obtain a copy
5
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
- *
7
- * Unless required by applicable law or agreed to in writing, software distributed under
8
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- * OF ANY KIND, either express or implied. See the License for the specific language
10
- * governing permissions and limitations under the License.
11
- */
12
-
13
- import {isRTL} from './utils';
14
- import {Locale, useDefaultLocale} from './useDefaultLocale';
15
- import React, {JSX, ReactNode, useContext} from 'react';
16
-
17
- export interface I18nProviderProps {
18
- /** Contents that should have the locale applied. */
19
- children: ReactNode,
20
- /** The locale to apply to the children. */
21
- locale?: string
22
- }
23
-
24
- const I18nContext = React.createContext<Locale | null>(null);
25
-
26
- interface I18nProviderWithLocaleProps extends I18nProviderProps {
27
- locale: string
28
- }
29
-
30
- /**
31
- * Internal component that handles the case when locale is provided.
32
- */
33
- function I18nProviderWithLocale(props: I18nProviderWithLocaleProps): JSX.Element {
34
- let {locale, children} = props;
35
- let value: Locale = React.useMemo(() => ({
36
- locale,
37
- direction: isRTL(locale) ? 'rtl' : 'ltr'
38
- }), [locale]);
39
-
40
- return (
41
- <I18nContext.Provider value={value}>
42
- {children}
43
- </I18nContext.Provider>
44
- );
45
- }
46
-
47
- interface I18nProviderWithDefaultLocaleProps {
48
- children: ReactNode
49
- }
50
-
51
- /**
52
- * Internal component that handles the case when no locale is provided.
53
- */
54
- function I18nProviderWithDefaultLocale(props: I18nProviderWithDefaultLocaleProps): JSX.Element {
55
- let {children} = props;
56
- let defaultLocale = useDefaultLocale();
57
-
58
- return (
59
- <I18nContext.Provider value={defaultLocale}>
60
- {children}
61
- </I18nContext.Provider>
62
- );
63
- }
64
-
65
- /**
66
- * Provides the locale for the application to all child components.
67
- */
68
- export function I18nProvider(props: I18nProviderProps): JSX.Element {
69
- let {locale, children} = props;
70
-
71
- // Conditionally render different components to avoid calling useDefaultLocale.
72
- // This is necessary because useDefaultLocale triggers a re-render.
73
- if (locale) {
74
- return <I18nProviderWithLocale locale={locale} children={children} />;
75
- }
76
-
77
- return <I18nProviderWithDefaultLocale children={children} />;
78
- }
79
-
80
- /**
81
- * Returns the current locale and layout direction.
82
- */
83
- export function useLocale(): Locale {
84
- let defaultLocale = useDefaultLocale();
85
- let context = useContext(I18nContext);
86
- return context || defaultLocale;
87
- }
package/src/main.js DELETED
@@ -1,6 +0,0 @@
1
- // useMessageFormatter is deprecated, but has a large dependency on intl-messageformat
2
- // that we want to avoid. If it is built into the same file as the rest of the package,
3
- // it deopts tree shaking in Parcel even when unused. Instead, it is split into a separate
4
- // file and re-exported here, which allows tree shaking to work properly.
5
- module.exports = require('./real-main.js');
6
- Object.defineProperties(module.exports, Object.getOwnPropertyDescriptors(require('./useMessageFormatter.js')));
package/src/module.js DELETED
@@ -1,6 +0,0 @@
1
- // useMessageFormatter is deprecated, but has a large dependency on intl-messageformat
2
- // that we want to avoid. If it is built into the same file as the rest of the package,
3
- // it deopts tree shaking in Parcel even when unused. Instead, it is split into a separate
4
- // file and re-exported here, which allows tree shaking to work properly.
5
- export * from './real-module.js';
6
- export * from './useMessageFormatter.module.js';