@visiion/forms-library 1.4.9 → 1.4.11

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
@@ -10184,7 +10184,7 @@ var InputWrapper = function (_a) {
10184
10184
  var SelectInput = function (_a) {
10185
10185
  var _b;
10186
10186
  var field = _a.field, value = _a.value, onChange = _a.onChange, error = _a.error;
10187
- return (jsx(InputWrapper, { id: field.id, label: field.label, error: error, children: jsxs("select", { id: field.id, name: field.name, value: value, onChange: onChange, disabled: field.disabled, required: field.required, className: "w-full px-3 py-2 font-roboto font-normal text-gray-800 text-sm border rounded-md focus:outline-none focus:ring-2 focus:ring-orange-500 ".concat(error ? "border-red-500" : "border-gray-300"), children: [jsx("option", { value: "", children: field.placeholder || "Seleccione una opción" }), Array.isArray(field === null || field === void 0 ? void 0 : field.options) &&
10187
+ return (jsx(InputWrapper, { id: field.id, label: field.label, error: error, children: jsxs("select", { id: field.id, name: field.name, value: value, onChange: onChange, disabled: field.disabled, required: field.required, className: "w-full px-3 py-2 font-roboto font-normal text-gray-800 text-sm border rounded-md focus:outline-none focus:ring-2 focus:ring-orange-500 ".concat(error ? "border-red-500" : "border-gray-300"), children: [jsx("option", { disabled: true, hidden: true, selected: true, value: "", children: field.placeholder || "Seleccione una opción" }), Array.isArray(field === null || field === void 0 ? void 0 : field.options) &&
10188
10188
  ((_b = field === null || field === void 0 ? void 0 : field.options) === null || _b === void 0 ? void 0 : _b.map(function (option) { return (jsx("option", { value: option.value, children: option.label }, option.value)); }))] }) }));
10189
10189
  };
10190
10190
 
@@ -22859,6 +22859,9 @@ var createValidationSchema = function (fields) {
22859
22859
  else if (customValidator === "otra-medida") {
22860
22860
  fieldSchema_1 = fieldSchema_1.test("otra-medida", validation.params[1] ||
22861
22861
  "Debe detallar cuál es la medida de resguardo", function (value) {
22862
+ // Verificar que value sea un array
22863
+ if (!Array.isArray(value))
22864
+ return true;
22862
22865
  // Si no incluye "otra-medida", la validación pasa
22863
22866
  if (!value.includes("otra-medida"))
22864
22867
  return true;
package/dist/index.js CHANGED
@@ -10203,7 +10203,7 @@ var InputWrapper = function (_a) {
10203
10203
  var SelectInput = function (_a) {
10204
10204
  var _b;
10205
10205
  var field = _a.field, value = _a.value, onChange = _a.onChange, error = _a.error;
10206
- return (jsxRuntime.jsx(InputWrapper, { id: field.id, label: field.label, error: error, children: jsxRuntime.jsxs("select", { id: field.id, name: field.name, value: value, onChange: onChange, disabled: field.disabled, required: field.required, className: "w-full px-3 py-2 font-roboto font-normal text-gray-800 text-sm border rounded-md focus:outline-none focus:ring-2 focus:ring-orange-500 ".concat(error ? "border-red-500" : "border-gray-300"), children: [jsxRuntime.jsx("option", { value: "", children: field.placeholder || "Seleccione una opción" }), Array.isArray(field === null || field === void 0 ? void 0 : field.options) &&
10206
+ return (jsxRuntime.jsx(InputWrapper, { id: field.id, label: field.label, error: error, children: jsxRuntime.jsxs("select", { id: field.id, name: field.name, value: value, onChange: onChange, disabled: field.disabled, required: field.required, className: "w-full px-3 py-2 font-roboto font-normal text-gray-800 text-sm border rounded-md focus:outline-none focus:ring-2 focus:ring-orange-500 ".concat(error ? "border-red-500" : "border-gray-300"), children: [jsxRuntime.jsx("option", { disabled: true, hidden: true, selected: true, value: "", children: field.placeholder || "Seleccione una opción" }), Array.isArray(field === null || field === void 0 ? void 0 : field.options) &&
10207
10207
  ((_b = field === null || field === void 0 ? void 0 : field.options) === null || _b === void 0 ? void 0 : _b.map(function (option) { return (jsxRuntime.jsx("option", { value: option.value, children: option.label }, option.value)); }))] }) }));
10208
10208
  };
10209
10209
 
@@ -22878,6 +22878,9 @@ var createValidationSchema = function (fields) {
22878
22878
  else if (customValidator === "otra-medida") {
22879
22879
  fieldSchema_1 = fieldSchema_1.test("otra-medida", validation.params[1] ||
22880
22880
  "Debe detallar cuál es la medida de resguardo", function (value) {
22881
+ // Verificar que value sea un array
22882
+ if (!Array.isArray(value))
22883
+ return true;
22881
22884
  // Si no incluye "otra-medida", la validación pasa
22882
22885
  if (!value.includes("otra-medida"))
22883
22886
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visiion/forms-library",
3
- "version": "1.4.9",
3
+ "version": "1.4.11",
4
4
  "description": "Librería de componentes de formularios reutilizables",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",