@react-aria/i18n 3.12.10 → 3.12.12

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.
@@ -27,23 +27,41 @@ $parcel$export(module.exports, "useLocale", () => $47fa5ec5ff482271$export$43bb1
27
27
 
28
28
 
29
29
  const $47fa5ec5ff482271$var$I18nContext = /*#__PURE__*/ (0, ($parcel$interopDefault($e7RNT$react))).createContext(null);
30
- function $47fa5ec5ff482271$export$a54013f0d02a8f82(props) {
30
+ /**
31
+ * Internal component that handles the case when locale is provided.
32
+ */ function $47fa5ec5ff482271$var$I18nProviderWithLocale(props) {
31
33
  let { locale: locale, children: children } = props;
32
- let defaultLocale = (0, $2919bdec75484e64$exports.useDefaultLocale)();
33
- let value = (0, ($parcel$interopDefault($e7RNT$react))).useMemo(()=>{
34
- if (!locale) return defaultLocale;
35
- return {
34
+ let value = (0, ($parcel$interopDefault($e7RNT$react))).useMemo(()=>({
36
35
  locale: locale,
37
36
  direction: (0, $4d65847630a056a8$exports.isRTL)(locale) ? 'rtl' : 'ltr'
38
- };
39
- }, [
40
- defaultLocale,
37
+ }), [
41
38
  locale
42
39
  ]);
43
40
  return /*#__PURE__*/ (0, ($parcel$interopDefault($e7RNT$react))).createElement($47fa5ec5ff482271$var$I18nContext.Provider, {
44
41
  value: value
45
42
  }, children);
46
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
+ }
47
65
  function $47fa5ec5ff482271$export$43bb16f9c6d9e3f7() {
48
66
  let defaultLocale = (0, $2919bdec75484e64$exports.useDefaultLocale)();
49
67
  let context = (0, $e7RNT$react.useContext)($47fa5ec5ff482271$var$I18nContext);
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAaD,MAAM,kDAAc,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAgB;AAKhD,SAAS,0CAAa,KAAwB;IACnD,IAAI,UAAC,MAAM,YAAE,QAAQ,EAAC,GAAG;IACzB,IAAI,gBAAgB,CAAA,GAAA,0CAAe;IAEnC,IAAI,QAAgB,CAAA,GAAA,sCAAI,EAAE,OAAO,CAAC;QAChC,IAAI,CAAC,QACH,OAAO;QAGT,OAAO;oBACL;YACA,WAAW,CAAA,GAAA,+BAAI,EAAE,UAAU,QAAQ;QACrC;IACF,GAAG;QAAC;QAAe;KAAO;IAE1B,qBACE,0DAAC,kCAAY,QAAQ;QAAC,OAAO;OAC1B;AAGP;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\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 let defaultLocale = useDefaultLocale();\n\n let value: Locale = React.useMemo(() => {\n if (!locale) {\n return defaultLocale;\n }\n\n return {\n locale,\n direction: isRTL(locale) ? 'rtl' : 'ltr'\n };\n }, [defaultLocale, locale]);\n\n return (\n <I18nContext.Provider value={value}>\n {children}\n </I18nContext.Provider>\n );\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"}
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 CHANGED
@@ -16,23 +16,41 @@ import $h9FiU$react, {useContext as $h9FiU$useContext} from "react";
16
16
 
17
17
 
18
18
  const $18f2051aff69b9bf$var$I18nContext = /*#__PURE__*/ (0, $h9FiU$react).createContext(null);
19
- function $18f2051aff69b9bf$export$a54013f0d02a8f82(props) {
19
+ /**
20
+ * Internal component that handles the case when locale is provided.
21
+ */ function $18f2051aff69b9bf$var$I18nProviderWithLocale(props) {
20
22
  let { locale: locale, children: children } = props;
21
- let defaultLocale = (0, $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a)();
22
- let value = (0, $h9FiU$react).useMemo(()=>{
23
- if (!locale) return defaultLocale;
24
- return {
23
+ let value = (0, $h9FiU$react).useMemo(()=>({
25
24
  locale: locale,
26
25
  direction: (0, $148a7a147e38ea7f$export$702d680b21cbd764)(locale) ? 'rtl' : 'ltr'
27
- };
28
- }, [
29
- defaultLocale,
26
+ }), [
30
27
  locale
31
28
  ]);
32
29
  return /*#__PURE__*/ (0, $h9FiU$react).createElement($18f2051aff69b9bf$var$I18nContext.Provider, {
33
30
  value: value
34
31
  }, children);
35
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
+ }
36
54
  function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7() {
37
55
  let defaultLocale = (0, $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a)();
38
56
  let context = (0, $h9FiU$useContext)($18f2051aff69b9bf$var$I18nContext);
@@ -16,23 +16,41 @@ import $h9FiU$react, {useContext as $h9FiU$useContext} from "react";
16
16
 
17
17
 
18
18
  const $18f2051aff69b9bf$var$I18nContext = /*#__PURE__*/ (0, $h9FiU$react).createContext(null);
19
- function $18f2051aff69b9bf$export$a54013f0d02a8f82(props) {
19
+ /**
20
+ * Internal component that handles the case when locale is provided.
21
+ */ function $18f2051aff69b9bf$var$I18nProviderWithLocale(props) {
20
22
  let { locale: locale, children: children } = props;
21
- let defaultLocale = (0, $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a)();
22
- let value = (0, $h9FiU$react).useMemo(()=>{
23
- if (!locale) return defaultLocale;
24
- return {
23
+ let value = (0, $h9FiU$react).useMemo(()=>({
25
24
  locale: locale,
26
25
  direction: (0, $148a7a147e38ea7f$export$702d680b21cbd764)(locale) ? 'rtl' : 'ltr'
27
- };
28
- }, [
29
- defaultLocale,
26
+ }), [
30
27
  locale
31
28
  ]);
32
29
  return /*#__PURE__*/ (0, $h9FiU$react).createElement($18f2051aff69b9bf$var$I18nContext.Provider, {
33
30
  value: value
34
31
  }, children);
35
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
+ }
36
54
  function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7() {
37
55
  let defaultLocale = (0, $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a)();
38
56
  let context = (0, $h9FiU$useContext)($18f2051aff69b9bf$var$I18nContext);
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAaD,MAAM,kDAAc,CAAA,GAAA,YAAI,EAAE,aAAa,CAAgB;AAKhD,SAAS,0CAAa,KAAwB;IACnD,IAAI,UAAC,MAAM,YAAE,QAAQ,EAAC,GAAG;IACzB,IAAI,gBAAgB,CAAA,GAAA,yCAAe;IAEnC,IAAI,QAAgB,CAAA,GAAA,YAAI,EAAE,OAAO,CAAC;QAChC,IAAI,CAAC,QACH,OAAO;QAGT,OAAO;oBACL;YACA,WAAW,CAAA,GAAA,yCAAI,EAAE,UAAU,QAAQ;QACrC;IACF,GAAG;QAAC;QAAe;KAAO;IAE1B,qBACE,gCAAC,kCAAY,QAAQ;QAAC,OAAO;OAC1B;AAGP;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\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 let defaultLocale = useDefaultLocale();\n\n let value: Locale = React.useMemo(() => {\n if (!locale) {\n return defaultLocale;\n }\n\n return {\n locale,\n direction: isRTL(locale) ? 'rtl' : 'ltr'\n };\n }, [defaultLocale, locale]);\n\n return (\n <I18nContext.Provider value={value}>\n {children}\n </I18nContext.Provider>\n );\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"}
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/import.mjs CHANGED
@@ -6,6 +6,7 @@ import {useDateFormatter as $896ba0a80a8f4d36$export$85fd5fdf27bacc79} from "./u
6
6
  import {useNumberFormatter as $a916eb452884faea$export$b7a616150fdb9f44} from "./useNumberFormatter.mjs";
7
7
  import {useCollator as $325a3faab7a68acd$export$a16aca283550c30d} from "./useCollator.mjs";
8
8
  import {useFilter as $bb77f239b46e8c72$export$3274cf84b703fff} from "./useFilter.mjs";
9
+ import {isRTL as $148a7a147e38ea7f$export$702d680b21cbd764} from "./utils.mjs";
9
10
 
10
11
  /*
11
12
  * Copyright 2020 Adobe. All rights reserved.
@@ -27,5 +28,6 @@ import {useFilter as $bb77f239b46e8c72$export$3274cf84b703fff} from "./useFilter
27
28
 
28
29
 
29
30
 
30
- export {$18f2051aff69b9bf$export$a54013f0d02a8f82 as I18nProvider, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 as useLocale, $321bc95feeb923dd$export$ec23bf898b1eed85 as useMessageFormatter, $fca6afa0e843324b$export$f12b703ca79dfbb1 as useLocalizedStringFormatter, $fca6afa0e843324b$export$87b761675e8eaa10 as useLocalizedStringDictionary, $33bf17300c498528$export$a2f47a3d2973640 as useListFormatter, $896ba0a80a8f4d36$export$85fd5fdf27bacc79 as useDateFormatter, $a916eb452884faea$export$b7a616150fdb9f44 as useNumberFormatter, $325a3faab7a68acd$export$a16aca283550c30d as useCollator, $bb77f239b46e8c72$export$3274cf84b703fff as useFilter};
31
+
32
+ export {$18f2051aff69b9bf$export$a54013f0d02a8f82 as I18nProvider, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 as useLocale, $321bc95feeb923dd$export$ec23bf898b1eed85 as useMessageFormatter, $fca6afa0e843324b$export$f12b703ca79dfbb1 as useLocalizedStringFormatter, $fca6afa0e843324b$export$87b761675e8eaa10 as useLocalizedStringDictionary, $33bf17300c498528$export$a2f47a3d2973640 as useListFormatter, $896ba0a80a8f4d36$export$85fd5fdf27bacc79 as useDateFormatter, $a916eb452884faea$export$b7a616150fdb9f44 as useNumberFormatter, $325a3faab7a68acd$export$a16aca283550c30d as useCollator, $bb77f239b46e8c72$export$3274cf84b703fff as useFilter, $148a7a147e38ea7f$export$702d680b21cbd764 as isRTL};
31
33
  //# sourceMappingURL=module.js.map
package/dist/main.js CHANGED
@@ -6,6 +6,7 @@ var $b80c530ff2e20243$exports = require("./useDateFormatter.main.js");
6
6
  var $fea93c5b7c90d9f4$exports = require("./useNumberFormatter.main.js");
7
7
  var $27a5ce66022270ad$exports = require("./useCollator.main.js");
8
8
  var $832d079b867c7223$exports = require("./useFilter.main.js");
9
+ var $4d65847630a056a8$exports = require("./utils.main.js");
9
10
 
10
11
 
11
12
  function $parcel$export(e, n, v, s) {
@@ -22,6 +23,7 @@ $parcel$export(module.exports, "useDateFormatter", () => $b80c530ff2e20243$expor
22
23
  $parcel$export(module.exports, "useNumberFormatter", () => $fea93c5b7c90d9f4$exports.useNumberFormatter);
23
24
  $parcel$export(module.exports, "useCollator", () => $27a5ce66022270ad$exports.useCollator);
24
25
  $parcel$export(module.exports, "useFilter", () => $832d079b867c7223$exports.useFilter);
26
+ $parcel$export(module.exports, "isRTL", () => $4d65847630a056a8$exports.isRTL);
25
27
  /*
26
28
  * Copyright 2020 Adobe. All rights reserved.
27
29
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -42,4 +44,5 @@ $parcel$export(module.exports, "useFilter", () => $832d079b867c7223$exports.useF
42
44
 
43
45
 
44
46
 
47
+
45
48
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/i18n/src/index.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\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';\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":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/i18n/src/index.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\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":"main.js.map"}
package/dist/module.js CHANGED
@@ -6,6 +6,7 @@ import {useDateFormatter as $896ba0a80a8f4d36$export$85fd5fdf27bacc79} from "./u
6
6
  import {useNumberFormatter as $a916eb452884faea$export$b7a616150fdb9f44} from "./useNumberFormatter.module.js";
7
7
  import {useCollator as $325a3faab7a68acd$export$a16aca283550c30d} from "./useCollator.module.js";
8
8
  import {useFilter as $bb77f239b46e8c72$export$3274cf84b703fff} from "./useFilter.module.js";
9
+ import {isRTL as $148a7a147e38ea7f$export$702d680b21cbd764} from "./utils.module.js";
9
10
 
10
11
  /*
11
12
  * Copyright 2020 Adobe. All rights reserved.
@@ -27,5 +28,6 @@ import {useFilter as $bb77f239b46e8c72$export$3274cf84b703fff} from "./useFilter
27
28
 
28
29
 
29
30
 
30
- export {$18f2051aff69b9bf$export$a54013f0d02a8f82 as I18nProvider, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 as useLocale, $321bc95feeb923dd$export$ec23bf898b1eed85 as useMessageFormatter, $fca6afa0e843324b$export$f12b703ca79dfbb1 as useLocalizedStringFormatter, $fca6afa0e843324b$export$87b761675e8eaa10 as useLocalizedStringDictionary, $33bf17300c498528$export$a2f47a3d2973640 as useListFormatter, $896ba0a80a8f4d36$export$85fd5fdf27bacc79 as useDateFormatter, $a916eb452884faea$export$b7a616150fdb9f44 as useNumberFormatter, $325a3faab7a68acd$export$a16aca283550c30d as useCollator, $bb77f239b46e8c72$export$3274cf84b703fff as useFilter};
31
+
32
+ export {$18f2051aff69b9bf$export$a54013f0d02a8f82 as I18nProvider, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 as useLocale, $321bc95feeb923dd$export$ec23bf898b1eed85 as useMessageFormatter, $fca6afa0e843324b$export$f12b703ca79dfbb1 as useLocalizedStringFormatter, $fca6afa0e843324b$export$87b761675e8eaa10 as useLocalizedStringDictionary, $33bf17300c498528$export$a2f47a3d2973640 as useListFormatter, $896ba0a80a8f4d36$export$85fd5fdf27bacc79 as useDateFormatter, $a916eb452884faea$export$b7a616150fdb9f44 as useNumberFormatter, $325a3faab7a68acd$export$a16aca283550c30d as useCollator, $bb77f239b46e8c72$export$3274cf84b703fff as useFilter, $148a7a147e38ea7f$export$702d680b21cbd764 as isRTL};
31
33
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/i18n/src/index.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\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';\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":"module.js.map"}
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/i18n/src/index.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\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":"module.js.map"}
package/dist/types.d.ts CHANGED
@@ -4,6 +4,10 @@ import { LocalizedStrings } from "@internationalized/message";
4
4
  import { LocalizedString, LocalizedStringDictionary, LocalizedStringFormatter, LocalizedStrings as _LocalizedStrings1 } from "@internationalized/string";
5
5
  import { DateFormatter } from "@internationalized/date";
6
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;
7
11
  export interface Locale {
8
12
  /** The [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt) language code for the locale. */
9
13
  locale: string;
@@ -1 +1 @@
1
- {"mappings":";;;;;;ACiBA;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;AAID;;GAEG;AACH,6BAA6B,KAAK,EAAE,iBAAiB,GAAG,IAAI,OAAO,CAoBlE;AAED;;GAEG;AACH,6BAA6B,MAAM,CAIlC;ACzCD,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,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IACvD,4DAA4D;IAC5D,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IACrD,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAA;CACrD;AAED;;;GAGG;AACH,0BAA0B,OAAO,CAAC,EAAE,KAAK,eAAe,GAAG,MAAM,CAsDhE;AC5DD,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';\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
+ {"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,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IACvD,4DAA4D;IAC5D,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IACrD,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAA;CACrD;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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/i18n",
3
- "version": "3.12.10",
3
+ "version": "3.12.12",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -52,13 +52,13 @@
52
52
  "url": "https://github.com/adobe/react-spectrum"
53
53
  },
54
54
  "dependencies": {
55
- "@internationalized/date": "^3.8.2",
55
+ "@internationalized/date": "^3.9.0",
56
56
  "@internationalized/message": "^3.1.8",
57
- "@internationalized/number": "^3.6.3",
57
+ "@internationalized/number": "^3.6.5",
58
58
  "@internationalized/string": "^3.2.7",
59
- "@react-aria/ssr": "^3.9.9",
60
- "@react-aria/utils": "^3.29.1",
61
- "@react-types/shared": "^3.30.0",
59
+ "@react-aria/ssr": "^3.9.10",
60
+ "@react-aria/utils": "^3.30.1",
61
+ "@react-types/shared": "^3.32.0",
62
62
  "@swc/helpers": "^0.5.0"
63
63
  },
64
64
  "peerDependencies": {
@@ -68,5 +68,5 @@
68
68
  "publishConfig": {
69
69
  "access": "public"
70
70
  },
71
- "gitHead": "265b4d7f107905ee1c6e87a8af1613ab440a6849"
71
+ "gitHead": "2c58ed3ddd9be9100af9b1d0cfd137fcdc95ba2d"
72
72
  }
package/src/context.tsx CHANGED
@@ -23,31 +23,60 @@ export interface I18nProviderProps {
23
23
 
24
24
  const I18nContext = React.createContext<Locale | null>(null);
25
25
 
26
+ interface I18nProviderWithLocaleProps extends I18nProviderProps {
27
+ locale: string
28
+ }
29
+
26
30
  /**
27
- * Provides the locale for the application to all child components.
31
+ * Internal component that handles the case when locale is provided.
28
32
  */
29
- export function I18nProvider(props: I18nProviderProps): JSX.Element {
30
- let {locale, children} = props;
31
- let defaultLocale = useDefaultLocale();
33
+ function I18nProviderWithLocale(props: I18nProviderWithLocaleProps): JSX.Element {
34
+ let {locale, children} = props;
35
+ let value: Locale = React.useMemo(() => ({
36
+ locale,
37
+ direction: isRTL(locale) ? 'rtl' : 'ltr'
38
+ }), [locale]);
32
39
 
33
- let value: Locale = React.useMemo(() => {
34
- if (!locale) {
35
- return defaultLocale;
36
- }
40
+ return (
41
+ <I18nContext.Provider value={value}>
42
+ {children}
43
+ </I18nContext.Provider>
44
+ );
45
+ }
37
46
 
38
- return {
39
- locale,
40
- direction: isRTL(locale) ? 'rtl' : 'ltr'
41
- };
42
- }, [defaultLocale, locale]);
47
+ interface I18nProviderWithDefaultLocaleProps {
48
+ children: ReactNode
49
+ }
50
+
51
+ /**
52
+ * Internal component that handles the case when no locale is provided.
53
+ */
54
+ function I18nProviderWithDefaultLocale(props: I18nProviderWithDefaultLocaleProps): JSX.Element {
55
+ let {children} = props;
56
+ let defaultLocale = useDefaultLocale();
43
57
 
44
58
  return (
45
- <I18nContext.Provider value={value}>
59
+ <I18nContext.Provider value={defaultLocale}>
46
60
  {children}
47
61
  </I18nContext.Provider>
48
62
  );
49
63
  }
50
64
 
65
+ /**
66
+ * Provides the locale for the application to all child components.
67
+ */
68
+ export function I18nProvider(props: I18nProviderProps): JSX.Element {
69
+ let {locale, children} = props;
70
+
71
+ // Conditionally render different components to avoid calling useDefaultLocale.
72
+ // This is necessary because useDefaultLocale triggers a re-render.
73
+ if (locale) {
74
+ return <I18nProviderWithLocale locale={locale} children={children} />;
75
+ }
76
+
77
+ return <I18nProviderWithDefaultLocale children={children} />;
78
+ }
79
+
51
80
  /**
52
81
  * Returns the current locale and layout direction.
53
82
  */
package/src/index.ts CHANGED
@@ -18,6 +18,7 @@ export {useDateFormatter} from './useDateFormatter';
18
18
  export {useNumberFormatter} from './useNumberFormatter';
19
19
  export {useCollator} from './useCollator';
20
20
  export {useFilter} from './useFilter';
21
+ export {isRTL} from './utils';
21
22
 
22
23
  export type {FormatMessage} from './useMessageFormatter';
23
24
  export type {LocalizedStringFormatter} from '@internationalized/string';