@visiion/forms-library 1.4.16 → 1.4.17

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.esm.js CHANGED
@@ -20037,6 +20037,16 @@ var Checklist = function (_a) {
20037
20037
  var _d = useState((props === null || props === void 0 ? void 0 : props.valueOtraMedida) || ""), otraMedida = _d[0], setOtraMedida = _d[1];
20038
20038
  var options = field.options || [];
20039
20039
  var isOtraMedidaRequired = selectedOptions.includes("otra-medida");
20040
+ var handleOtraMedida = function () {
20041
+ try {
20042
+ var array = JSON.parse(value);
20043
+ var foundValue = (array === null || array === void 0 ? void 0 : array.find(function (opt) { return opt.includes("otra-medida-value-"); })) || "";
20044
+ return foundValue.replace("otra-medida-value-", "");
20045
+ }
20046
+ catch (error) {
20047
+ return otraMedida || "";
20048
+ }
20049
+ };
20040
20050
  useEffect(function () {
20041
20051
  setSelectedOptions(value);
20042
20052
  }, [value]);
@@ -20082,7 +20092,7 @@ var Checklist = function (_a) {
20082
20092
  };
20083
20093
  return (jsxs("div", { className: "space-y-4", children: [jsx("div", { className: "space-y-2", children: options.map(function (option) { return (jsxs("div", { className: "flex items-center gap-2", children: [jsx("input", { type: "checkbox", disabled: field === null || field === void 0 ? void 0 : field.disabled, checked: selectedOptions.includes(option.value), onChange: function (e) {
20084
20094
  return handleOptionChange(option.value, e.target.checked);
20085
- }, className: "w-4 h-4 text-orange-600 border-gray-800 rounded focus:ring-orange-500 bg-white border-2" }), jsx("label", { className: "font-normal text-text font-roboto font-normal font-weight-400 text-sm leading-4 text-gray-600", children: option.label })] }, option.value)); }) }), isOtraMedidaRequired && (jsx("div", { className: "mt-4", children: jsx(TextareaInput, { id: "textarea-otra-medida", name: "textarea-otra-medida", label: "", value: otraMedida, onChange: function (e) { return handleOtraMedidaChange(e.target.value); }, placeholder: "Detalle cu\u00E1l es la medida de resguardo", disabled: field === null || field === void 0 ? void 0 : field.disabled, maxLength: 100, rows: 2, error: error }) })), error && !isOtraMedidaRequired && (jsx("div", { className: "text-red-600 text-sm mt-2", children: error }))] }));
20095
+ }, className: "w-4 h-4 text-orange-600 border-gray-800 rounded focus:ring-orange-500 bg-white border-2" }), jsx("label", { className: "font-normal text-text font-roboto font-normal font-weight-400 text-sm leading-4 text-gray-600", children: option.label })] }, option.value)); }) }), isOtraMedidaRequired && (jsx("div", { className: "mt-4", children: jsx(TextareaInput, { id: "textarea-otra-medida", name: "textarea-otra-medida", label: "", value: handleOtraMedida() || "", onChange: function (e) { return handleOtraMedidaChange(e.target.value); }, placeholder: "Detalle cu\u00E1l es la medida de resguardo", disabled: field === null || field === void 0 ? void 0 : field.disabled, maxLength: 100, rows: 2, error: error }) })), error && !isOtraMedidaRequired && (jsx("div", { className: "text-red-600 text-sm mt-2", children: error }))] }));
20086
20096
  };
20087
20097
 
20088
20098
  var Upload = function (_a) {
package/dist/index.js CHANGED
@@ -20056,6 +20056,16 @@ var Checklist = function (_a) {
20056
20056
  var _d = React.useState((props === null || props === void 0 ? void 0 : props.valueOtraMedida) || ""), otraMedida = _d[0], setOtraMedida = _d[1];
20057
20057
  var options = field.options || [];
20058
20058
  var isOtraMedidaRequired = selectedOptions.includes("otra-medida");
20059
+ var handleOtraMedida = function () {
20060
+ try {
20061
+ var array = JSON.parse(value);
20062
+ var foundValue = (array === null || array === void 0 ? void 0 : array.find(function (opt) { return opt.includes("otra-medida-value-"); })) || "";
20063
+ return foundValue.replace("otra-medida-value-", "");
20064
+ }
20065
+ catch (error) {
20066
+ return otraMedida || "";
20067
+ }
20068
+ };
20059
20069
  React.useEffect(function () {
20060
20070
  setSelectedOptions(value);
20061
20071
  }, [value]);
@@ -20101,7 +20111,7 @@ var Checklist = function (_a) {
20101
20111
  };
20102
20112
  return (jsxRuntime.jsxs("div", { className: "space-y-4", children: [jsxRuntime.jsx("div", { className: "space-y-2", children: options.map(function (option) { return (jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("input", { type: "checkbox", disabled: field === null || field === void 0 ? void 0 : field.disabled, checked: selectedOptions.includes(option.value), onChange: function (e) {
20103
20113
  return handleOptionChange(option.value, e.target.checked);
20104
- }, className: "w-4 h-4 text-orange-600 border-gray-800 rounded focus:ring-orange-500 bg-white border-2" }), jsxRuntime.jsx("label", { className: "font-normal text-text font-roboto font-normal font-weight-400 text-sm leading-4 text-gray-600", children: option.label })] }, option.value)); }) }), isOtraMedidaRequired && (jsxRuntime.jsx("div", { className: "mt-4", children: jsxRuntime.jsx(TextareaInput, { id: "textarea-otra-medida", name: "textarea-otra-medida", label: "", value: otraMedida, onChange: function (e) { return handleOtraMedidaChange(e.target.value); }, placeholder: "Detalle cu\u00E1l es la medida de resguardo", disabled: field === null || field === void 0 ? void 0 : field.disabled, maxLength: 100, rows: 2, error: error }) })), error && !isOtraMedidaRequired && (jsxRuntime.jsx("div", { className: "text-red-600 text-sm mt-2", children: error }))] }));
20114
+ }, className: "w-4 h-4 text-orange-600 border-gray-800 rounded focus:ring-orange-500 bg-white border-2" }), jsxRuntime.jsx("label", { className: "font-normal text-text font-roboto font-normal font-weight-400 text-sm leading-4 text-gray-600", children: option.label })] }, option.value)); }) }), isOtraMedidaRequired && (jsxRuntime.jsx("div", { className: "mt-4", children: jsxRuntime.jsx(TextareaInput, { id: "textarea-otra-medida", name: "textarea-otra-medida", label: "", value: handleOtraMedida() || "", onChange: function (e) { return handleOtraMedidaChange(e.target.value); }, placeholder: "Detalle cu\u00E1l es la medida de resguardo", disabled: field === null || field === void 0 ? void 0 : field.disabled, maxLength: 100, rows: 2, error: error }) })), error && !isOtraMedidaRequired && (jsxRuntime.jsx("div", { className: "text-red-600 text-sm mt-2", children: error }))] }));
20105
20115
  };
20106
20116
 
20107
20117
  var Upload = function (_a) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visiion/forms-library",
3
- "version": "1.4.16",
3
+ "version": "1.4.17",
4
4
  "description": "Librería de componentes de formularios reutilizables",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",