@visiion/forms-library 1.4.6 → 1.4.8

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
@@ -20029,7 +20029,7 @@ var Typography = function (_a) {
20029
20029
  var Checklist = function (_a) {
20030
20030
  var field = _a.field, _b = _a.value, value = _b === void 0 ? [] : _b, onChange = _a.onChange, error = _a.error, props = _a.props;
20031
20031
  var _c = useState(value), selectedOptions = _c[0], setSelectedOptions = _c[1];
20032
- var _d = useState(props.valueOtraMedida), otraMedida = _d[0], setOtraMedida = _d[1];
20032
+ var _d = useState((props === null || props === void 0 ? void 0 : props.valueOtraMedida) || ""), otraMedida = _d[0], setOtraMedida = _d[1];
20033
20033
  var options = field.options || [];
20034
20034
  var isOtraMedidaRequired = selectedOptions.includes("otra-medida");
20035
20035
  useEffect(function () {
@@ -20075,9 +20075,9 @@ var Checklist = function (_a) {
20075
20075
  onChange === null || onChange === void 0 ? void 0 : onChange(updatedOptions);
20076
20076
  (_a = props.onOtraMedidaChange) === null || _a === void 0 ? void 0 : _a.call(props, text);
20077
20077
  };
20078
- 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", checked: selectedOptions.includes(option.value), onChange: function (e) {
20078
+ 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) {
20079
20079
  return handleOptionChange(option.value, e.target.checked);
20080
- }, 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", maxLength: 100, rows: 2, error: error }) })), error && !isOtraMedidaRequired && (jsx("div", { className: "text-red-600 text-sm mt-2", children: error }))] }));
20080
+ }, 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 }))] }));
20081
20081
  };
20082
20082
 
20083
20083
  var Upload = function (_a) {
@@ -20172,6 +20172,7 @@ var Upload = function (_a) {
20172
20172
  };
20173
20173
 
20174
20174
  var DynamicInput = function (_a) {
20175
+ var _b;
20175
20176
  var field = _a.field, value = _a.value, onChange = _a.onChange, error = _a.error, formData = _a.formData;
20176
20177
  switch (field.type) {
20177
20178
  case "status":
@@ -20203,7 +20204,7 @@ var DynamicInput = function (_a) {
20203
20204
  };
20204
20205
  onChange(event);
20205
20206
  }, error: error, props: {
20206
- valueOtraMedida: formData["otraMedida"] || "",
20207
+ valueOtraMedida: formData["otraMedida"] || ((_b = field === null || field === void 0 ? void 0 : field.props) === null || _b === void 0 ? void 0 : _b.valueOtraMedida) || "",
20207
20208
  onOtraMedidaChange: function (text) {
20208
20209
  var event = {
20209
20210
  target: {
package/dist/index.js CHANGED
@@ -20048,7 +20048,7 @@ var Typography = function (_a) {
20048
20048
  var Checklist = function (_a) {
20049
20049
  var field = _a.field, _b = _a.value, value = _b === void 0 ? [] : _b, onChange = _a.onChange, error = _a.error, props = _a.props;
20050
20050
  var _c = React.useState(value), selectedOptions = _c[0], setSelectedOptions = _c[1];
20051
- var _d = React.useState(props.valueOtraMedida), otraMedida = _d[0], setOtraMedida = _d[1];
20051
+ var _d = React.useState((props === null || props === void 0 ? void 0 : props.valueOtraMedida) || ""), otraMedida = _d[0], setOtraMedida = _d[1];
20052
20052
  var options = field.options || [];
20053
20053
  var isOtraMedidaRequired = selectedOptions.includes("otra-medida");
20054
20054
  React.useEffect(function () {
@@ -20094,9 +20094,9 @@ var Checklist = function (_a) {
20094
20094
  onChange === null || onChange === void 0 ? void 0 : onChange(updatedOptions);
20095
20095
  (_a = props.onOtraMedidaChange) === null || _a === void 0 ? void 0 : _a.call(props, text);
20096
20096
  };
20097
- 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", checked: selectedOptions.includes(option.value), onChange: function (e) {
20097
+ 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) {
20098
20098
  return handleOptionChange(option.value, e.target.checked);
20099
- }, 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", maxLength: 100, rows: 2, error: error }) })), error && !isOtraMedidaRequired && (jsxRuntime.jsx("div", { className: "text-red-600 text-sm mt-2", children: error }))] }));
20099
+ }, 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 }))] }));
20100
20100
  };
20101
20101
 
20102
20102
  var Upload = function (_a) {
@@ -20191,6 +20191,7 @@ var Upload = function (_a) {
20191
20191
  };
20192
20192
 
20193
20193
  var DynamicInput = function (_a) {
20194
+ var _b;
20194
20195
  var field = _a.field, value = _a.value, onChange = _a.onChange, error = _a.error, formData = _a.formData;
20195
20196
  switch (field.type) {
20196
20197
  case "status":
@@ -20222,7 +20223,7 @@ var DynamicInput = function (_a) {
20222
20223
  };
20223
20224
  onChange(event);
20224
20225
  }, error: error, props: {
20225
- valueOtraMedida: formData["otraMedida"] || "",
20226
+ valueOtraMedida: formData["otraMedida"] || ((_b = field === null || field === void 0 ? void 0 : field.props) === null || _b === void 0 ? void 0 : _b.valueOtraMedida) || "",
20226
20227
  onOtraMedidaChange: function (text) {
20227
20228
  var event = {
20228
20229
  target: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visiion/forms-library",
3
- "version": "1.4.6",
3
+ "version": "1.4.8",
4
4
  "description": "Librería de componentes de formularios reutilizables",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",