@zydon/common 2.7.54 → 2.7.55
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.
|
@@ -6,6 +6,6 @@ import 'dayjs';
|
|
|
6
6
|
import '../../../types/baseField.js';
|
|
7
7
|
import 'react-hook-form';
|
|
8
8
|
|
|
9
|
-
declare const DatePicker: ({ name, rules, tabIndex, helperText, required, ...other }: DatePickerProps) => react_jsx_runtime.JSX.Element;
|
|
9
|
+
declare const DatePicker: ({ name, id, rules, tabIndex, helperText, required, ...other }: DatePickerProps) => react_jsx_runtime.JSX.Element;
|
|
10
10
|
|
|
11
11
|
export { DatePicker as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useFormContext, Controller } from 'react-hook-form';
|
|
2
2
|
import { DatePicker } from '@mui/x-date-pickers-pro';
|
|
3
|
-
import
|
|
3
|
+
import C from 'dayjs';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var g=({name:t,id:s,rules:i,tabIndex:u,helperText:p,required:c,...e})=>{let{control:f}=useFormContext();return jsx(Controller,{name:t,control:f,rules:i,render:({field:{ref:m,onChange:P,...o},fieldState:{error:r}})=>jsx(DatePicker,{inputRef:m,format:"DD/MM/YYYY",...o,"data-intercom-target":t,...e,value:o.value?C(o.value):null,onChange:l=>{let a=l?l.toDate():null;P(a),e.onChange&&e.onChange(a);},slotProps:{textField:{...e.slotProps?.textField,id:s,name:t,required:c,error:!!r,helperText:r?.message||p,autoComplete:"off",spellCheck:"false",fullWidth:!0},openPickerButton:{tabIndex:u}}})})},F=g;
|
|
7
7
|
|
|
8
|
-
export {
|
|
8
|
+
export { F as default };
|
|
9
9
|
//# sourceMappingURL=out.js.map
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/form/DatePicker/index.tsx"],"names":["Controller","useFormContext","MuiDatePicker","dayjs","jsx","DatePicker","name","rules","tabIndex","helperText","required","other","control","ref","onChange","field","error","v","newValue","DatePicker_default"],"mappings":"AAAA,OAAS,cAAAA,EAAY,kBAAAC,MAAsB,kBAC3C,OAAS,cAAcC,MAAqB,0BAC5C,OAAOC,MAAW,
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/form/DatePicker/index.tsx"],"names":["Controller","useFormContext","MuiDatePicker","dayjs","jsx","DatePicker","name","id","rules","tabIndex","helperText","required","other","control","ref","onChange","field","error","v","newValue","DatePicker_default"],"mappings":"AAAA,OAAS,cAAAA,EAAY,kBAAAC,MAAsB,kBAC3C,OAAS,cAAcC,MAAqB,0BAC5C,OAAOC,MAAW,QAwBV,cAAAC,MAAA,oBApBR,IAAMC,EAAa,CAAC,CAClB,KAAAC,EACA,GAAAC,EACA,MAAAC,EACA,SAAAC,EACA,WAAAC,EACA,SAAAC,EACA,GAAGC,CACL,IAAuB,CACrB,GAAM,CAAE,QAAAC,CAAQ,EAAIZ,EAAe,EAEnC,OACEG,EAACJ,EAAA,CACC,KAAMM,EACN,QAASO,EACT,MAAOL,EACP,OAAQ,CAAC,CACP,MAAO,CAAE,IAAAM,EAAK,SAAAC,EAAU,GAAGC,CAAM,EACjC,WAAY,CAAE,MAAAC,CAAM,CACtB,IACEb,EAACF,EAAA,CACC,SAAUY,EACV,OAAO,aACN,GAAGE,EACJ,uBAAsBV,EACrB,GAAGM,EACJ,MAAOI,EAAM,MAAQb,EAAMa,EAAM,KAAK,EAAI,KAC1C,SAAUE,GAAK,CACb,IAAMC,EAAWD,EAAIA,EAAE,OAAO,EAAI,KAClCH,EAASI,CAAQ,EACjBP,EAAM,UAAYA,EAAM,SAASO,CAAQ,CAC3C,EACA,UAAW,CACT,UAAW,CACT,GAAGP,EAAM,WAAW,UACpB,GAAAL,EACA,KAAAD,EACA,SAAAK,EACA,MAAO,CAAC,CAACM,EACT,WAAYA,GAAO,SAAWP,EAC9B,aAAc,MACd,WAAY,QACZ,UAAW,EACb,EACA,iBAAkB,CAChB,SAAAD,CACF,CACF,EACF,EAEJ,CAEJ,EAEOW,EAAQf","sourcesContent":["import { Controller, useFormContext } from 'react-hook-form';\nimport { DatePicker as MuiDatePicker } from '@mui/x-date-pickers-pro';\nimport dayjs from 'dayjs';\n\nimport { DatePickerProps } from 'types/datePickerProps';\n\nconst DatePicker = ({\n name,\n id,\n rules,\n tabIndex,\n helperText,\n required,\n ...other\n}: DatePickerProps) => {\n const { control } = useFormContext();\n\n return (\n <Controller\n name={name}\n control={control}\n rules={rules}\n render={({\n field: { ref, onChange, ...field },\n fieldState: { error },\n }) => (\n <MuiDatePicker\n inputRef={ref}\n format=\"DD/MM/YYYY\"\n {...field}\n data-intercom-target={name}\n {...other}\n value={field.value ? dayjs(field.value) : null}\n onChange={v => {\n const newValue = v ? v.toDate() : null;\n onChange(newValue);\n other.onChange && other.onChange(newValue);\n }}\n slotProps={{\n textField: {\n ...other.slotProps?.textField,\n id,\n name,\n required,\n error: !!error,\n helperText: error?.message || helperText,\n autoComplete: 'off',\n spellCheck: 'false',\n fullWidth: true,\n },\n openPickerButton: {\n tabIndex,\n },\n }}\n />\n )}\n />\n );\n};\n\nexport default DatePicker;\n"]}
|