diff --git a/package-lock.json b/package-lock.json index f9289412227..a4276cb3d35 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11974,23 +11974,6 @@ "loose-envify": "cli.js" } }, - "node_modules/lottie-react": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/lottie-react/-/lottie-react-2.4.0.tgz", - "integrity": "sha512-pDJGj+AQlnlyHvOHFK7vLdsDcvbuqvwPZdMlJ360wrzGFurXeKPr8SiRCjLf3LrNYKANQtSsh5dz9UYQHuqx4w==", - "dependencies": { - "lottie-web": "^5.10.2" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0", - "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" - } - }, - "node_modules/lottie-web": { - "version": "5.12.2", - "resolved": "https://registry.npmjs.org/lottie-web/-/lottie-web-5.12.2.tgz", - "integrity": "sha512-uvhvYPC8kGPjXT3MyKMrL3JitEAmDMp30lVkuq/590Mw9ok6pWcFCwXJveo0t5uqYw1UREQHofD+jVpdjBv8wg==" - }, "node_modules/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", diff --git a/src/components/ABDM/FetchRecordsModal.tsx b/src/components/ABDM/FetchRecordsModal.tsx index 34d70255846..441bee0ddbd 100644 --- a/src/components/ABDM/FetchRecordsModal.tsx +++ b/src/components/ABDM/FetchRecordsModal.tsx @@ -193,7 +193,6 @@ export default function FetchRecordsModal({ abha, show, onClose }: IProps) { label={t("consent_request__expiry")} required disablePast - position="TOP-RIGHT" />
diff --git a/src/components/Assets/AssetServiceEditModal.tsx b/src/components/Assets/AssetServiceEditModal.tsx index 9accf5c3d66..fecea8ad124 100644 --- a/src/components/Assets/AssetServiceEditModal.tsx +++ b/src/components/Assets/AssetServiceEditModal.tsx @@ -196,7 +196,6 @@ export const AssetServiceEditModal = (props: { label={t("serviced_on")} name="serviced_on" className="mt-2" - position="LEFT" value={new Date(form.serviced_on)} max={new Date(props.service_record.created_date)} onChange={(date) => { diff --git a/src/components/Common/DateInputV2.tsx b/src/components/Common/DateInputV2.tsx index d28f232b0ad..5eb90129812 100644 --- a/src/components/Common/DateInputV2.tsx +++ b/src/components/Common/DateInputV2.tsx @@ -9,15 +9,6 @@ import { t } from "i18next"; import DateTextInput from "./DateTextInput"; type DatePickerType = "date" | "month" | "year"; -export type DatePickerPosition = - | "LEFT" - | "RIGHT" - | "CENTER" - | "LEFT-CENTER" - | "RIGHT-CENTER" - | "TOP-LEFT" - | "TOP-RIGHT" - | "TOP-CENTER"; interface Props { id?: string; @@ -29,12 +20,11 @@ interface Props { max?: Date; outOfLimitsErrorMessage?: string; onChange: (date: Date | undefined) => void; - position?: DatePickerPosition; disabled?: boolean; placeholder?: string; isOpen?: boolean; setIsOpen?: (isOpen: boolean) => void; - time?: boolean; + allowTime?: boolean; popOverClassName?: string; } @@ -53,7 +43,7 @@ const DateInputV2: React.FC = ({ disabled, placeholder, setIsOpen, - time, + allowTime, isOpen, popOverClassName, }) => { @@ -84,7 +74,7 @@ const DateInputV2: React.FC = ({ }; const handleChange = (date: Date) => { - onChange(time ? date : getDayStart(date)); + onChange(allowTime ? date : getDayStart(date)); }; const decrement = () => { @@ -140,7 +130,7 @@ const DateInputV2: React.FC = ({ datePickerHeaderDate.getSeconds(), ), ); - if (!time) { + if (!allowTime) { close(); setIsOpen?.(false); } @@ -276,7 +266,7 @@ const DateInputV2: React.FC = ({ isOpen && popoverButtonRef.current?.click(); }, [isOpen]); - const dateFormat = `DD/MM/YYYY${time ? " hh:mm a" : ""}`; + const dateFormat = `DD/MM/YYYY${allowTime ? " hh:mm a" : ""}`; const getPosition = () => { const viewportWidth = document.documentElement.clientWidth; @@ -285,7 +275,7 @@ const DateInputV2: React.FC = ({ const popOverX = popoverButtonRef.current?.getBoundingClientRect().x || 0; const popOverY = popoverButtonRef.current?.getBoundingClientRect().y || 0; - const right = popOverX > viewportWidth - (time ? 420 : 300); + const right = popOverX > viewportWidth - (allowTime ? 420 : 300); const top = popOverY > viewportHeight - 400; return `${right ? "md:-translate-x-1/2" : ""} ${top ? "md:-translate-y-[calc(100%+50px)]" : ""}`; @@ -327,7 +317,7 @@ const DateInputV2: React.FC = ({ {open && ( = ({ )} > close()} @@ -537,7 +527,7 @@ const DateInputV2: React.FC = ({
)} - {time && ( + {allowTime && (
{( [ diff --git a/src/components/Common/DateRangeInputV2.tsx b/src/components/Common/DateRangeInputV2.tsx index 689307dd59c..aa426ad0cb2 100644 --- a/src/components/Common/DateRangeInputV2.tsx +++ b/src/components/Common/DateRangeInputV2.tsx @@ -14,7 +14,7 @@ type Props = { disabled?: boolean; max?: Date; min?: Date; - time?: boolean; + allowTime?: boolean; }; const DateRangeInputV2 = ({ value, onChange, ...props }: Props) => { @@ -34,10 +34,9 @@ const DateRangeInputV2 = ({ value, onChange, ...props }: Props) => { }} min={props.min} max={end || props.max} - position="RIGHT-CENTER" placeholder="Start date" disabled={props.disabled} - time={props.time} + allowTime={props.allowTime} />
@@ -48,12 +47,11 @@ const DateRangeInputV2 = ({ value, onChange, ...props }: Props) => { onChange={(end) => onChange({ start, end })} min={start || props.min} max={props.max} - position="CENTER" disabled={props.disabled || !start} placeholder="End date" isOpen={showEndPicker} setIsOpen={setShowEndPicker} - time={props.time} + allowTime={props.allowTime} />
diff --git a/src/components/Common/prescription-builder/InvestigationBuilder.tsx b/src/components/Common/prescription-builder/InvestigationBuilder.tsx index 7c1910ee61d..8bee74b9067 100644 --- a/src/components/Common/prescription-builder/InvestigationBuilder.tsx +++ b/src/components/Common/prescription-builder/InvestigationBuilder.tsx @@ -228,7 +228,7 @@ export default function InvestigationBuilder( i, ) } - time + allowTime errorClassName="hidden" className="w-full" onFocus={() => setActiveIdx(i)} diff --git a/src/components/Common/prescription-builder/ProcedureBuilder.tsx b/src/components/Common/prescription-builder/ProcedureBuilder.tsx index eb6b128378a..36536c2435b 100644 --- a/src/components/Common/prescription-builder/ProcedureBuilder.tsx +++ b/src/components/Common/prescription-builder/ProcedureBuilder.tsx @@ -150,7 +150,7 @@ export default function ProcedureBuilder(props: Props) { i, ) } - time + allowTime errorClassName="hidden" className="w-full" onFocus={() => setActiveIdx(i)} diff --git a/src/components/DeathReport/DeathReport.tsx b/src/components/DeathReport/DeathReport.tsx index 702a486bdfb..00f6d6bd773 100644 --- a/src/components/DeathReport/DeathReport.tsx +++ b/src/components/DeathReport/DeathReport.tsx @@ -410,7 +410,6 @@ export default function PrintDeathReport(props: { id: string }) { @@ -428,14 +427,12 @@ export default function PrintDeathReport(props: { id: string }) {
@@ -477,7 +474,6 @@ export default function PrintDeathReport(props: { id: string }) { @@ -485,7 +481,6 @@ export default function PrintDeathReport(props: { id: string }) { @@ -534,7 +529,6 @@ export default function PrintDeathReport(props: { id: string }) { diff --git a/src/components/Facility/AssetCreate.tsx b/src/components/Facility/AssetCreate.tsx index ade70828bbd..60676f9ca18 100644 --- a/src/components/Facility/AssetCreate.tsx +++ b/src/components/Facility/AssetCreate.tsx @@ -834,7 +834,6 @@ const AssetCreate = (props: AssetProps) => { label={t("last_serviced_on")} name="last_serviced_on" className="mt-2" - position="TOP-RIGHT" disableFuture value={last_serviced_on && new Date(last_serviced_on)} onChange={(date) => { diff --git a/src/components/Facility/ConsultationForm.tsx b/src/components/Facility/ConsultationForm.tsx index 9b6f5d0cccc..9fe281635f2 100644 --- a/src/components/Facility/ConsultationForm.tsx +++ b/src/components/Facility/ConsultationForm.tsx @@ -1195,7 +1195,7 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { value: dayjs(e.value).format("YYYY-MM-DDTHH:mm"), }) } - time + allowTime errorClassName="hidden" /> @@ -1242,7 +1242,7 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { value: dayjs(e.value).format("YYYY-MM-DDTHH:mm"), }) } - time + allowTime errorClassName="hidden" /> {dayjs().diff(state.form.encounter_date, "day") > 30 && ( @@ -1281,7 +1281,7 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { value: dayjs(e.value).format("YYYY-MM-DDTHH:mm"), }) } - time + allowTime errorClassName="hidden" /> diff --git a/src/components/Facility/Consultations/Beds.tsx b/src/components/Facility/Consultations/Beds.tsx index 982780b74e4..5d43ffff7fd 100644 --- a/src/components/Facility/Consultations/Beds.tsx +++ b/src/components/Facility/Consultations/Beds.tsx @@ -215,8 +215,7 @@ const Beds = (props: BedsProps) => { max={new Date()} error="" errorClassName="hidden" - position="TOP-RIGHT" - time + allowTime />
Link Assets diff --git a/src/components/Facility/Consultations/DailyRoundsFilter.tsx b/src/components/Facility/Consultations/DailyRoundsFilter.tsx index 492604dbbe4..53232db9616 100644 --- a/src/components/Facility/Consultations/DailyRoundsFilter.tsx +++ b/src/components/Facility/Consultations/DailyRoundsFilter.tsx @@ -95,7 +95,7 @@ export default function DailyRoundsFilter(props: Props) { } max={new Date()} errorClassName="hidden" - time + allowTime /> { const updates: Record = { @@ -340,7 +339,7 @@ const DischargeModal = ({ ? errors?.death_datetime : errors?.discharge_date } - time + allowTime /> {discharge_reason !== diff --git a/src/components/Facility/TriageForm.tsx b/src/components/Facility/TriageForm.tsx index 72b391f2318..fe4499e3758 100644 --- a/src/components/Facility/TriageForm.tsx +++ b/src/components/Facility/TriageForm.tsx @@ -250,7 +250,6 @@ export const TriageForm = ({ facilityId, id }: Props) => { value={state.form.entry_date} disableFuture onChange={handleFormFieldChange} - position="LEFT" placeholder="Entry Date" error={state.errors.entry_date} /> diff --git a/src/components/Form/FormFields/DateFormField.tsx b/src/components/Form/FormFields/DateFormField.tsx index 2210db4a3df..c27e7421cbb 100644 --- a/src/components/Form/FormFields/DateFormField.tsx +++ b/src/components/Form/FormFields/DateFormField.tsx @@ -1,6 +1,4 @@ -import DateInputV2, { - DatePickerPosition, -} from "@/components/Common/DateInputV2"; +import DateInputV2 from "@/components/Common/DateInputV2"; import { FormFieldBaseProps, useFormFieldPropsResolver } from "./Utils"; import FormField from "./FormField"; @@ -11,10 +9,9 @@ type Props = FormFieldBaseProps & { placeholder?: string; max?: Date; min?: Date; - position?: DatePickerPosition; disableFuture?: boolean; disablePast?: boolean; - time?: boolean; + allowTime?: boolean; popOverClassName?: string; }; @@ -50,9 +47,8 @@ const DateFormField = (props: Props) => { disabled={field.disabled} max={props.max ?? (props.disableFuture ? new Date() : undefined)} min={props.min ?? (props.disablePast ? yesterday() : undefined)} - position={props.position ?? "RIGHT"} placeholder={props.placeholder} - time={props.time} + allowTime={props.allowTime} popOverClassName={props.popOverClassName} /> diff --git a/src/components/Form/FormFields/DateRangeFormField.tsx b/src/components/Form/FormFields/DateRangeFormField.tsx index 8dba2d5428c..a5e814278b8 100644 --- a/src/components/Form/FormFields/DateRangeFormField.tsx +++ b/src/components/Form/FormFields/DateRangeFormField.tsx @@ -10,7 +10,7 @@ type Props = FormFieldBaseProps & { min?: Date; disableFuture?: boolean; disablePast?: boolean; - time?: boolean; + allowTime?: boolean; }; /** @@ -40,7 +40,7 @@ const DateRangeFormField = (props: Props) => { disabled={field.disabled} min={props.min || (props.disableFuture ? new Date() : undefined)} max={props.max || (props.disablePast ? new Date() : undefined)} - time={props.time} + allowTime={props.allowTime} /> ); diff --git a/src/components/Medicine/AdministerMedicine.tsx b/src/components/Medicine/AdministerMedicine.tsx index c9d078a4ba1..13c6f4bab1a 100644 --- a/src/components/Medicine/AdministerMedicine.tsx +++ b/src/components/Medicine/AdministerMedicine.tsx @@ -151,8 +151,7 @@ export default function AdministerMedicine({ prescription, ...props }: Props) { min={new Date(prescription.created_date)} max={new Date()} errorClassName="hidden" - position="TOP-RIGHT" - time + allowTime />
diff --git a/src/components/Medicine/MedicineAdministration.tsx b/src/components/Medicine/MedicineAdministration.tsx index 098d54a8ca0..d2daf370207 100644 --- a/src/components/Medicine/MedicineAdministration.tsx +++ b/src/components/Medicine/MedicineAdministration.tsx @@ -219,7 +219,7 @@ export default function MedicineAdministration(props: Props) { max={new Date()} className="w-full" errorClassName="hidden" - time + allowTime /> diff --git a/src/components/Patient/DailyRounds.tsx b/src/components/Patient/DailyRounds.tsx index bf2f8214861..f6ac117c2ec 100644 --- a/src/components/Patient/DailyRounds.tsx +++ b/src/components/Patient/DailyRounds.tsx @@ -650,8 +650,7 @@ export const DailyRounds = (props: any) => { value: dayjs(e.value).format("YYYY-MM-DDTHH:mm"), }) } - position="LEFT" - time + allowTime errorClassName="hidden" /> diff --git a/src/components/Patient/PatientRegister.tsx b/src/components/Patient/PatientRegister.tsx index 77f43c04251..6aab7799772 100644 --- a/src/components/Patient/PatientRegister.tsx +++ b/src/components/Patient/PatientRegister.tsx @@ -1219,7 +1219,6 @@ export const PatientRegister = (props: PatientRegisterProps) => { {...field("date_of_birth")} errorClassName="hidden" required - position="LEFT" disableFuture /> @@ -1330,7 +1329,6 @@ export const PatientRegister = (props: PatientRegisterProps) => { containerClassName="w-full" {...field("last_menstruation_start_date")} label="Last Menstruation Start Date" - position="LEFT" disableFuture required /> @@ -1355,7 +1353,6 @@ export const PatientRegister = (props: PatientRegisterProps) => { containerClassName="w-full" {...field("date_of_delivery")} label="Date of Delivery" - position="LEFT" disableFuture required /> @@ -1727,7 +1724,6 @@ export const PatientRegister = (props: PatientRegisterProps) => { {...field("last_vaccinated_date")} label="Last Date of Vaccination" disableFuture={true} - position="LEFT" /> @@ -1759,7 +1755,6 @@ export const PatientRegister = (props: PatientRegisterProps) => { {...field("date_declared_positive")} label="Date Patient is Declared Positive for COVID" disableFuture - position="LEFT" /> @@ -1770,7 +1765,6 @@ export const PatientRegister = (props: PatientRegisterProps) => { id="date_of_test" label="Date of Sample given for COVID Test" disableFuture - position="LEFT" /> diff --git a/src/components/Symptoms/SymptomsBuilder.tsx b/src/components/Symptoms/SymptomsBuilder.tsx index 9e28410f0d6..3676e2ad607 100644 --- a/src/components/Symptoms/SymptomsBuilder.tsx +++ b/src/components/Symptoms/SymptomsBuilder.tsx @@ -184,7 +184,6 @@ const SymptomEntry = (props: { disableFuture disabled={disabled} onChange={props.onChange} - position="LEFT" errorClassName="hidden" /> setOnsetDate(value)} errorClassName="hidden" - position="CENTER" />
{ required value={getDate(state.form.date_of_birth)} onChange={handleDateChange} - position="LEFT" disableFuture /> diff --git a/src/components/Users/UserProfile.tsx b/src/components/Users/UserProfile.tsx index 7aa3c9eff34..fd574e0df1e 100644 --- a/src/components/Users/UserProfile.tsx +++ b/src/components/Users/UserProfile.tsx @@ -775,7 +775,6 @@ export default function UserProfile() { required className="col-span-6 sm:col-span-3" value={getDate(states.form.date_of_birth)} - position="LEFT" disableFuture={true} />