formanitor 0.0.19 → 0.0.20
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 +35 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +35 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6944,6 +6944,39 @@ var ReadOnlyCheckbox = ({ fieldDef, value }) => {
|
|
|
6944
6944
|
/* @__PURE__ */ jsx("div", { className: "text-gray-900 border border-gray-200 rounded-md p-3 bg-gray-50 min-h-[2.5rem] flex items-center", children: loading ? /* @__PURE__ */ jsx("span", { className: "text-gray-400 italic", children: "Loading..." }) : displayText })
|
|
6945
6945
|
] });
|
|
6946
6946
|
};
|
|
6947
|
+
function normalizeValue2(value) {
|
|
6948
|
+
if (!value || !Array.isArray(value)) return [];
|
|
6949
|
+
return value.map((item) => {
|
|
6950
|
+
if (item && typeof item === "object" && "specialization" in item) {
|
|
6951
|
+
return {
|
|
6952
|
+
specialization: String(item.specialization),
|
|
6953
|
+
is_urgent: Boolean(item.is_urgent)
|
|
6954
|
+
};
|
|
6955
|
+
}
|
|
6956
|
+
return { specialization: String(item), is_urgent: false };
|
|
6957
|
+
});
|
|
6958
|
+
}
|
|
6959
|
+
var ReadOnlyReferral = ({ fieldDef, value }) => {
|
|
6960
|
+
if (!fieldDef) return null;
|
|
6961
|
+
const items = normalizeValue2(value);
|
|
6962
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
6963
|
+
/* @__PURE__ */ jsx(Label, { className: "text-sm font-medium text-gray-700", children: fieldDef.label }),
|
|
6964
|
+
items.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-gray-900 border border-gray-200 rounded-md p-3 bg-gray-50 min-h-[2.5rem]", children: /* @__PURE__ */ jsx("span", { className: "text-gray-400 italic", children: "No value" }) }) : /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5", children: items.map((item, i) => {
|
|
6965
|
+
const isUrgent = item.is_urgent;
|
|
6966
|
+
return /* @__PURE__ */ jsxs(
|
|
6967
|
+
"span",
|
|
6968
|
+
{
|
|
6969
|
+
className: isUrgent ? "inline-flex items-center gap-1 px-2 py-0.5 bg-red-100 text-red-800 border border-red-300 rounded-full text-xs font-medium" : "inline-flex items-center gap-1 px-2 py-0.5 bg-blue-100 text-blue-800 rounded-full text-xs font-medium",
|
|
6970
|
+
children: [
|
|
6971
|
+
isUrgent && /* @__PURE__ */ jsx("span", { className: "flex-shrink-0 bg-red-600 text-white text-[10px] font-bold px-1 py-0.5 rounded", children: "U" }),
|
|
6972
|
+
item.specialization
|
|
6973
|
+
]
|
|
6974
|
+
},
|
|
6975
|
+
i
|
|
6976
|
+
);
|
|
6977
|
+
}) })
|
|
6978
|
+
] });
|
|
6979
|
+
};
|
|
6947
6980
|
var ReadOnlyFieldRenderer = ({ fieldDef, value }) => {
|
|
6948
6981
|
if (!fieldDef) return null;
|
|
6949
6982
|
switch (fieldDef.type) {
|
|
@@ -6972,6 +7005,8 @@ var ReadOnlyFieldRenderer = ({ fieldDef, value }) => {
|
|
|
6972
7005
|
return /* @__PURE__ */ jsx(ReadOnlySignature, { fieldDef, value });
|
|
6973
7006
|
case "editable_table":
|
|
6974
7007
|
return /* @__PURE__ */ jsx(ReadOnlyTable, { fieldDef, value });
|
|
7008
|
+
case "referral":
|
|
7009
|
+
return /* @__PURE__ */ jsx(ReadOnlyReferral, { fieldDef, value });
|
|
6975
7010
|
case "static_text": {
|
|
6976
7011
|
const def = fieldDef;
|
|
6977
7012
|
const size = def.size ?? "regular";
|