formanitor 0.0.18 → 0.0.19

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.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- type FieldType = 'text' | 'number' | 'textarea' | 'select' | 'multiselect' | 'radio' | 'repeatable' | 'checkbox' | 'image_upload' | 'signature' | 'date' | 'datetime' | 'editable_table' | 'static_text' | 'medications' | 'investigations' | 'procedures' | 'vitals' | 'referral' | 'followup' | string;
3
+ type FieldType = 'text' | 'number' | 'textarea' | 'select' | 'multiselect' | 'radio' | 'repeatable' | 'checkbox' | 'image_upload' | 'signature' | 'date' | 'datetime' | 'editable_table' | 'static_text' | 'medications' | 'investigations' | 'procedures' | 'vitals' | 'hidden_vitals' | 'referral' | 'followup' | string;
4
4
  interface ValidationRule {
5
5
  min?: number;
6
6
  max?: number;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- type FieldType = 'text' | 'number' | 'textarea' | 'select' | 'multiselect' | 'radio' | 'repeatable' | 'checkbox' | 'image_upload' | 'signature' | 'date' | 'datetime' | 'editable_table' | 'static_text' | 'medications' | 'investigations' | 'procedures' | 'vitals' | 'referral' | 'followup' | string;
3
+ type FieldType = 'text' | 'number' | 'textarea' | 'select' | 'multiselect' | 'radio' | 'repeatable' | 'checkbox' | 'image_upload' | 'signature' | 'date' | 'datetime' | 'editable_table' | 'static_text' | 'medications' | 'investigations' | 'procedures' | 'vitals' | 'hidden_vitals' | 'referral' | 'followup' | string;
4
4
  interface ValidationRule {
5
5
  min?: number;
6
6
  max?: number;
package/dist/index.mjs CHANGED
@@ -3763,6 +3763,38 @@ var VitalsWidget = ({ fieldId }) => {
3763
3763
  }
3764
3764
  );
3765
3765
  };
3766
+ var HiddenVitalsWidget = ({ fieldId }) => {
3767
+ const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
3768
+ const { state } = useForm();
3769
+ const showError = !!error && (touched || state.submitAttempted);
3770
+ if (!fieldDef) return null;
3771
+ const height = "height" in fieldDef ? fieldDef.height : void 0;
3772
+ const theme = getThemeConfig("textarea", fieldDef.theme);
3773
+ const wrapperClass = cn(theme?.wrapperClassName ?? "space-y-2", "sr-only");
3774
+ const labelClass = theme?.labelClassName;
3775
+ const inputClass = cn(theme?.inputClassName, showError && "border-red-500");
3776
+ const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
3777
+ fieldDef.label,
3778
+ " ",
3779
+ fieldDef.required && /* @__PURE__ */ jsx("span", { className: "text-red-500", children: "*" })
3780
+ ] });
3781
+ return /* @__PURE__ */ jsxs("div", { className: wrapperClass, "aria-hidden": "true", children: [
3782
+ theme ? /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, children: labelContent }),
3783
+ /* @__PURE__ */ jsx(
3784
+ Textarea,
3785
+ {
3786
+ id: fieldId,
3787
+ value: value ?? "",
3788
+ onChange: (e) => setValue(e.target.value),
3789
+ onBlur: setTouched,
3790
+ disabled,
3791
+ className: inputClass,
3792
+ ...height != null && { height }
3793
+ }
3794
+ ),
3795
+ showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
3796
+ ] });
3797
+ };
3766
3798
  function normalizeOptions(response) {
3767
3799
  if (Array.isArray(response)) {
3768
3800
  return response.map((o) => ({ label: String(o.label), value: String(o.value) }));
@@ -6379,6 +6411,8 @@ var FieldRenderer = ({ fieldId }) => {
6379
6411
  return /* @__PURE__ */ jsx(DifferentialDiagnosisWidget, { fieldId });
6380
6412
  case "vitals":
6381
6413
  return /* @__PURE__ */ jsx(VitalsWidget, { fieldId });
6414
+ case "hidden_vitals":
6415
+ return /* @__PURE__ */ jsx(HiddenVitalsWidget, { fieldId });
6382
6416
  case "referral":
6383
6417
  return /* @__PURE__ */ jsx(ReferralWidget, { fieldId });
6384
6418
  case "followup":