@applica-software-guru/react-admin 1.5.358 → 1.5.359

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.
package/package.json CHANGED
@@ -108,5 +108,5 @@
108
108
  "type": "module",
109
109
  "types": "dist/index.d.ts",
110
110
  "typings": "dist/index.d.ts",
111
- "version": "1.5.358"
111
+ "version": "1.5.359"
112
112
  }
@@ -2,7 +2,7 @@ import { useAppConfig } from '@/components/AppStateProvider';
2
2
  import { useTheme } from '@emotion/react';
3
3
  import { FormHelperText, InputLabel, Stack, SxProps } from '@mui/material';
4
4
  import React, { PropsWithChildren } from 'react';
5
- import { FieldTitle } from 'react-admin';
5
+ import { FieldTitle, useTranslate } from 'react-admin';
6
6
  import { useFormContext } from 'react-hook-form';
7
7
 
8
8
  /**
@@ -20,6 +20,7 @@ function LabeledArrayInput({
20
20
  ...props
21
21
  }: LabeledArrayInputProps): React.ReactElement {
22
22
  const theme = useTheme() as any;
23
+ const translate = useTranslate();
23
24
  const { getCurrentDialog } = useAppConfig();
24
25
  const { source, resource, isRequired } = props;
25
26
  const { getFieldState, formState } = useFormContext();
@@ -73,7 +74,11 @@ function LabeledArrayInput({
73
74
  }}
74
75
  error={!!error}
75
76
  >
76
- {helperText}
77
+ {React.isValidElement(helperText)
78
+ ? helperText
79
+ : typeof helperText === 'string'
80
+ ? translate(helperText, { _: helperText })
81
+ : helperText}
77
82
  </FormHelperText>
78
83
  ) : null}
79
84
  </Stack>
@@ -2,7 +2,7 @@ import { useAppConfig } from '@/components/AppStateProvider';
2
2
  import { FormHelperText, InputLabel, Stack } from '@mui/material';
3
3
  import { useTheme } from '@mui/material/styles';
4
4
  import React, { PropsWithChildren, ReactElement } from 'react';
5
- import { CommonInputProps, FieldTitle, useInput } from 'react-admin';
5
+ import { CommonInputProps, FieldTitle, useInput, useTranslate } from 'react-admin';
6
6
 
7
7
  function LabeledInput({
8
8
  label,
@@ -15,6 +15,7 @@ function LabeledInput({
15
15
  ...props
16
16
  }: LabeledInputProps): JSX.Element {
17
17
  const theme = useTheme();
18
+ const translate = useTranslate();
18
19
  const { getCurrentDialog } = useAppConfig();
19
20
  const { source, resource, isRequired, chip } = props;
20
21
  const {
@@ -73,7 +74,11 @@ function LabeledInput({
73
74
  }}
74
75
  error={invalid === true}
75
76
  >
76
- {helperText}
77
+ {React.isValidElement(helperText)
78
+ ? helperText
79
+ : typeof helperText === 'string'
80
+ ? translate(helperText, { _: helperText })
81
+ : helperText}
77
82
  </FormHelperText>
78
83
  ) : null}
79
84
  </Stack>