UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

55 lines (54 loc) 1.82 kB
import { jsxs as o, Fragment as u, jsx as e } from "react/jsx-runtime"; import { Tooltip as T, TextField as g, alpha as v } from "@mui/material"; import { ColumnTypeEnum as F } from "@sage-bionetworks/synapse-types"; import { isFormDataValueSmallerThanRecommendedValue as b, getFormDataValueAsNumber as c } from "../TableColumnSchemaEditorUtils.js"; function w(h) { const { value: l, originalValue: a, recommendedValue: t, columnType: p, error: x, ...r } = h, n = b(l, t), f = a != null && c(l) !== c(a), s = !!x || n; let i = null, d; return n ? i = /* @__PURE__ */ o(u, { children: [ /* @__PURE__ */ e("p", { children: "Data annotations are longer than allowed by current schema." }), /* @__PURE__ */ o("p", { children: [ "Recommended size is ", /* @__PURE__ */ e("strong", { children: t }), "." ] }), F.STRING === p && /* @__PURE__ */ e("p", { children: "If unsure, choose “MediumText” from the Column Type menu." }) ] }) : f && (i = /* @__PURE__ */ o(u, { children: [ /* @__PURE__ */ e("p", { children: "This value has changed since the table was last saved." }), /* @__PURE__ */ o("p", { children: [ "The last saved value was ", a, "." ] }) ] }), d = (m) => ({ "& .MuiInputBase-root": { backgroundColor: v(m.palette.info.main, 0.1), border: "1px solid", borderColor: m.palette.info.main } })), /* @__PURE__ */ e(T, { title: i, children: /* @__PURE__ */ e( g, { value: l ?? "", error: s, color: s ? "error" : void 0, focused: n ? !0 : void 0, sx: [ ...Array.isArray(r.sx) ? r.sx : [r.sx], d ], ...r } ) }); } export { w as FieldWithRecommendedMinimum }; //# sourceMappingURL=FieldWithRecommendedMinimum.js.map