@react-aria/i18n 3.11.0 → 3.12.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.
@@ -30,10 +30,16 @@ const $47fa5ec5ff482271$var$I18nContext = /*#__PURE__*/ (0, ($parcel$interopDefa
30
30
  function $47fa5ec5ff482271$export$a54013f0d02a8f82(props) {
31
31
  let { locale: locale, children: children } = props;
32
32
  let defaultLocale = (0, $2919bdec75484e64$exports.useDefaultLocale)();
33
- let value = locale ? {
34
- locale: locale,
35
- direction: (0, $4d65847630a056a8$exports.isRTL)(locale) ? "rtl" : "ltr"
36
- } : defaultLocale;
33
+ let value = (0, ($parcel$interopDefault($e7RNT$react))).useMemo(()=>{
34
+ if (!locale) return defaultLocale;
35
+ return {
36
+ locale: locale,
37
+ direction: (0, $4d65847630a056a8$exports.isRTL)(locale) ? 'rtl' : 'ltr'
38
+ };
39
+ }, [
40
+ defaultLocale,
41
+ locale
42
+ ]);
37
43
  return /*#__PURE__*/ (0, ($parcel$interopDefault($e7RNT$react))).createElement($47fa5ec5ff482271$var$I18nContext.Provider, {
38
44
  value: value
39
45
  }, children);
@@ -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,SAAS;gBAC3B;QACA,WAAW,CAAA,GAAA,+BAAI,EAAE,UAAU,QAAQ;IACrC,IAAI;IAEJ,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, {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) {\n let {locale, children} = props;\n let defaultLocale = useDefaultLocale();\n\n let value: Locale = locale ? {\n locale,\n direction: isRTL(locale) ? 'rtl' : 'ltr'\n } : defaultLocale;\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;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, {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) {\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"}
package/dist/context.mjs CHANGED
@@ -19,10 +19,16 @@ const $18f2051aff69b9bf$var$I18nContext = /*#__PURE__*/ (0, $h9FiU$react).create
19
19
  function $18f2051aff69b9bf$export$a54013f0d02a8f82(props) {
20
20
  let { locale: locale, children: children } = props;
21
21
  let defaultLocale = (0, $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a)();
22
- let value = locale ? {
23
- locale: locale,
24
- direction: (0, $148a7a147e38ea7f$export$702d680b21cbd764)(locale) ? "rtl" : "ltr"
25
- } : defaultLocale;
22
+ let value = (0, $h9FiU$react).useMemo(()=>{
23
+ if (!locale) return defaultLocale;
24
+ return {
25
+ locale: locale,
26
+ direction: (0, $148a7a147e38ea7f$export$702d680b21cbd764)(locale) ? 'rtl' : 'ltr'
27
+ };
28
+ }, [
29
+ defaultLocale,
30
+ locale
31
+ ]);
26
32
  return /*#__PURE__*/ (0, $h9FiU$react).createElement($18f2051aff69b9bf$var$I18nContext.Provider, {
27
33
  value: value
28
34
  }, children);
@@ -35,4 +41,4 @@ function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7() {
35
41
 
36
42
 
37
43
  export {$18f2051aff69b9bf$export$a54013f0d02a8f82 as I18nProvider, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 as useLocale};
38
- //# sourceMappingURL=context.mjs.map
44
+ //# sourceMappingURL=context.module.js.map
@@ -19,10 +19,16 @@ const $18f2051aff69b9bf$var$I18nContext = /*#__PURE__*/ (0, $h9FiU$react).create
19
19
  function $18f2051aff69b9bf$export$a54013f0d02a8f82(props) {
20
20
  let { locale: locale, children: children } = props;
21
21
  let defaultLocale = (0, $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a)();
22
- let value = locale ? {
23
- locale: locale,
24
- direction: (0, $148a7a147e38ea7f$export$702d680b21cbd764)(locale) ? "rtl" : "ltr"
25
- } : defaultLocale;
22
+ let value = (0, $h9FiU$react).useMemo(()=>{
23
+ if (!locale) return defaultLocale;
24
+ return {
25
+ locale: locale,
26
+ direction: (0, $148a7a147e38ea7f$export$702d680b21cbd764)(locale) ? 'rtl' : 'ltr'
27
+ };
28
+ }, [
29
+ defaultLocale,
30
+ locale
31
+ ]);
26
32
  return /*#__PURE__*/ (0, $h9FiU$react).createElement($18f2051aff69b9bf$var$I18nContext.Provider, {
27
33
  value: value
28
34
  }, children);
@@ -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,SAAS;gBAC3B;QACA,WAAW,CAAA,GAAA,yCAAI,EAAE,UAAU,QAAQ;IACrC,IAAI;IAEJ,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, {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) {\n let {locale, children} = props;\n let defaultLocale = useDefaultLocale();\n\n let value: Locale = locale ? {\n locale,\n direction: isRTL(locale) ? 'rtl' : 'ltr'\n } : defaultLocale;\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;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, {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) {\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 +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,qBAcpD;AAED;;GAEG;AACH,6BAA6B,MAAM,CAIlC;ACnCD,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,e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A4B,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":";;;;;;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,qBAoBpD;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"}
@@ -20,7 +20,7 @@ $parcel$export(module.exports, "useCollator", () => $27a5ce66022270ad$export$a16
20
20
  let $27a5ce66022270ad$var$cache = new Map();
21
21
  function $27a5ce66022270ad$export$a16aca283550c30d(options) {
22
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() : "");
23
+ let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1).join() : '');
24
24
  if ($27a5ce66022270ad$var$cache.has(cacheKey)) return $27a5ce66022270ad$var$cache.get(cacheKey);
25
25
  let formatter = new Intl.Collator(locale, options);
26
26
  $27a5ce66022270ad$var$cache.set(cacheKey, formatter);
@@ -14,7 +14,7 @@ import {useLocale as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7} from "./context.
14
14
  let $325a3faab7a68acd$var$cache = new Map();
15
15
  function $325a3faab7a68acd$export$a16aca283550c30d(options) {
16
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() : "");
17
+ let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1).join() : '');
18
18
  if ($325a3faab7a68acd$var$cache.has(cacheKey)) return $325a3faab7a68acd$var$cache.get(cacheKey);
19
19
  let formatter = new Intl.Collator(locale, options);
20
20
  $325a3faab7a68acd$var$cache.set(cacheKey, formatter);
@@ -23,4 +23,4 @@ function $325a3faab7a68acd$export$a16aca283550c30d(options) {
23
23
 
24
24
 
25
25
  export {$325a3faab7a68acd$export$a16aca283550c30d as useCollator};
26
- //# sourceMappingURL=useCollator.mjs.map
26
+ //# sourceMappingURL=useCollator.module.js.map
@@ -14,7 +14,7 @@ import {useLocale as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7} from "./context.
14
14
  let $325a3faab7a68acd$var$cache = new Map();
15
15
  function $325a3faab7a68acd$export$a16aca283550c30d(options) {
16
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() : "");
17
+ let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1).join() : '');
18
18
  if ($325a3faab7a68acd$var$cache.has(cacheKey)) return $325a3faab7a68acd$var$cache.get(cacheKey);
19
19
  let formatter = new Intl.Collator(locale, options);
20
20
  $325a3faab7a68acd$var$cache.set(cacheKey, formatter);
@@ -39,4 +39,4 @@ function $896ba0a80a8f4d36$var$isEqual(a, b) {
39
39
 
40
40
 
41
41
  export {$896ba0a80a8f4d36$export$85fd5fdf27bacc79 as useDateFormatter};
42
- //# sourceMappingURL=useDateFormatter.mjs.map
42
+ //# sourceMappingURL=useDateFormatter.module.js.map
@@ -22,20 +22,20 @@ $parcel$export(module.exports, "useDefaultLocale", () => $2919bdec75484e64$expor
22
22
 
23
23
 
24
24
  // Locale passed from server by PackageLocalizationProvider.
25
- const $2919bdec75484e64$var$localeSymbol = Symbol.for("react-aria.i18n.locale");
25
+ const $2919bdec75484e64$var$localeSymbol = Symbol.for('react-aria.i18n.locale');
26
26
  function $2919bdec75484e64$export$f09106e7c6677ec5() {
27
- let locale = typeof window !== "undefined" && window[$2919bdec75484e64$var$localeSymbol] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
27
+ let locale = typeof window !== 'undefined' && window[$2919bdec75484e64$var$localeSymbol] || typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage) || 'en-US';
28
28
  try {
29
29
  // @ts-ignore
30
30
  Intl.DateTimeFormat.supportedLocalesOf([
31
31
  locale
32
32
  ]);
33
33
  } catch (_err) {
34
- locale = "en-US";
34
+ locale = 'en-US';
35
35
  }
36
36
  return {
37
37
  locale: locale,
38
- direction: (0, $4d65847630a056a8$exports.isRTL)(locale) ? "rtl" : "ltr"
38
+ direction: (0, $4d65847630a056a8$exports.isRTL)(locale) ? 'rtl' : 'ltr'
39
39
  };
40
40
  }
41
41
  let $2919bdec75484e64$var$currentLocale = $2919bdec75484e64$export$f09106e7c6677ec5();
@@ -48,18 +48,18 @@ function $2919bdec75484e64$export$188ec29ebc2bdc3a() {
48
48
  let isSSR = (0, $5Ie0C$reactariassr.useIsSSR)();
49
49
  let [defaultLocale, setDefaultLocale] = (0, $5Ie0C$react.useState)($2919bdec75484e64$var$currentLocale);
50
50
  (0, $5Ie0C$react.useEffect)(()=>{
51
- if ($2919bdec75484e64$var$listeners.size === 0) window.addEventListener("languagechange", $2919bdec75484e64$var$updateLocale);
51
+ if ($2919bdec75484e64$var$listeners.size === 0) window.addEventListener('languagechange', $2919bdec75484e64$var$updateLocale);
52
52
  $2919bdec75484e64$var$listeners.add(setDefaultLocale);
53
53
  return ()=>{
54
54
  $2919bdec75484e64$var$listeners.delete(setDefaultLocale);
55
- if ($2919bdec75484e64$var$listeners.size === 0) window.removeEventListener("languagechange", $2919bdec75484e64$var$updateLocale);
55
+ if ($2919bdec75484e64$var$listeners.size === 0) window.removeEventListener('languagechange', $2919bdec75484e64$var$updateLocale);
56
56
  };
57
57
  }, []);
58
58
  // We cannot determine the browser's language on the server, so default to
59
59
  // en-US. This will be updated after hydration on the client to the correct value.
60
60
  if (isSSR) return {
61
- locale: "en-US",
62
- direction: "ltr"
61
+ locale: 'en-US',
62
+ direction: 'ltr'
63
63
  };
64
64
  return defaultLocale;
65
65
  }
@@ -16,20 +16,20 @@ import {useIsSSR as $ffhGL$useIsSSR} from "@react-aria/ssr";
16
16
 
17
17
 
18
18
  // Locale passed from server by PackageLocalizationProvider.
19
- const $1e5a04cdaf7d1af8$var$localeSymbol = Symbol.for("react-aria.i18n.locale");
19
+ const $1e5a04cdaf7d1af8$var$localeSymbol = Symbol.for('react-aria.i18n.locale');
20
20
  function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5() {
21
- let locale = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
21
+ let locale = typeof window !== 'undefined' && window[$1e5a04cdaf7d1af8$var$localeSymbol] || typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage) || 'en-US';
22
22
  try {
23
23
  // @ts-ignore
24
24
  Intl.DateTimeFormat.supportedLocalesOf([
25
25
  locale
26
26
  ]);
27
27
  } catch (_err) {
28
- locale = "en-US";
28
+ locale = 'en-US';
29
29
  }
30
30
  return {
31
31
  locale: locale,
32
- direction: (0, $148a7a147e38ea7f$export$702d680b21cbd764)(locale) ? "rtl" : "ltr"
32
+ direction: (0, $148a7a147e38ea7f$export$702d680b21cbd764)(locale) ? 'rtl' : 'ltr'
33
33
  };
34
34
  }
35
35
  let $1e5a04cdaf7d1af8$var$currentLocale = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5();
@@ -42,22 +42,22 @@ function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a() {
42
42
  let isSSR = (0, $ffhGL$useIsSSR)();
43
43
  let [defaultLocale, setDefaultLocale] = (0, $ffhGL$useState)($1e5a04cdaf7d1af8$var$currentLocale);
44
44
  (0, $ffhGL$useEffect)(()=>{
45
- if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale);
45
+ if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.addEventListener('languagechange', $1e5a04cdaf7d1af8$var$updateLocale);
46
46
  $1e5a04cdaf7d1af8$var$listeners.add(setDefaultLocale);
47
47
  return ()=>{
48
48
  $1e5a04cdaf7d1af8$var$listeners.delete(setDefaultLocale);
49
- if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale);
49
+ if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.removeEventListener('languagechange', $1e5a04cdaf7d1af8$var$updateLocale);
50
50
  };
51
51
  }, []);
52
52
  // We cannot determine the browser's language on the server, so default to
53
53
  // en-US. This will be updated after hydration on the client to the correct value.
54
54
  if (isSSR) return {
55
- locale: "en-US",
56
- direction: "ltr"
55
+ locale: 'en-US',
56
+ direction: 'ltr'
57
57
  };
58
58
  return defaultLocale;
59
59
  }
60
60
 
61
61
 
62
62
  export {$1e5a04cdaf7d1af8$export$f09106e7c6677ec5 as getDefaultLocale, $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a as useDefaultLocale};
63
- //# sourceMappingURL=useDefaultLocale.mjs.map
63
+ //# sourceMappingURL=useDefaultLocale.module.js.map
@@ -16,20 +16,20 @@ import {useIsSSR as $ffhGL$useIsSSR} from "@react-aria/ssr";
16
16
 
17
17
 
18
18
  // Locale passed from server by PackageLocalizationProvider.
19
- const $1e5a04cdaf7d1af8$var$localeSymbol = Symbol.for("react-aria.i18n.locale");
19
+ const $1e5a04cdaf7d1af8$var$localeSymbol = Symbol.for('react-aria.i18n.locale');
20
20
  function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5() {
21
- let locale = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
21
+ let locale = typeof window !== 'undefined' && window[$1e5a04cdaf7d1af8$var$localeSymbol] || typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage) || 'en-US';
22
22
  try {
23
23
  // @ts-ignore
24
24
  Intl.DateTimeFormat.supportedLocalesOf([
25
25
  locale
26
26
  ]);
27
27
  } catch (_err) {
28
- locale = "en-US";
28
+ locale = 'en-US';
29
29
  }
30
30
  return {
31
31
  locale: locale,
32
- direction: (0, $148a7a147e38ea7f$export$702d680b21cbd764)(locale) ? "rtl" : "ltr"
32
+ direction: (0, $148a7a147e38ea7f$export$702d680b21cbd764)(locale) ? 'rtl' : 'ltr'
33
33
  };
34
34
  }
35
35
  let $1e5a04cdaf7d1af8$var$currentLocale = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5();
@@ -42,18 +42,18 @@ function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a() {
42
42
  let isSSR = (0, $ffhGL$useIsSSR)();
43
43
  let [defaultLocale, setDefaultLocale] = (0, $ffhGL$useState)($1e5a04cdaf7d1af8$var$currentLocale);
44
44
  (0, $ffhGL$useEffect)(()=>{
45
- if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale);
45
+ if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.addEventListener('languagechange', $1e5a04cdaf7d1af8$var$updateLocale);
46
46
  $1e5a04cdaf7d1af8$var$listeners.add(setDefaultLocale);
47
47
  return ()=>{
48
48
  $1e5a04cdaf7d1af8$var$listeners.delete(setDefaultLocale);
49
- if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale);
49
+ if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.removeEventListener('languagechange', $1e5a04cdaf7d1af8$var$updateLocale);
50
50
  };
51
51
  }, []);
52
52
  // We cannot determine the browser's language on the server, so default to
53
53
  // en-US. This will be updated after hydration on the client to the correct value.
54
54
  if (isSSR) return {
55
- locale: "en-US",
56
- direction: "ltr"
55
+ locale: 'en-US',
56
+ direction: 'ltr'
57
57
  };
58
58
  return defaultLocale;
59
59
  }
@@ -21,7 +21,7 @@ $parcel$export(module.exports, "useFilter", () => $832d079b867c7223$export$3274c
21
21
 
22
22
  function $832d079b867c7223$export$3274cf84b703fff(options) {
23
23
  let collator = (0, $27a5ce66022270ad$exports.useCollator)({
24
- usage: "search",
24
+ usage: 'search',
25
25
  ...options
26
26
  });
27
27
  // TODO(later): these methods don't currently support the ignorePunctuation option.
@@ -29,24 +29,24 @@ function $832d079b867c7223$export$3274cf84b703fff(options) {
29
29
  if (substring.length === 0) return true;
30
30
  // Normalize both strings so we can slice safely
31
31
  // TODO: take into account the ignorePunctuation option as well...
32
- string = string.normalize("NFC");
33
- substring = substring.normalize("NFC");
32
+ string = string.normalize('NFC');
33
+ substring = substring.normalize('NFC');
34
34
  return collator.compare(string.slice(0, substring.length), substring) === 0;
35
35
  }, [
36
36
  collator
37
37
  ]);
38
38
  let endsWith = (0, $c0oFg$react.useCallback)((string, substring)=>{
39
39
  if (substring.length === 0) return true;
40
- string = string.normalize("NFC");
41
- substring = substring.normalize("NFC");
40
+ string = string.normalize('NFC');
41
+ substring = substring.normalize('NFC');
42
42
  return collator.compare(string.slice(-substring.length), substring) === 0;
43
43
  }, [
44
44
  collator
45
45
  ]);
46
46
  let contains = (0, $c0oFg$react.useCallback)((string, substring)=>{
47
47
  if (substring.length === 0) return true;
48
- string = string.normalize("NFC");
49
- substring = substring.normalize("NFC");
48
+ string = string.normalize('NFC');
49
+ substring = substring.normalize('NFC');
50
50
  let scan = 0;
51
51
  let sliceLen = substring.length;
52
52
  for(; scan + sliceLen <= string.length; scan++){
@@ -15,7 +15,7 @@ import {useCallback as $21ck9$useCallback, useMemo as $21ck9$useMemo} from "reac
15
15
 
16
16
  function $bb77f239b46e8c72$export$3274cf84b703fff(options) {
17
17
  let collator = (0, $325a3faab7a68acd$export$a16aca283550c30d)({
18
- usage: "search",
18
+ usage: 'search',
19
19
  ...options
20
20
  });
21
21
  // TODO(later): these methods don't currently support the ignorePunctuation option.
@@ -23,24 +23,24 @@ function $bb77f239b46e8c72$export$3274cf84b703fff(options) {
23
23
  if (substring.length === 0) return true;
24
24
  // Normalize both strings so we can slice safely
25
25
  // TODO: take into account the ignorePunctuation option as well...
26
- string = string.normalize("NFC");
27
- substring = substring.normalize("NFC");
26
+ string = string.normalize('NFC');
27
+ substring = substring.normalize('NFC');
28
28
  return collator.compare(string.slice(0, substring.length), substring) === 0;
29
29
  }, [
30
30
  collator
31
31
  ]);
32
32
  let endsWith = (0, $21ck9$useCallback)((string, substring)=>{
33
33
  if (substring.length === 0) return true;
34
- string = string.normalize("NFC");
35
- substring = substring.normalize("NFC");
34
+ string = string.normalize('NFC');
35
+ substring = substring.normalize('NFC');
36
36
  return collator.compare(string.slice(-substring.length), substring) === 0;
37
37
  }, [
38
38
  collator
39
39
  ]);
40
40
  let contains = (0, $21ck9$useCallback)((string, substring)=>{
41
41
  if (substring.length === 0) return true;
42
- string = string.normalize("NFC");
43
- substring = substring.normalize("NFC");
42
+ string = string.normalize('NFC');
43
+ substring = substring.normalize('NFC');
44
44
  let scan = 0;
45
45
  let sliceLen = substring.length;
46
46
  for(; scan + sliceLen <= string.length; scan++){
@@ -64,4 +64,4 @@ function $bb77f239b46e8c72$export$3274cf84b703fff(options) {
64
64
 
65
65
 
66
66
  export {$bb77f239b46e8c72$export$3274cf84b703fff as useFilter};
67
- //# sourceMappingURL=useFilter.mjs.map
67
+ //# sourceMappingURL=useFilter.module.js.map
@@ -15,7 +15,7 @@ import {useCallback as $21ck9$useCallback, useMemo as $21ck9$useMemo} from "reac
15
15
 
16
16
  function $bb77f239b46e8c72$export$3274cf84b703fff(options) {
17
17
  let collator = (0, $325a3faab7a68acd$export$a16aca283550c30d)({
18
- usage: "search",
18
+ usage: 'search',
19
19
  ...options
20
20
  });
21
21
  // TODO(later): these methods don't currently support the ignorePunctuation option.
@@ -23,24 +23,24 @@ function $bb77f239b46e8c72$export$3274cf84b703fff(options) {
23
23
  if (substring.length === 0) return true;
24
24
  // Normalize both strings so we can slice safely
25
25
  // TODO: take into account the ignorePunctuation option as well...
26
- string = string.normalize("NFC");
27
- substring = substring.normalize("NFC");
26
+ string = string.normalize('NFC');
27
+ substring = substring.normalize('NFC');
28
28
  return collator.compare(string.slice(0, substring.length), substring) === 0;
29
29
  }, [
30
30
  collator
31
31
  ]);
32
32
  let endsWith = (0, $21ck9$useCallback)((string, substring)=>{
33
33
  if (substring.length === 0) return true;
34
- string = string.normalize("NFC");
35
- substring = substring.normalize("NFC");
34
+ string = string.normalize('NFC');
35
+ substring = substring.normalize('NFC');
36
36
  return collator.compare(string.slice(-substring.length), substring) === 0;
37
37
  }, [
38
38
  collator
39
39
  ]);
40
40
  let contains = (0, $21ck9$useCallback)((string, substring)=>{
41
41
  if (substring.length === 0) return true;
42
- string = string.normalize("NFC");
43
- substring = substring.normalize("NFC");
42
+ string = string.normalize('NFC');
43
+ substring = substring.normalize('NFC');
44
44
  let scan = 0;
45
45
  let sliceLen = substring.length;
46
46
  for(; scan + sliceLen <= string.length; scan++){
@@ -23,4 +23,4 @@ function $33bf17300c498528$export$a2f47a3d2973640(options = {}) {
23
23
 
24
24
 
25
25
  export {$33bf17300c498528$export$a2f47a3d2973640 as useListFormatter};
26
- //# sourceMappingURL=useListFormatter.mjs.map
26
+ //# sourceMappingURL=useListFormatter.module.js.map
@@ -38,4 +38,4 @@ function $fca6afa0e843324b$export$f12b703ca79dfbb1(strings, packageName) {
38
38
 
39
39
 
40
40
  export {$fca6afa0e843324b$export$87b761675e8eaa10 as useLocalizedStringDictionary, $fca6afa0e843324b$export$f12b703ca79dfbb1 as useLocalizedStringFormatter};
41
- //# sourceMappingURL=useLocalizedStringFormatter.mjs.map
41
+ //# sourceMappingURL=useLocalizedStringFormatter.module.js.map
@@ -40,4 +40,4 @@ function $321bc95feeb923dd$export$ec23bf898b1eed85(strings) {
40
40
 
41
41
 
42
42
  export {$321bc95feeb923dd$export$ec23bf898b1eed85 as useMessageFormatter};
43
- //# sourceMappingURL=useMessageFormatter.mjs.map
43
+ //# sourceMappingURL=useMessageFormatter.module.js.map
@@ -25,4 +25,4 @@ function $a916eb452884faea$export$b7a616150fdb9f44(options = {}) {
25
25
 
26
26
 
27
27
  export {$a916eb452884faea$export$b7a616150fdb9f44 as useNumberFormatter};
28
- //# sourceMappingURL=useNumberFormatter.mjs.map
28
+ //# sourceMappingURL=useNumberFormatter.module.js.map
@@ -16,37 +16,37 @@ $parcel$export(module.exports, "isRTL", () => $4d65847630a056a8$export$702d680b2
16
16
  * governing permissions and limitations under the License.
17
17
  */ // https://en.wikipedia.org/wiki/Right-to-left
18
18
  const $4d65847630a056a8$var$RTL_SCRIPTS = new Set([
19
- "Arab",
20
- "Syrc",
21
- "Samr",
22
- "Mand",
23
- "Thaa",
24
- "Mend",
25
- "Nkoo",
26
- "Adlm",
27
- "Rohg",
28
- "Hebr"
19
+ 'Arab',
20
+ 'Syrc',
21
+ 'Samr',
22
+ 'Mand',
23
+ 'Thaa',
24
+ 'Mend',
25
+ 'Nkoo',
26
+ 'Adlm',
27
+ 'Rohg',
28
+ 'Hebr'
29
29
  ]);
30
30
  const $4d65847630a056a8$var$RTL_LANGS = new Set([
31
- "ae",
32
- "ar",
33
- "arc",
34
- "bcc",
35
- "bqi",
36
- "ckb",
37
- "dv",
38
- "fa",
39
- "glk",
40
- "he",
41
- "ku",
42
- "mzn",
43
- "nqo",
44
- "pnb",
45
- "ps",
46
- "sd",
47
- "ug",
48
- "ur",
49
- "yi"
31
+ 'ae',
32
+ 'ar',
33
+ 'arc',
34
+ 'bcc',
35
+ 'bqi',
36
+ 'ckb',
37
+ 'dv',
38
+ 'fa',
39
+ 'glk',
40
+ 'he',
41
+ 'ku',
42
+ 'mzn',
43
+ 'nqo',
44
+ 'pnb',
45
+ 'ps',
46
+ 'sd',
47
+ 'ug',
48
+ 'ur',
49
+ 'yi'
50
50
  ]);
51
51
  function $4d65847630a056a8$export$702d680b21cbd764(localeString) {
52
52
  // If the Intl.Locale API is available, use it to get the locale's text direction.
@@ -56,14 +56,14 @@ function $4d65847630a056a8$export$702d680b21cbd764(localeString) {
56
56
  // Use the text info object to get the direction if possible.
57
57
  // @ts-ignore - this was implemented as a property by some browsers before it was standardized as a function.
58
58
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo
59
- let textInfo = typeof locale.getTextInfo === "function" ? locale.getTextInfo() : locale.textInfo;
60
- if (textInfo) return textInfo.direction === "rtl";
59
+ let textInfo = typeof locale.getTextInfo === 'function' ? locale.getTextInfo() : locale.textInfo;
60
+ if (textInfo) return textInfo.direction === 'rtl';
61
61
  // Fallback: guess using the script.
62
62
  // This is more accurate than guessing by language, since languages can be written in multiple scripts.
63
63
  if (locale.script) return $4d65847630a056a8$var$RTL_SCRIPTS.has(locale.script);
64
64
  }
65
65
  // If not, just guess by the language (first part of the locale)
66
- let lang = localeString.split("-")[0];
66
+ let lang = localeString.split('-')[0];
67
67
  return $4d65847630a056a8$var$RTL_LANGS.has(lang);
68
68
  }
69
69
 
package/dist/utils.mjs CHANGED
@@ -10,37 +10,37 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */ // https://en.wikipedia.org/wiki/Right-to-left
12
12
  const $148a7a147e38ea7f$var$RTL_SCRIPTS = new Set([
13
- "Arab",
14
- "Syrc",
15
- "Samr",
16
- "Mand",
17
- "Thaa",
18
- "Mend",
19
- "Nkoo",
20
- "Adlm",
21
- "Rohg",
22
- "Hebr"
13
+ 'Arab',
14
+ 'Syrc',
15
+ 'Samr',
16
+ 'Mand',
17
+ 'Thaa',
18
+ 'Mend',
19
+ 'Nkoo',
20
+ 'Adlm',
21
+ 'Rohg',
22
+ 'Hebr'
23
23
  ]);
24
24
  const $148a7a147e38ea7f$var$RTL_LANGS = new Set([
25
- "ae",
26
- "ar",
27
- "arc",
28
- "bcc",
29
- "bqi",
30
- "ckb",
31
- "dv",
32
- "fa",
33
- "glk",
34
- "he",
35
- "ku",
36
- "mzn",
37
- "nqo",
38
- "pnb",
39
- "ps",
40
- "sd",
41
- "ug",
42
- "ur",
43
- "yi"
25
+ 'ae',
26
+ 'ar',
27
+ 'arc',
28
+ 'bcc',
29
+ 'bqi',
30
+ 'ckb',
31
+ 'dv',
32
+ 'fa',
33
+ 'glk',
34
+ 'he',
35
+ 'ku',
36
+ 'mzn',
37
+ 'nqo',
38
+ 'pnb',
39
+ 'ps',
40
+ 'sd',
41
+ 'ug',
42
+ 'ur',
43
+ 'yi'
44
44
  ]);
45
45
  function $148a7a147e38ea7f$export$702d680b21cbd764(localeString) {
46
46
  // If the Intl.Locale API is available, use it to get the locale's text direction.
@@ -50,17 +50,17 @@ function $148a7a147e38ea7f$export$702d680b21cbd764(localeString) {
50
50
  // Use the text info object to get the direction if possible.
51
51
  // @ts-ignore - this was implemented as a property by some browsers before it was standardized as a function.
52
52
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo
53
- let textInfo = typeof locale.getTextInfo === "function" ? locale.getTextInfo() : locale.textInfo;
54
- if (textInfo) return textInfo.direction === "rtl";
53
+ let textInfo = typeof locale.getTextInfo === 'function' ? locale.getTextInfo() : locale.textInfo;
54
+ if (textInfo) return textInfo.direction === 'rtl';
55
55
  // Fallback: guess using the script.
56
56
  // This is more accurate than guessing by language, since languages can be written in multiple scripts.
57
57
  if (locale.script) return $148a7a147e38ea7f$var$RTL_SCRIPTS.has(locale.script);
58
58
  }
59
59
  // If not, just guess by the language (first part of the locale)
60
- let lang = localeString.split("-")[0];
60
+ let lang = localeString.split('-')[0];
61
61
  return $148a7a147e38ea7f$var$RTL_LANGS.has(lang);
62
62
  }
63
63
 
64
64
 
65
65
  export {$148a7a147e38ea7f$export$702d680b21cbd764 as isRTL};
66
- //# sourceMappingURL=utils.mjs.map
66
+ //# sourceMappingURL=utils.module.js.map
@@ -10,37 +10,37 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */ // https://en.wikipedia.org/wiki/Right-to-left
12
12
  const $148a7a147e38ea7f$var$RTL_SCRIPTS = new Set([
13
- "Arab",
14
- "Syrc",
15
- "Samr",
16
- "Mand",
17
- "Thaa",
18
- "Mend",
19
- "Nkoo",
20
- "Adlm",
21
- "Rohg",
22
- "Hebr"
13
+ 'Arab',
14
+ 'Syrc',
15
+ 'Samr',
16
+ 'Mand',
17
+ 'Thaa',
18
+ 'Mend',
19
+ 'Nkoo',
20
+ 'Adlm',
21
+ 'Rohg',
22
+ 'Hebr'
23
23
  ]);
24
24
  const $148a7a147e38ea7f$var$RTL_LANGS = new Set([
25
- "ae",
26
- "ar",
27
- "arc",
28
- "bcc",
29
- "bqi",
30
- "ckb",
31
- "dv",
32
- "fa",
33
- "glk",
34
- "he",
35
- "ku",
36
- "mzn",
37
- "nqo",
38
- "pnb",
39
- "ps",
40
- "sd",
41
- "ug",
42
- "ur",
43
- "yi"
25
+ 'ae',
26
+ 'ar',
27
+ 'arc',
28
+ 'bcc',
29
+ 'bqi',
30
+ 'ckb',
31
+ 'dv',
32
+ 'fa',
33
+ 'glk',
34
+ 'he',
35
+ 'ku',
36
+ 'mzn',
37
+ 'nqo',
38
+ 'pnb',
39
+ 'ps',
40
+ 'sd',
41
+ 'ug',
42
+ 'ur',
43
+ 'yi'
44
44
  ]);
45
45
  function $148a7a147e38ea7f$export$702d680b21cbd764(localeString) {
46
46
  // If the Intl.Locale API is available, use it to get the locale's text direction.
@@ -50,14 +50,14 @@ function $148a7a147e38ea7f$export$702d680b21cbd764(localeString) {
50
50
  // Use the text info object to get the direction if possible.
51
51
  // @ts-ignore - this was implemented as a property by some browsers before it was standardized as a function.
52
52
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo
53
- let textInfo = typeof locale.getTextInfo === "function" ? locale.getTextInfo() : locale.textInfo;
54
- if (textInfo) return textInfo.direction === "rtl";
53
+ let textInfo = typeof locale.getTextInfo === 'function' ? locale.getTextInfo() : locale.textInfo;
54
+ if (textInfo) return textInfo.direction === 'rtl';
55
55
  // Fallback: guess using the script.
56
56
  // This is more accurate than guessing by language, since languages can be written in multiple scripts.
57
57
  if (locale.script) return $148a7a147e38ea7f$var$RTL_SCRIPTS.has(locale.script);
58
58
  }
59
59
  // If not, just guess by the language (first part of the locale)
60
- let lang = localeString.split("-")[0];
60
+ let lang = localeString.split('-')[0];
61
61
  return $148a7a147e38ea7f$var$RTL_LANGS.has(lang);
62
62
  }
63
63
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/i18n",
3
- "version": "3.11.0",
3
+ "version": "3.12.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -47,20 +47,20 @@
47
47
  "url": "https://github.com/adobe/react-spectrum"
48
48
  },
49
49
  "dependencies": {
50
- "@internationalized/date": "^3.5.3",
51
- "@internationalized/message": "^3.1.3",
52
- "@internationalized/number": "^3.5.2",
53
- "@internationalized/string": "^3.2.2",
54
- "@react-aria/ssr": "^3.9.3",
55
- "@react-aria/utils": "^3.24.0",
56
- "@react-types/shared": "^3.23.0",
50
+ "@internationalized/date": "^3.5.5",
51
+ "@internationalized/message": "^3.1.4",
52
+ "@internationalized/number": "^3.5.3",
53
+ "@internationalized/string": "^3.2.3",
54
+ "@react-aria/ssr": "^3.9.5",
55
+ "@react-aria/utils": "^3.25.0",
56
+ "@react-types/shared": "^3.24.0",
57
57
  "@swc/helpers": "^0.5.0"
58
58
  },
59
59
  "peerDependencies": {
60
- "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
60
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
61
61
  },
62
62
  "publishConfig": {
63
63
  "access": "public"
64
64
  },
65
- "gitHead": "f645f29edc1322153fd60af4640cbcab1d992dbd"
65
+ "gitHead": "86d80e3216bc32e75108831cf3a5a720bc849206"
66
66
  }
package/server/index.js CHANGED
@@ -23,12 +23,16 @@ $parcel$export(module.exports, "getPackageLocalizationScript", () => $417d44b697
23
23
  * governing permissions and limitations under the License.
24
24
  */
25
25
  function $417d44b6975b2ee7$export$9ec1fc026a5460ba(props) {
26
- if (typeof document !== "undefined") {
27
- console.log("PackageLocalizationProvider should only be rendered on the server.");
26
+ if (typeof document !== 'undefined') {
27
+ console.log('PackageLocalizationProvider should only be rendered on the server.');
28
28
  return null;
29
29
  }
30
- let { locale: locale, strings: strings } = props;
30
+ let { nonce: nonce, locale: locale, strings: strings } = props;
31
+ // suppressHydrationWarning is necessary because the browser
32
+ // remove the nonce parameter from the DOM before hydration
31
33
  return /*#__PURE__*/ (0, ($parcel$interopDefault($kg1kr$react))).createElement("script", {
34
+ nonce: typeof window === 'undefined' ? nonce : '',
35
+ suppressHydrationWarning: true,
32
36
  dangerouslySetInnerHTML: {
33
37
  __html: $417d44b6975b2ee7$export$fe9518edbbdc73da(locale, strings)
34
38
  }
@@ -46,29 +50,29 @@ function $417d44b6975b2ee7$var$serialize(strings) {
46
50
  let common = new Map();
47
51
  for(let pkg in strings)for(let key in strings[pkg]){
48
52
  let v = strings[pkg][key];
49
- let s = typeof v === "string" ? JSON.stringify(v) : v.toString();
53
+ let s = typeof v === 'string' ? JSON.stringify(v) : v.toString();
50
54
  if (seen.has(s) && !common.has(s)) {
51
55
  let name = String.fromCharCode(common.size > 25 ? common.size + 97 : common.size + 65);
52
56
  common.set(s, name);
53
57
  }
54
58
  seen.add(s);
55
59
  }
56
- let res = "";
57
- if (common.size > 0) res += "let ";
60
+ let res = '';
61
+ if (common.size > 0) res += 'let ';
58
62
  for (let [string, name] of common)res += `${name}=${string},`;
59
- if (common.size > 0) res = res.slice(0, -1) + ";";
63
+ if (common.size > 0) res = res.slice(0, -1) + ';';
60
64
  res += "window[Symbol.for('react-aria.i18n.strings')]={";
61
65
  for(let pkg in strings){
62
66
  res += `'${pkg}':{`;
63
67
  for(let key in strings[pkg]){
64
68
  let v = strings[pkg][key];
65
- let s = typeof v === "string" ? JSON.stringify(v) : v.toString();
69
+ let s = typeof v === 'string' ? JSON.stringify(v) : v.toString();
66
70
  if (common.has(s)) s = common.get(s);
67
71
  res += `${/[ ()]/.test(key) ? JSON.stringify(key) : key}:${s},`;
68
72
  }
69
- res = res.slice(0, -1) + "},";
73
+ res = res.slice(0, -1) + '},';
70
74
  }
71
- res = res.slice(0, -1) + "};";
75
+ res = res.slice(0, -1) + '};';
72
76
  $417d44b6975b2ee7$var$cache.set(strings, res);
73
77
  return res;
74
78
  }
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAkBM,SAAS,0CAA4B,KAAuC;IACjF,IAAI,OAAO,aAAa,aAAa;QACnC,QAAQ,GAAG,CAAC;QACZ,OAAO;IACT;IAEA,IAAI,UAAC,MAAM,WAAE,OAAO,EAAC,GAAG;IACxB,qBAAO,0DAAC;QAAO,yBAAyB;YAAC,QAAQ,0CAA6B,QAAQ;QAA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AAK,EAAE,QAAQ;YAC9D,IAAI,OAAO,GAAG,CAAC,IACb,IAAI,OAAO,GAAG,CAAC;YAEjB,OAAO,CAAC,EAAE,QAAQ,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,OAAO,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QACjE;QACA,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM;IAC3B;IACA,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM;IACzB,4BAAM,GAAG,CAAC,SAAS;IACnB,OAAO;AACT","sources":["packages/@react-aria/i18n/src/server.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 type {LocalizedString} from '@internationalized/string';\nimport React from 'react';\n\ntype PackageLocalizedStrings = {\n [packageName: string]: Record<string, LocalizedString>\n};\n\ninterface PackageLocalizationProviderProps {\n locale: string,\n strings: PackageLocalizedStrings\n}\n\n/**\n * A PackageLocalizationProvider can be rendered on the server to inject the localized strings\n * needed by the client into the initial HTML.\n */\nexport function PackageLocalizationProvider(props: PackageLocalizationProviderProps) {\n if (typeof document !== 'undefined') {\n console.log('PackageLocalizationProvider should only be rendered on the server.');\n return null;\n }\n\n let {locale, strings} = props;\n return <script dangerouslySetInnerHTML={{__html: getPackageLocalizationScript(locale, strings)}} />;\n}\n\n/**\n * Returns the content for an inline `<script>` tag to inject localized strings into initial HTML.\n */\nexport function getPackageLocalizationScript(locale: string, strings: PackageLocalizedStrings) {\n return `window[Symbol.for('react-aria.i18n.locale')]=${JSON.stringify(locale)};{${serialize(strings)}}`;\n}\n\nconst cache = new WeakMap<PackageLocalizedStrings, string>();\n\nfunction serialize(strings: PackageLocalizedStrings): string {\n let cached = cache.get(strings);\n if (cached) {\n return cached;\n }\n\n // Find common strings between packages and hoist them into variables.\n let seen = new Set();\n let common = new Map();\n for (let pkg in strings) {\n for (let key in strings[pkg]) {\n let v = strings[pkg][key];\n let s = typeof v === 'string' ? JSON.stringify(v) : v.toString();\n if (seen.has(s) && !common.has(s)) {\n let name = String.fromCharCode(common.size > 25 ? common.size + 97 : common.size + 65);\n common.set(s, name);\n }\n seen.add(s);\n }\n }\n\n let res = '';\n if (common.size > 0) {\n res += 'let ';\n }\n for (let [string, name] of common) {\n res += `${name}=${string},`;\n }\n if (common.size > 0) {\n res = res.slice(0, -1) + ';';\n }\n\n res += \"window[Symbol.for('react-aria.i18n.strings')]={\";\n for (let pkg in strings) {\n res += `'${pkg}':{`;\n for (let key in strings[pkg]) {\n let v = strings[pkg][key];\n let s = typeof v === 'string' ? JSON.stringify(v) : v.toString();\n if (common.has(s)) {\n s = common.get(s);\n }\n res += `${/[ ()]/.test(key) ? JSON.stringify(key) : key}:${s},`;\n }\n res = res.slice(0, -1) + '},';\n }\n res = res.slice(0, -1) + '};';\n cache.set(strings, res);\n return res;\n}\n"],"names":[],"version":3,"file":"index.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAmBM,SAAS,0CAA4B,KAAuC;IACjF,IAAI,OAAO,aAAa,aAAa;QACnC,QAAQ,GAAG,CAAC;QACZ,OAAO;IACT;IAEA,IAAI,SAAC,KAAK,UAAE,MAAM,WAAE,OAAO,EAAC,GAAG;IAC/B,4DAA4D;IAC5D,2DAA2D;IAC3D,qBAAO,0DAAC;QAAO,OAAO,OAAO,WAAW,cAAc,QAAQ;QAAI,0BAAA;QAAyB,yBAAyB;YAAC,QAAQ,0CAA6B,QAAQ;QAAQ;;AAC5K;AAKO,SAAS,0CAA6B,MAAc,EAAE,OAAgC;IAC3F,OAAO,CAAC,6CAA6C,E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AEjB,OAAO,CAAC,EAAE,QAAQ,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,OAAO,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QACjE;QACA,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM;IAC3B;IACA,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM;IACzB,4BAAM,GAAG,CAAC,SAAS;IACnB,OAAO;AACT","sources":["packages/@react-aria/i18n/src/server.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 type {LocalizedString} from '@internationalized/string';\nimport React from 'react';\n\ntype PackageLocalizedStrings = {\n [packageName: string]: Record<string, LocalizedString>\n};\n\ninterface PackageLocalizationProviderProps {\n locale: string,\n strings: PackageLocalizedStrings,\n nonce?: string\n}\n\n/**\n * A PackageLocalizationProvider can be rendered on the server to inject the localized strings\n * needed by the client into the initial HTML.\n */\nexport function PackageLocalizationProvider(props: PackageLocalizationProviderProps) {\n if (typeof document !== 'undefined') {\n console.log('PackageLocalizationProvider should only be rendered on the server.');\n return null;\n }\n\n let {nonce, locale, strings} = props;\n // suppressHydrationWarning is necessary because the browser\n // remove the nonce parameter from the DOM before hydration\n return <script nonce={typeof window === 'undefined' ? nonce : ''} suppressHydrationWarning dangerouslySetInnerHTML={{__html: getPackageLocalizationScript(locale, strings)}} />;\n}\n\n/**\n * Returns the content for an inline `<script>` tag to inject localized strings into initial HTML.\n */\nexport function getPackageLocalizationScript(locale: string, strings: PackageLocalizedStrings) {\n return `window[Symbol.for('react-aria.i18n.locale')]=${JSON.stringify(locale)};{${serialize(strings)}}`;\n}\n\nconst cache = new WeakMap<PackageLocalizedStrings, string>();\n\nfunction serialize(strings: PackageLocalizedStrings): string {\n let cached = cache.get(strings);\n if (cached) {\n return cached;\n }\n\n // Find common strings between packages and hoist them into variables.\n let seen = new Set();\n let common = new Map();\n for (let pkg in strings) {\n for (let key in strings[pkg]) {\n let v = strings[pkg][key];\n let s = typeof v === 'string' ? JSON.stringify(v) : v.toString();\n if (seen.has(s) && !common.has(s)) {\n let name = String.fromCharCode(common.size > 25 ? common.size + 97 : common.size + 65);\n common.set(s, name);\n }\n seen.add(s);\n }\n }\n\n let res = '';\n if (common.size > 0) {\n res += 'let ';\n }\n for (let [string, name] of common) {\n res += `${name}=${string},`;\n }\n if (common.size > 0) {\n res = res.slice(0, -1) + ';';\n }\n\n res += \"window[Symbol.for('react-aria.i18n.strings')]={\";\n for (let pkg in strings) {\n res += `'${pkg}':{`;\n for (let key in strings[pkg]) {\n let v = strings[pkg][key];\n let s = typeof v === 'string' ? JSON.stringify(v) : v.toString();\n if (common.has(s)) {\n s = common.get(s);\n }\n res += `${/[ ()]/.test(key) ? JSON.stringify(key) : key}:${s},`;\n }\n res = res.slice(0, -1) + '},';\n }\n res = res.slice(0, -1) + '};';\n cache.set(strings, res);\n return res;\n}\n"],"names":[],"version":3,"file":"index.js.map"}
package/server/index.mjs CHANGED
@@ -12,12 +12,16 @@ import $7cMCw$react from "react";
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
  function $f4fda66de26cefb3$export$9ec1fc026a5460ba(props) {
15
- if (typeof document !== "undefined") {
16
- console.log("PackageLocalizationProvider should only be rendered on the server.");
15
+ if (typeof document !== 'undefined') {
16
+ console.log('PackageLocalizationProvider should only be rendered on the server.');
17
17
  return null;
18
18
  }
19
- let { locale: locale, strings: strings } = props;
19
+ let { nonce: nonce, locale: locale, strings: strings } = props;
20
+ // suppressHydrationWarning is necessary because the browser
21
+ // remove the nonce parameter from the DOM before hydration
20
22
  return /*#__PURE__*/ (0, $7cMCw$react).createElement("script", {
23
+ nonce: typeof window === 'undefined' ? nonce : '',
24
+ suppressHydrationWarning: true,
21
25
  dangerouslySetInnerHTML: {
22
26
  __html: $f4fda66de26cefb3$export$fe9518edbbdc73da(locale, strings)
23
27
  }
@@ -35,29 +39,29 @@ function $f4fda66de26cefb3$var$serialize(strings) {
35
39
  let common = new Map();
36
40
  for(let pkg in strings)for(let key in strings[pkg]){
37
41
  let v = strings[pkg][key];
38
- let s = typeof v === "string" ? JSON.stringify(v) : v.toString();
42
+ let s = typeof v === 'string' ? JSON.stringify(v) : v.toString();
39
43
  if (seen.has(s) && !common.has(s)) {
40
44
  let name = String.fromCharCode(common.size > 25 ? common.size + 97 : common.size + 65);
41
45
  common.set(s, name);
42
46
  }
43
47
  seen.add(s);
44
48
  }
45
- let res = "";
46
- if (common.size > 0) res += "let ";
49
+ let res = '';
50
+ if (common.size > 0) res += 'let ';
47
51
  for (let [string, name] of common)res += `${name}=${string},`;
48
- if (common.size > 0) res = res.slice(0, -1) + ";";
52
+ if (common.size > 0) res = res.slice(0, -1) + ';';
49
53
  res += "window[Symbol.for('react-aria.i18n.strings')]={";
50
54
  for(let pkg in strings){
51
55
  res += `'${pkg}':{`;
52
56
  for(let key in strings[pkg]){
53
57
  let v = strings[pkg][key];
54
- let s = typeof v === "string" ? JSON.stringify(v) : v.toString();
58
+ let s = typeof v === 'string' ? JSON.stringify(v) : v.toString();
55
59
  if (common.has(s)) s = common.get(s);
56
60
  res += `${/[ ()]/.test(key) ? JSON.stringify(key) : key}:${s},`;
57
61
  }
58
- res = res.slice(0, -1) + "},";
62
+ res = res.slice(0, -1) + '},';
59
63
  }
60
- res = res.slice(0, -1) + "};";
64
+ res = res.slice(0, -1) + '};';
61
65
  $f4fda66de26cefb3$var$cache.set(strings, res);
62
66
  return res;
63
67
  }
@@ -1 +1 @@
1
- {"mappings":";;AAAA;;;;;;;;;;CAUC;AAkBM,SAAS,0CAA4B,KAAuC;IACjF,IAAI,OAAO,aAAa,a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AG,CAAC;QACnB,IAAK,IAAI,OAAO,OAAO,CAAC,IAAI,CAAE;YAC5B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI;YACzB,IAAI,IAAI,OAAO,MAAM,WAAW,KAAK,SAAS,CAAC,KAAK,EAAE,QAAQ;YAC9D,IAAI,OAAO,GAAG,CAAC,IACb,IAAI,OAAO,GAAG,CAAC;YAEjB,OAAO,CAAC,EAAE,QAAQ,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,OAAO,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QACjE;QACA,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM;IAC3B;IACA,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM;IACzB,4BAAM,GAAG,CAAC,SAAS;IACnB,OAAO;AACT","sources":["packages/@react-aria/i18n/src/server.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 type {LocalizedString} from '@internationalized/string';\nimport React from 'react';\n\ntype PackageLocalizedStrings = {\n [packageName: string]: Record<string, LocalizedString>\n};\n\ninterface PackageLocalizationProviderProps {\n locale: string,\n strings: PackageLocalizedStrings\n}\n\n/**\n * A PackageLocalizationProvider can be rendered on the server to inject the localized strings\n * needed by the client into the initial HTML.\n */\nexport function PackageLocalizationProvider(props: PackageLocalizationProviderProps) {\n if (typeof document !== 'undefined') {\n console.log('PackageLocalizationProvider should only be rendered on the server.');\n return null;\n }\n\n let {locale, strings} = props;\n return <script dangerouslySetInnerHTML={{__html: getPackageLocalizationScript(locale, strings)}} />;\n}\n\n/**\n * Returns the content for an inline `<script>` tag to inject localized strings into initial HTML.\n */\nexport function getPackageLocalizationScript(locale: string, strings: PackageLocalizedStrings) {\n return `window[Symbol.for('react-aria.i18n.locale')]=${JSON.stringify(locale)};{${serialize(strings)}}`;\n}\n\nconst cache = new WeakMap<PackageLocalizedStrings, string>();\n\nfunction serialize(strings: PackageLocalizedStrings): string {\n let cached = cache.get(strings);\n if (cached) {\n return cached;\n }\n\n // Find common strings between packages and hoist them into variables.\n let seen = new Set();\n let common = new Map();\n for (let pkg in strings) {\n for (let key in strings[pkg]) {\n let v = strings[pkg][key];\n let s = typeof v === 'string' ? JSON.stringify(v) : v.toString();\n if (seen.has(s) && !common.has(s)) {\n let name = String.fromCharCode(common.size > 25 ? common.size + 97 : common.size + 65);\n common.set(s, name);\n }\n seen.add(s);\n }\n }\n\n let res = '';\n if (common.size > 0) {\n res += 'let ';\n }\n for (let [string, name] of common) {\n res += `${name}=${string},`;\n }\n if (common.size > 0) {\n res = res.slice(0, -1) + ';';\n }\n\n res += \"window[Symbol.for('react-aria.i18n.strings')]={\";\n for (let pkg in strings) {\n res += `'${pkg}':{`;\n for (let key in strings[pkg]) {\n let v = strings[pkg][key];\n let s = typeof v === 'string' ? JSON.stringify(v) : v.toString();\n if (common.has(s)) {\n s = common.get(s);\n }\n res += `${/[ ()]/.test(key) ? JSON.stringify(key) : key}:${s},`;\n }\n res = res.slice(0, -1) + '},';\n }\n res = res.slice(0, -1) + '};';\n cache.set(strings, res);\n return res;\n}\n"],"names":[],"version":3,"file":"index.mjs.map"}
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;AAmBM,SAAS,0CAA4B,KAAuC;IACjF,IAAI,OAAO,aAAa,aAAa;QACnC,QAAQ,GAAG,CAAC;QACZ,OAAO;IACT;IAEA,IAAI,SAAC,KAAK,UAAE,MAAM,WAAE,OAAO,EAAC,GAAG;IAC/B,4DAA4D;IAC5D,2DAA2D;IAC3D,qBAAO,gCAAC;QAAO,OAAO,OAAO,WAAW,cAA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AAI,CAAC,IAAI;YACzB,IAAI,IAAI,OAAO,MAAM,WAAW,KAAK,SAAS,CAAC,KAAK,EAAE,QAAQ;YAC9D,IAAI,OAAO,GAAG,CAAC,IACb,IAAI,OAAO,GAAG,CAAC;YAEjB,OAAO,CAAC,EAAE,QAAQ,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,OAAO,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QACjE;QACA,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM;IAC3B;IACA,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM;IACzB,4BAAM,GAAG,CAAC,SAAS;IACnB,OAAO;AACT","sources":["packages/@react-aria/i18n/src/server.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 type {LocalizedString} from '@internationalized/string';\nimport React from 'react';\n\ntype PackageLocalizedStrings = {\n [packageName: string]: Record<string, LocalizedString>\n};\n\ninterface PackageLocalizationProviderProps {\n locale: string,\n strings: PackageLocalizedStrings,\n nonce?: string\n}\n\n/**\n * A PackageLocalizationProvider can be rendered on the server to inject the localized strings\n * needed by the client into the initial HTML.\n */\nexport function PackageLocalizationProvider(props: PackageLocalizationProviderProps) {\n if (typeof document !== 'undefined') {\n console.log('PackageLocalizationProvider should only be rendered on the server.');\n return null;\n }\n\n let {nonce, locale, strings} = props;\n // suppressHydrationWarning is necessary because the browser\n // remove the nonce parameter from the DOM before hydration\n return <script nonce={typeof window === 'undefined' ? nonce : ''} suppressHydrationWarning dangerouslySetInnerHTML={{__html: getPackageLocalizationScript(locale, strings)}} />;\n}\n\n/**\n * Returns the content for an inline `<script>` tag to inject localized strings into initial HTML.\n */\nexport function getPackageLocalizationScript(locale: string, strings: PackageLocalizedStrings) {\n return `window[Symbol.for('react-aria.i18n.locale')]=${JSON.stringify(locale)};{${serialize(strings)}}`;\n}\n\nconst cache = new WeakMap<PackageLocalizedStrings, string>();\n\nfunction serialize(strings: PackageLocalizedStrings): string {\n let cached = cache.get(strings);\n if (cached) {\n return cached;\n }\n\n // Find common strings between packages and hoist them into variables.\n let seen = new Set();\n let common = new Map();\n for (let pkg in strings) {\n for (let key in strings[pkg]) {\n let v = strings[pkg][key];\n let s = typeof v === 'string' ? JSON.stringify(v) : v.toString();\n if (seen.has(s) && !common.has(s)) {\n let name = String.fromCharCode(common.size > 25 ? common.size + 97 : common.size + 65);\n common.set(s, name);\n }\n seen.add(s);\n }\n }\n\n let res = '';\n if (common.size > 0) {\n res += 'let ';\n }\n for (let [string, name] of common) {\n res += `${name}=${string},`;\n }\n if (common.size > 0) {\n res = res.slice(0, -1) + ';';\n }\n\n res += \"window[Symbol.for('react-aria.i18n.strings')]={\";\n for (let pkg in strings) {\n res += `'${pkg}':{`;\n for (let key in strings[pkg]) {\n let v = strings[pkg][key];\n let s = typeof v === 'string' ? JSON.stringify(v) : v.toString();\n if (common.has(s)) {\n s = common.get(s);\n }\n res += `${/[ ()]/.test(key) ? JSON.stringify(key) : key}:${s},`;\n }\n res = res.slice(0, -1) + '},';\n }\n res = res.slice(0, -1) + '};';\n cache.set(strings, res);\n return res;\n}\n"],"names":[],"version":3,"file":"index.mjs.map"}
package/src/context.tsx CHANGED
@@ -30,10 +30,16 @@ export function I18nProvider(props: I18nProviderProps) {
30
30
  let {locale, children} = props;
31
31
  let defaultLocale = useDefaultLocale();
32
32
 
33
- let value: Locale = locale ? {
34
- locale,
35
- direction: isRTL(locale) ? 'rtl' : 'ltr'
36
- } : defaultLocale;
33
+ let value: Locale = React.useMemo(() => {
34
+ if (!locale) {
35
+ return defaultLocale;
36
+ }
37
+
38
+ return {
39
+ locale,
40
+ direction: isRTL(locale) ? 'rtl' : 'ltr'
41
+ };
42
+ }, [defaultLocale, locale]);
37
43
 
38
44
  return (
39
45
  <I18nContext.Provider value={value}>
package/src/server.tsx CHANGED
@@ -19,7 +19,8 @@ type PackageLocalizedStrings = {
19
19
 
20
20
  interface PackageLocalizationProviderProps {
21
21
  locale: string,
22
- strings: PackageLocalizedStrings
22
+ strings: PackageLocalizedStrings,
23
+ nonce?: string
23
24
  }
24
25
 
25
26
  /**
@@ -32,8 +33,10 @@ export function PackageLocalizationProvider(props: PackageLocalizationProviderPr
32
33
  return null;
33
34
  }
34
35
 
35
- let {locale, strings} = props;
36
- return <script dangerouslySetInnerHTML={{__html: getPackageLocalizationScript(locale, strings)}} />;
36
+ let {nonce, locale, strings} = props;
37
+ // suppressHydrationWarning is necessary because the browser
38
+ // remove the nonce parameter from the DOM before hydration
39
+ return <script nonce={typeof window === 'undefined' ? nonce : ''} suppressHydrationWarning dangerouslySetInnerHTML={{__html: getPackageLocalizationScript(locale, strings)}} />;
37
40
  }
38
41
 
39
42
  /**