@sonardigital/carbon-ui 1.1.57 → 1.1.61
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
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { Stack } from '@mui/material';
|
|
1
2
|
import { Controller } from 'react-hook-form';
|
|
2
3
|
import { FormLabel } from '../layout';
|
|
4
|
+
import { FormError } from '../layout/FormError';
|
|
3
5
|
import { DatePicker, DatePickerProps } from '../../inputs/DatePicker';
|
|
4
6
|
|
|
5
7
|
interface FormDatePickerProps extends Omit<DatePickerProps, 'value' | 'onChange'> {
|
|
@@ -11,9 +13,12 @@ export function FormDatePicker({ name, label, ...props }: FormDatePickerProps):
|
|
|
11
13
|
return (
|
|
12
14
|
<Controller
|
|
13
15
|
name={name}
|
|
14
|
-
render={({ field }) => (
|
|
16
|
+
render={({ field, fieldState }) => (
|
|
15
17
|
<FormLabel label={label}>
|
|
16
|
-
<
|
|
18
|
+
<Stack gap={0.8}>
|
|
19
|
+
<DatePicker {...field} {...props} />
|
|
20
|
+
{fieldState.error && <FormError label={fieldState.error?.message ?? ''} />}
|
|
21
|
+
</Stack>
|
|
17
22
|
</FormLabel>
|
|
18
23
|
)}
|
|
19
24
|
/>
|
|
@@ -194,6 +194,22 @@ export const components: Components<Omit<Theme, 'components' | 'palette'> & CssV
|
|
|
194
194
|
},
|
|
195
195
|
}),
|
|
196
196
|
},
|
|
197
|
+
{
|
|
198
|
+
props: {
|
|
199
|
+
variant: 'contained',
|
|
200
|
+
color: 'secondary',
|
|
201
|
+
},
|
|
202
|
+
style: ({ theme }) => ({
|
|
203
|
+
...defaultButtonStyle,
|
|
204
|
+
backgroundColor: theme.palette.secondary.light,
|
|
205
|
+
color: theme.palette.secondary.main,
|
|
206
|
+
'&:hover': {
|
|
207
|
+
boxShadow: 0,
|
|
208
|
+
backgroundColor: theme.palette.secondary.main,
|
|
209
|
+
color: 'white',
|
|
210
|
+
},
|
|
211
|
+
}),
|
|
212
|
+
},
|
|
197
213
|
{
|
|
198
214
|
props: {
|
|
199
215
|
variant: 'contained',
|