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 CHANGED
@@ -6974,6 +6974,39 @@ var ReadOnlyCheckbox = ({ fieldDef, value }) => {
6974
6974
  /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx("span", { className: "text-gray-400 italic", children: "Loading..." }) : displayText })
6975
6975
  ] });
6976
6976
  };
6977
+ function normalizeValue2(value) {
6978
+ if (!value || !Array.isArray(value)) return [];
6979
+ return value.map((item) => {
6980
+ if (item && typeof item === "object" && "specialization" in item) {
6981
+ return {
6982
+ specialization: String(item.specialization),
6983
+ is_urgent: Boolean(item.is_urgent)
6984
+ };
6985
+ }
6986
+ return { specialization: String(item), is_urgent: false };
6987
+ });
6988
+ }
6989
+ var ReadOnlyReferral = ({ fieldDef, value }) => {
6990
+ if (!fieldDef) return null;
6991
+ const items = normalizeValue2(value);
6992
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
6993
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-medium text-gray-700", children: fieldDef.label }),
6994
+ items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-gray-900 border border-gray-200 rounded-md p-3 bg-gray-50 min-h-[2.5rem]", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400 italic", children: "No value" }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1.5", children: items.map((item, i) => {
6995
+ const isUrgent = item.is_urgent;
6996
+ return /* @__PURE__ */ jsxRuntime.jsxs(
6997
+ "span",
6998
+ {
6999
+ 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",
7000
+ children: [
7001
+ isUrgent && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-shrink-0 bg-red-600 text-white text-[10px] font-bold px-1 py-0.5 rounded", children: "U" }),
7002
+ item.specialization
7003
+ ]
7004
+ },
7005
+ i
7006
+ );
7007
+ }) })
7008
+ ] });
7009
+ };
6977
7010
  var ReadOnlyFieldRenderer = ({ fieldDef, value }) => {
6978
7011
  if (!fieldDef) return null;
6979
7012
  switch (fieldDef.type) {
@@ -7002,6 +7035,8 @@ var ReadOnlyFieldRenderer = ({ fieldDef, value }) => {
7002
7035
  return /* @__PURE__ */ jsxRuntime.jsx(ReadOnlySignature, { fieldDef, value });
7003
7036
  case "editable_table":
7004
7037
  return /* @__PURE__ */ jsxRuntime.jsx(ReadOnlyTable, { fieldDef, value });
7038
+ case "referral":
7039
+ return /* @__PURE__ */ jsxRuntime.jsx(ReadOnlyReferral, { fieldDef, value });
7005
7040
  case "static_text": {
7006
7041
  const def = fieldDef;
7007
7042
  const size = def.size ?? "regular";