"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.TextView = void 0;
var _react = _interopRequireDefault(require("react"));
var _patternsFields = require("@wix/patterns-fields");
var _CellViewLayout = require("../CellViewLayout");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/EditableTable/cellTypes/text/View.tsx";
function resolveDisplayValue(value, validation) {
  const rule = validation == null ? void 0 : validation.find(r => r.type === 'specificValues');
  if (rule) {
    var _rule$values$find;
    return ((_rule$values$find = rule.values.find(v => v.id === value)) == null ? void 0 : _rule$values$find.value) ?? value ?? '';
  }
  return value ?? '';
}
const TextView = ({
  value,
  validation
}) => /*#__PURE__*/_react.default.createElement(_CellViewLayout.CellViewLayout, {
  __self: void 0,
  __source: {
    fileName: _jsxFileName,
    lineNumber: 19,
    columnNumber: 3
  }
}, /*#__PURE__*/_react.default.createElement(_patternsFields.TextView, {
  data: resolveDisplayValue(value, validation),
  __self: void 0,
  __source: {
    fileName: _jsxFileName,
    lineNumber: 20,
    columnNumber: 5
  }
}));
exports.TextView = TextView;
//# sourceMappingURL=View.js.map