@ttn-shared/ui 1.0.3 → 1.0.4

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/index.cjs CHANGED
@@ -454,11 +454,11 @@ var PatientVoluntaryInsuranceForm = ({
454
454
  companyTypeTag || ""
455
455
  );
456
456
  }
457
- form.setFieldValue(`voluntaryInsurance.${index}.companyType`, value || "");
458
- form.setFieldValue(`voluntaryInsurance.${index}.companyId`, "");
459
- form.setFieldValue(`voluntaryInsurance.${index}.plan`, "");
460
- form.setFieldValue(`voluntaryInsurance.${index}.population`, "");
461
- form.setFieldValue(`voluntaryInsurance.${index}.groupId`, "");
457
+ form.setFieldValue(`voluntaryInsurance.${index}.companyType`, value);
458
+ form.setFieldValue(`voluntaryInsurance.${index}.companyId`, null);
459
+ form.setFieldValue(`voluntaryInsurance.${index}.plan`, null);
460
+ form.setFieldValue(`voluntaryInsurance.${index}.population`, null);
461
+ form.setFieldValue(`voluntaryInsurance.${index}.groupId`, null);
462
462
  form.setFieldValue(`voluntaryInsurance.${index}.policyNumber`, "");
463
463
  },
464
464
  "data-testid": `patient-form-voluntary-insurance-company-type-select-${index}`
@@ -473,10 +473,10 @@ var PatientVoluntaryInsuranceForm = ({
473
473
  data: companyClientOptions,
474
474
  ...form.getInputProps(`voluntaryInsurance.${index}.companyId`),
475
475
  onChange: (value) => {
476
- form.setFieldValue(`voluntaryInsurance.${index}.companyId`, value || "");
477
- form.setFieldValue(`voluntaryInsurance.${index}.plan`, "");
478
- form.setFieldValue(`voluntaryInsurance.${index}.population`, "");
479
- form.setFieldValue(`voluntaryInsurance.${index}.groupId`, "");
476
+ form.setFieldValue(`voluntaryInsurance.${index}.companyId`, value);
477
+ form.setFieldValue(`voluntaryInsurance.${index}.plan`, null);
478
+ form.setFieldValue(`voluntaryInsurance.${index}.population`, null);
479
+ form.setFieldValue(`voluntaryInsurance.${index}.groupId`, null);
480
480
  form.setFieldValue(`voluntaryInsurance.${index}.policyNumber`, "");
481
481
  },
482
482
  "data-testid": `patient-form-voluntary-insurance-company-select-${index}`
@@ -491,9 +491,9 @@ var PatientVoluntaryInsuranceForm = ({
491
491
  data: contractOptions,
492
492
  ...form.getInputProps(`voluntaryInsurance.${index}.plan`),
493
493
  onChange: (value) => {
494
- form.setFieldValue(`voluntaryInsurance.${index}.plan`, value || "");
495
- form.setFieldValue(`voluntaryInsurance.${index}.population`, "");
496
- form.setFieldValue(`voluntaryInsurance.${index}.groupId`, "");
494
+ form.setFieldValue(`voluntaryInsurance.${index}.plan`, value);
495
+ form.setFieldValue(`voluntaryInsurance.${index}.population`, null);
496
+ form.setFieldValue(`voluntaryInsurance.${index}.groupId`, null);
497
497
  form.setFieldValue(`voluntaryInsurance.${index}.policyNumber`, "");
498
498
  },
499
499
  "data-testid": `patient-form-voluntary-insurance-plan-select-${index}`
@@ -1451,7 +1451,7 @@ var PatientForm = ({
1451
1451
  const form = (0, import_form.useForm)({
1452
1452
  mode: "controlled",
1453
1453
  initialValues: {
1454
- documentTypeId: "",
1454
+ documentTypeId: null,
1455
1455
  documentNumber: "",
1456
1456
  firstName: "",
1457
1457
  middleName: "",
@@ -1460,30 +1460,30 @@ var PatientForm = ({
1460
1460
  birthDate: "",
1461
1461
  age: "",
1462
1462
  whatsapp: "",
1463
- gender: "",
1464
- affiliationTypeId: "",
1465
- bloodType: "",
1463
+ gender: null,
1464
+ affiliationTypeId: null,
1465
+ bloodType: null,
1466
1466
  email: "",
1467
- provinceId: "",
1468
- cityId: "",
1467
+ provinceId: null,
1468
+ cityId: null,
1469
1469
  homeAddress: "",
1470
1470
  neighborhood: "",
1471
1471
  cellphone: "",
1472
1472
  homephone: "",
1473
1473
  emergencyContact: "",
1474
- maritalStatus: "",
1474
+ maritalStatus: null,
1475
1475
  occupation: "",
1476
1476
  use_glasses: "",
1477
1477
  use_contact_lens: "",
1478
1478
  isDataPolicyAccepted: false,
1479
- stratumId: "",
1480
- educationLevelId: "",
1481
- ethnicGroupId: "",
1479
+ stratumId: null,
1480
+ educationLevelId: null,
1481
+ ethnicGroupId: null,
1482
1482
  mandatoryInsurance: {
1483
- companyId: "",
1484
- plan: "",
1485
- population: "",
1486
- groupId: "",
1483
+ companyId: null,
1484
+ plan: null,
1485
+ population: null,
1486
+ groupId: null,
1487
1487
  policyNumber: ""
1488
1488
  },
1489
1489
  voluntaryInsurance: []
@@ -1683,16 +1683,17 @@ var PatientForm = ({
1683
1683
  onBack?.();
1684
1684
  };
1685
1685
  const handleAddVoluntaryInsurance = () => {
1686
- form.insertListItem("voluntaryInsurance", {
1686
+ const newInsurance = {
1687
1687
  companyTypeTag: "",
1688
1688
  id: Date.now().toString(),
1689
1689
  companyType: "",
1690
- companyId: "",
1691
- plan: "",
1692
- population: "",
1693
- groupId: "",
1690
+ companyId: null,
1691
+ plan: null,
1692
+ population: null,
1693
+ groupId: null,
1694
1694
  policyNumber: ""
1695
- });
1695
+ };
1696
+ form.insertListItem("voluntaryInsurance", newInsurance);
1696
1697
  };
1697
1698
  (0, import_react7.useEffect)(() => {
1698
1699
  if (!patientInfo || mode === "create") return;
@@ -1994,8 +1995,8 @@ var PatientForm = ({
1994
1995
  data: provinceOptions,
1995
1996
  ...form.getInputProps("provinceId"),
1996
1997
  onChange: (value) => {
1997
- form.setFieldValue("provinceId", value || "");
1998
- form.setFieldValue("cityId", "");
1998
+ form.setFieldValue("provinceId", value);
1999
+ form.setFieldValue("cityId", null);
1999
2000
  },
2000
2001
  "data-testid": "patient-form-province-select"
2001
2002
  }
@@ -2100,10 +2101,10 @@ var PatientForm = ({
2100
2101
  data: companyClientOptions,
2101
2102
  ...form.getInputProps("mandatoryInsurance.companyId"),
2102
2103
  onChange: (value) => {
2103
- form.setFieldValue("mandatoryInsurance.companyId", value || "");
2104
- form.setFieldValue("mandatoryInsurance.plan", "");
2105
- form.setFieldValue("mandatoryInsurance.population", "");
2106
- form.setFieldValue("mandatoryInsurance.groupId", "");
2104
+ form.setFieldValue("mandatoryInsurance.companyId", value);
2105
+ form.setFieldValue("mandatoryInsurance.plan", null);
2106
+ form.setFieldValue("mandatoryInsurance.population", null);
2107
+ form.setFieldValue("mandatoryInsurance.groupId", null);
2107
2108
  form.setFieldValue("mandatoryInsurance.policyNumber", "");
2108
2109
  },
2109
2110
  "data-testid": "patient-form-mandatory-insurance-company-select"
@@ -2118,9 +2119,9 @@ var PatientForm = ({
2118
2119
  data: contractOptions,
2119
2120
  ...form.getInputProps("mandatoryInsurance.plan"),
2120
2121
  onChange: (value) => {
2121
- form.setFieldValue("mandatoryInsurance.plan", value || "");
2122
- form.setFieldValue("mandatoryInsurance.population", "");
2123
- form.setFieldValue("mandatoryInsurance.groupId", "");
2122
+ form.setFieldValue("mandatoryInsurance.plan", value);
2123
+ form.setFieldValue("mandatoryInsurance.population", null);
2124
+ form.setFieldValue("mandatoryInsurance.groupId", null);
2124
2125
  form.setFieldValue("mandatoryInsurance.policyNumber", "");
2125
2126
  },
2126
2127
  "data-testid": "patient-form-mandatory-insurance-plan-select"
@@ -2258,14 +2259,14 @@ var createPatientPayload = (values) => {
2258
2259
  birthDate: values.birthDate,
2259
2260
  age: values.age,
2260
2261
  whatsapp: String(values.whatsapp),
2261
- gender: values.gender,
2262
+ gender: values.gender ?? "",
2262
2263
  affiliationType: Number(values.affiliationTypeId),
2263
2264
  email: values.email,
2264
- maritalStatus: values.maritalStatus,
2265
+ maritalStatus: values.maritalStatus ?? "",
2265
2266
  provinceId: Number(values.provinceId),
2266
2267
  cityId: Number(values.cityId),
2267
2268
  homeAddress: values.homeAddress,
2268
- bloodType: values.bloodType,
2269
+ bloodType: values.bloodType ?? "",
2269
2270
  cellphone: String(values.cellphone),
2270
2271
  homephone: String(values.homephone),
2271
2272
  emergencyContact: values.emergencyContact,
package/dist/index.d.cts CHANGED
@@ -8,7 +8,7 @@ interface SelectOption {
8
8
 
9
9
  type PatientFormMode = "create" | "edit" | "view";
10
10
  interface PatientFormValues {
11
- documentTypeId: string;
11
+ documentTypeId: string | null;
12
12
  documentNumber: string;
13
13
  firstName: string;
14
14
  middleName: string;
@@ -17,14 +17,14 @@ interface PatientFormValues {
17
17
  birthDate: string;
18
18
  age: string;
19
19
  whatsapp: number | string;
20
- gender: string;
21
- affiliationTypeId: string;
20
+ gender: string | null;
21
+ affiliationTypeId: string | null;
22
22
  email: string;
23
- maritalStatus: string;
24
- provinceId: string;
25
- cityId: string;
23
+ maritalStatus: string | null;
24
+ provinceId: string | null;
25
+ cityId: string | null;
26
26
  homeAddress: string;
27
- bloodType: string;
27
+ bloodType: string | null;
28
28
  neighborhood: string;
29
29
  cellphone: number | string;
30
30
  homephone: number | string;
@@ -33,24 +33,24 @@ interface PatientFormValues {
33
33
  use_glasses: string;
34
34
  use_contact_lens: string;
35
35
  isDataPolicyAccepted: boolean;
36
- stratumId: string;
37
- educationLevelId: string;
38
- ethnicGroupId: string;
36
+ stratumId: string | null;
37
+ educationLevelId: string | null;
38
+ ethnicGroupId: string | null;
39
39
  mandatoryInsurance: {
40
- companyId: string;
41
- plan: string;
42
- population: string;
43
- groupId: string;
40
+ companyId: string | null;
41
+ plan: string | null;
42
+ population: string | null;
43
+ groupId: string | null;
44
44
  policyNumber: string;
45
45
  };
46
46
  voluntaryInsurance: {
47
47
  id: string;
48
48
  companyTypeTag: string;
49
49
  companyType: string;
50
- companyId: string;
51
- plan: string;
52
- population: string;
53
- groupId: string;
50
+ companyId: string | null;
51
+ plan: string | null;
52
+ population: string | null;
53
+ groupId: string | null;
54
54
  policyNumber: string;
55
55
  }[];
56
56
  }
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ interface SelectOption {
8
8
 
9
9
  type PatientFormMode = "create" | "edit" | "view";
10
10
  interface PatientFormValues {
11
- documentTypeId: string;
11
+ documentTypeId: string | null;
12
12
  documentNumber: string;
13
13
  firstName: string;
14
14
  middleName: string;
@@ -17,14 +17,14 @@ interface PatientFormValues {
17
17
  birthDate: string;
18
18
  age: string;
19
19
  whatsapp: number | string;
20
- gender: string;
21
- affiliationTypeId: string;
20
+ gender: string | null;
21
+ affiliationTypeId: string | null;
22
22
  email: string;
23
- maritalStatus: string;
24
- provinceId: string;
25
- cityId: string;
23
+ maritalStatus: string | null;
24
+ provinceId: string | null;
25
+ cityId: string | null;
26
26
  homeAddress: string;
27
- bloodType: string;
27
+ bloodType: string | null;
28
28
  neighborhood: string;
29
29
  cellphone: number | string;
30
30
  homephone: number | string;
@@ -33,24 +33,24 @@ interface PatientFormValues {
33
33
  use_glasses: string;
34
34
  use_contact_lens: string;
35
35
  isDataPolicyAccepted: boolean;
36
- stratumId: string;
37
- educationLevelId: string;
38
- ethnicGroupId: string;
36
+ stratumId: string | null;
37
+ educationLevelId: string | null;
38
+ ethnicGroupId: string | null;
39
39
  mandatoryInsurance: {
40
- companyId: string;
41
- plan: string;
42
- population: string;
43
- groupId: string;
40
+ companyId: string | null;
41
+ plan: string | null;
42
+ population: string | null;
43
+ groupId: string | null;
44
44
  policyNumber: string;
45
45
  };
46
46
  voluntaryInsurance: {
47
47
  id: string;
48
48
  companyTypeTag: string;
49
49
  companyType: string;
50
- companyId: string;
51
- plan: string;
52
- population: string;
53
- groupId: string;
50
+ companyId: string | null;
51
+ plan: string | null;
52
+ population: string | null;
53
+ groupId: string | null;
54
54
  policyNumber: string;
55
55
  }[];
56
56
  }
package/dist/index.js CHANGED
@@ -431,11 +431,11 @@ var PatientVoluntaryInsuranceForm = ({
431
431
  companyTypeTag || ""
432
432
  );
433
433
  }
434
- form.setFieldValue(`voluntaryInsurance.${index}.companyType`, value || "");
435
- form.setFieldValue(`voluntaryInsurance.${index}.companyId`, "");
436
- form.setFieldValue(`voluntaryInsurance.${index}.plan`, "");
437
- form.setFieldValue(`voluntaryInsurance.${index}.population`, "");
438
- form.setFieldValue(`voluntaryInsurance.${index}.groupId`, "");
434
+ form.setFieldValue(`voluntaryInsurance.${index}.companyType`, value);
435
+ form.setFieldValue(`voluntaryInsurance.${index}.companyId`, null);
436
+ form.setFieldValue(`voluntaryInsurance.${index}.plan`, null);
437
+ form.setFieldValue(`voluntaryInsurance.${index}.population`, null);
438
+ form.setFieldValue(`voluntaryInsurance.${index}.groupId`, null);
439
439
  form.setFieldValue(`voluntaryInsurance.${index}.policyNumber`, "");
440
440
  },
441
441
  "data-testid": `patient-form-voluntary-insurance-company-type-select-${index}`
@@ -450,10 +450,10 @@ var PatientVoluntaryInsuranceForm = ({
450
450
  data: companyClientOptions,
451
451
  ...form.getInputProps(`voluntaryInsurance.${index}.companyId`),
452
452
  onChange: (value) => {
453
- form.setFieldValue(`voluntaryInsurance.${index}.companyId`, value || "");
454
- form.setFieldValue(`voluntaryInsurance.${index}.plan`, "");
455
- form.setFieldValue(`voluntaryInsurance.${index}.population`, "");
456
- form.setFieldValue(`voluntaryInsurance.${index}.groupId`, "");
453
+ form.setFieldValue(`voluntaryInsurance.${index}.companyId`, value);
454
+ form.setFieldValue(`voluntaryInsurance.${index}.plan`, null);
455
+ form.setFieldValue(`voluntaryInsurance.${index}.population`, null);
456
+ form.setFieldValue(`voluntaryInsurance.${index}.groupId`, null);
457
457
  form.setFieldValue(`voluntaryInsurance.${index}.policyNumber`, "");
458
458
  },
459
459
  "data-testid": `patient-form-voluntary-insurance-company-select-${index}`
@@ -468,9 +468,9 @@ var PatientVoluntaryInsuranceForm = ({
468
468
  data: contractOptions,
469
469
  ...form.getInputProps(`voluntaryInsurance.${index}.plan`),
470
470
  onChange: (value) => {
471
- form.setFieldValue(`voluntaryInsurance.${index}.plan`, value || "");
472
- form.setFieldValue(`voluntaryInsurance.${index}.population`, "");
473
- form.setFieldValue(`voluntaryInsurance.${index}.groupId`, "");
471
+ form.setFieldValue(`voluntaryInsurance.${index}.plan`, value);
472
+ form.setFieldValue(`voluntaryInsurance.${index}.population`, null);
473
+ form.setFieldValue(`voluntaryInsurance.${index}.groupId`, null);
474
474
  form.setFieldValue(`voluntaryInsurance.${index}.policyNumber`, "");
475
475
  },
476
476
  "data-testid": `patient-form-voluntary-insurance-plan-select-${index}`
@@ -1473,7 +1473,7 @@ var PatientForm = ({
1473
1473
  const form = useForm({
1474
1474
  mode: "controlled",
1475
1475
  initialValues: {
1476
- documentTypeId: "",
1476
+ documentTypeId: null,
1477
1477
  documentNumber: "",
1478
1478
  firstName: "",
1479
1479
  middleName: "",
@@ -1482,30 +1482,30 @@ var PatientForm = ({
1482
1482
  birthDate: "",
1483
1483
  age: "",
1484
1484
  whatsapp: "",
1485
- gender: "",
1486
- affiliationTypeId: "",
1487
- bloodType: "",
1485
+ gender: null,
1486
+ affiliationTypeId: null,
1487
+ bloodType: null,
1488
1488
  email: "",
1489
- provinceId: "",
1490
- cityId: "",
1489
+ provinceId: null,
1490
+ cityId: null,
1491
1491
  homeAddress: "",
1492
1492
  neighborhood: "",
1493
1493
  cellphone: "",
1494
1494
  homephone: "",
1495
1495
  emergencyContact: "",
1496
- maritalStatus: "",
1496
+ maritalStatus: null,
1497
1497
  occupation: "",
1498
1498
  use_glasses: "",
1499
1499
  use_contact_lens: "",
1500
1500
  isDataPolicyAccepted: false,
1501
- stratumId: "",
1502
- educationLevelId: "",
1503
- ethnicGroupId: "",
1501
+ stratumId: null,
1502
+ educationLevelId: null,
1503
+ ethnicGroupId: null,
1504
1504
  mandatoryInsurance: {
1505
- companyId: "",
1506
- plan: "",
1507
- population: "",
1508
- groupId: "",
1505
+ companyId: null,
1506
+ plan: null,
1507
+ population: null,
1508
+ groupId: null,
1509
1509
  policyNumber: ""
1510
1510
  },
1511
1511
  voluntaryInsurance: []
@@ -1705,16 +1705,17 @@ var PatientForm = ({
1705
1705
  onBack?.();
1706
1706
  };
1707
1707
  const handleAddVoluntaryInsurance = () => {
1708
- form.insertListItem("voluntaryInsurance", {
1708
+ const newInsurance = {
1709
1709
  companyTypeTag: "",
1710
1710
  id: Date.now().toString(),
1711
1711
  companyType: "",
1712
- companyId: "",
1713
- plan: "",
1714
- population: "",
1715
- groupId: "",
1712
+ companyId: null,
1713
+ plan: null,
1714
+ population: null,
1715
+ groupId: null,
1716
1716
  policyNumber: ""
1717
- });
1717
+ };
1718
+ form.insertListItem("voluntaryInsurance", newInsurance);
1718
1719
  };
1719
1720
  useEffect3(() => {
1720
1721
  if (!patientInfo || mode === "create") return;
@@ -2016,8 +2017,8 @@ var PatientForm = ({
2016
2017
  data: provinceOptions,
2017
2018
  ...form.getInputProps("provinceId"),
2018
2019
  onChange: (value) => {
2019
- form.setFieldValue("provinceId", value || "");
2020
- form.setFieldValue("cityId", "");
2020
+ form.setFieldValue("provinceId", value);
2021
+ form.setFieldValue("cityId", null);
2021
2022
  },
2022
2023
  "data-testid": "patient-form-province-select"
2023
2024
  }
@@ -2122,10 +2123,10 @@ var PatientForm = ({
2122
2123
  data: companyClientOptions,
2123
2124
  ...form.getInputProps("mandatoryInsurance.companyId"),
2124
2125
  onChange: (value) => {
2125
- form.setFieldValue("mandatoryInsurance.companyId", value || "");
2126
- form.setFieldValue("mandatoryInsurance.plan", "");
2127
- form.setFieldValue("mandatoryInsurance.population", "");
2128
- form.setFieldValue("mandatoryInsurance.groupId", "");
2126
+ form.setFieldValue("mandatoryInsurance.companyId", value);
2127
+ form.setFieldValue("mandatoryInsurance.plan", null);
2128
+ form.setFieldValue("mandatoryInsurance.population", null);
2129
+ form.setFieldValue("mandatoryInsurance.groupId", null);
2129
2130
  form.setFieldValue("mandatoryInsurance.policyNumber", "");
2130
2131
  },
2131
2132
  "data-testid": "patient-form-mandatory-insurance-company-select"
@@ -2140,9 +2141,9 @@ var PatientForm = ({
2140
2141
  data: contractOptions,
2141
2142
  ...form.getInputProps("mandatoryInsurance.plan"),
2142
2143
  onChange: (value) => {
2143
- form.setFieldValue("mandatoryInsurance.plan", value || "");
2144
- form.setFieldValue("mandatoryInsurance.population", "");
2145
- form.setFieldValue("mandatoryInsurance.groupId", "");
2144
+ form.setFieldValue("mandatoryInsurance.plan", value);
2145
+ form.setFieldValue("mandatoryInsurance.population", null);
2146
+ form.setFieldValue("mandatoryInsurance.groupId", null);
2146
2147
  form.setFieldValue("mandatoryInsurance.policyNumber", "");
2147
2148
  },
2148
2149
  "data-testid": "patient-form-mandatory-insurance-plan-select"
@@ -2280,14 +2281,14 @@ var createPatientPayload = (values) => {
2280
2281
  birthDate: values.birthDate,
2281
2282
  age: values.age,
2282
2283
  whatsapp: String(values.whatsapp),
2283
- gender: values.gender,
2284
+ gender: values.gender ?? "",
2284
2285
  affiliationType: Number(values.affiliationTypeId),
2285
2286
  email: values.email,
2286
- maritalStatus: values.maritalStatus,
2287
+ maritalStatus: values.maritalStatus ?? "",
2287
2288
  provinceId: Number(values.provinceId),
2288
2289
  cityId: Number(values.cityId),
2289
2290
  homeAddress: values.homeAddress,
2290
- bloodType: values.bloodType,
2291
+ bloodType: values.bloodType ?? "",
2291
2292
  cellphone: String(values.cellphone),
2292
2293
  homephone: String(values.homephone),
2293
2294
  emergencyContact: values.emergencyContact,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttn-shared/ui",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "files": [
@@ -14,6 +14,11 @@
14
14
  "shared"
15
15
  ],
16
16
  "description": "A shared UI component library for TTN projects.",
17
+ "scripts": {
18
+ "build": "tsup src/index.ts",
19
+ "lint": "eslint 'src/**/*.{ts,tsx}' --fix",
20
+ "format": "prettier --write 'src/**/*.{ts,tsx,js,json,md}'"
21
+ },
17
22
  "main": "./dist/index.cjs",
18
23
  "module": "./dist/index.js",
19
24
  "types": "./dist/index.d.ts",
@@ -53,10 +58,5 @@
53
58
  "@tanstack/react-query": ">=5.0.0",
54
59
  "react": ">=18.0.0",
55
60
  "react-dom": ">=18.0.0"
56
- },
57
- "scripts": {
58
- "build": "tsup src/index.ts",
59
- "lint": "eslint 'src/**/*.{ts,tsx}' --fix",
60
- "format": "prettier --write 'src/**/*.{ts,tsx,js,json,md}'"
61
61
  }
62
- }
62
+ }