@flipdish/portal-library 1.0.63 → 1.0.64
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/dist/components/ui/GenericDatePickerField/GenericDatePickerField.cjs.js +1 -1
- package/dist/components/ui/GenericDatePickerField/GenericDatePickerField.cjs.js.map +1 -1
- package/dist/components/ui/GenericDatePickerField/GenericDatePickerField.d.ts +1 -0
- package/dist/components/ui/GenericDatePickerField/GenericDatePickerField.js +1 -1
- package/dist/components/ui/GenericDatePickerField/GenericDatePickerField.js.map +1 -1
- package/dist/components/ui/GenericDateTimePickerField/GenericDateTimePickerField.cjs.js +1 -1
- package/dist/components/ui/GenericDateTimePickerField/GenericDateTimePickerField.cjs.js.map +1 -1
- package/dist/components/ui/GenericDateTimePickerField/GenericDateTimePickerField.d.ts +1 -0
- package/dist/components/ui/GenericDateTimePickerField/GenericDateTimePickerField.js +1 -1
- package/dist/components/ui/GenericDateTimePickerField/GenericDateTimePickerField.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),r=require("formik"),a=require("../Form/FormItemLayout.cjs.js"),
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("formik"),a=require("../Form/FormItemLayout.cjs.js"),t=require("@mui/x-date-pickers/DatePicker"),i=require("@mui/material/styles"),l=require("@mui/material/Box"),s=require("@mui/material/Typography"),o=require("../../custom-hooks/useRenderValidText.cjs.js"),n=require("moment");const d=i.styled(t.DatePicker)((({theme:e})=>({marginTop:e.spacing(2),width:"100%"})));module.exports=({label:t,fieldName:u,description:m,validation:c,variant:h="standard",layout:x,onChange:p,disabled:v=!1,disablePast:j=!1,disablefuture:b=!1,placeholder:g,showHelperTextWhenValid:q=!1})=>{const y=i.useTheme(),F=()=>e.jsx(r.Field,{name:u,validate:c,children:({field:r,form:a})=>{const{errors:i,touched:c,isSubmitting:F}=a,P=i[r.name],T=!!P&&c[r.name],f=o({fieldError:P,showError:T,touched:!!c[r.name],value:r.value});return e.jsxs(l,{sx:{paddingRight:"horizontal"===x?"16px":0},children:[e.jsx(d,{label:"standard"===h?void 0:t,value:n.isMoment(r.value)?r.value:n(r.value),onChange:e=>{const t=n.isMoment(e)?e:n(e);a.setFieldValue(r.name,t),p&&p(t)},name:u,slotProps:{textField:{variant:h,placeholder:g,error:T,helperText:T||q?f:void 0,FormHelperTextProps:{children:" ",style:{textAlign:"right"}}}},disabled:F||v,disablePast:j,disableFuture:b}),m&&e.jsx(s,{variant:"caption",sx:{color:y.palette.text.secondary},children:m})]})}});return"vertical"===x?e.jsxs(e.Fragment,{children:["standard"===h&&e.jsx(s,{variant:"subtitle1",component:"h3",color:"textPrimary",children:t}),F()]}):e.jsx(a,{label:t,children:F()})};
|
|
2
2
|
//# sourceMappingURL=GenericDatePickerField.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericDatePickerField.cjs.js","sources":["../../../../src/components/ui/GenericDatePickerField/GenericDatePickerField.tsx"],"sourcesContent":["import { type FieldProps, Field } from 'formik';\nimport FormItemLayout from '../Form/FormItemLayout';\nimport { DatePicker } from '@mui/x-date-pickers/DatePicker';\nimport { styled, useTheme } from '@mui/material/styles';\nimport { TextFieldVariants } from '@mui/material/TextField';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport useRenderValidText from '../../custom-hooks/useRenderValidText';\n\nconst StyledDateTimePicker = styled(DatePicker)(({ theme }) => ({\n marginTop: theme.spacing(2),\n width: '100%',\n}));\n\ntype Props = {\n label: string;\n placeholder?: string;\n fieldName: string;\n description?: string;\n validation?: (value: string) => string | undefined;\n layout?: 'horizontal' | 'vertical';\n variant?: TextFieldVariants;\n disabled?: boolean;\n disablePast?: boolean;\n disablefuture?: boolean;\n onChange?: (dateTime: moment.Moment) => void;\n showHelperTextWhenValid?: boolean;\n};\nconst GenericDatePickerField = ({\n label,\n fieldName,\n description,\n validation,\n variant = 'standard',\n layout,\n onChange,\n disabled = false,\n disablePast = false,\n disablefuture = false,\n placeholder = undefined,\n showHelperTextWhenValid = false,\n}: Props) => {\n const theme = useTheme();\n\n const renderField = () => {\n return (\n <Field name={fieldName} validate={validation}>\n {({ field, form }: FieldProps) => {\n const { errors, touched, isSubmitting } = form;\n const fieldError = errors[field.name] as string | undefined;\n const showError = !!fieldError && (touched[field.name] as boolean | undefined);\n const helperText = useRenderValidText({\n fieldError,\n showError,\n touched: !!touched[field.name],\n value: field.value,\n });\n\n return (\n <Box sx={{ paddingRight: layout === 'horizontal' ? '16px' : 0 }}>\n <StyledDateTimePicker\n label={variant === 'standard' ? undefined : label}\n value={field.value}\n onChange={(value) => {\n
|
|
1
|
+
{"version":3,"file":"GenericDatePickerField.cjs.js","sources":["../../../../src/components/ui/GenericDatePickerField/GenericDatePickerField.tsx"],"sourcesContent":["import { type FieldProps, Field } from 'formik';\nimport FormItemLayout from '../Form/FormItemLayout';\nimport { DatePicker } from '@mui/x-date-pickers/DatePicker';\nimport { styled, useTheme } from '@mui/material/styles';\nimport { TextFieldVariants } from '@mui/material/TextField';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport useRenderValidText from '../../custom-hooks/useRenderValidText';\nimport moment from 'moment';\n\nconst StyledDateTimePicker = styled(DatePicker)(({ theme }) => ({\n marginTop: theme.spacing(2),\n width: '100%',\n}));\n\ntype Props = {\n label: string;\n placeholder?: string;\n fieldName: string;\n description?: string;\n validation?: (value: string) => string | undefined;\n layout?: 'horizontal' | 'vertical';\n variant?: TextFieldVariants;\n disabled?: boolean;\n disablePast?: boolean;\n disablefuture?: boolean;\n onChange?: (dateTime: moment.Moment) => void;\n showHelperTextWhenValid?: boolean;\n};\nconst GenericDatePickerField = ({\n label,\n fieldName,\n description,\n validation,\n variant = 'standard',\n layout,\n onChange,\n disabled = false,\n disablePast = false,\n disablefuture = false,\n placeholder = undefined,\n showHelperTextWhenValid = false,\n}: Props) => {\n const theme = useTheme();\n\n const renderField = () => {\n return (\n <Field name={fieldName} validate={validation}>\n {({ field, form }: FieldProps) => {\n const { errors, touched, isSubmitting } = form;\n const fieldError = errors[field.name] as string | undefined;\n const showError = !!fieldError && (touched[field.name] as boolean | undefined);\n const helperText = useRenderValidText({\n fieldError,\n showError,\n touched: !!touched[field.name],\n value: field.value,\n });\n\n return (\n <Box sx={{ paddingRight: layout === 'horizontal' ? '16px' : 0 }}>\n <StyledDateTimePicker\n label={variant === 'standard' ? undefined : label}\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n value={moment.isMoment(field.value) ? field.value : moment(field.value)}\n onChange={(value) => {\n const momentValue = moment.isMoment(value) ? value : moment(value);\n void form.setFieldValue(field.name, momentValue);\n if (onChange) {\n onChange(momentValue);\n }\n }}\n name={fieldName}\n slotProps={{\n textField: {\n variant,\n placeholder,\n error: showError,\n helperText: showError ? helperText : showHelperTextWhenValid ? helperText : undefined,\n FormHelperTextProps: {\n children: ' ', // reserves line height for error message\n style: { textAlign: 'right' },\n },\n },\n }}\n disabled={isSubmitting || disabled}\n disablePast={disablePast}\n disableFuture={disablefuture}\n />\n {description && (\n <Typography variant=\"caption\" sx={{ color: theme.palette.text.secondary }}>\n {description}\n </Typography>\n )}\n </Box>\n );\n }}\n </Field>\n );\n };\n\n if (layout === 'vertical') {\n return (\n <>\n {variant === 'standard' && (\n <Typography variant=\"subtitle1\" component=\"h3\" color=\"textPrimary\">\n {label}\n </Typography>\n )}\n {renderField()}\n </>\n );\n }\n\n return <FormItemLayout label={label}>{renderField()}</FormItemLayout>;\n};\n\nexport default GenericDatePickerField;\n"],"names":["StyledDateTimePicker","styled","DatePicker","theme","marginTop","spacing","width","label","fieldName","description","validation","variant","layout","onChange","disabled","disablePast","disablefuture","placeholder","showHelperTextWhenValid","useTheme","renderField","_jsx","Field","name","validate","children","field","form","errors","touched","isSubmitting","fieldError","showError","helperText","useRenderValidText","value","_jsxs","jsxs","Box","sx","paddingRight","jsx","undefined","moment","isMoment","momentValue","setFieldValue","slotProps","textField","error","FormHelperTextProps","style","textAlign","disableFuture","Typography","color","palette","text","secondary","_Fragment","component","FormItemLayout"],"mappings":"gVAUA,MAAMA,EAAuBC,EAAAA,OAAOC,EAAAA,WAAPD,EAAmB,EAAGE,YAAa,CAC5DC,UAAWD,EAAME,QAAQ,GACzBC,MAAO,0BAiBoB,EAC3BC,QACAC,YACAC,cACAC,aACAC,UAAU,WACVC,SACAC,WACAC,YAAW,EACXC,eAAc,EACdC,iBAAgB,EAChBC,cACAC,2BAA0B,MAE1B,MAAMf,EAAQgB,EAAAA,WAERC,EAAc,IAEZC,MAACC,EAAAA,OAAMC,KAAMf,EAAWgB,SAAUd,EAAUe,SACvC,EAAGC,QAAOC,WACP,MAAMC,OAAEA,EAAMC,QAAEA,EAAOC,aAAEA,GAAiBH,EACpCI,EAAaH,EAAOF,EAAMH,MAC1BS,IAAcD,GAAeF,EAAQH,EAAMH,MAC3CU,EAAaC,EAAmB,CAClCH,aACAC,YACAH,UAAWA,EAAQH,EAAMH,MACzBY,MAAOT,EAAMS,QAGjB,OACIC,EAACC,KAAAC,EAAI,CAAAC,GAAI,CAAEC,aAAyB,eAAX5B,EAA0B,OAAS,GACxDa,SAAA,CAAAJ,EAAAoB,IAACzC,EAAoB,CACjBO,MAAmB,aAAZI,OAAyB+B,EAAYnC,EAE5C4B,MAAOQ,EAAOC,SAASlB,EAAMS,OAAST,EAAMS,MAAQQ,EAAOjB,EAAMS,OACjEtB,SAAWsB,IACP,MAAMU,EAAcF,EAAOC,SAAST,GAASA,EAAQQ,EAAOR,GACvDR,EAAKmB,cAAcpB,EAAMH,KAAMsB,GAChChC,GACAA,EAASgC,EACZ,EAELtB,KAAMf,EACNuC,UAAW,CACPC,UAAW,CACPrC,UACAM,cACAgC,MAAOjB,EACPC,WAAYD,GAAyBd,EAAbe,OAAoDS,EAC5EQ,oBAAqB,CACjBzB,SAAU,IACV0B,MAAO,CAAEC,UAAW,YAIhCtC,SAAUgB,GAAgBhB,EAC1BC,YAAaA,EACbsC,cAAerC,IAElBP,GACGY,EAAAoB,IAACa,EAAW,CAAA3C,QAAQ,UAAU4B,GAAI,CAAEgB,MAAOpD,EAAMqD,QAAQC,KAAKC,WACzDjC,SAAAhB,MAIf,IAMlB,MAAe,aAAXG,EAEIwB,EAAAC,KAAAsB,WAAA,CAAAlC,SAAA,CACiB,aAAZd,GACGU,EAAAoB,IAACa,EAAU,CAAC3C,QAAQ,YAAYiD,UAAU,KAAKL,MAAM,cAChD9B,SAAAlB,IAGRa,OAKNC,EAAAoB,IAACoB,EAAc,CAACtD,MAAOA,EAAQkB,SAAAL,KAA+B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as e,Fragment as r,jsx as t}from"react/jsx-runtime";import{Field as a}from"formik";import i from"../Form/FormItemLayout.js";import{DatePicker as o}from"@mui/x-date-pickers/DatePicker";import{styled as l,useTheme as
|
|
1
|
+
import{jsxs as e,Fragment as r,jsx as t}from"react/jsx-runtime";import{Field as a}from"formik";import i from"../Form/FormItemLayout.js";import{DatePicker as o}from"@mui/x-date-pickers/DatePicker";import{styled as l,useTheme as m}from"@mui/material/styles";import n from"@mui/material/Box";import d from"@mui/material/Typography";import s from"../../custom-hooks/useRenderValidText.js";import p from"moment";const c=l(o)((({theme:e})=>({marginTop:e.spacing(2),width:"100%"}))),u=({label:o,fieldName:l,description:u,validation:h,variant:f="standard",layout:v,onChange:x,disabled:b=!1,disablePast:g=!1,disablefuture:y=!1,placeholder:F,showHelperTextWhenValid:P=!1})=>{const T=m(),k=()=>t(a,{name:l,validate:h,children:({field:r,form:a})=>{const{errors:i,touched:m,isSubmitting:h}=a,k=i[r.name],j=!!k&&m[r.name],w=s({fieldError:k,showError:j,touched:!!m[r.name],value:r.value});return e(n,{sx:{paddingRight:"horizontal"===v?"16px":0},children:[t(c,{label:"standard"===f?void 0:o,value:p.isMoment(r.value)?r.value:p(r.value),onChange:e=>{const t=p.isMoment(e)?e:p(e);a.setFieldValue(r.name,t),x&&x(t)},name:l,slotProps:{textField:{variant:f,placeholder:F,error:j,helperText:j||P?w:void 0,FormHelperTextProps:{children:" ",style:{textAlign:"right"}}}},disabled:h||b,disablePast:g,disableFuture:y}),u&&t(d,{variant:"caption",sx:{color:T.palette.text.secondary},children:u})]})}});return"vertical"===v?e(r,{children:["standard"===f&&t(d,{variant:"subtitle1",component:"h3",color:"textPrimary",children:o}),k()]}):t(i,{label:o,children:k()})};export{u as default};
|
|
2
2
|
//# sourceMappingURL=GenericDatePickerField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericDatePickerField.js","sources":["../../../../src/components/ui/GenericDatePickerField/GenericDatePickerField.tsx"],"sourcesContent":["import { type FieldProps, Field } from 'formik';\nimport FormItemLayout from '../Form/FormItemLayout';\nimport { DatePicker } from '@mui/x-date-pickers/DatePicker';\nimport { styled, useTheme } from '@mui/material/styles';\nimport { TextFieldVariants } from '@mui/material/TextField';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport useRenderValidText from '../../custom-hooks/useRenderValidText';\n\nconst StyledDateTimePicker = styled(DatePicker)(({ theme }) => ({\n marginTop: theme.spacing(2),\n width: '100%',\n}));\n\ntype Props = {\n label: string;\n placeholder?: string;\n fieldName: string;\n description?: string;\n validation?: (value: string) => string | undefined;\n layout?: 'horizontal' | 'vertical';\n variant?: TextFieldVariants;\n disabled?: boolean;\n disablePast?: boolean;\n disablefuture?: boolean;\n onChange?: (dateTime: moment.Moment) => void;\n showHelperTextWhenValid?: boolean;\n};\nconst GenericDatePickerField = ({\n label,\n fieldName,\n description,\n validation,\n variant = 'standard',\n layout,\n onChange,\n disabled = false,\n disablePast = false,\n disablefuture = false,\n placeholder = undefined,\n showHelperTextWhenValid = false,\n}: Props) => {\n const theme = useTheme();\n\n const renderField = () => {\n return (\n <Field name={fieldName} validate={validation}>\n {({ field, form }: FieldProps) => {\n const { errors, touched, isSubmitting } = form;\n const fieldError = errors[field.name] as string | undefined;\n const showError = !!fieldError && (touched[field.name] as boolean | undefined);\n const helperText = useRenderValidText({\n fieldError,\n showError,\n touched: !!touched[field.name],\n value: field.value,\n });\n\n return (\n <Box sx={{ paddingRight: layout === 'horizontal' ? '16px' : 0 }}>\n <StyledDateTimePicker\n label={variant === 'standard' ? undefined : label}\n value={field.value}\n onChange={(value) => {\n
|
|
1
|
+
{"version":3,"file":"GenericDatePickerField.js","sources":["../../../../src/components/ui/GenericDatePickerField/GenericDatePickerField.tsx"],"sourcesContent":["import { type FieldProps, Field } from 'formik';\nimport FormItemLayout from '../Form/FormItemLayout';\nimport { DatePicker } from '@mui/x-date-pickers/DatePicker';\nimport { styled, useTheme } from '@mui/material/styles';\nimport { TextFieldVariants } from '@mui/material/TextField';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport useRenderValidText from '../../custom-hooks/useRenderValidText';\nimport moment from 'moment';\n\nconst StyledDateTimePicker = styled(DatePicker)(({ theme }) => ({\n marginTop: theme.spacing(2),\n width: '100%',\n}));\n\ntype Props = {\n label: string;\n placeholder?: string;\n fieldName: string;\n description?: string;\n validation?: (value: string) => string | undefined;\n layout?: 'horizontal' | 'vertical';\n variant?: TextFieldVariants;\n disabled?: boolean;\n disablePast?: boolean;\n disablefuture?: boolean;\n onChange?: (dateTime: moment.Moment) => void;\n showHelperTextWhenValid?: boolean;\n};\nconst GenericDatePickerField = ({\n label,\n fieldName,\n description,\n validation,\n variant = 'standard',\n layout,\n onChange,\n disabled = false,\n disablePast = false,\n disablefuture = false,\n placeholder = undefined,\n showHelperTextWhenValid = false,\n}: Props) => {\n const theme = useTheme();\n\n const renderField = () => {\n return (\n <Field name={fieldName} validate={validation}>\n {({ field, form }: FieldProps) => {\n const { errors, touched, isSubmitting } = form;\n const fieldError = errors[field.name] as string | undefined;\n const showError = !!fieldError && (touched[field.name] as boolean | undefined);\n const helperText = useRenderValidText({\n fieldError,\n showError,\n touched: !!touched[field.name],\n value: field.value,\n });\n\n return (\n <Box sx={{ paddingRight: layout === 'horizontal' ? '16px' : 0 }}>\n <StyledDateTimePicker\n label={variant === 'standard' ? undefined : label}\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n value={moment.isMoment(field.value) ? field.value : moment(field.value)}\n onChange={(value) => {\n const momentValue = moment.isMoment(value) ? value : moment(value);\n void form.setFieldValue(field.name, momentValue);\n if (onChange) {\n onChange(momentValue);\n }\n }}\n name={fieldName}\n slotProps={{\n textField: {\n variant,\n placeholder,\n error: showError,\n helperText: showError ? helperText : showHelperTextWhenValid ? helperText : undefined,\n FormHelperTextProps: {\n children: ' ', // reserves line height for error message\n style: { textAlign: 'right' },\n },\n },\n }}\n disabled={isSubmitting || disabled}\n disablePast={disablePast}\n disableFuture={disablefuture}\n />\n {description && (\n <Typography variant=\"caption\" sx={{ color: theme.palette.text.secondary }}>\n {description}\n </Typography>\n )}\n </Box>\n );\n }}\n </Field>\n );\n };\n\n if (layout === 'vertical') {\n return (\n <>\n {variant === 'standard' && (\n <Typography variant=\"subtitle1\" component=\"h3\" color=\"textPrimary\">\n {label}\n </Typography>\n )}\n {renderField()}\n </>\n );\n }\n\n return <FormItemLayout label={label}>{renderField()}</FormItemLayout>;\n};\n\nexport default GenericDatePickerField;\n"],"names":["StyledDateTimePicker","styled","DatePicker","theme","marginTop","spacing","width","GenericDatePickerField","label","fieldName","description","validation","variant","layout","onChange","disabled","disablePast","disablefuture","placeholder","showHelperTextWhenValid","useTheme","renderField","_jsx","Field","name","validate","children","field","form","errors","touched","isSubmitting","fieldError","showError","helperText","useRenderValidText","value","_jsxs","Box","sx","paddingRight","undefined","moment","isMoment","momentValue","setFieldValue","slotProps","textField","error","FormHelperTextProps","style","textAlign","disableFuture","Typography","color","palette","text","secondary","_Fragment","component","FormItemLayout"],"mappings":"uZAUA,MAAMA,EAAuBC,EAAOC,EAAPD,EAAmB,EAAGE,YAAa,CAC5DC,UAAWD,EAAME,QAAQ,GACzBC,MAAO,WAiBLC,EAAy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Q,YAAY+C,UAAU,KAAKL,MAAM,cAChD5B,SAAAlB,IAGRa,OAKNC,EAACsC,EAAc,CAACpD,MAAOA,EAAQkB,SAAAL,KAA+B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),r=require("formik"),a=require("../Form/FormItemLayout.cjs.js"),i=require("@mui/x-date-pickers/DateTimePicker"),t=require("@mui/material/styles"),l=require("@mui/material/Box"),s=require("@mui/material/Typography"),o=require("../../custom-hooks/useRenderValidText.cjs.js");const d=t.styled(i.DateTimePicker)((({theme:e})=>({marginTop:e.spacing(2),width:"100%"})));module.exports=({label:i,fieldName:
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("formik"),a=require("../Form/FormItemLayout.cjs.js"),i=require("@mui/x-date-pickers/DateTimePicker"),t=require("@mui/material/styles"),l=require("@mui/material/Box"),s=require("@mui/material/Typography"),o=require("../../custom-hooks/useRenderValidText.cjs.js"),n=require("moment");const d=t.styled(i.DateTimePicker)((({theme:e})=>({marginTop:e.spacing(2),width:"100%"})));module.exports=({label:i,fieldName:u,description:m,validation:c,variant:h="standard",layout:x,onChange:p,disabled:v=!1,disablePast:j=!1,disablefuture:b=!1,placeholder:g,showHelperTextWhenValid:q=!1})=>{const y=t.useTheme(),T=()=>e.jsx(r.Field,{name:u,validate:c,children:({field:r,form:a})=>{const{errors:t,touched:c,isSubmitting:T}=a,F=t[r.name],P=!!F&&c[r.name],f=o({fieldError:F,showError:P,touched:!!c[r.name],value:r.value});return e.jsxs(l,{sx:{paddingRight:"horizontal"===x?"16px":0},children:[e.jsx(d,{label:"standard"===h?void 0:i,value:n.isMoment(r.value)?r.value:n(r.value),onChange:e=>{const i=n.isMoment(e)?e:n(e);a.setFieldValue(r.name,i),p&&p(i)},name:u,slotProps:{textField:{variant:h,placeholder:g,error:P,helperText:P||q?f:void 0,FormHelperTextProps:{children:" ",style:{textAlign:"right"}}}},disabled:T||v,disablePast:j,disableFuture:b}),m&&e.jsx(s,{variant:"caption",sx:{color:y.palette.text.secondary},children:m})]})}});return"vertical"===x?e.jsxs(e.Fragment,{children:["standard"===h&&e.jsx(s,{variant:"subtitle1",component:"h3",color:"textPrimary",children:i}),T()]}):e.jsx(a,{label:i,children:T()})};
|
|
2
2
|
//# sourceMappingURL=GenericDateTimePickerField.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericDateTimePickerField.cjs.js","sources":["../../../../src/components/ui/GenericDateTimePickerField/GenericDateTimePickerField.tsx"],"sourcesContent":["import { type FieldProps, Field } from 'formik';\nimport FormItemLayout from '../Form/FormItemLayout';\nimport { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';\nimport { styled, useTheme } from '@mui/material/styles';\nimport { TextFieldVariants } from '@mui/material/TextField';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport useRenderValidText from '../../custom-hooks/useRenderValidText';\n\nconst StyledDateTimePicker = styled(DateTimePicker)(({ theme }) => ({\n marginTop: theme.spacing(2),\n width: '100%',\n}));\n\ntype Props = {\n label: string;\n placeholder?: string;\n fieldName: string;\n description?: string;\n validation?: (value: string) => string | undefined;\n layout?: 'horizontal' | 'vertical';\n variant?: TextFieldVariants;\n disabled?: boolean;\n disablePast?: boolean;\n disablefuture?: boolean;\n onChange?: (dateTime: moment.Moment) => void;\n showHelperTextWhenValid?: boolean;\n};\nconst GenericDateTimePickerField = ({\n label,\n fieldName,\n description,\n validation,\n variant = 'standard',\n layout,\n onChange,\n disabled = false,\n disablePast = false,\n disablefuture = false,\n placeholder = undefined,\n showHelperTextWhenValid = false,\n}: Props) => {\n const theme = useTheme();\n\n const renderField = () => {\n return (\n <Field name={fieldName} validate={validation}>\n {({ field, form }: FieldProps) => {\n const { errors, touched, isSubmitting } = form;\n const fieldError = errors[field.name] as string | undefined;\n const showError = !!fieldError && (touched[field.name] as boolean | undefined);\n const helperText = useRenderValidText({\n fieldError,\n showError,\n touched: !!touched[field.name],\n value: field.value,\n });\n\n return (\n <Box sx={{ paddingRight: layout === 'horizontal' ? '16px' : 0 }}>\n <StyledDateTimePicker\n label={variant === 'standard' ? undefined : label}\n value={field.value}\n onChange={(value) => {\n
|
|
1
|
+
{"version":3,"file":"GenericDateTimePickerField.cjs.js","sources":["../../../../src/components/ui/GenericDateTimePickerField/GenericDateTimePickerField.tsx"],"sourcesContent":["import { type FieldProps, Field } from 'formik';\nimport FormItemLayout from '../Form/FormItemLayout';\nimport { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';\nimport { styled, useTheme } from '@mui/material/styles';\nimport { TextFieldVariants } from '@mui/material/TextField';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport useRenderValidText from '../../custom-hooks/useRenderValidText';\nimport moment from 'moment';\n\nconst StyledDateTimePicker = styled(DateTimePicker)(({ theme }) => ({\n marginTop: theme.spacing(2),\n width: '100%',\n}));\n\ntype Props = {\n label: string;\n placeholder?: string;\n fieldName: string;\n description?: string;\n validation?: (value: string) => string | undefined;\n layout?: 'horizontal' | 'vertical';\n variant?: TextFieldVariants;\n disabled?: boolean;\n disablePast?: boolean;\n disablefuture?: boolean;\n onChange?: (dateTime: moment.Moment) => void;\n showHelperTextWhenValid?: boolean;\n};\nconst GenericDateTimePickerField = ({\n label,\n fieldName,\n description,\n validation,\n variant = 'standard',\n layout,\n onChange,\n disabled = false,\n disablePast = false,\n disablefuture = false,\n placeholder = undefined,\n showHelperTextWhenValid = false,\n}: Props) => {\n const theme = useTheme();\n\n const renderField = () => {\n return (\n <Field name={fieldName} validate={validation}>\n {({ field, form }: FieldProps) => {\n const { errors, touched, isSubmitting } = form;\n const fieldError = errors[field.name] as string | undefined;\n const showError = !!fieldError && (touched[field.name] as boolean | undefined);\n const helperText = useRenderValidText({\n fieldError,\n showError,\n touched: !!touched[field.name],\n value: field.value,\n });\n\n return (\n <Box sx={{ paddingRight: layout === 'horizontal' ? '16px' : 0 }}>\n <StyledDateTimePicker\n label={variant === 'standard' ? undefined : label}\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n value={moment.isMoment(field.value) ? field.value : moment(field.value)}\n onChange={(value) => {\n const momentValue = moment.isMoment(value) ? value : moment(value);\n void form.setFieldValue(field.name, momentValue);\n if (onChange) {\n onChange(momentValue);\n }\n }}\n name={fieldName}\n slotProps={{\n textField: {\n variant,\n placeholder,\n error: showError,\n helperText: showError ? helperText : showHelperTextWhenValid ? helperText : undefined,\n FormHelperTextProps: {\n children: ' ', // reserves line height for error message\n style: { textAlign: 'right' },\n },\n },\n }}\n disabled={isSubmitting || disabled}\n disablePast={disablePast}\n disableFuture={disablefuture}\n />\n {description && (\n <Typography variant=\"caption\" sx={{ color: theme.palette.text.secondary }}>\n {description}\n </Typography>\n )}\n </Box>\n );\n }}\n </Field>\n );\n };\n\n if (layout === 'vertical') {\n return (\n <>\n {variant === 'standard' && (\n <Typography variant=\"subtitle1\" component=\"h3\" color=\"textPrimary\">\n {label}\n </Typography>\n )}\n {renderField()}\n </>\n );\n }\n\n return <FormItemLayout label={label}>{renderField()}</FormItemLayout>;\n};\n\nexport default GenericDateTimePickerField;\n"],"names":["StyledDateTimePicker","styled","DateTimePicker","theme","marginTop","spacing","width","label","fieldName","description","validation","variant","layout","onChange","disabled","disablePast","disablefuture","placeholder","showHelperTextWhenValid","useTheme","renderField","_jsx","Field","name","validate","children","field","form","errors","touched","isSubmitting","fieldError","showError","helperText","useRenderValidText","value","_jsxs","jsxs","Box","sx","paddingRight","jsx","undefined","moment","isMoment","momentValue","setFieldValue","slotProps","textField","error","FormHelperTextProps","style","textAlign","disableFuture","Typography","color","palette","text","secondary","_Fragment","component","FormItemLayout"],"mappings":"oVAUA,MAAMA,EAAuBC,EAAAA,OAAOC,EAAAA,eAAPD,EAAuB,EAAGE,YAAa,CAChEC,UAAWD,EAAME,QAAQ,GACzBC,MAAO,0BAiBwB,EAC/BC,QACAC,YACAC,cACAC,aACAC,UAAU,WACVC,SACAC,WACAC,YAAW,E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,UAAU,KAAKL,MAAM,cAChD9B,SAAAlB,IAGRa,OAKNC,EAAAoB,IAACoB,EAAc,CAACtD,MAAOA,EAAQkB,SAAAL,KAA+B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as e,Fragment as r,jsx as t}from"react/jsx-runtime";import{Field as a}from"formik";import i from"../Form/FormItemLayout.js";import{DateTimePicker as o}from"@mui/x-date-pickers/DateTimePicker";import{styled as l,useTheme as
|
|
1
|
+
import{jsxs as e,Fragment as r,jsx as t}from"react/jsx-runtime";import{Field as a}from"formik";import i from"../Form/FormItemLayout.js";import{DateTimePicker as o}from"@mui/x-date-pickers/DateTimePicker";import{styled as l,useTheme as m}from"@mui/material/styles";import n from"@mui/material/Box";import d from"@mui/material/Typography";import s from"../../custom-hooks/useRenderValidText.js";import p from"moment";const c=l(o)((({theme:e})=>({marginTop:e.spacing(2),width:"100%"}))),u=({label:o,fieldName:l,description:u,validation:h,variant:f="standard",layout:v,onChange:x,disabled:b=!1,disablePast:g=!1,disablefuture:y=!1,placeholder:T,showHelperTextWhenValid:F=!1})=>{const P=m(),k=()=>t(a,{name:l,validate:h,children:({field:r,form:a})=>{const{errors:i,touched:m,isSubmitting:h}=a,k=i[r.name],j=!!k&&m[r.name],w=s({fieldError:k,showError:j,touched:!!m[r.name],value:r.value});return e(n,{sx:{paddingRight:"horizontal"===v?"16px":0},children:[t(c,{label:"standard"===f?void 0:o,value:p.isMoment(r.value)?r.value:p(r.value),onChange:e=>{const t=p.isMoment(e)?e:p(e);a.setFieldValue(r.name,t),x&&x(t)},name:l,slotProps:{textField:{variant:f,placeholder:T,error:j,helperText:j||F?w:void 0,FormHelperTextProps:{children:" ",style:{textAlign:"right"}}}},disabled:h||b,disablePast:g,disableFuture:y}),u&&t(d,{variant:"caption",sx:{color:P.palette.text.secondary},children:u})]})}});return"vertical"===v?e(r,{children:["standard"===f&&t(d,{variant:"subtitle1",component:"h3",color:"textPrimary",children:o}),k()]}):t(i,{label:o,children:k()})};export{u as default};
|
|
2
2
|
//# sourceMappingURL=GenericDateTimePickerField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericDateTimePickerField.js","sources":["../../../../src/components/ui/GenericDateTimePickerField/GenericDateTimePickerField.tsx"],"sourcesContent":["import { type FieldProps, Field } from 'formik';\nimport FormItemLayout from '../Form/FormItemLayout';\nimport { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';\nimport { styled, useTheme } from '@mui/material/styles';\nimport { TextFieldVariants } from '@mui/material/TextField';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport useRenderValidText from '../../custom-hooks/useRenderValidText';\n\nconst StyledDateTimePicker = styled(DateTimePicker)(({ theme }) => ({\n marginTop: theme.spacing(2),\n width: '100%',\n}));\n\ntype Props = {\n label: string;\n placeholder?: string;\n fieldName: string;\n description?: string;\n validation?: (value: string) => string | undefined;\n layout?: 'horizontal' | 'vertical';\n variant?: TextFieldVariants;\n disabled?: boolean;\n disablePast?: boolean;\n disablefuture?: boolean;\n onChange?: (dateTime: moment.Moment) => void;\n showHelperTextWhenValid?: boolean;\n};\nconst GenericDateTimePickerField = ({\n label,\n fieldName,\n description,\n validation,\n variant = 'standard',\n layout,\n onChange,\n disabled = false,\n disablePast = false,\n disablefuture = false,\n placeholder = undefined,\n showHelperTextWhenValid = false,\n}: Props) => {\n const theme = useTheme();\n\n const renderField = () => {\n return (\n <Field name={fieldName} validate={validation}>\n {({ field, form }: FieldProps) => {\n const { errors, touched, isSubmitting } = form;\n const fieldError = errors[field.name] as string | undefined;\n const showError = !!fieldError && (touched[field.name] as boolean | undefined);\n const helperText = useRenderValidText({\n fieldError,\n showError,\n touched: !!touched[field.name],\n value: field.value,\n });\n\n return (\n <Box sx={{ paddingRight: layout === 'horizontal' ? '16px' : 0 }}>\n <StyledDateTimePicker\n label={variant === 'standard' ? undefined : label}\n value={field.value}\n onChange={(value) => {\n
|
|
1
|
+
{"version":3,"file":"GenericDateTimePickerField.js","sources":["../../../../src/components/ui/GenericDateTimePickerField/GenericDateTimePickerField.tsx"],"sourcesContent":["import { type FieldProps, Field } from 'formik';\nimport FormItemLayout from '../Form/FormItemLayout';\nimport { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';\nimport { styled, useTheme } from '@mui/material/styles';\nimport { TextFieldVariants } from '@mui/material/TextField';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport useRenderValidText from '../../custom-hooks/useRenderValidText';\nimport moment from 'moment';\n\nconst StyledDateTimePicker = styled(DateTimePicker)(({ theme }) => ({\n marginTop: theme.spacing(2),\n width: '100%',\n}));\n\ntype Props = {\n label: string;\n placeholder?: string;\n fieldName: string;\n description?: string;\n validation?: (value: string) => string | undefined;\n layout?: 'horizontal' | 'vertical';\n variant?: TextFieldVariants;\n disabled?: boolean;\n disablePast?: boolean;\n disablefuture?: boolean;\n onChange?: (dateTime: moment.Moment) => void;\n showHelperTextWhenValid?: boolean;\n};\nconst GenericDateTimePickerField = ({\n label,\n fieldName,\n description,\n validation,\n variant = 'standard',\n layout,\n onChange,\n disabled = false,\n disablePast = false,\n disablefuture = false,\n placeholder = undefined,\n showHelperTextWhenValid = false,\n}: Props) => {\n const theme = useTheme();\n\n const renderField = () => {\n return (\n <Field name={fieldName} validate={validation}>\n {({ field, form }: FieldProps) => {\n const { errors, touched, isSubmitting } = form;\n const fieldError = errors[field.name] as string | undefined;\n const showError = !!fieldError && (touched[field.name] as boolean | undefined);\n const helperText = useRenderValidText({\n fieldError,\n showError,\n touched: !!touched[field.name],\n value: field.value,\n });\n\n return (\n <Box sx={{ paddingRight: layout === 'horizontal' ? '16px' : 0 }}>\n <StyledDateTimePicker\n label={variant === 'standard' ? undefined : label}\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n value={moment.isMoment(field.value) ? field.value : moment(field.value)}\n onChange={(value) => {\n const momentValue = moment.isMoment(value) ? value : moment(value);\n void form.setFieldValue(field.name, momentValue);\n if (onChange) {\n onChange(momentValue);\n }\n }}\n name={fieldName}\n slotProps={{\n textField: {\n variant,\n placeholder,\n error: showError,\n helperText: showError ? helperText : showHelperTextWhenValid ? helperText : undefined,\n FormHelperTextProps: {\n children: ' ', // reserves line height for error message\n style: { textAlign: 'right' },\n },\n },\n }}\n disabled={isSubmitting || disabled}\n disablePast={disablePast}\n disableFuture={disablefuture}\n />\n {description && (\n <Typography variant=\"caption\" sx={{ color: theme.palette.text.secondary }}>\n {description}\n </Typography>\n )}\n </Box>\n );\n }}\n </Field>\n );\n };\n\n if (layout === 'vertical') {\n return (\n <>\n {variant === 'standard' && (\n <Typography variant=\"subtitle1\" component=\"h3\" color=\"textPrimary\">\n {label}\n </Typography>\n )}\n {renderField()}\n </>\n );\n }\n\n return <FormItemLayout label={label}>{renderField()}</FormItemLayout>;\n};\n\nexport default GenericDateTimePickerField;\n"],"names":["StyledDateTimePicker","styled","DateTimePicker","theme","marginTop","spacing","width","GenericDateTimePickerField","label","fieldName","description","validation","variant","layout","onChange","disabled","disablePast","disablefuture","placeholder","showHelperTextWhenValid","useTheme","renderField","_jsx","Field","name","validate","children","field","form","errors","touched","isSubmitting","fieldError","showError","helperText","useRenderValidText","value","_jsxs","Box","sx","paddingRight","undefined","moment","isMoment","momentValue","setFieldValue","slotProps","textField","error","FormHelperTextProps","style","textAlign","disableFuture","Typography","color","palette","text","secondary","_Fragment","component","FormItemLayout"],"mappings":"+ZAUA,MAAMA,EAAuBC,EAAOC,EAAPD,EAAuB,EAAGE,YAAa,CAChEC,UAAWD,EAAME,QAAQ,GACzBC,MAAO,WAiBLC,EAA6B,EAC/BC,QACAC,YACAC,cACAC,aACAC,UAAU,WACVC,SACAC,WACAC,YAAW,EACXC,eAAc,EACdC,iBAAgB,EAChBC,cACAC,2BAA0B,MAE1B,MAAMhB,EAAQiB,IAERC,EAAc,IAEZC,EAACC,GAAMC,KAAMf,EAAWgB,SAAUd,EAAUe,SACvC,EAAGC,QAAOC,WACP,MAAMC,OAAEA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