@intlayer/react-intl 9.5.9 → 9.5.10

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.
@@ -26,7 +26,7 @@ import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
26
26
  * />
27
27
  * ```
28
28
  */
29
- const FormattedMessage = ({ id = "", description: _description, defaultMessage, values, tagName: TagName, children, ignoreTag: _ignoreTag }) => {
29
+ const FormattedMessage = (({ id = "", description: _description, defaultMessage, values, tagName: TagName, children, ignoreTag: _ignoreTag }) => {
30
30
  const intl = useIntl();
31
31
  const stringDefaultMessage = typeof defaultMessage === "string" ? defaultMessage : void 0;
32
32
  const result = intl.formatMessage({
@@ -37,7 +37,7 @@ const FormattedMessage = ({ id = "", description: _description, defaultMessage,
37
37
  if (typeof children === "function") return children(nodes) ?? null;
38
38
  if (TagName && TagName !== Fragment) return /* @__PURE__ */ jsx(TagName, { children: nodes });
39
39
  return /* @__PURE__ */ jsx(Fragment$1, { children: nodes });
40
- };
40
+ });
41
41
 
42
42
  //#endregion
43
43
  export { FormattedMessage };
@@ -1 +1 @@
1
- {"version":3,"file":"FormattedMessage.mjs","names":[],"sources":["../../src/FormattedMessage.tsx"],"sourcesContent":["'use client';\n\nimport { Fragment, type ReactElement, type ReactNode } from 'react';\nimport type { FormattedMessage as _FormattedMessage } from 'react-intl';\nimport { useIntl } from './useIntl';\n\n/**\n * Drop-in for react-intl's `<FormattedMessage>`.\n *\n * Translates the message identified by `id` using the active intl context.\n * Full ICU MessageFormat syntax is supported.\n *\n * When `values` contains render functions, rich text tags\n * (`<b>chunks</b>`) are mapped through them. When a `tagName` is provided,\n * the output is wrapped in that element; otherwise a fragment is used.\n * A `children` render-prop receives the resolved nodes.\n *\n * @example\n * ```tsx\n * <FormattedMessage id=\"home.title\" />\n * <FormattedMessage id=\"home.greeting\" values={{ name: 'Alice' }} />\n * <FormattedMessage\n * id=\"terms.agreement\"\n * values={{ b: (chunks) => <strong>{chunks}</strong> }}\n * />\n * ```\n */\nexport const FormattedMessage: typeof _FormattedMessage = ({\n id = '',\n description: _description,\n defaultMessage,\n values,\n tagName: TagName,\n children,\n ignoreTag: _ignoreTag,\n}) => {\n const intl = useIntl();\n const stringDefaultMessage =\n typeof defaultMessage === 'string' ? defaultMessage : undefined;\n const result = (\n intl.formatMessage as (\n descriptor: { id: string; defaultMessage?: string },\n values?: Record<string, unknown>\n ) => string | ReactNode[]\n )(\n { id, defaultMessage: stringDefaultMessage },\n values as Record<string, unknown>\n );\n const nodes: ReactNode[] = Array.isArray(result) ? result : [result];\n\n if (typeof children === 'function') {\n return (children(nodes) ?? null) as ReactElement | null;\n }\n\n if (TagName && TagName !== Fragment) {\n return <TagName>{nodes}</TagName>;\n }\n\n return <>{nodes}</>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAa,oBAA8C,EACzD,KAAK,IACL,aAAa,cACb,gBACA,QACA,SAAS,SACT,UACA,WAAW,iBACP;CACJ,MAAM,OAAO,QAAQ;CACrB,MAAM,uBACJ,OAAO,mBAAmB,WAAW,iBAAiB;CACxD,MAAM,SACJ,KAAK,cAKL;EAAE;EAAI,gBAAgB;CAAqB,GAC3C,MACF;CACA,MAAM,QAAqB,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM;CAEnE,IAAI,OAAO,aAAa,YACtB,OAAQ,SAAS,KAAK,KAAK;CAG7B,IAAI,WAAW,YAAY,UACzB,OAAO,oBAAC,SAAD,YAAU,MAAe;CAGlC,OAAO,4CAAG,MAAQ;AACpB"}
1
+ {"version":3,"file":"FormattedMessage.mjs","names":[],"sources":["../../src/FormattedMessage.tsx"],"sourcesContent":["'use client';\n\nimport {\n type ComponentProps,\n Fragment,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport type { FormattedMessage as _FormattedMessage } from 'react-intl';\nimport { useIntl } from './useIntl';\n\n/**\n * Drop-in for react-intl's `<FormattedMessage>`.\n *\n * Translates the message identified by `id` using the active intl context.\n * Full ICU MessageFormat syntax is supported.\n *\n * When `values` contains render functions, rich text tags\n * (`<b>chunks</b>`) are mapped through them. When a `tagName` is provided,\n * the output is wrapped in that element; otherwise a fragment is used.\n * A `children` render-prop receives the resolved nodes.\n *\n * @example\n * ```tsx\n * <FormattedMessage id=\"home.title\" />\n * <FormattedMessage id=\"home.greeting\" values={{ name: 'Alice' }} />\n * <FormattedMessage\n * id=\"terms.agreement\"\n * values={{ b: (chunks) => <strong>{chunks}</strong> }}\n * />\n * ```\n */\nexport const FormattedMessage: typeof _FormattedMessage = (({\n id = '',\n description: _description,\n defaultMessage,\n values,\n tagName: TagName,\n children,\n ignoreTag: _ignoreTag,\n}: ComponentProps<typeof _FormattedMessage>) => {\n const intl = useIntl();\n const stringDefaultMessage =\n typeof defaultMessage === 'string' ? defaultMessage : undefined;\n const result = (\n intl.formatMessage as (\n descriptor: { id: string; defaultMessage?: string },\n values?: Record<string, unknown>\n ) => string | ReactNode[]\n )(\n { id, defaultMessage: stringDefaultMessage },\n values as Record<string, unknown>\n );\n const nodes: ReactNode[] = Array.isArray(result) ? result : [result];\n\n if (typeof children === 'function') {\n return (children(nodes) ?? null) as ReactElement | null;\n }\n\n if (TagName && TagName !== Fragment) {\n return <TagName>{nodes}</TagName>;\n }\n\n return <>{nodes}</>;\n}) as unknown as typeof _FormattedMessage;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAa,qBAA+C,EAC1D,KAAK,IACL,aAAa,cACb,gBACA,QACA,SAAS,SACT,UACA,WAAW,iBACmC;CAC9C,MAAM,OAAO,QAAQ;CACrB,MAAM,uBACJ,OAAO,mBAAmB,WAAW,iBAAiB;CACxD,MAAM,SACJ,KAAK,cAKL;EAAE;EAAI,gBAAgB;CAAqB,GAC3C,MACF;CACA,MAAM,QAAqB,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM;CAEnE,IAAI,OAAO,aAAa,YACtB,OAAQ,SAAS,KAAK,KAAK;CAG7B,IAAI,WAAW,YAAY,UACzB,OAAO,oBAAC,SAAD,YAAU,MAAe;CAGlC,OAAO,4CAAG,MAAQ;AACpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"FormattedMessage.d.ts","names":[],"sources":["../../src/FormattedMessage.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;qBA2Ba,yBAAyB"}
1
+ {"version":3,"file":"FormattedMessage.d.ts","names":[],"sources":["../../src/FormattedMessage.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;qBAgCa,yBAAyB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/react-intl",
3
- "version": "9.5.9",
3
+ "version": "9.5.10",
4
4
  "private": false,
5
5
  "description": "react-intl API adapter for intlayer — drop-in compatibility layer",
6
6
  "keywords": [
@@ -75,13 +75,13 @@
75
75
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
76
76
  },
77
77
  "dependencies": {
78
- "@intlayer/config": "9.5.9",
79
- "@intlayer/core": "9.5.9",
80
- "@intlayer/dictionaries-entry": "9.5.9",
81
- "@intlayer/engine": "9.5.9",
82
- "@intlayer/types": "9.5.9",
83
- "react-intlayer": "9.5.9",
84
- "vite-intlayer": "9.5.9"
78
+ "@intlayer/config": "9.5.10",
79
+ "@intlayer/core": "9.5.10",
80
+ "@intlayer/dictionaries-entry": "9.5.10",
81
+ "@intlayer/engine": "9.5.10",
82
+ "@intlayer/types": "9.5.10",
83
+ "react-intlayer": "9.5.10",
84
+ "vite-intlayer": "9.5.10"
85
85
  },
86
86
  "devDependencies": {
87
87
  "@types/node": "^22",
@@ -93,8 +93,8 @@
93
93
  "rimraf": "6.1.3",
94
94
  "tsdown": "0.23.0",
95
95
  "typescript": "7.0.2",
96
- "vite": "8.3.0",
97
- "vitest": "5.0.1"
96
+ "vite": "8.3.1",
97
+ "vitest": "5.0.2"
98
98
  },
99
99
  "peerDependencies": {
100
100
  "react": ">=16.0.0",