@react-aria/i18n 3.10.2 → 3.11.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 (68) hide show
  1. package/dist/context.main.js +48 -0
  2. package/dist/context.main.js.map +1 -0
  3. package/dist/context.mjs +38 -0
  4. package/dist/context.module.js +38 -0
  5. package/dist/context.module.js.map +1 -0
  6. package/dist/import.mjs +31 -6
  7. package/dist/main.js +45 -6
  8. package/dist/main.js.map +1 -0
  9. package/dist/module.js +31 -6
  10. package/dist/module.js.map +1 -0
  11. package/dist/types.d.ts +1 -0
  12. package/dist/types.d.ts.map +1 -1
  13. package/dist/useCollator.main.js +31 -0
  14. package/dist/useCollator.main.js.map +1 -0
  15. package/dist/useCollator.mjs +26 -0
  16. package/dist/useCollator.module.js +26 -0
  17. package/dist/useCollator.module.js.map +1 -0
  18. package/dist/useDateFormatter.main.js +47 -0
  19. package/dist/useDateFormatter.main.js.map +1 -0
  20. package/dist/useDateFormatter.mjs +42 -0
  21. package/dist/useDateFormatter.module.js +42 -0
  22. package/dist/useDateFormatter.module.js.map +1 -0
  23. package/dist/useDefaultLocale.main.js +68 -0
  24. package/dist/useDefaultLocale.main.js.map +1 -0
  25. package/dist/useDefaultLocale.mjs +63 -0
  26. package/dist/useDefaultLocale.module.js +63 -0
  27. package/dist/useDefaultLocale.module.js.map +1 -0
  28. package/dist/useFilter.main.js +72 -0
  29. package/dist/useFilter.main.js.map +1 -0
  30. package/dist/useFilter.mjs +67 -0
  31. package/dist/useFilter.module.js +67 -0
  32. package/dist/useFilter.module.js.map +1 -0
  33. package/dist/useListFormatter.main.js +31 -0
  34. package/dist/useListFormatter.main.js.map +1 -0
  35. package/dist/useListFormatter.mjs +26 -0
  36. package/dist/useListFormatter.module.js +26 -0
  37. package/dist/useListFormatter.module.js.map +1 -0
  38. package/dist/useLocalizedStringFormatter.main.js +47 -0
  39. package/dist/useLocalizedStringFormatter.main.js.map +1 -0
  40. package/dist/useLocalizedStringFormatter.mjs +41 -0
  41. package/dist/useLocalizedStringFormatter.module.js +41 -0
  42. package/dist/useLocalizedStringFormatter.module.js.map +1 -0
  43. package/dist/useMessageFormatter.main.js +48 -0
  44. package/dist/useMessageFormatter.main.js.map +1 -0
  45. package/dist/useMessageFormatter.mjs +43 -0
  46. package/dist/useMessageFormatter.module.js +28 -27
  47. package/dist/useMessageFormatter.module.js.map +1 -0
  48. package/dist/useNumberFormatter.main.js +33 -0
  49. package/dist/useNumberFormatter.main.js.map +1 -0
  50. package/dist/useNumberFormatter.mjs +28 -0
  51. package/dist/useNumberFormatter.module.js +28 -0
  52. package/dist/useNumberFormatter.module.js.map +1 -0
  53. package/dist/utils.main.js +71 -0
  54. package/dist/utils.main.js.map +1 -0
  55. package/dist/utils.mjs +66 -0
  56. package/dist/utils.module.js +66 -0
  57. package/dist/utils.module.js.map +1 -0
  58. package/package.json +11 -31
  59. package/src/index.ts +1 -0
  60. package/src/useMessageFormatter.ts +1 -1
  61. package/dist/real-main.js +0 -391
  62. package/dist/real-main.js.map +0 -1
  63. package/dist/real-module.js +0 -373
  64. package/dist/real-module.js.map +0 -1
  65. package/dist/real-module.mjs +0 -373
  66. package/dist/real-module.mjs.map +0 -1
  67. package/dist/useMessageFormatter.js +0 -52
  68. package/dist/useMessageFormatter.module.mjs +0 -42
@@ -0,0 +1,41 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,48 @@
1
+ var $47fa5ec5ff482271$exports = require("./context.main.js");
2
+ var $8WbGG$internationalizedmessage = require("@internationalized/message");
3
+ var $8WbGG$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, "useMessageFormatter", () => $c376aa482226bf60$export$ec23bf898b1eed85);
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
+ const $c376aa482226bf60$var$cache = new WeakMap();
25
+ function $c376aa482226bf60$var$getCachedDictionary(strings) {
26
+ let dictionary = $c376aa482226bf60$var$cache.get(strings);
27
+ if (!dictionary) {
28
+ dictionary = new (0, $8WbGG$internationalizedmessage.MessageDictionary)(strings);
29
+ $c376aa482226bf60$var$cache.set(strings, dictionary);
30
+ }
31
+ return dictionary;
32
+ }
33
+ function $c376aa482226bf60$export$ec23bf898b1eed85(strings) {
34
+ let { locale: locale } = (0, $47fa5ec5ff482271$exports.useLocale)();
35
+ let dictionary = (0, $8WbGG$react.useMemo)(()=>$c376aa482226bf60$var$getCachedDictionary(strings), [
36
+ strings
37
+ ]);
38
+ let formatter = (0, $8WbGG$react.useMemo)(()=>new (0, $8WbGG$internationalizedmessage.MessageFormatter)(locale, dictionary), [
39
+ locale,
40
+ dictionary
41
+ ]);
42
+ return (0, $8WbGG$react.useCallback)((key, variables)=>formatter.format(key, variables), [
43
+ formatter
44
+ ]);
45
+ }
46
+
47
+
48
+ //# sourceMappingURL=useMessageFormatter.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAQD,MAAM,8BAAQ,IAAI;AAClB,SAAS,0CAAoB,OAAyB;IACpD,IAAI,aAAa,4BAAM,GAAG,CAAC;IAC3B,IAAI,CAAC,YAAY;QACf,aAAa,IAAI,CAAA,GAAA,iDAAgB,EAAE;QACnC,4BAAM,GAAG,CAAC,SAAS;IACrB;IAEA,OAAO;AACT;AAQO,SAAS,0CAAoB,OAAyB;IAC3D,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,mCAAQ;IACvB,IAAI,aAAa,CAAA,GAAA,oBAAM,EAAE,IAAM,0CAAoB,UAAU;QAAC;KAAQ;IACtE,IAAI,YAAY,CAAA,GAAA,oBAAM,EAAE,IAAM,IAAI,CAAA,GAAA,gDAAe,EAAE,QAAQ,aAAa;QAAC;QAAQ;KAAW;IAC5F,OAAO,CAAA,GAAA,wBAAU,EAAE,CAAC,KAAK,YAAc,UAAU,MAAM,CAAC,KAAK,YAAY;QAAC;KAAU;AACtF","sources":["packages/@react-aria/i18n/src/useMessageFormatter.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 {LocalizedStrings, MessageDictionary, MessageFormatter} from '@internationalized/message';\nimport {useCallback, useMemo} from 'react';\nimport {useLocale} from './context';\n\nexport type FormatMessage = (key: string, variables?: {[key: string]: any}) => string;\n\nconst cache = new WeakMap();\nfunction getCachedDictionary(strings: LocalizedStrings) {\n let dictionary = cache.get(strings);\n if (!dictionary) {\n dictionary = new MessageDictionary(strings);\n cache.set(strings, dictionary);\n }\n\n return dictionary;\n}\n\n/**\n * Handles formatting ICU Message strings to create localized strings for the current locale.\n * Automatically updates when the locale changes, and handles caching of messages for performance.\n * @param strings - A mapping of languages to strings by key.\n * @deprecated - use useLocalizedStringFormatter instead.\n */\nexport function useMessageFormatter(strings: LocalizedStrings): FormatMessage {\n let {locale} = useLocale();\n let dictionary = useMemo(() => getCachedDictionary(strings), [strings]);\n let formatter = useMemo(() => new MessageFormatter(locale, dictionary), [locale, dictionary]);\n return useCallback((key, variables) => formatter.format(key, variables), [formatter]);\n}\n"],"names":[],"version":3,"file":"useMessageFormatter.main.js.map"}
@@ -0,0 +1,43 @@
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.mjs.map
@@ -1,3 +1,7 @@
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
+
1
5
  /*
2
6
  * Copyright 2020 Adobe. All rights reserved.
3
7
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -8,35 +12,32 @@
8
12
  * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
13
  * OF ANY KIND, either express or implied. See the License for the specific language
10
14
  * governing permissions and limitations under the License.
11
- */
12
- import { MessageDictionary, MessageFormatter } from '@internationalized/message';
13
- import { useCallback, useMemo } from 'react';
14
- import { useLocale } from '@react-aria/i18n';
15
- const cache = new WeakMap();
16
-
17
- function getCachedDictionary(strings) {
18
- let dictionary = cache.get(strings);
15
+ */
19
16
 
20
- if (!dictionary) {
21
- dictionary = new MessageDictionary(strings);
22
- cache.set(strings, dictionary);
23
- }
24
17
 
25
- return dictionary;
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
+ ]);
26
39
  }
27
- /**
28
- * Handles formatting ICU Message strings to create localized strings for the current locale.
29
- * Automatically updates when the locale changes, and handles caching of messages for performance.
30
- * @param strings - A mapping of languages to strings by key.
31
- * @deprecated - use useLocalizedStringFormatter instead.
32
- */
33
40
 
34
41
 
35
- export function useMessageFormatter(strings) {
36
- let {
37
- locale
38
- } = useLocale();
39
- let dictionary = useMemo(() => getCachedDictionary(strings), [strings]);
40
- let formatter = useMemo(() => new MessageFormatter(locale, dictionary), [locale, dictionary]);
41
- return useCallback((key, variables) => formatter.format(key, variables), [formatter]);
42
- }
42
+ export {$321bc95feeb923dd$export$ec23bf898b1eed85 as useMessageFormatter};
43
+ //# sourceMappingURL=useMessageFormatter.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAQD,MAAM,8BAAQ,IAAI;AAClB,SAAS,0CAAoB,OAAyB;IACpD,IAAI,aAAa,4BAAM,GAAG,CAAC;IAC3B,IAAI,CAAC,YAAY;QACf,aAAa,IAAI,CAAA,GAAA,wBAAgB,EAAE;QACnC,4BAAM,GAAG,CAAC,SAAS;IACrB;IAEA,OAAO;AACT;AAQO,SAAS,0CAAoB,OAAyB;IAC3D,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,yCAAQ;IACvB,IAAI,aAAa,CAAA,GAAA,cAAM,EAAE,IAAM,0CAAoB,UAAU;QAAC;KAAQ;IACtE,IAAI,YAAY,CAAA,GAAA,cAAM,EAAE,IAAM,IAAI,CAAA,GAAA,uBAAe,EAAE,QAAQ,aAAa;QAAC;QAAQ;KAAW;IAC5F,OAAO,CAAA,GAAA,kBAAU,EAAE,CAAC,KAAK,YAAc,UAAU,MAAM,CAAC,KAAK,YAAY;QAAC;KAAU;AACtF","sources":["packages/@react-aria/i18n/src/useMessageFormatter.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 {LocalizedStrings, MessageDictionary, MessageFormatter} from '@internationalized/message';\nimport {useCallback, useMemo} from 'react';\nimport {useLocale} from './context';\n\nexport type FormatMessage = (key: string, variables?: {[key: string]: any}) => string;\n\nconst cache = new WeakMap();\nfunction getCachedDictionary(strings: LocalizedStrings) {\n let dictionary = cache.get(strings);\n if (!dictionary) {\n dictionary = new MessageDictionary(strings);\n cache.set(strings, dictionary);\n }\n\n return dictionary;\n}\n\n/**\n * Handles formatting ICU Message strings to create localized strings for the current locale.\n * Automatically updates when the locale changes, and handles caching of messages for performance.\n * @param strings - A mapping of languages to strings by key.\n * @deprecated - use useLocalizedStringFormatter instead.\n */\nexport function useMessageFormatter(strings: LocalizedStrings): FormatMessage {\n let {locale} = useLocale();\n let dictionary = useMemo(() => getCachedDictionary(strings), [strings]);\n let formatter = useMemo(() => new MessageFormatter(locale, dictionary), [locale, dictionary]);\n return useCallback((key, variables) => formatter.format(key, variables), [formatter]);\n}\n"],"names":[],"version":3,"file":"useMessageFormatter.module.js.map"}
@@ -0,0 +1,33 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,28 @@
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.mjs.map
@@ -0,0 +1,28 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,71 @@
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
+ // @ts-ignore
54
+ if (Intl.Locale) {
55
+ let locale = new Intl.Locale(localeString).maximize();
56
+ // Use the text info object to get the direction if possible.
57
+ // @ts-ignore - this was implemented as a property by some browsers before it was standardized as a function.
58
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo
59
+ let textInfo = typeof locale.getTextInfo === "function" ? locale.getTextInfo() : locale.textInfo;
60
+ if (textInfo) return textInfo.direction === "rtl";
61
+ // Fallback: guess using the script.
62
+ // This is more accurate than guessing by language, since languages can be written in multiple scripts.
63
+ if (locale.script) return $4d65847630a056a8$var$RTL_SCRIPTS.has(locale.script);
64
+ }
65
+ // If not, just guess by the language (first part of the locale)
66
+ let lang = localeString.split("-")[0];
67
+ return $4d65847630a056a8$var$RTL_LANGS.has(lang);
68
+ }
69
+
70
+
71
+ //# sourceMappingURL=utils.main.js.map
@@ -0,0 +1 @@
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,aAAa;IACb,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) {\n // If the Intl.Locale API is available, use it to get the locale's text direction.\n // @ts-ignore\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 ADDED
@@ -0,0 +1,66 @@
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
+ // @ts-ignore
48
+ if (Intl.Locale) {
49
+ let locale = new Intl.Locale(localeString).maximize();
50
+ // Use the text info object to get the direction if possible.
51
+ // @ts-ignore - this was implemented as a property by some browsers before it was standardized as a function.
52
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo
53
+ let textInfo = typeof locale.getTextInfo === "function" ? locale.getTextInfo() : locale.textInfo;
54
+ if (textInfo) return textInfo.direction === "rtl";
55
+ // Fallback: guess using the script.
56
+ // This is more accurate than guessing by language, since languages can be written in multiple scripts.
57
+ if (locale.script) return $148a7a147e38ea7f$var$RTL_SCRIPTS.has(locale.script);
58
+ }
59
+ // If not, just guess by the language (first part of the locale)
60
+ let lang = localeString.split("-")[0];
61
+ return $148a7a147e38ea7f$var$RTL_LANGS.has(lang);
62
+ }
63
+
64
+
65
+ export {$148a7a147e38ea7f$export$702d680b21cbd764 as isRTL};
66
+ //# sourceMappingURL=utils.mjs.map
@@ -0,0 +1,66 @@
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
+ // @ts-ignore
48
+ if (Intl.Locale) {
49
+ let locale = new Intl.Locale(localeString).maximize();
50
+ // Use the text info object to get the direction if possible.
51
+ // @ts-ignore - this was implemented as a property by some browsers before it was standardized as a function.
52
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo
53
+ let textInfo = typeof locale.getTextInfo === "function" ? locale.getTextInfo() : locale.textInfo;
54
+ if (textInfo) return textInfo.direction === "rtl";
55
+ // Fallback: guess using the script.
56
+ // This is more accurate than guessing by language, since languages can be written in multiple scripts.
57
+ if (locale.script) return $148a7a147e38ea7f$var$RTL_SCRIPTS.has(locale.script);
58
+ }
59
+ // If not, just guess by the language (first part of the locale)
60
+ let lang = localeString.split("-")[0];
61
+ return $148a7a147e38ea7f$var$RTL_LANGS.has(lang);
62
+ }
63
+
64
+
65
+ export {$148a7a147e38ea7f$export$702d680b21cbd764 as isRTL};
66
+ //# sourceMappingURL=utils.module.js.map
@@ -0,0 +1 @@
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,aAAa;IACb,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) {\n // If the Intl.Locale API is available, use it to get the locale's text direction.\n // @ts-ignore\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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/i18n",
3
- "version": "3.10.2",
3
+ "version": "3.11.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -16,25 +16,13 @@
16
16
  "require": "./server/index.js"
17
17
  }
18
18
  },
19
- "real-main": "dist/real-main.js",
20
- "real-module": "dist/real-module.js",
21
19
  "server-module": "server/index.mjs",
22
20
  "server-main": "server/index.js",
23
21
  "types": "dist/types.d.ts",
24
22
  "source": "src/index.ts",
25
23
  "targets": {
26
- "main": false,
27
- "module": false,
28
- "real-module": {
29
- "outputFormat": "esmodule",
30
- "isLibrary": true,
31
- "includeNodeModules": false
32
- },
33
- "real-main": {
34
- "outputFormat": "commonjs",
35
- "isLibrary": true,
36
- "includeNodeModules": false
37
- },
24
+ "main": {},
25
+ "module": {},
38
26
  "server-module": {
39
27
  "source": "src/server.tsx",
40
28
  "outputFormat": "esmodule",
@@ -48,14 +36,6 @@
48
36
  "includeNodeModules": false
49
37
  }
50
38
  },
51
- "alias": {
52
- "./src/useMessageFormatter.ts": false
53
- },
54
- "scripts": {
55
- "build:module": "yarn babel --presets @babel/preset-typescript src/useMessageFormatter.ts -o dist/useMessageFormatter.module.js && cp src/module.js dist/module.js && cp dist/real-module.js dist/real-module.mjs && cp dist/real-module.js.map dist/real-module.mjs.map && cp dist/useMessageFormatter.module.js dist/useMessageFormatter.module.mjs",
56
- "build:cjs": "yarn babel --presets @babel/preset-typescript,@babel/preset-env src/useMessageFormatter.ts -o dist/useMessageFormatter.js && cp src/main.js dist/main.js",
57
- "prepublishOnly": "yarn build:module && yarn build:cjs"
58
- },
59
39
  "files": [
60
40
  "dist",
61
41
  "src",
@@ -67,13 +47,13 @@
67
47
  "url": "https://github.com/adobe/react-spectrum"
68
48
  },
69
49
  "dependencies": {
70
- "@internationalized/date": "^3.5.2",
71
- "@internationalized/message": "^3.1.2",
72
- "@internationalized/number": "^3.5.1",
73
- "@internationalized/string": "^3.2.1",
74
- "@react-aria/ssr": "^3.9.2",
75
- "@react-aria/utils": "^3.23.2",
76
- "@react-types/shared": "^3.22.1",
50
+ "@internationalized/date": "^3.5.3",
51
+ "@internationalized/message": "^3.1.3",
52
+ "@internationalized/number": "^3.5.2",
53
+ "@internationalized/string": "^3.2.2",
54
+ "@react-aria/ssr": "^3.9.3",
55
+ "@react-aria/utils": "^3.24.0",
56
+ "@react-types/shared": "^3.23.0",
77
57
  "@swc/helpers": "^0.5.0"
78
58
  },
79
59
  "peerDependencies": {
@@ -82,5 +62,5 @@
82
62
  "publishConfig": {
83
63
  "access": "public"
84
64
  },
85
- "gitHead": "de9f84a22583fc741c29b341d14cd35ef4cca161"
65
+ "gitHead": "f645f29edc1322153fd60af4640cbcab1d992dbd"
86
66
  }
package/src/index.ts CHANGED
@@ -20,6 +20,7 @@ export {useCollator} from './useCollator';
20
20
  export {useFilter} from './useFilter';
21
21
 
22
22
  export type {FormatMessage} from './useMessageFormatter';
23
+ export type {LocalizedStringFormatter} from '@internationalized/string';
23
24
  export type {I18nProviderProps} from './context';
24
25
  export type {Locale} from './useDefaultLocale';
25
26
  export type {LocalizedStrings} from '@internationalized/message';