@react-aria/i18n 3.12.15 → 3.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/import.mjs +9 -11
  2. package/dist/main.js +19 -21
  3. package/dist/main.js.map +1 -1
  4. package/dist/module.js +9 -11
  5. package/dist/module.js.map +1 -1
  6. package/dist/{useMessageFormatter.main.js → private/useMessageFormatter.cjs} +15 -15
  7. package/dist/{useMessageFormatter.main.js.map → private/useMessageFormatter.cjs.map} +1 -1
  8. package/dist/private/useMessageFormatter.js +43 -0
  9. package/dist/{useMessageFormatter.module.js.map → private/useMessageFormatter.js.map} +1 -1
  10. package/dist/types/src/index.d.ts +15 -0
  11. package/dist/types/src/server.d.ts +1 -0
  12. package/dist/types/src/useMessageFormatter.d.ts +11 -0
  13. package/package.json +15 -21
  14. package/server/index.js +4 -72
  15. package/server/index.js.map +1 -1
  16. package/server/index.mjs +3 -67
  17. package/server/index.mjs.map +1 -1
  18. package/src/index.ts +11 -13
  19. package/src/server.ts +1 -0
  20. package/src/useMessageFormatter.ts +1 -1
  21. package/dist/context.main.js +0 -72
  22. package/dist/context.main.js.map +0 -1
  23. package/dist/context.mjs +0 -62
  24. package/dist/context.module.js +0 -62
  25. package/dist/context.module.js.map +0 -1
  26. package/dist/types.d.ts +0 -95
  27. package/dist/types.d.ts.map +0 -1
  28. package/dist/useCollator.main.js +0 -31
  29. package/dist/useCollator.main.js.map +0 -1
  30. package/dist/useCollator.mjs +0 -26
  31. package/dist/useCollator.module.js +0 -26
  32. package/dist/useCollator.module.js.map +0 -1
  33. package/dist/useDateFormatter.main.js +0 -47
  34. package/dist/useDateFormatter.main.js.map +0 -1
  35. package/dist/useDateFormatter.mjs +0 -42
  36. package/dist/useDateFormatter.module.js +0 -42
  37. package/dist/useDateFormatter.module.js.map +0 -1
  38. package/dist/useDefaultLocale.main.js +0 -70
  39. package/dist/useDefaultLocale.main.js.map +0 -1
  40. package/dist/useDefaultLocale.mjs +0 -65
  41. package/dist/useDefaultLocale.module.js +0 -65
  42. package/dist/useDefaultLocale.module.js.map +0 -1
  43. package/dist/useFilter.main.js +0 -72
  44. package/dist/useFilter.main.js.map +0 -1
  45. package/dist/useFilter.mjs +0 -67
  46. package/dist/useFilter.module.js +0 -67
  47. package/dist/useFilter.module.js.map +0 -1
  48. package/dist/useListFormatter.main.js +0 -31
  49. package/dist/useListFormatter.main.js.map +0 -1
  50. package/dist/useListFormatter.mjs +0 -26
  51. package/dist/useListFormatter.module.js +0 -26
  52. package/dist/useListFormatter.module.js.map +0 -1
  53. package/dist/useLocalizedStringFormatter.main.js +0 -47
  54. package/dist/useLocalizedStringFormatter.main.js.map +0 -1
  55. package/dist/useLocalizedStringFormatter.mjs +0 -41
  56. package/dist/useLocalizedStringFormatter.module.js +0 -41
  57. package/dist/useLocalizedStringFormatter.module.js.map +0 -1
  58. package/dist/useMessageFormatter.mjs +0 -43
  59. package/dist/useMessageFormatter.module.js +0 -43
  60. package/dist/useNumberFormatter.main.js +0 -33
  61. package/dist/useNumberFormatter.main.js.map +0 -1
  62. package/dist/useNumberFormatter.mjs +0 -28
  63. package/dist/useNumberFormatter.module.js +0 -28
  64. package/dist/useNumberFormatter.module.js.map +0 -1
  65. package/dist/utils.main.js +0 -70
  66. package/dist/utils.main.js.map +0 -1
  67. package/dist/utils.mjs +0 -65
  68. package/dist/utils.module.js +0 -65
  69. package/dist/utils.module.js.map +0 -1
  70. package/src/context.tsx +0 -87
  71. package/src/main.js +0 -6
  72. package/src/module.js +0 -6
  73. package/src/server.tsx +0 -99
  74. package/src/useCollator.ts +0 -33
  75. package/src/useDateFormatter.ts +0 -52
  76. package/src/useDefaultLocale.ts +0 -91
  77. package/src/useFilter.ts +0 -83
  78. package/src/useListFormatter.tsx +0 -24
  79. package/src/useLocalizedStringFormatter.ts +0 -44
  80. package/src/useNumberFormatter.ts +0 -25
  81. package/src/utils.ts +0 -43
package/src/index.ts CHANGED
@@ -10,21 +10,19 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- export {I18nProvider, useLocale} from './context';
14
- export {useMessageFormatter} from './useMessageFormatter';
15
- export {useLocalizedStringFormatter, useLocalizedStringDictionary} from './useLocalizedStringFormatter';
16
- export {useListFormatter} from './useListFormatter';
17
- export {useDateFormatter} from './useDateFormatter';
18
- export {useNumberFormatter} from './useNumberFormatter';
19
- export {useCollator} from './useCollator';
20
- export {useFilter} from './useFilter';
21
- export {isRTL} from './utils';
13
+ export {I18nProvider, useLocale, isRTL} from 'react-aria/I18nProvider';
22
14
 
15
+ export {useMessageFormatter} from './useMessageFormatter';
16
+ export {useLocalizedStringFormatter, useLocalizedStringDictionary} from 'react-aria/useLocalizedStringFormatter';
17
+ export {useListFormatter} from 'react-aria/useListFormatter';
18
+ export {useDateFormatter} from 'react-aria/useDateFormatter';
19
+ export {useNumberFormatter} from 'react-aria/useNumberFormatter';
20
+ export {useCollator} from 'react-aria/useCollator';
21
+ export {useFilter} from 'react-aria/useFilter';
23
22
  export type {FormatMessage} from './useMessageFormatter';
23
+ export type {I18nProviderProps, Locale} from 'react-aria/I18nProvider';
24
+ export type {DateFormatterOptions} from 'react-aria/useDateFormatter';
25
+ export type {Filter} from 'react-aria/useFilter';
24
26
  export type {LocalizedStringFormatter} from '@internationalized/string';
25
- export type {I18nProviderProps} from './context';
26
- export type {Locale} from './useDefaultLocale';
27
27
  export type {LocalizedStrings} from '@internationalized/message';
28
- export type {DateFormatterOptions} from './useDateFormatter';
29
28
  export type {DateFormatter} from '@internationalized/date';
30
- export type {Filter} from './useFilter';
package/src/server.ts ADDED
@@ -0,0 +1 @@
1
+ export {PackageLocalizationProvider, getPackageLocalizationScript} from 'react-aria/private/i18n/server';
@@ -12,7 +12,7 @@
12
12
 
13
13
  import {LocalizedStrings, MessageDictionary, MessageFormatter} from '@internationalized/message';
14
14
  import {useCallback, useMemo} from 'react';
15
- import {useLocale} from './context';
15
+ import {useLocale} from 'react-aria/I18nProvider';
16
16
 
17
17
  export type FormatMessage = (key: string, variables?: {[key: string]: any}) => string;
18
18
 
@@ -1,72 +0,0 @@
1
- var $4d65847630a056a8$exports = require("./utils.main.js");
2
- var $2919bdec75484e64$exports = require("./useDefaultLocale.main.js");
3
- var $e7RNT$react = require("react");
4
-
5
-
6
- function $parcel$interopDefault(a) {
7
- return a && a.__esModule ? a.default : a;
8
- }
9
-
10
- function $parcel$export(e, n, v, s) {
11
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
12
- }
13
-
14
- $parcel$export(module.exports, "I18nProvider", () => $47fa5ec5ff482271$export$a54013f0d02a8f82);
15
- $parcel$export(module.exports, "useLocale", () => $47fa5ec5ff482271$export$43bb16f9c6d9e3f7);
16
- /*
17
- * Copyright 2020 Adobe. All rights reserved.
18
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
19
- * you may not use this file except in compliance with the License. You may obtain a copy
20
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
21
- *
22
- * Unless required by applicable law or agreed to in writing, software distributed under
23
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
24
- * OF ANY KIND, either express or implied. See the License for the specific language
25
- * governing permissions and limitations under the License.
26
- */
27
-
28
-
29
- const $47fa5ec5ff482271$var$I18nContext = /*#__PURE__*/ (0, ($parcel$interopDefault($e7RNT$react))).createContext(null);
30
- /**
31
- * Internal component that handles the case when locale is provided.
32
- */ function $47fa5ec5ff482271$var$I18nProviderWithLocale(props) {
33
- let { locale: locale, children: children } = props;
34
- let value = (0, ($parcel$interopDefault($e7RNT$react))).useMemo(()=>({
35
- locale: locale,
36
- direction: (0, $4d65847630a056a8$exports.isRTL)(locale) ? 'rtl' : 'ltr'
37
- }), [
38
- locale
39
- ]);
40
- return /*#__PURE__*/ (0, ($parcel$interopDefault($e7RNT$react))).createElement($47fa5ec5ff482271$var$I18nContext.Provider, {
41
- value: value
42
- }, children);
43
- }
44
- /**
45
- * Internal component that handles the case when no locale is provided.
46
- */ function $47fa5ec5ff482271$var$I18nProviderWithDefaultLocale(props) {
47
- let { children: children } = props;
48
- let defaultLocale = (0, $2919bdec75484e64$exports.useDefaultLocale)();
49
- return /*#__PURE__*/ (0, ($parcel$interopDefault($e7RNT$react))).createElement($47fa5ec5ff482271$var$I18nContext.Provider, {
50
- value: defaultLocale
51
- }, children);
52
- }
53
- function $47fa5ec5ff482271$export$a54013f0d02a8f82(props) {
54
- let { locale: locale, children: children } = props;
55
- // Conditionally render different components to avoid calling useDefaultLocale.
56
- // This is necessary because useDefaultLocale triggers a re-render.
57
- if (locale) return /*#__PURE__*/ (0, ($parcel$interopDefault($e7RNT$react))).createElement($47fa5ec5ff482271$var$I18nProviderWithLocale, {
58
- locale: locale,
59
- children: children
60
- });
61
- return /*#__PURE__*/ (0, ($parcel$interopDefault($e7RNT$react))).createElement($47fa5ec5ff482271$var$I18nProviderWithDefaultLocale, {
62
- children: children
63
- });
64
- }
65
- function $47fa5ec5ff482271$export$43bb16f9c6d9e3f7() {
66
- let defaultLocale = (0, $2919bdec75484e64$exports.useDefaultLocale)();
67
- let context = (0, $e7RNT$react.useContext)($47fa5ec5ff482271$var$I18nContext);
68
- return context || defaultLocale;
69
- }
70
-
71
-
72
- //# sourceMappingURL=context.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAaD,MAAM,kDAAc,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAgB;AAMvD;;CAEC,GACD,SAAS,6CAAuB,KAAkC;IAChE,IAAI,UAAC,MAAM,YAAE,QAAQ,EAAC,GAAG;IACzB,IAAI,QAAgB,CAAA,GAAA,sCAAI,EAAE,OAAO,CAAC,IAAO,CAAA;oBACvC;YACA,WAAW,CAAA,GAAA,+BAAI,EAAE,UAAU,QAAQ;QACrC,CAAA,GAAI;QAAC;KAAO;IAEZ,qBACE,0DAAC,kCAAY,QAAQ;QAAC,OAAO;OAC1B;AAGP;AAMA;;CAEC,GACD,SAAS,oDAA8B,KAAyC;IAC9E,IAAI,YAAC,QAAQ,EAAC,GAAG;IACjB,IAAI,gBAAgB,CAAA,GAAA,0CAAe;IAEnC,qBACE,0DAAC,kCAAY,QAAQ;QAAC,OAAO;OAC1B;AAGP;AAKO,SAAS,0CAAa,KAAwB;IACnD,IAAI,UAAC,MAAM,YAAE,QAAQ,EAAC,GAAG;IAEzB,+EAA+E;IAC/E,mEAAmE;IACnE,IAAI,QACF,qBAAO,0DAAC;QAAuB,QAAQ;QAAQ,UAAU;;IAG3D,qBAAO,0DAAC;QAA8B,UAAU;;AAClD;AAKO,SAAS;IACd,IAAI,gBAAgB,CAAA,GAAA,0CAAe;IACnC,IAAI,UAAU,CAAA,GAAA,uBAAS,EAAE;IACzB,OAAO,WAAW;AACpB","sources":["packages/@react-aria/i18n/src/context.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 {isRTL} from './utils';\nimport {Locale, useDefaultLocale} from './useDefaultLocale';\nimport React, {JSX, ReactNode, useContext} from 'react';\n\nexport interface I18nProviderProps {\n /** Contents that should have the locale applied. */\n children: ReactNode,\n /** The locale to apply to the children. */\n locale?: string\n}\n\nconst I18nContext = React.createContext<Locale | null>(null);\n\ninterface I18nProviderWithLocaleProps extends I18nProviderProps {\n locale: string\n}\n\n/**\n * Internal component that handles the case when locale is provided.\n */\nfunction I18nProviderWithLocale(props: I18nProviderWithLocaleProps): JSX.Element {\n let {locale, children} = props; \n let value: Locale = React.useMemo(() => ({\n locale,\n direction: isRTL(locale) ? 'rtl' : 'ltr'\n }), [locale]);\n\n return (\n <I18nContext.Provider value={value}>\n {children}\n </I18nContext.Provider>\n );\n}\n\ninterface I18nProviderWithDefaultLocaleProps {\n children: ReactNode\n}\n\n/**\n * Internal component that handles the case when no locale is provided.\n */\nfunction I18nProviderWithDefaultLocale(props: I18nProviderWithDefaultLocaleProps): JSX.Element {\n let {children} = props;\n let defaultLocale = useDefaultLocale();\n\n return (\n <I18nContext.Provider value={defaultLocale}>\n {children}\n </I18nContext.Provider>\n );\n}\n\n/**\n * Provides the locale for the application to all child components.\n */\nexport function I18nProvider(props: I18nProviderProps): JSX.Element {\n let {locale, children} = props;\n\n // Conditionally render different components to avoid calling useDefaultLocale.\n // This is necessary because useDefaultLocale triggers a re-render.\n if (locale) {\n return <I18nProviderWithLocale locale={locale} children={children} />;\n }\n\n return <I18nProviderWithDefaultLocale children={children} />;\n}\n\n/**\n * Returns the current locale and layout direction.\n */\nexport function useLocale(): Locale {\n let defaultLocale = useDefaultLocale();\n let context = useContext(I18nContext);\n return context || defaultLocale;\n}\n"],"names":[],"version":3,"file":"context.main.js.map"}
package/dist/context.mjs DELETED
@@ -1,62 +0,0 @@
1
- import {isRTL as $148a7a147e38ea7f$export$702d680b21cbd764} from "./utils.mjs";
2
- import {useDefaultLocale as $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a} from "./useDefaultLocale.mjs";
3
- import $h9FiU$react, {useContext as $h9FiU$useContext} 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 $18f2051aff69b9bf$var$I18nContext = /*#__PURE__*/ (0, $h9FiU$react).createContext(null);
19
- /**
20
- * Internal component that handles the case when locale is provided.
21
- */ function $18f2051aff69b9bf$var$I18nProviderWithLocale(props) {
22
- let { locale: locale, children: children } = props;
23
- let value = (0, $h9FiU$react).useMemo(()=>({
24
- locale: locale,
25
- direction: (0, $148a7a147e38ea7f$export$702d680b21cbd764)(locale) ? 'rtl' : 'ltr'
26
- }), [
27
- locale
28
- ]);
29
- return /*#__PURE__*/ (0, $h9FiU$react).createElement($18f2051aff69b9bf$var$I18nContext.Provider, {
30
- value: value
31
- }, children);
32
- }
33
- /**
34
- * Internal component that handles the case when no locale is provided.
35
- */ function $18f2051aff69b9bf$var$I18nProviderWithDefaultLocale(props) {
36
- let { children: children } = props;
37
- let defaultLocale = (0, $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a)();
38
- return /*#__PURE__*/ (0, $h9FiU$react).createElement($18f2051aff69b9bf$var$I18nContext.Provider, {
39
- value: defaultLocale
40
- }, children);
41
- }
42
- function $18f2051aff69b9bf$export$a54013f0d02a8f82(props) {
43
- let { locale: locale, children: children } = props;
44
- // Conditionally render different components to avoid calling useDefaultLocale.
45
- // This is necessary because useDefaultLocale triggers a re-render.
46
- if (locale) return /*#__PURE__*/ (0, $h9FiU$react).createElement($18f2051aff69b9bf$var$I18nProviderWithLocale, {
47
- locale: locale,
48
- children: children
49
- });
50
- return /*#__PURE__*/ (0, $h9FiU$react).createElement($18f2051aff69b9bf$var$I18nProviderWithDefaultLocale, {
51
- children: children
52
- });
53
- }
54
- function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7() {
55
- let defaultLocale = (0, $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a)();
56
- let context = (0, $h9FiU$useContext)($18f2051aff69b9bf$var$I18nContext);
57
- return context || defaultLocale;
58
- }
59
-
60
-
61
- export {$18f2051aff69b9bf$export$a54013f0d02a8f82 as I18nProvider, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 as useLocale};
62
- //# sourceMappingURL=context.module.js.map
@@ -1,62 +0,0 @@
1
- import {isRTL as $148a7a147e38ea7f$export$702d680b21cbd764} from "./utils.module.js";
2
- import {useDefaultLocale as $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a} from "./useDefaultLocale.module.js";
3
- import $h9FiU$react, {useContext as $h9FiU$useContext} 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 $18f2051aff69b9bf$var$I18nContext = /*#__PURE__*/ (0, $h9FiU$react).createContext(null);
19
- /**
20
- * Internal component that handles the case when locale is provided.
21
- */ function $18f2051aff69b9bf$var$I18nProviderWithLocale(props) {
22
- let { locale: locale, children: children } = props;
23
- let value = (0, $h9FiU$react).useMemo(()=>({
24
- locale: locale,
25
- direction: (0, $148a7a147e38ea7f$export$702d680b21cbd764)(locale) ? 'rtl' : 'ltr'
26
- }), [
27
- locale
28
- ]);
29
- return /*#__PURE__*/ (0, $h9FiU$react).createElement($18f2051aff69b9bf$var$I18nContext.Provider, {
30
- value: value
31
- }, children);
32
- }
33
- /**
34
- * Internal component that handles the case when no locale is provided.
35
- */ function $18f2051aff69b9bf$var$I18nProviderWithDefaultLocale(props) {
36
- let { children: children } = props;
37
- let defaultLocale = (0, $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a)();
38
- return /*#__PURE__*/ (0, $h9FiU$react).createElement($18f2051aff69b9bf$var$I18nContext.Provider, {
39
- value: defaultLocale
40
- }, children);
41
- }
42
- function $18f2051aff69b9bf$export$a54013f0d02a8f82(props) {
43
- let { locale: locale, children: children } = props;
44
- // Conditionally render different components to avoid calling useDefaultLocale.
45
- // This is necessary because useDefaultLocale triggers a re-render.
46
- if (locale) return /*#__PURE__*/ (0, $h9FiU$react).createElement($18f2051aff69b9bf$var$I18nProviderWithLocale, {
47
- locale: locale,
48
- children: children
49
- });
50
- return /*#__PURE__*/ (0, $h9FiU$react).createElement($18f2051aff69b9bf$var$I18nProviderWithDefaultLocale, {
51
- children: children
52
- });
53
- }
54
- function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7() {
55
- let defaultLocale = (0, $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a)();
56
- let context = (0, $h9FiU$useContext)($18f2051aff69b9bf$var$I18nContext);
57
- return context || defaultLocale;
58
- }
59
-
60
-
61
- export {$18f2051aff69b9bf$export$a54013f0d02a8f82 as I18nProvider, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 as useLocale};
62
- //# sourceMappingURL=context.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAaD,MAAM,kDAAc,CAAA,GAAA,YAAI,EAAE,aAAa,CAAgB;AAMvD;;CAEC,GACD,SAAS,6CAAuB,KAAkC;IAChE,IAAI,UAAC,MAAM,YAAE,QAAQ,EAAC,GAAG;IACzB,IAAI,QAAgB,CAAA,GAAA,YAAI,EAAE,OAAO,CAAC,IAAO,CAAA;oBACvC;YACA,WAAW,CAAA,GAAA,yCAAI,EAAE,UAAU,QAAQ;QACrC,CAAA,GAAI;QAAC;KAAO;IAEZ,qBACE,gCAAC,kCAAY,QAAQ;QAAC,OAAO;OAC1B;AAGP;AAMA;;CAEC,GACD,SAAS,oDAA8B,KAAyC;IAC9E,IAAI,YAAC,QAAQ,EAAC,GAAG;IACjB,IAAI,gBAAgB,CAAA,GAAA,yCAAe;IAEnC,qBACE,gCAAC,kCAAY,QAAQ;QAAC,OAAO;OAC1B;AAGP;AAKO,SAAS,0CAAa,KAAwB;IACnD,IAAI,UAAC,MAAM,YAAE,QAAQ,EAAC,GAAG;IAEzB,+EAA+E;IAC/E,mEAAmE;IACnE,IAAI,QACF,qBAAO,gCAAC;QAAuB,QAAQ;QAAQ,UAAU;;IAG3D,qBAAO,gCAAC;QAA8B,UAAU;;AAClD;AAKO,SAAS;IACd,IAAI,gBAAgB,CAAA,GAAA,yCAAe;IACnC,IAAI,UAAU,CAAA,GAAA,iBAAS,EAAE;IACzB,OAAO,WAAW;AACpB","sources":["packages/@react-aria/i18n/src/context.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 {isRTL} from './utils';\nimport {Locale, useDefaultLocale} from './useDefaultLocale';\nimport React, {JSX, ReactNode, useContext} from 'react';\n\nexport interface I18nProviderProps {\n /** Contents that should have the locale applied. */\n children: ReactNode,\n /** The locale to apply to the children. */\n locale?: string\n}\n\nconst I18nContext = React.createContext<Locale | null>(null);\n\ninterface I18nProviderWithLocaleProps extends I18nProviderProps {\n locale: string\n}\n\n/**\n * Internal component that handles the case when locale is provided.\n */\nfunction I18nProviderWithLocale(props: I18nProviderWithLocaleProps): JSX.Element {\n let {locale, children} = props; \n let value: Locale = React.useMemo(() => ({\n locale,\n direction: isRTL(locale) ? 'rtl' : 'ltr'\n }), [locale]);\n\n return (\n <I18nContext.Provider value={value}>\n {children}\n </I18nContext.Provider>\n );\n}\n\ninterface I18nProviderWithDefaultLocaleProps {\n children: ReactNode\n}\n\n/**\n * Internal component that handles the case when no locale is provided.\n */\nfunction I18nProviderWithDefaultLocale(props: I18nProviderWithDefaultLocaleProps): JSX.Element {\n let {children} = props;\n let defaultLocale = useDefaultLocale();\n\n return (\n <I18nContext.Provider value={defaultLocale}>\n {children}\n </I18nContext.Provider>\n );\n}\n\n/**\n * Provides the locale for the application to all child components.\n */\nexport function I18nProvider(props: I18nProviderProps): JSX.Element {\n let {locale, children} = props;\n\n // Conditionally render different components to avoid calling useDefaultLocale.\n // This is necessary because useDefaultLocale triggers a re-render.\n if (locale) {\n return <I18nProviderWithLocale locale={locale} children={children} />;\n }\n\n return <I18nProviderWithDefaultLocale children={children} />;\n}\n\n/**\n * Returns the current locale and layout direction.\n */\nexport function useLocale(): Locale {\n let defaultLocale = useDefaultLocale();\n let context = useContext(I18nContext);\n return context || defaultLocale;\n}\n"],"names":[],"version":3,"file":"context.module.js.map"}
package/dist/types.d.ts DELETED
@@ -1,95 +0,0 @@
1
- import { Direction } from "@react-types/shared";
2
- import { JSX, ReactNode } from "react";
3
- import { LocalizedStrings } from "@internationalized/message";
4
- import { LocalizedString, LocalizedStringDictionary, LocalizedStringFormatter, LocalizedStrings as _LocalizedStrings1 } from "@internationalized/string";
5
- import { DateFormatter } from "@internationalized/date";
6
- import { NumberFormatOptions } from "@internationalized/number";
7
- /**
8
- * 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}.
9
- */
10
- export function isRTL(localeString: string): boolean;
11
- export interface Locale {
12
- /** The [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt) language code for the locale. */
13
- locale: string;
14
- /** The writing direction for the locale. */
15
- direction: Direction;
16
- }
17
- export interface I18nProviderProps {
18
- /** Contents that should have the locale applied. */
19
- children: ReactNode;
20
- /** The locale to apply to the children. */
21
- locale?: string;
22
- }
23
- /**
24
- * Provides the locale for the application to all child components.
25
- */
26
- export function I18nProvider(props: I18nProviderProps): JSX.Element;
27
- /**
28
- * Returns the current locale and layout direction.
29
- */
30
- export function useLocale(): Locale;
31
- export type FormatMessage = (key: string, variables?: {
32
- [key: string]: any;
33
- }) => string;
34
- /**
35
- * Handles formatting ICU Message strings to create localized strings for the current locale.
36
- * Automatically updates when the locale changes, and handles caching of messages for performance.
37
- * @param strings - A mapping of languages to strings by key.
38
- * @deprecated - use useLocalizedStringFormatter instead.
39
- */
40
- export function useMessageFormatter(strings: LocalizedStrings): FormatMessage;
41
- /**
42
- * Returns a cached LocalizedStringDictionary for the given strings.
43
- */
44
- export function useLocalizedStringDictionary<K extends string = string, T extends LocalizedString = string>(strings: _LocalizedStrings1<K, T>, packageName?: string): LocalizedStringDictionary<K, T>;
45
- /**
46
- * Provides localized string formatting for the current locale. Supports interpolating variables,
47
- * selecting the correct pluralization, and formatting numbers. Automatically updates when the locale changes.
48
- * @param strings - A mapping of languages to localized strings by key.
49
- */
50
- export function useLocalizedStringFormatter<K extends string = string, T extends LocalizedString = string>(strings: _LocalizedStrings1<K, T>, packageName?: string): LocalizedStringFormatter<K, T>;
51
- /**
52
- * Provides localized list formatting for the current locale. Automatically updates when the locale changes,
53
- * and handles caching of the list formatter for performance.
54
- * @param options - Formatting options.
55
- */
56
- export function useListFormatter(options?: Intl.ListFormatOptions): Intl.ListFormat;
57
- export interface DateFormatterOptions extends Intl.DateTimeFormatOptions {
58
- calendar?: string;
59
- }
60
- /**
61
- * Provides localized date formatting for the current locale. Automatically updates when the locale changes,
62
- * and handles caching of the date formatter for performance.
63
- * @param options - Formatting options.
64
- */
65
- export function useDateFormatter(options?: DateFormatterOptions): DateFormatter;
66
- /**
67
- * Provides localized number formatting for the current locale. Automatically updates when the locale changes,
68
- * and handles caching of the number formatter for performance.
69
- * @param options - Formatting options.
70
- */
71
- export function useNumberFormatter(options?: NumberFormatOptions): Intl.NumberFormat;
72
- /**
73
- * Provides localized string collation for the current locale. Automatically updates when the locale changes,
74
- * and handles caching of the collator for performance.
75
- * @param options - Collator options.
76
- */
77
- export function useCollator(options?: Intl.CollatorOptions): Intl.Collator;
78
- export interface Filter {
79
- /** Returns whether a string starts with a given substring. */
80
- startsWith: (string: string, substring: string) => boolean;
81
- /** Returns whether a string ends with a given substring. */
82
- endsWith: (string: string, substring: string) => boolean;
83
- /** Returns whether a string contains a given substring. */
84
- contains: (string: string, substring: string) => boolean;
85
- }
86
- /**
87
- * Provides localized string search functionality that is useful for filtering or matching items
88
- * in a list. Options can be provided to adjust the sensitivity to case, diacritics, and other parameters.
89
- */
90
- export function useFilter(options?: Intl.CollatorOptions): Filter;
91
- export type { LocalizedStringFormatter } from '@internationalized/string';
92
- export type { LocalizedStrings } from '@internationalized/message';
93
- export type { DateFormatter } from '@internationalized/date';
94
-
95
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;AAgBA;;GAEG;AACH,sBAAsB,YAAY,EAAE,MAAM,GAAG,OAAO,CAuBnD;ACzBD;IACE,wFAAwF;IACxF,MAAM,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,SAAS,EAAE,SAAS,CAAA;CACrB;ACND;IACE,oDAAoD;IACpD,QAAQ,EAAE,SAAS,CAAC;IACpB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AA2CD;;GAEG;AACH,6BAA6B,KAAK,EAAE,iBAAiB,GAAG,IAAI,OAAO,CAUlE;AAED;;GAEG;AACH,6BAA6B,MAAM,CAIlC;ACtED,4BAA4B,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAC,KAAK,MAAM,CAAC;AAatF;;;;;GAKG;AACH,oCAAoC,OAAO,EAAE,gBAAgB,GAAG,aAAa,CAK5E;ACbD;;GAEG;AACH,6CAA6C,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,SAAS,eAAe,GAAG,MAAM,EAAE,OAAO,EAAE,mBAAiB,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,0BAA0B,CAAC,EAAE,CAAC,CAAC,CAElM;AAED;;;;GAIG;AACH,4CAA4C,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,SAAS,eAAe,GAAG,MAAM,EAAE,OAAO,EAAE,mBAAiB,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,yBAAyB,CAAC,EAAE,CAAC,CAAC,CAIhM;AC5BD;;;;GAIG;AACH,iCAAiC,OAAO,GAAE,KAAK,iBAAsB,GAAG,KAAK,UAAU,CAGtF;ACND,qCAAsC,SAAQ,IAAI,CAAC,qBAAqB;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;;GAIG;AACH,iCAAiC,OAAO,CAAC,EAAE,oBAAoB,GAAG,aAAa,CAK9E;ACfD;;;;GAIG;AACH,mCAAmC,OAAO,GAAE,mBAAwB,GAAG,KAAK,YAAY,CAGvF;ACRD;;;;GAIG;AACH,4BAA4B,OAAO,CAAC,EAAE,KAAK,eAAe,GAAG,KAAK,QAAQ,CAWzE;ACjBD;IACE,8DAA8D;IAC9D,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IAC3D,4DAA4D;IAC5D,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IACzD,2DAA2D;IAC3D,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAA;CACzD;AAED;;;GAGG;AACH,0BAA0B,OAAO,CAAC,EAAE,KAAK,eAAe,GAAG,MAAM,CAsDhE;AC3DD,YAAY,EAAC,wBAAwB,EAAC,MAAM,2BAA2B,CAAC;AAGxE,YAAY,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAEjE,YAAY,EAAC,aAAa,EAAC,MAAM,yBAAyB,CAAC","sources":["packages/@react-aria/i18n/src/packages/@react-aria/i18n/src/utils.ts","packages/@react-aria/i18n/src/packages/@react-aria/i18n/src/useDefaultLocale.ts","packages/@react-aria/i18n/src/packages/@react-aria/i18n/src/context.tsx","packages/@react-aria/i18n/src/packages/@react-aria/i18n/src/useMessageFormatter.ts","packages/@react-aria/i18n/src/packages/@react-aria/i18n/src/useLocalizedStringFormatter.ts","packages/@react-aria/i18n/src/packages/@react-aria/i18n/src/useListFormatter.tsx","packages/@react-aria/i18n/src/packages/@react-aria/i18n/src/useDateFormatter.ts","packages/@react-aria/i18n/src/packages/@react-aria/i18n/src/useNumberFormatter.ts","packages/@react-aria/i18n/src/packages/@react-aria/i18n/src/useCollator.ts","packages/@react-aria/i18n/src/packages/@react-aria/i18n/src/useFilter.ts","packages/@react-aria/i18n/src/packages/@react-aria/i18n/src/index.ts","packages/@react-aria/i18n/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,"/*\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\nexport {I18nProvider, useLocale} from './context';\nexport {useMessageFormatter} from './useMessageFormatter';\nexport {useLocalizedStringFormatter, useLocalizedStringDictionary} from './useLocalizedStringFormatter';\nexport {useListFormatter} from './useListFormatter';\nexport {useDateFormatter} from './useDateFormatter';\nexport {useNumberFormatter} from './useNumberFormatter';\nexport {useCollator} from './useCollator';\nexport {useFilter} from './useFilter';\nexport {isRTL} from './utils';\n\nexport type {FormatMessage} from './useMessageFormatter';\nexport type {LocalizedStringFormatter} from '@internationalized/string';\nexport type {I18nProviderProps} from './context';\nexport type {Locale} from './useDefaultLocale';\nexport type {LocalizedStrings} from '@internationalized/message';\nexport type {DateFormatterOptions} from './useDateFormatter';\nexport type {DateFormatter} from '@internationalized/date';\nexport type {Filter} from './useFilter';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
@@ -1,31 +0,0 @@
1
- var $47fa5ec5ff482271$exports = require("./context.main.js");
2
-
3
-
4
- function $parcel$export(e, n, v, s) {
5
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
6
- }
7
-
8
- $parcel$export(module.exports, "useCollator", () => $27a5ce66022270ad$export$a16aca283550c30d);
9
- /*
10
- * Copyright 2020 Adobe. All rights reserved.
11
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
12
- * you may not use this file except in compliance with the License. You may obtain a copy
13
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
14
- *
15
- * Unless required by applicable law or agreed to in writing, software distributed under
16
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
17
- * OF ANY KIND, either express or implied. See the License for the specific language
18
- * governing permissions and limitations under the License.
19
- */
20
- let $27a5ce66022270ad$var$cache = new Map();
21
- function $27a5ce66022270ad$export$a16aca283550c30d(options) {
22
- let { locale: locale } = (0, $47fa5ec5ff482271$exports.useLocale)();
23
- let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1).join() : '');
24
- if ($27a5ce66022270ad$var$cache.has(cacheKey)) return $27a5ce66022270ad$var$cache.get(cacheKey);
25
- let formatter = new Intl.Collator(locale, options);
26
- $27a5ce66022270ad$var$cache.set(cacheKey, formatter);
27
- return formatter;
28
- }
29
-
30
-
31
- //# sourceMappingURL=useCollator.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAID,IAAI,8BAAQ,IAAI;AAOT,SAAS,0CAAY,OAA8B;IACxD,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,mCAAQ;IAEvB,IAAI,WAAW,SAAU,CAAA,UAAU,OAAO,OAAO,CAAC,SAAS,IAAI,CAAC,CAAC,GAAG,IAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,KAAK,GAAG,IAAI,KAAK,EAAC;IAC1G,IAAI,4BAAM,GAAG,CAAC,WACZ,OAAO,4BAAM,GAAG,CAAC;IAGnB,IAAI,YAAY,IAAI,KAAK,QAAQ,CAAC,QAAQ;IAC1C,4BAAM,GAAG,CAAC,UAAU;IACpB,OAAO;AACT","sources":["packages/@react-aria/i18n/src/useCollator.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 {useLocale} from './context';\n\nlet cache = new Map<string, Intl.Collator>();\n\n/**\n * Provides localized string collation for the current locale. Automatically updates when the locale changes,\n * and handles caching of the collator for performance.\n * @param options - Collator options.\n */\nexport function useCollator(options?: Intl.CollatorOptions): Intl.Collator {\n let {locale} = useLocale();\n\n let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : '');\n if (cache.has(cacheKey)) {\n return cache.get(cacheKey)!;\n }\n\n let formatter = new Intl.Collator(locale, options);\n cache.set(cacheKey, formatter);\n return formatter;\n}\n"],"names":[],"version":3,"file":"useCollator.main.js.map"}
@@ -1,26 +0,0 @@
1
- import {useLocale as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7} from "./context.mjs";
2
-
3
- /*
4
- * Copyright 2020 Adobe. All rights reserved.
5
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License. You may obtain a copy
7
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software distributed under
10
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
- * OF ANY KIND, either express or implied. See the License for the specific language
12
- * governing permissions and limitations under the License.
13
- */
14
- let $325a3faab7a68acd$var$cache = new Map();
15
- function $325a3faab7a68acd$export$a16aca283550c30d(options) {
16
- let { locale: locale } = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)();
17
- let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1).join() : '');
18
- if ($325a3faab7a68acd$var$cache.has(cacheKey)) return $325a3faab7a68acd$var$cache.get(cacheKey);
19
- let formatter = new Intl.Collator(locale, options);
20
- $325a3faab7a68acd$var$cache.set(cacheKey, formatter);
21
- return formatter;
22
- }
23
-
24
-
25
- export {$325a3faab7a68acd$export$a16aca283550c30d as useCollator};
26
- //# sourceMappingURL=useCollator.module.js.map
@@ -1,26 +0,0 @@
1
- import {useLocale as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7} from "./context.module.js";
2
-
3
- /*
4
- * Copyright 2020 Adobe. All rights reserved.
5
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License. You may obtain a copy
7
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software distributed under
10
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
- * OF ANY KIND, either express or implied. See the License for the specific language
12
- * governing permissions and limitations under the License.
13
- */
14
- let $325a3faab7a68acd$var$cache = new Map();
15
- function $325a3faab7a68acd$export$a16aca283550c30d(options) {
16
- let { locale: locale } = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)();
17
- let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1).join() : '');
18
- if ($325a3faab7a68acd$var$cache.has(cacheKey)) return $325a3faab7a68acd$var$cache.get(cacheKey);
19
- let formatter = new Intl.Collator(locale, options);
20
- $325a3faab7a68acd$var$cache.set(cacheKey, formatter);
21
- return formatter;
22
- }
23
-
24
-
25
- export {$325a3faab7a68acd$export$a16aca283550c30d as useCollator};
26
- //# sourceMappingURL=useCollator.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;AAAA;;;;;;;;;;CAUC;AAID,IAAI,8BAAQ,IAAI;AAOT,SAAS,0CAAY,OAA8B;IACxD,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,yCAAQ;IAEvB,IAAI,WAAW,SAAU,CAAA,UAAU,OAAO,OAAO,CAAC,SAAS,IAAI,CAAC,CAAC,GAAG,IAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,KAAK,GAAG,IAAI,KAAK,EAAC;IAC1G,IAAI,4BAAM,GAAG,CAAC,WACZ,OAAO,4BAAM,GAAG,CAAC;IAGnB,IAAI,YAAY,IAAI,KAAK,QAAQ,CAAC,QAAQ;IAC1C,4BAAM,GAAG,CAAC,UAAU;IACpB,OAAO;AACT","sources":["packages/@react-aria/i18n/src/useCollator.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 {useLocale} from './context';\n\nlet cache = new Map<string, Intl.Collator>();\n\n/**\n * Provides localized string collation for the current locale. Automatically updates when the locale changes,\n * and handles caching of the collator for performance.\n * @param options - Collator options.\n */\nexport function useCollator(options?: Intl.CollatorOptions): Intl.Collator {\n let {locale} = useLocale();\n\n let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : '');\n if (cache.has(cacheKey)) {\n return cache.get(cacheKey)!;\n }\n\n let formatter = new Intl.Collator(locale, options);\n cache.set(cacheKey, formatter);\n return formatter;\n}\n"],"names":[],"version":3,"file":"useCollator.module.js.map"}
@@ -1,47 +0,0 @@
1
- var $47fa5ec5ff482271$exports = require("./context.main.js");
2
- var $9DCmA$internationalizeddate = require("@internationalized/date");
3
- var $9DCmA$reactariautils = require("@react-aria/utils");
4
- var $9DCmA$react = require("react");
5
-
6
-
7
- function $parcel$export(e, n, v, s) {
8
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
9
- }
10
-
11
- $parcel$export(module.exports, "useDateFormatter", () => $b80c530ff2e20243$export$85fd5fdf27bacc79);
12
- /*
13
- * Copyright 2020 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
-
26
- function $b80c530ff2e20243$export$85fd5fdf27bacc79(options) {
27
- // Reuse last options object if it is shallowly equal, which allows the useMemo result to also be reused.
28
- options = (0, $9DCmA$reactariautils.useDeepMemo)(options !== null && options !== void 0 ? options : {}, $b80c530ff2e20243$var$isEqual);
29
- let { locale: locale } = (0, $47fa5ec5ff482271$exports.useLocale)();
30
- return (0, $9DCmA$react.useMemo)(()=>new (0, $9DCmA$internationalizeddate.DateFormatter)(locale, options), [
31
- locale,
32
- options
33
- ]);
34
- }
35
- function $b80c530ff2e20243$var$isEqual(a, b) {
36
- if (a === b) return true;
37
- let aKeys = Object.keys(a);
38
- let bKeys = Object.keys(b);
39
- if (aKeys.length !== bKeys.length) return false;
40
- for (let key of aKeys){
41
- if (b[key] !== a[key]) return false;
42
- }
43
- return true;
44
- }
45
-
46
-
47
- //# sourceMappingURL=useDateFormatter.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAgBM,SAAS,0CAAiB,OAA8B;IAC7D,yGAAyG;IACzG,UAAU,CAAA,GAAA,iCAAU,EAAE,oBAAA,qBAAA,UAAW,CAAC,GAAG;IACrC,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,mCAAQ;IACvB,OAAO,CAAA,GAAA,oBAAM,EAAE,IAAM,IAAI,CAAA,GAAA,0CAAY,EAAE,QAAQ,UAAU;QAAC;QAAQ;KAAQ;AAC5E;AAEA,SAAS,8BAAQ,CAAuB,EAAE,CAAuB;IAC/D,IAAI,MAAM,GACR,OAAO;IAGT,IAAI,QAAQ,OAAO,IAAI,CAAC;IACxB,IAAI,QAAQ,OAAO,IAAI,CAAC;IACxB,IAAI,MAAM,MAAM,KAAK,MAAM,MAAM,EAC/B,OAAO;IAGT,KAAK,IAAI,OAAO,MAAO;QACrB,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,EACnB,OAAO;IAEX;IAEA,OAAO;AACT","sources":["packages/@react-aria/i18n/src/useDateFormatter.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 {DateFormatter} from '@internationalized/date';\nimport {useDeepMemo} from '@react-aria/utils';\nimport {useLocale} from './context';\nimport {useMemo} from 'react';\n\nexport interface DateFormatterOptions extends Intl.DateTimeFormatOptions {\n calendar?: string\n}\n\n/**\n * Provides localized date formatting for the current locale. Automatically updates when the locale changes,\n * and handles caching of the date formatter for performance.\n * @param options - Formatting options.\n */\nexport function useDateFormatter(options?: DateFormatterOptions): DateFormatter {\n // Reuse last options object if it is shallowly equal, which allows the useMemo result to also be reused.\n options = useDeepMemo(options ?? {}, isEqual);\n let {locale} = useLocale();\n return useMemo(() => new DateFormatter(locale, options), [locale, options]);\n}\n\nfunction isEqual(a: DateFormatterOptions, b: DateFormatterOptions) {\n if (a === b) {\n return true;\n }\n\n let aKeys = Object.keys(a);\n let bKeys = Object.keys(b);\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n\n for (let key of aKeys) {\n if (b[key] !== a[key]) {\n return false;\n }\n }\n\n return true;\n}\n"],"names":[],"version":3,"file":"useDateFormatter.main.js.map"}
@@ -1,42 +0,0 @@
1
- import {useLocale as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7} from "./context.mjs";
2
- import {DateFormatter as $6wxND$DateFormatter} from "@internationalized/date";
3
- import {useDeepMemo as $6wxND$useDeepMemo} from "@react-aria/utils";
4
- import {useMemo as $6wxND$useMemo} from "react";
5
-
6
- /*
7
- * Copyright 2020 Adobe. All rights reserved.
8
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
9
- * you may not use this file except in compliance with the License. You may obtain a copy
10
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software distributed under
13
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14
- * OF ANY KIND, either express or implied. See the License for the specific language
15
- * governing permissions and limitations under the License.
16
- */
17
-
18
-
19
-
20
- function $896ba0a80a8f4d36$export$85fd5fdf27bacc79(options) {
21
- // Reuse last options object if it is shallowly equal, which allows the useMemo result to also be reused.
22
- options = (0, $6wxND$useDeepMemo)(options !== null && options !== void 0 ? options : {}, $896ba0a80a8f4d36$var$isEqual);
23
- let { locale: locale } = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)();
24
- return (0, $6wxND$useMemo)(()=>new (0, $6wxND$DateFormatter)(locale, options), [
25
- locale,
26
- options
27
- ]);
28
- }
29
- function $896ba0a80a8f4d36$var$isEqual(a, b) {
30
- if (a === b) return true;
31
- let aKeys = Object.keys(a);
32
- let bKeys = Object.keys(b);
33
- if (aKeys.length !== bKeys.length) return false;
34
- for (let key of aKeys){
35
- if (b[key] !== a[key]) return false;
36
- }
37
- return true;
38
- }
39
-
40
-
41
- export {$896ba0a80a8f4d36$export$85fd5fdf27bacc79 as useDateFormatter};
42
- //# sourceMappingURL=useDateFormatter.module.js.map
@@ -1,42 +0,0 @@
1
- import {useLocale as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7} from "./context.module.js";
2
- import {DateFormatter as $6wxND$DateFormatter} from "@internationalized/date";
3
- import {useDeepMemo as $6wxND$useDeepMemo} from "@react-aria/utils";
4
- import {useMemo as $6wxND$useMemo} from "react";
5
-
6
- /*
7
- * Copyright 2020 Adobe. All rights reserved.
8
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
9
- * you may not use this file except in compliance with the License. You may obtain a copy
10
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software distributed under
13
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14
- * OF ANY KIND, either express or implied. See the License for the specific language
15
- * governing permissions and limitations under the License.
16
- */
17
-
18
-
19
-
20
- function $896ba0a80a8f4d36$export$85fd5fdf27bacc79(options) {
21
- // Reuse last options object if it is shallowly equal, which allows the useMemo result to also be reused.
22
- options = (0, $6wxND$useDeepMemo)(options !== null && options !== void 0 ? options : {}, $896ba0a80a8f4d36$var$isEqual);
23
- let { locale: locale } = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)();
24
- return (0, $6wxND$useMemo)(()=>new (0, $6wxND$DateFormatter)(locale, options), [
25
- locale,
26
- options
27
- ]);
28
- }
29
- function $896ba0a80a8f4d36$var$isEqual(a, b) {
30
- if (a === b) return true;
31
- let aKeys = Object.keys(a);
32
- let bKeys = Object.keys(b);
33
- if (aKeys.length !== bKeys.length) return false;
34
- for (let key of aKeys){
35
- if (b[key] !== a[key]) return false;
36
- }
37
- return true;
38
- }
39
-
40
-
41
- export {$896ba0a80a8f4d36$export$85fd5fdf27bacc79 as useDateFormatter};
42
- //# sourceMappingURL=useDateFormatter.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AAgBM,SAAS,0CAAiB,OAA8B;IAC7D,yGAAyG;IACzG,UAAU,CAAA,GAAA,kBAAU,EAAE,oBAAA,qBAAA,UAAW,CAAC,GAAG;IACrC,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,yCAAQ;IACvB,OAAO,CAAA,GAAA,cAAM,EAAE,IAAM,IAAI,CAAA,GAAA,oBAAY,EAAE,QAAQ,UAAU;QAAC;QAAQ;KAAQ;AAC5E;AAEA,SAAS,8BAAQ,CAAuB,EAAE,CAAuB;IAC/D,IAAI,MAAM,GACR,OAAO;IAGT,IAAI,QAAQ,OAAO,IAAI,CAAC;IACxB,IAAI,QAAQ,OAAO,IAAI,CAAC;IACxB,IAAI,MAAM,MAAM,KAAK,MAAM,MAAM,EAC/B,OAAO;IAGT,KAAK,IAAI,OAAO,MAAO;QACrB,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,EACnB,OAAO;IAEX;IAEA,OAAO;AACT","sources":["packages/@react-aria/i18n/src/useDateFormatter.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 {DateFormatter} from '@internationalized/date';\nimport {useDeepMemo} from '@react-aria/utils';\nimport {useLocale} from './context';\nimport {useMemo} from 'react';\n\nexport interface DateFormatterOptions extends Intl.DateTimeFormatOptions {\n calendar?: string\n}\n\n/**\n * Provides localized date formatting for the current locale. Automatically updates when the locale changes,\n * and handles caching of the date formatter for performance.\n * @param options - Formatting options.\n */\nexport function useDateFormatter(options?: DateFormatterOptions): DateFormatter {\n // Reuse last options object if it is shallowly equal, which allows the useMemo result to also be reused.\n options = useDeepMemo(options ?? {}, isEqual);\n let {locale} = useLocale();\n return useMemo(() => new DateFormatter(locale, options), [locale, options]);\n}\n\nfunction isEqual(a: DateFormatterOptions, b: DateFormatterOptions) {\n if (a === b) {\n return true;\n }\n\n let aKeys = Object.keys(a);\n let bKeys = Object.keys(b);\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n\n for (let key of aKeys) {\n if (b[key] !== a[key]) {\n return false;\n }\n }\n\n return true;\n}\n"],"names":[],"version":3,"file":"useDateFormatter.module.js.map"}