@react-aria/i18n 3.10.2 → 3.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/context.main.js +54 -0
  2. package/dist/context.main.js.map +1 -0
  3. package/dist/context.mjs +44 -0
  4. package/dist/context.module.js +44 -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/server/index.js +9 -9
  60. package/server/index.mjs +9 -9
  61. package/src/context.tsx +10 -4
  62. package/src/index.ts +1 -0
  63. package/src/useMessageFormatter.ts +1 -1
  64. package/dist/real-main.js +0 -391
  65. package/dist/real-main.js.map +0 -1
  66. package/dist/real-module.js +0 -373
  67. package/dist/real-module.js.map +0 -1
  68. package/dist/real-module.mjs +0 -373
  69. package/dist/real-module.mjs.map +0 -1
  70. package/dist/useMessageFormatter.js +0 -52
  71. package/dist/useMessageFormatter.module.mjs +0 -42
@@ -0,0 +1,68 @@
1
+ var $4d65847630a056a8$exports = require("./utils.main.js");
2
+ var $5Ie0C$react = require("react");
3
+ var $5Ie0C$reactariassr = require("@react-aria/ssr");
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, "useDefaultLocale", () => $2919bdec75484e64$export$188ec29ebc2bdc3a);
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
+ // Locale passed from server by PackageLocalizationProvider.
25
+ const $2919bdec75484e64$var$localeSymbol = Symbol.for('react-aria.i18n.locale');
26
+ function $2919bdec75484e64$export$f09106e7c6677ec5() {
27
+ let locale = typeof window !== 'undefined' && window[$2919bdec75484e64$var$localeSymbol] || typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage) || 'en-US';
28
+ try {
29
+ // @ts-ignore
30
+ Intl.DateTimeFormat.supportedLocalesOf([
31
+ locale
32
+ ]);
33
+ } catch (_err) {
34
+ locale = 'en-US';
35
+ }
36
+ return {
37
+ locale: locale,
38
+ direction: (0, $4d65847630a056a8$exports.isRTL)(locale) ? 'rtl' : 'ltr'
39
+ };
40
+ }
41
+ let $2919bdec75484e64$var$currentLocale = $2919bdec75484e64$export$f09106e7c6677ec5();
42
+ let $2919bdec75484e64$var$listeners = new Set();
43
+ function $2919bdec75484e64$var$updateLocale() {
44
+ $2919bdec75484e64$var$currentLocale = $2919bdec75484e64$export$f09106e7c6677ec5();
45
+ for (let listener of $2919bdec75484e64$var$listeners)listener($2919bdec75484e64$var$currentLocale);
46
+ }
47
+ function $2919bdec75484e64$export$188ec29ebc2bdc3a() {
48
+ let isSSR = (0, $5Ie0C$reactariassr.useIsSSR)();
49
+ let [defaultLocale, setDefaultLocale] = (0, $5Ie0C$react.useState)($2919bdec75484e64$var$currentLocale);
50
+ (0, $5Ie0C$react.useEffect)(()=>{
51
+ if ($2919bdec75484e64$var$listeners.size === 0) window.addEventListener('languagechange', $2919bdec75484e64$var$updateLocale);
52
+ $2919bdec75484e64$var$listeners.add(setDefaultLocale);
53
+ return ()=>{
54
+ $2919bdec75484e64$var$listeners.delete(setDefaultLocale);
55
+ if ($2919bdec75484e64$var$listeners.size === 0) window.removeEventListener('languagechange', $2919bdec75484e64$var$updateLocale);
56
+ };
57
+ }, []);
58
+ // We cannot determine the browser's language on the server, so default to
59
+ // en-US. This will be updated after hydration on the client to the correct value.
60
+ if (isSSR) return {
61
+ locale: 'en-US',
62
+ direction: 'ltr'
63
+ };
64
+ return defaultLocale;
65
+ }
66
+
67
+
68
+ //# sourceMappingURL=useDefaultLocale.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAcD,4DAA4D;AAC5D,MAAM,qCAAe,OAAO,GAAG,CAAC;AAKzB,SAAS;IACd,IAAI,SAAS,OAAO,WAAW,eAAe,MAAM,CAAC,mCAAa,IAE5D,OAAO,cAAc,eAAgB,CAAA,UAAU,QAAQ,IAAI,UAAU,YAAY,AAAD,KACjF;IAEL,IAAI;QACF,aAAa;QACb,KAAK,cAAc,CAAC,kBAAkB,CAAC;YAAC;SAAO;IACjD,EAAE,OAAO,MAAM;QACb,SAAS;IACX;IACA,OAAO;gBACL;QACA,WAAW,CAAA,GAAA,+BAAI,EAAE,UAAU,QAAQ;IACrC;AACF;AAEA,IAAI,sCAAgB;AACpB,IAAI,kCAAY,IAAI;AAEpB,SAAS;IACP,sCAAgB;IAChB,KAAK,IAAI,YAAY,gCACnB,SAAS;AAEb;AAKO,SAAS;IACd,IAAI,QAAQ,CAAA,GAAA,4BAAO;IACnB,IAAI,CAAC,eAAe,iBAAiB,GAAG,CAAA,GAAA,qBAAO,EAAE;IAEjD,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,gCAAU,IAAI,KAAK,GACrB,OAAO,gBAAgB,CAAC,kBAAkB;QAG5C,gCAAU,GAAG,CAAC;QAEd,OAAO;YACL,gCAAU,MAAM,CAAC;YACjB,IAAI,gCAAU,IAAI,KAAK,GACrB,OAAO,mBAAmB,CAAC,kBAAkB;QAEjD;IACF,GAAG,EAAE;IAEL,0EAA0E;IAC1E,kFAAkF;IAClF,IAAI,OACF,OAAO;QACL,QAAQ;QACR,WAAW;IACb;IAGF,OAAO;AACT","sources":["packages/@react-aria/i18n/src/useDefaultLocale.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 {Direction} from '@react-types/shared';\nimport {isRTL} from './utils';\nimport {useEffect, useState} from 'react';\nimport {useIsSSR} from '@react-aria/ssr';\n\nexport interface Locale {\n /** The [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt) language code for the locale. */\n locale: string,\n /** The writing direction for the locale. */\n direction: Direction\n}\n\n// Locale passed from server by PackageLocalizationProvider.\nconst localeSymbol = Symbol.for('react-aria.i18n.locale');\n\n/**\n * Gets the locale setting of the browser.\n */\nexport function getDefaultLocale(): Locale {\n let locale = typeof window !== 'undefined' && window[localeSymbol]\n // @ts-ignore\n || (typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage))\n || 'en-US';\n\n try {\n // @ts-ignore\n Intl.DateTimeFormat.supportedLocalesOf([locale]);\n } catch (_err) {\n locale = 'en-US';\n }\n return {\n locale,\n direction: isRTL(locale) ? 'rtl' : 'ltr'\n };\n}\n\nlet currentLocale = getDefaultLocale();\nlet listeners = new Set<(locale: Locale) => void>();\n\nfunction updateLocale() {\n currentLocale = getDefaultLocale();\n for (let listener of listeners) {\n listener(currentLocale);\n }\n}\n\n/**\n * Returns the current browser/system language, and updates when it changes.\n */\nexport function useDefaultLocale(): Locale {\n let isSSR = useIsSSR();\n let [defaultLocale, setDefaultLocale] = useState(currentLocale);\n\n useEffect(() => {\n if (listeners.size === 0) {\n window.addEventListener('languagechange', updateLocale);\n }\n\n listeners.add(setDefaultLocale);\n\n return () => {\n listeners.delete(setDefaultLocale);\n if (listeners.size === 0) {\n window.removeEventListener('languagechange', updateLocale);\n }\n };\n }, []);\n\n // We cannot determine the browser's language on the server, so default to\n // en-US. This will be updated after hydration on the client to the correct value.\n if (isSSR) {\n return {\n locale: 'en-US',\n direction: 'ltr'\n };\n }\n\n return defaultLocale;\n}\n"],"names":[],"version":3,"file":"useDefaultLocale.main.js.map"}
@@ -0,0 +1,63 @@
1
+ import {isRTL as $148a7a147e38ea7f$export$702d680b21cbd764} from "./utils.mjs";
2
+ import {useState as $ffhGL$useState, useEffect as $ffhGL$useEffect} from "react";
3
+ import {useIsSSR as $ffhGL$useIsSSR} from "@react-aria/ssr";
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
+ // Locale passed from server by PackageLocalizationProvider.
19
+ const $1e5a04cdaf7d1af8$var$localeSymbol = Symbol.for('react-aria.i18n.locale');
20
+ function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5() {
21
+ let locale = typeof window !== 'undefined' && window[$1e5a04cdaf7d1af8$var$localeSymbol] || typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage) || 'en-US';
22
+ try {
23
+ // @ts-ignore
24
+ Intl.DateTimeFormat.supportedLocalesOf([
25
+ locale
26
+ ]);
27
+ } catch (_err) {
28
+ locale = 'en-US';
29
+ }
30
+ return {
31
+ locale: locale,
32
+ direction: (0, $148a7a147e38ea7f$export$702d680b21cbd764)(locale) ? 'rtl' : 'ltr'
33
+ };
34
+ }
35
+ let $1e5a04cdaf7d1af8$var$currentLocale = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5();
36
+ let $1e5a04cdaf7d1af8$var$listeners = new Set();
37
+ function $1e5a04cdaf7d1af8$var$updateLocale() {
38
+ $1e5a04cdaf7d1af8$var$currentLocale = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5();
39
+ for (let listener of $1e5a04cdaf7d1af8$var$listeners)listener($1e5a04cdaf7d1af8$var$currentLocale);
40
+ }
41
+ function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a() {
42
+ let isSSR = (0, $ffhGL$useIsSSR)();
43
+ let [defaultLocale, setDefaultLocale] = (0, $ffhGL$useState)($1e5a04cdaf7d1af8$var$currentLocale);
44
+ (0, $ffhGL$useEffect)(()=>{
45
+ if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.addEventListener('languagechange', $1e5a04cdaf7d1af8$var$updateLocale);
46
+ $1e5a04cdaf7d1af8$var$listeners.add(setDefaultLocale);
47
+ return ()=>{
48
+ $1e5a04cdaf7d1af8$var$listeners.delete(setDefaultLocale);
49
+ if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.removeEventListener('languagechange', $1e5a04cdaf7d1af8$var$updateLocale);
50
+ };
51
+ }, []);
52
+ // We cannot determine the browser's language on the server, so default to
53
+ // en-US. This will be updated after hydration on the client to the correct value.
54
+ if (isSSR) return {
55
+ locale: 'en-US',
56
+ direction: 'ltr'
57
+ };
58
+ return defaultLocale;
59
+ }
60
+
61
+
62
+ export {$1e5a04cdaf7d1af8$export$f09106e7c6677ec5 as getDefaultLocale, $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a as useDefaultLocale};
63
+ //# sourceMappingURL=useDefaultLocale.module.js.map
@@ -0,0 +1,63 @@
1
+ import {isRTL as $148a7a147e38ea7f$export$702d680b21cbd764} from "./utils.module.js";
2
+ import {useState as $ffhGL$useState, useEffect as $ffhGL$useEffect} from "react";
3
+ import {useIsSSR as $ffhGL$useIsSSR} from "@react-aria/ssr";
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
+ // Locale passed from server by PackageLocalizationProvider.
19
+ const $1e5a04cdaf7d1af8$var$localeSymbol = Symbol.for('react-aria.i18n.locale');
20
+ function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5() {
21
+ let locale = typeof window !== 'undefined' && window[$1e5a04cdaf7d1af8$var$localeSymbol] || typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage) || 'en-US';
22
+ try {
23
+ // @ts-ignore
24
+ Intl.DateTimeFormat.supportedLocalesOf([
25
+ locale
26
+ ]);
27
+ } catch (_err) {
28
+ locale = 'en-US';
29
+ }
30
+ return {
31
+ locale: locale,
32
+ direction: (0, $148a7a147e38ea7f$export$702d680b21cbd764)(locale) ? 'rtl' : 'ltr'
33
+ };
34
+ }
35
+ let $1e5a04cdaf7d1af8$var$currentLocale = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5();
36
+ let $1e5a04cdaf7d1af8$var$listeners = new Set();
37
+ function $1e5a04cdaf7d1af8$var$updateLocale() {
38
+ $1e5a04cdaf7d1af8$var$currentLocale = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5();
39
+ for (let listener of $1e5a04cdaf7d1af8$var$listeners)listener($1e5a04cdaf7d1af8$var$currentLocale);
40
+ }
41
+ function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a() {
42
+ let isSSR = (0, $ffhGL$useIsSSR)();
43
+ let [defaultLocale, setDefaultLocale] = (0, $ffhGL$useState)($1e5a04cdaf7d1af8$var$currentLocale);
44
+ (0, $ffhGL$useEffect)(()=>{
45
+ if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.addEventListener('languagechange', $1e5a04cdaf7d1af8$var$updateLocale);
46
+ $1e5a04cdaf7d1af8$var$listeners.add(setDefaultLocale);
47
+ return ()=>{
48
+ $1e5a04cdaf7d1af8$var$listeners.delete(setDefaultLocale);
49
+ if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.removeEventListener('languagechange', $1e5a04cdaf7d1af8$var$updateLocale);
50
+ };
51
+ }, []);
52
+ // We cannot determine the browser's language on the server, so default to
53
+ // en-US. This will be updated after hydration on the client to the correct value.
54
+ if (isSSR) return {
55
+ locale: 'en-US',
56
+ direction: 'ltr'
57
+ };
58
+ return defaultLocale;
59
+ }
60
+
61
+
62
+ export {$1e5a04cdaf7d1af8$export$f09106e7c6677ec5 as getDefaultLocale, $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a as useDefaultLocale};
63
+ //# sourceMappingURL=useDefaultLocale.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAcD,4DAA4D;AAC5D,MAAM,qCAAe,OAAO,GAAG,CAAC;AAKzB,SAAS;IACd,IAAI,SAAS,OAAO,WAAW,eAAe,MAAM,CAAC,mCAAa,IAE5D,OAAO,cAAc,eAAgB,CAAA,UAAU,QAAQ,IAAI,UAAU,YAAY,AAAD,KACjF;IAEL,IAAI;QACF,aAAa;QACb,KAAK,cAAc,CAAC,kBAAkB,CAAC;YAAC;SAAO;IACjD,EAAE,OAAO,MAAM;QACb,SAAS;IACX;IACA,OAAO;gBACL;QACA,WAAW,CAAA,GAAA,yCAAI,EAAE,UAAU,QAAQ;IACrC;AACF;AAEA,IAAI,sCAAgB;AACpB,IAAI,kCAAY,IAAI;AAEpB,SAAS;IACP,sCAAgB;IAChB,KAAK,IAAI,YAAY,gCACnB,SAAS;AAEb;AAKO,SAAS;IACd,IAAI,QAAQ,CAAA,GAAA,eAAO;IACnB,IAAI,CAAC,eAAe,iBAAiB,GAAG,CAAA,GAAA,eAAO,EAAE;IAEjD,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,gCAAU,IAAI,KAAK,GACrB,OAAO,gBAAgB,CAAC,kBAAkB;QAG5C,gCAAU,GAAG,CAAC;QAEd,OAAO;YACL,gCAAU,MAAM,CAAC;YACjB,IAAI,gCAAU,IAAI,KAAK,GACrB,OAAO,mBAAmB,CAAC,kBAAkB;QAEjD;IACF,GAAG,EAAE;IAEL,0EAA0E;IAC1E,kFAAkF;IAClF,IAAI,OACF,OAAO;QACL,QAAQ;QACR,WAAW;IACb;IAGF,OAAO;AACT","sources":["packages/@react-aria/i18n/src/useDefaultLocale.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 {Direction} from '@react-types/shared';\nimport {isRTL} from './utils';\nimport {useEffect, useState} from 'react';\nimport {useIsSSR} from '@react-aria/ssr';\n\nexport interface Locale {\n /** The [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt) language code for the locale. */\n locale: string,\n /** The writing direction for the locale. */\n direction: Direction\n}\n\n// Locale passed from server by PackageLocalizationProvider.\nconst localeSymbol = Symbol.for('react-aria.i18n.locale');\n\n/**\n * Gets the locale setting of the browser.\n */\nexport function getDefaultLocale(): Locale {\n let locale = typeof window !== 'undefined' && window[localeSymbol]\n // @ts-ignore\n || (typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage))\n || 'en-US';\n\n try {\n // @ts-ignore\n Intl.DateTimeFormat.supportedLocalesOf([locale]);\n } catch (_err) {\n locale = 'en-US';\n }\n return {\n locale,\n direction: isRTL(locale) ? 'rtl' : 'ltr'\n };\n}\n\nlet currentLocale = getDefaultLocale();\nlet listeners = new Set<(locale: Locale) => void>();\n\nfunction updateLocale() {\n currentLocale = getDefaultLocale();\n for (let listener of listeners) {\n listener(currentLocale);\n }\n}\n\n/**\n * Returns the current browser/system language, and updates when it changes.\n */\nexport function useDefaultLocale(): Locale {\n let isSSR = useIsSSR();\n let [defaultLocale, setDefaultLocale] = useState(currentLocale);\n\n useEffect(() => {\n if (listeners.size === 0) {\n window.addEventListener('languagechange', updateLocale);\n }\n\n listeners.add(setDefaultLocale);\n\n return () => {\n listeners.delete(setDefaultLocale);\n if (listeners.size === 0) {\n window.removeEventListener('languagechange', updateLocale);\n }\n };\n }, []);\n\n // We cannot determine the browser's language on the server, so default to\n // en-US. This will be updated after hydration on the client to the correct value.\n if (isSSR) {\n return {\n locale: 'en-US',\n direction: 'ltr'\n };\n }\n\n return defaultLocale;\n}\n"],"names":[],"version":3,"file":"useDefaultLocale.module.js.map"}
@@ -0,0 +1,72 @@
1
+ var $27a5ce66022270ad$exports = require("./useCollator.main.js");
2
+ var $c0oFg$react = require("react");
3
+
4
+
5
+ function $parcel$export(e, n, v, s) {
6
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
+ }
8
+
9
+ $parcel$export(module.exports, "useFilter", () => $832d079b867c7223$export$3274cf84b703fff);
10
+ /*
11
+ * Copyright 2020 Adobe. All rights reserved.
12
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License. You may obtain a copy
14
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software distributed under
17
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
18
+ * OF ANY KIND, either express or implied. See the License for the specific language
19
+ * governing permissions and limitations under the License.
20
+ */
21
+
22
+ function $832d079b867c7223$export$3274cf84b703fff(options) {
23
+ let collator = (0, $27a5ce66022270ad$exports.useCollator)({
24
+ usage: 'search',
25
+ ...options
26
+ });
27
+ // TODO(later): these methods don't currently support the ignorePunctuation option.
28
+ let startsWith = (0, $c0oFg$react.useCallback)((string, substring)=>{
29
+ if (substring.length === 0) return true;
30
+ // Normalize both strings so we can slice safely
31
+ // TODO: take into account the ignorePunctuation option as well...
32
+ string = string.normalize('NFC');
33
+ substring = substring.normalize('NFC');
34
+ return collator.compare(string.slice(0, substring.length), substring) === 0;
35
+ }, [
36
+ collator
37
+ ]);
38
+ let endsWith = (0, $c0oFg$react.useCallback)((string, substring)=>{
39
+ if (substring.length === 0) return true;
40
+ string = string.normalize('NFC');
41
+ substring = substring.normalize('NFC');
42
+ return collator.compare(string.slice(-substring.length), substring) === 0;
43
+ }, [
44
+ collator
45
+ ]);
46
+ let contains = (0, $c0oFg$react.useCallback)((string, substring)=>{
47
+ if (substring.length === 0) return true;
48
+ string = string.normalize('NFC');
49
+ substring = substring.normalize('NFC');
50
+ let scan = 0;
51
+ let sliceLen = substring.length;
52
+ for(; scan + sliceLen <= string.length; scan++){
53
+ let slice = string.slice(scan, scan + sliceLen);
54
+ if (collator.compare(substring, slice) === 0) return true;
55
+ }
56
+ return false;
57
+ }, [
58
+ collator
59
+ ]);
60
+ return (0, $c0oFg$react.useMemo)(()=>({
61
+ startsWith: startsWith,
62
+ endsWith: endsWith,
63
+ contains: contains
64
+ }), [
65
+ startsWith,
66
+ endsWith,
67
+ contains
68
+ ]);
69
+ }
70
+
71
+
72
+ //# sourceMappingURL=useFilter.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAkBM,SAAS,yCAAU,OAA8B;IACtD,IAAI,WAAW,CAAA,GAAA,qCAAU,EAAE;QACzB,OAAO;QACP,GAAG,OAAO;IACZ;IAEA,mFAAmF;IACnF,IAAI,aAAa,CAAA,GAAA,wBAAU,EAAE,CAAC,QAAQ;QACpC,IAAI,UAAU,MAAM,KAAK,GACvB,OAAO;QAGT,gDAAgD;QAChD,kEAAkE;QAClE,SAAS,OAAO,SAAS,CAAC;QAC1B,YAAY,UAAU,SAAS,CAAC;QAChC,OAAO,SAAS,OAAO,CAAC,OAAO,KAAK,CAAC,GAAG,UAAU,MAAM,GAAG,eAAe;IAC5E,GAAG;QAAC;KAAS;IAEb,IAAI,WAAW,CAAA,GAAA,wBAAU,EAAE,CAAC,QAAQ;QAClC,IAAI,UAAU,MAAM,KAAK,GACvB,OAAO;QAGT,SAAS,OAAO,SAAS,CAAC;QAC1B,YAAY,UAAU,SAAS,CAAC;QAChC,OAAO,SAAS,OAAO,CAAC,OAAO,KAAK,CAAC,CAAC,UAAU,MAAM,GAAG,eAAe;IAC1E,GAAG;QAAC;KAAS;IAEb,IAAI,WAAW,CAAA,GAAA,wBAAU,EAAE,CAAC,QAAQ;QAClC,IAAI,UAAU,MAAM,KAAK,GACvB,OAAO;QAGT,SAAS,OAAO,SAAS,CAAC;QAC1B,YAAY,UAAU,SAAS,CAAC;QAEhC,IAAI,OAAO;QACX,IAAI,WAAW,UAAU,MAAM;QAC/B,MAAO,OAAO,YAAY,OAAO,MAAM,EAAE,OAAQ;YAC/C,IAAI,QAAQ,OAAO,KAAK,CAAC,MAAM,OAAO;YACtC,IAAI,SAAS,OAAO,CAAC,WAAW,WAAW,GACzC,OAAO;QAEX;QAEA,OAAO;IACT,GAAG;QAAC;KAAS;IAEb,OAAO,CAAA,GAAA,oBAAM,EAAE,IAAO,CAAA;wBACpB;sBACA;sBACA;QACF,CAAA,GAAI;QAAC;QAAY;QAAU;KAAS;AACtC","sources":["packages/@react-aria/i18n/src/useFilter.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 {useCallback, useMemo} from 'react';\nimport {useCollator} from './useCollator';\n\nexport interface Filter {\n /** Returns whether a string starts with a given substring. */\n startsWith(string: string, substring: string): boolean,\n /** Returns whether a string ends with a given substring. */\n endsWith(string: string, substring: string): boolean,\n /** Returns whether a string contains a given substring. */\n contains(string: string, substring: string): boolean\n}\n\n/**\n * Provides localized string search functionality that is useful for filtering or matching items\n * in a list. Options can be provided to adjust the sensitivity to case, diacritics, and other parameters.\n */\nexport function useFilter(options?: Intl.CollatorOptions): Filter {\n let collator = useCollator({\n usage: 'search',\n ...options\n });\n\n // TODO(later): these methods don't currently support the ignorePunctuation option.\n let startsWith = useCallback((string, substring) => {\n if (substring.length === 0) {\n return true;\n }\n\n // Normalize both strings so we can slice safely\n // TODO: take into account the ignorePunctuation option as well...\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n return collator.compare(string.slice(0, substring.length), substring) === 0;\n }, [collator]);\n\n let endsWith = useCallback((string, substring) => {\n if (substring.length === 0) {\n return true;\n }\n\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n return collator.compare(string.slice(-substring.length), substring) === 0;\n }, [collator]);\n\n let contains = useCallback((string, substring) => {\n if (substring.length === 0) {\n return true;\n }\n\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n\n let scan = 0;\n let sliceLen = substring.length;\n for (; scan + sliceLen <= string.length; scan++) {\n let slice = string.slice(scan, scan + sliceLen);\n if (collator.compare(substring, slice) === 0) {\n return true;\n }\n }\n\n return false;\n }, [collator]);\n\n return useMemo(() => ({\n startsWith,\n endsWith,\n contains\n }), [startsWith, endsWith, contains]);\n}\n"],"names":[],"version":3,"file":"useFilter.main.js.map"}
@@ -0,0 +1,67 @@
1
+ import {useCollator as $325a3faab7a68acd$export$a16aca283550c30d} from "./useCollator.mjs";
2
+ import {useCallback as $21ck9$useCallback, useMemo as $21ck9$useMemo} from "react";
3
+
4
+ /*
5
+ * Copyright 2020 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ function $bb77f239b46e8c72$export$3274cf84b703fff(options) {
17
+ let collator = (0, $325a3faab7a68acd$export$a16aca283550c30d)({
18
+ usage: 'search',
19
+ ...options
20
+ });
21
+ // TODO(later): these methods don't currently support the ignorePunctuation option.
22
+ let startsWith = (0, $21ck9$useCallback)((string, substring)=>{
23
+ if (substring.length === 0) return true;
24
+ // Normalize both strings so we can slice safely
25
+ // TODO: take into account the ignorePunctuation option as well...
26
+ string = string.normalize('NFC');
27
+ substring = substring.normalize('NFC');
28
+ return collator.compare(string.slice(0, substring.length), substring) === 0;
29
+ }, [
30
+ collator
31
+ ]);
32
+ let endsWith = (0, $21ck9$useCallback)((string, substring)=>{
33
+ if (substring.length === 0) return true;
34
+ string = string.normalize('NFC');
35
+ substring = substring.normalize('NFC');
36
+ return collator.compare(string.slice(-substring.length), substring) === 0;
37
+ }, [
38
+ collator
39
+ ]);
40
+ let contains = (0, $21ck9$useCallback)((string, substring)=>{
41
+ if (substring.length === 0) return true;
42
+ string = string.normalize('NFC');
43
+ substring = substring.normalize('NFC');
44
+ let scan = 0;
45
+ let sliceLen = substring.length;
46
+ for(; scan + sliceLen <= string.length; scan++){
47
+ let slice = string.slice(scan, scan + sliceLen);
48
+ if (collator.compare(substring, slice) === 0) return true;
49
+ }
50
+ return false;
51
+ }, [
52
+ collator
53
+ ]);
54
+ return (0, $21ck9$useMemo)(()=>({
55
+ startsWith: startsWith,
56
+ endsWith: endsWith,
57
+ contains: contains
58
+ }), [
59
+ startsWith,
60
+ endsWith,
61
+ contains
62
+ ]);
63
+ }
64
+
65
+
66
+ export {$bb77f239b46e8c72$export$3274cf84b703fff as useFilter};
67
+ //# sourceMappingURL=useFilter.module.js.map
@@ -0,0 +1,67 @@
1
+ import {useCollator as $325a3faab7a68acd$export$a16aca283550c30d} from "./useCollator.module.js";
2
+ import {useCallback as $21ck9$useCallback, useMemo as $21ck9$useMemo} from "react";
3
+
4
+ /*
5
+ * Copyright 2020 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ function $bb77f239b46e8c72$export$3274cf84b703fff(options) {
17
+ let collator = (0, $325a3faab7a68acd$export$a16aca283550c30d)({
18
+ usage: 'search',
19
+ ...options
20
+ });
21
+ // TODO(later): these methods don't currently support the ignorePunctuation option.
22
+ let startsWith = (0, $21ck9$useCallback)((string, substring)=>{
23
+ if (substring.length === 0) return true;
24
+ // Normalize both strings so we can slice safely
25
+ // TODO: take into account the ignorePunctuation option as well...
26
+ string = string.normalize('NFC');
27
+ substring = substring.normalize('NFC');
28
+ return collator.compare(string.slice(0, substring.length), substring) === 0;
29
+ }, [
30
+ collator
31
+ ]);
32
+ let endsWith = (0, $21ck9$useCallback)((string, substring)=>{
33
+ if (substring.length === 0) return true;
34
+ string = string.normalize('NFC');
35
+ substring = substring.normalize('NFC');
36
+ return collator.compare(string.slice(-substring.length), substring) === 0;
37
+ }, [
38
+ collator
39
+ ]);
40
+ let contains = (0, $21ck9$useCallback)((string, substring)=>{
41
+ if (substring.length === 0) return true;
42
+ string = string.normalize('NFC');
43
+ substring = substring.normalize('NFC');
44
+ let scan = 0;
45
+ let sliceLen = substring.length;
46
+ for(; scan + sliceLen <= string.length; scan++){
47
+ let slice = string.slice(scan, scan + sliceLen);
48
+ if (collator.compare(substring, slice) === 0) return true;
49
+ }
50
+ return false;
51
+ }, [
52
+ collator
53
+ ]);
54
+ return (0, $21ck9$useMemo)(()=>({
55
+ startsWith: startsWith,
56
+ endsWith: endsWith,
57
+ contains: contains
58
+ }), [
59
+ startsWith,
60
+ endsWith,
61
+ contains
62
+ ]);
63
+ }
64
+
65
+
66
+ export {$bb77f239b46e8c72$export$3274cf84b703fff as useFilter};
67
+ //# sourceMappingURL=useFilter.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAkBM,SAAS,yCAAU,OAA8B;IACtD,IAAI,WAAW,CAAA,GAAA,yCAAU,EAAE;QACzB,OAAO;QACP,GAAG,OAAO;IACZ;IAEA,mFAAmF;IACnF,IAAI,aAAa,CAAA,GAAA,kBAAU,EAAE,CAAC,QAAQ;QACpC,IAAI,UAAU,MAAM,KAAK,GACvB,OAAO;QAGT,gDAAgD;QAChD,kEAAkE;QAClE,SAAS,OAAO,SAAS,CAAC;QAC1B,YAAY,UAAU,SAAS,CAAC;QAChC,OAAO,SAAS,OAAO,CAAC,OAAO,KAAK,CAAC,GAAG,UAAU,MAAM,GAAG,eAAe;IAC5E,GAAG;QAAC;KAAS;IAEb,IAAI,WAAW,CAAA,GAAA,kBAAU,EAAE,CAAC,QAAQ;QAClC,IAAI,UAAU,MAAM,KAAK,GACvB,OAAO;QAGT,SAAS,OAAO,SAAS,CAAC;QAC1B,YAAY,UAAU,SAAS,CAAC;QAChC,OAAO,SAAS,OAAO,CAAC,OAAO,KAAK,CAAC,CAAC,UAAU,MAAM,GAAG,eAAe;IAC1E,GAAG;QAAC;KAAS;IAEb,IAAI,WAAW,CAAA,GAAA,kBAAU,EAAE,CAAC,QAAQ;QAClC,IAAI,UAAU,MAAM,KAAK,GACvB,OAAO;QAGT,SAAS,OAAO,SAAS,CAAC;QAC1B,YAAY,UAAU,SAAS,CAAC;QAEhC,IAAI,OAAO;QACX,IAAI,WAAW,UAAU,MAAM;QAC/B,MAAO,OAAO,YAAY,OAAO,MAAM,EAAE,OAAQ;YAC/C,IAAI,QAAQ,OAAO,KAAK,CAAC,MAAM,OAAO;YACtC,IAAI,SAAS,OAAO,CAAC,WAAW,WAAW,GACzC,OAAO;QAEX;QAEA,OAAO;IACT,GAAG;QAAC;KAAS;IAEb,OAAO,CAAA,GAAA,cAAM,EAAE,IAAO,CAAA;wBACpB;sBACA;sBACA;QACF,CAAA,GAAI;QAAC;QAAY;QAAU;KAAS;AACtC","sources":["packages/@react-aria/i18n/src/useFilter.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 {useCallback, useMemo} from 'react';\nimport {useCollator} from './useCollator';\n\nexport interface Filter {\n /** Returns whether a string starts with a given substring. */\n startsWith(string: string, substring: string): boolean,\n /** Returns whether a string ends with a given substring. */\n endsWith(string: string, substring: string): boolean,\n /** Returns whether a string contains a given substring. */\n contains(string: string, substring: string): boolean\n}\n\n/**\n * Provides localized string search functionality that is useful for filtering or matching items\n * in a list. Options can be provided to adjust the sensitivity to case, diacritics, and other parameters.\n */\nexport function useFilter(options?: Intl.CollatorOptions): Filter {\n let collator = useCollator({\n usage: 'search',\n ...options\n });\n\n // TODO(later): these methods don't currently support the ignorePunctuation option.\n let startsWith = useCallback((string, substring) => {\n if (substring.length === 0) {\n return true;\n }\n\n // Normalize both strings so we can slice safely\n // TODO: take into account the ignorePunctuation option as well...\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n return collator.compare(string.slice(0, substring.length), substring) === 0;\n }, [collator]);\n\n let endsWith = useCallback((string, substring) => {\n if (substring.length === 0) {\n return true;\n }\n\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n return collator.compare(string.slice(-substring.length), substring) === 0;\n }, [collator]);\n\n let contains = useCallback((string, substring) => {\n if (substring.length === 0) {\n return true;\n }\n\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n\n let scan = 0;\n let sliceLen = substring.length;\n for (; scan + sliceLen <= string.length; scan++) {\n let slice = string.slice(scan, scan + sliceLen);\n if (collator.compare(substring, slice) === 0) {\n return true;\n }\n }\n\n return false;\n }, [collator]);\n\n return useMemo(() => ({\n startsWith,\n endsWith,\n contains\n }), [startsWith, endsWith, contains]);\n}\n"],"names":[],"version":3,"file":"useFilter.module.js.map"}
@@ -0,0 +1,31 @@
1
+ var $47fa5ec5ff482271$exports = require("./context.main.js");
2
+ var $3UK6J$react = require("react");
3
+
4
+
5
+ function $parcel$export(e, n, v, s) {
6
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
+ }
8
+
9
+ $parcel$export(module.exports, "useListFormatter", () => $cb6a3e7d490e97a4$export$a2f47a3d2973640);
10
+ /*
11
+ * Copyright 2020 Adobe. All rights reserved.
12
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License. You may obtain a copy
14
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software distributed under
17
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
18
+ * OF ANY KIND, either express or implied. See the License for the specific language
19
+ * governing permissions and limitations under the License.
20
+ */
21
+
22
+ function $cb6a3e7d490e97a4$export$a2f47a3d2973640(options = {}) {
23
+ let { locale: locale } = (0, $47fa5ec5ff482271$exports.useLocale)();
24
+ return (0, $3UK6J$react.useMemo)(()=>new Intl.ListFormat(locale, options), [
25
+ locale,
26
+ options
27
+ ]);
28
+ }
29
+
30
+
31
+ //# sourceMappingURL=useListFormatter.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAUM,SAAS,yCAAiB,UAAkC,CAAC,CAAC;IACnE,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,mCAAQ;IACvB,OAAO,CAAA,GAAA,oBAAM,EAAE,IAAM,IAAI,KAAK,UAAU,CAAC,QAAQ,UAAU;QAAC;QAAQ;KAAQ;AAC9E","sources":["packages/@react-aria/i18n/src/useListFormatter.tsx"],"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 {useLocale} from './context';\nimport {useMemo} from 'react';\n\n/**\n * Provides localized list formatting for the current locale. Automatically updates when the locale changes,\n * and handles caching of the list formatter for performance.\n * @param options - Formatting options.\n */\nexport function useListFormatter(options: Intl.ListFormatOptions = {}): Intl.ListFormat {\n let {locale} = useLocale();\n return useMemo(() => new Intl.ListFormat(locale, options), [locale, options]);\n}\n"],"names":[],"version":3,"file":"useListFormatter.main.js.map"}
@@ -0,0 +1,26 @@
1
+ import {useLocale as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7} from "./context.mjs";
2
+ import {useMemo as $l9VVR$useMemo} from "react";
3
+
4
+ /*
5
+ * Copyright 2020 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ function $33bf17300c498528$export$a2f47a3d2973640(options = {}) {
17
+ let { locale: locale } = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)();
18
+ return (0, $l9VVR$useMemo)(()=>new Intl.ListFormat(locale, options), [
19
+ locale,
20
+ options
21
+ ]);
22
+ }
23
+
24
+
25
+ export {$33bf17300c498528$export$a2f47a3d2973640 as useListFormatter};
26
+ //# sourceMappingURL=useListFormatter.module.js.map
@@ -0,0 +1,26 @@
1
+ import {useLocale as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7} from "./context.module.js";
2
+ import {useMemo as $l9VVR$useMemo} from "react";
3
+
4
+ /*
5
+ * Copyright 2020 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ function $33bf17300c498528$export$a2f47a3d2973640(options = {}) {
17
+ let { locale: locale } = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)();
18
+ return (0, $l9VVR$useMemo)(()=>new Intl.ListFormat(locale, options), [
19
+ locale,
20
+ options
21
+ ]);
22
+ }
23
+
24
+
25
+ export {$33bf17300c498528$export$a2f47a3d2973640 as useListFormatter};
26
+ //# sourceMappingURL=useListFormatter.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAUM,SAAS,yCAAiB,UAAkC,CAAC,CAAC;IACnE,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,yCAAQ;IACvB,OAAO,CAAA,GAAA,cAAM,EAAE,IAAM,IAAI,KAAK,UAAU,CAAC,QAAQ,UAAU;QAAC;QAAQ;KAAQ;AAC9E","sources":["packages/@react-aria/i18n/src/useListFormatter.tsx"],"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 {useLocale} from './context';\nimport {useMemo} from 'react';\n\n/**\n * Provides localized list formatting for the current locale. Automatically updates when the locale changes,\n * and handles caching of the list formatter for performance.\n * @param options - Formatting options.\n */\nexport function useListFormatter(options: Intl.ListFormatOptions = {}): Intl.ListFormat {\n let {locale} = useLocale();\n return useMemo(() => new Intl.ListFormat(locale, options), [locale, options]);\n}\n"],"names":[],"version":3,"file":"useListFormatter.module.js.map"}
@@ -0,0 +1,47 @@
1
+ var $47fa5ec5ff482271$exports = require("./context.main.js");
2
+ var $fbyBw$internationalizedstring = require("@internationalized/string");
3
+ var $fbyBw$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, "useLocalizedStringDictionary", () => $fc53663969a3d00a$export$87b761675e8eaa10);
11
+ $parcel$export(module.exports, "useLocalizedStringFormatter", () => $fc53663969a3d00a$export$f12b703ca79dfbb1);
12
+ /*
13
+ * Copyright 2022 Adobe. All rights reserved.
14
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
15
+ * you may not use this file except in compliance with the License. You may obtain a copy
16
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software distributed under
19
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
20
+ * OF ANY KIND, either express or implied. See the License for the specific language
21
+ * governing permissions and limitations under the License.
22
+ */
23
+
24
+
25
+ const $fc53663969a3d00a$var$cache = new WeakMap();
26
+ function $fc53663969a3d00a$var$getCachedDictionary(strings) {
27
+ let dictionary = $fc53663969a3d00a$var$cache.get(strings);
28
+ if (!dictionary) {
29
+ dictionary = new (0, $fbyBw$internationalizedstring.LocalizedStringDictionary)(strings);
30
+ $fc53663969a3d00a$var$cache.set(strings, dictionary);
31
+ }
32
+ return dictionary;
33
+ }
34
+ function $fc53663969a3d00a$export$87b761675e8eaa10(strings, packageName) {
35
+ return packageName && (0, $fbyBw$internationalizedstring.LocalizedStringDictionary).getGlobalDictionaryForPackage(packageName) || $fc53663969a3d00a$var$getCachedDictionary(strings);
36
+ }
37
+ function $fc53663969a3d00a$export$f12b703ca79dfbb1(strings, packageName) {
38
+ let { locale: locale } = (0, $47fa5ec5ff482271$exports.useLocale)();
39
+ let dictionary = $fc53663969a3d00a$export$87b761675e8eaa10(strings, packageName);
40
+ return (0, $fbyBw$react.useMemo)(()=>new (0, $fbyBw$internationalizedstring.LocalizedStringFormatter)(locale, dictionary), [
41
+ locale,
42
+ dictionary
43
+ ]);
44
+ }
45
+
46
+
47
+ //# sourceMappingURL=useLocalizedStringFormatter.main.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,wDAAwB,EAAE;QAC3C,4BAAM,GAAG,CAAC,SAAS;IACrB;IAEA,OAAO;AACT;AAKO,SAAS,0CAA4F,OAA+B,EAAE,WAAoB;IAC/J,OAAO,AAAC,eAAe,CAAA,GAAA,wDAAwB,EAAE,6BAA6B,CAAC,gBAAiB,0CAAoB;AACtH;AAOO,SAAS,0CAA2F,OAA+B,EAAE,WAAoB;IAC9J,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,mCAAQ;IACvB,IAAI,aAAa,0CAA6B,SAAS;IACvD,OAAO,CAAA,GAAA,oBAAM,EAAE,IAAM,IAAI,CAAA,GAAA,uDAAuB,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.main.js.map"}
@@ -0,0 +1,41 @@
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