@isettingkit/business-rules 0.1.20 → 0.1.22

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.
@@ -1,8 +1,11 @@
1
1
  import { IRuleDecision } from '@isettingkit/input';
2
2
  import { JSX as JSX_2 } from 'react/jsx-runtime';
3
+ import { ReactPortal } from 'react';
3
4
 
4
5
  export declare const BusinessRuleCard: (props: IBusinessRuleCard) => JSX_2.Element;
5
6
 
7
+ export declare const BusinessRules: ({ decisions, textValues, decisionTemplate, isModalOpen, selectedDecision, loading, handleOpenModal, handleCloseModal, handleSubmitForm, handleDelete, }: IBusinessRules) => JSX_2.Element;
8
+
6
9
  export declare const BusinessRuleView: (props: IBusinessRuleView) => JSX_2.Element;
7
10
 
8
11
  export declare interface IBusinessRuleCard {
@@ -13,12 +16,32 @@ export declare interface IBusinessRuleCard {
13
16
  id: string;
14
17
  }
15
18
 
19
+ declare interface IBusinessRules {
20
+ decisions: IRuleDecision[];
21
+ textValues: IRulesFormTextValues;
22
+ decisionTemplate: IRuleDecision;
23
+ isModalOpen: boolean;
24
+ selectedDecision: IRuleDecision | null;
25
+ loading: boolean;
26
+ handleOpenModal: (decision?: IRuleDecision | null) => void;
27
+ handleCloseModal: () => void;
28
+ handleSubmitForm: (dataDecision: IRuleDecision) => void;
29
+ handleDelete: (id: string) => void;
30
+ }
31
+
16
32
  export declare interface IBusinessRuleView {
17
33
  decision?: IRuleDecision;
18
34
  loading?: boolean;
19
35
  textValues?: IRulesFormTextValues;
20
36
  }
21
37
 
38
+ declare interface IModalRules {
39
+ children: React.ReactNode;
40
+ onCloseModal: () => void;
41
+ portalId: string;
42
+ title: string;
43
+ }
44
+
22
45
  export declare interface IRulesForm {
23
46
  id: string;
24
47
  decision: IRuleDecision;
@@ -46,6 +69,8 @@ declare interface IRulesFormTextValues {
46
69
  termStart: string;
47
70
  }
48
71
 
72
+ export declare const ModalRules: (props: IModalRules) => ReactPortal;
73
+
49
74
  export declare const RulesForm: (prop: IRulesForm) => JSX_2.Element;
50
75
 
51
76
  export { }
package/dist/index.es.js CHANGED
@@ -1,143 +1,148 @@
1
- import { jsxs as p, Fragment as R, jsx as n } from "react/jsx-runtime";
1
+ import { jsxs as p, Fragment as A, jsx as t } from "react/jsx-runtime";
2
2
  import { useFormik as ee } from "formik";
3
- import { useState as y, useEffect as Q } from "react";
4
- import { Divider as C } from "@inubekit/divider";
5
- import { Stack as u } from "@inubekit/stack";
6
- import { Text as D } from "@inubekit/text";
7
- import { Toggle as Z } from "@inubekit/toggle";
8
- import { ValueHowToSetUp as m, ValueDataType as I, DecisionConditionRenderer as z } from "@isettingkit/input";
9
- import { Button as _ } from "@inubekit/button";
10
- import { object as J, string as L, number as N, mixed as H } from "yup";
11
- import { Date as q } from "@inubekit/date";
3
+ import { useState as k, useEffect as Z } from "react";
4
+ import { Divider as S } from "@inubekit/divider";
5
+ import { Stack as l } from "@inubekit/stack";
6
+ import { Text as f } from "@inubekit/text";
7
+ import { Toggle as J } from "@inubekit/toggle";
8
+ import { ValueHowToSetUp as b, ValueDataType as O, DecisionConditionRenderer as _ } from "@isettingkit/input";
9
+ import { Button as L } from "@inubekit/button";
10
+ import { object as K, string as H, number as $, mixed as q } from "yup";
11
+ import { Date as G } from "@inubekit/date";
12
12
  import { Checkbox as te } from "@inubekit/checkbox";
13
- import { inube as V } from "@inubekit/foundations";
14
- import x, { keyframes as K, css as W } from "styled-components";
15
- import { DecisionViewConditionRenderer as F } from "@isettingkit/view";
16
- import { MdOutlineEdit as ne, MdOutlineDelete as re } from "react-icons/md";
17
- import { Icon as G } from "@inubekit/icon";
18
- const P = (t) => {
19
- if ("value" in t && "valueUse" in t && t.value !== void 0) {
20
- const e = t.value, a = typeof e == "object" && "from" in e && typeof e.from == "number" ? e.from : 0, o = typeof e == "object" && "to" in e && typeof e.to == "number" ? e.to : 1 / 0;
21
- switch (t.valueUse) {
22
- case m.LIST_OF_VALUES:
13
+ import { inube as w } from "@inubekit/foundations";
14
+ import g, { keyframes as ne } from "styled-components";
15
+ import { DecisionViewConditionRenderer as z } from "@isettingkit/view";
16
+ import { SkeletonLine as V } from "@inubekit/skeleton";
17
+ import { MdOutlineEdit as re, MdOutlineDelete as ae, MdClear as ie, MdAdd as oe } from "react-icons/md";
18
+ import { Icon as F } from "@inubekit/icon";
19
+ import { createPortal as le } from "react-dom";
20
+ import { Blanket as de } from "@inubekit/blanket";
21
+ import { Grid as ce } from "@inubekit/grid";
22
+ import { useMediaQuery as se } from "@inubekit/hooks";
23
+ const B = (n) => {
24
+ if ("value" in n && "valueUse" in n && n.value !== void 0) {
25
+ const e = n.value, a = typeof e == "object" && "from" in e && typeof e.from == "number" ? e.from : 0, i = typeof e == "object" && "to" in e && typeof e.to == "number" ? e.to : 1 / 0;
26
+ switch (n.valueUse) {
27
+ case b.LIST_OF_VALUES:
23
28
  return {
24
- schema: H().test(
29
+ schema: q().test(
25
30
  "isArrayOrString",
26
31
  "Must be an array of strings/numbers or a single string",
27
- (l) => Array.isArray(l) ? l.every(
28
- (s) => typeof s == "string" || typeof s == "number"
29
- ) : typeof l == "string"
32
+ (d) => Array.isArray(d) ? d.every(
33
+ (u) => typeof u == "string" || typeof u == "number"
34
+ ) : typeof d == "string"
30
35
  ),
31
36
  value: e
32
37
  };
33
- case m.LIST_OF_VALUES_MULTI:
38
+ case b.LIST_OF_VALUES_MULTI:
34
39
  return {
35
- schema: H().test(
40
+ schema: q().test(
36
41
  "isArrayOrString",
37
42
  "Must be an array of strings/numbers or a single string",
38
- (l) => Array.isArray(l) ? l.every(
39
- (s) => typeof s == "string" || typeof s == "number"
40
- ) : typeof l == "string"
43
+ (d) => Array.isArray(d) ? d.every(
44
+ (u) => typeof u == "string" || typeof u == "number"
45
+ ) : typeof d == "string"
41
46
  ),
42
47
  value: e
43
48
  };
44
- case m.RANGE:
49
+ case b.RANGE:
45
50
  return {
46
- schema: J({
47
- from: N().required("Range From is required").max(o, "'Range From' cannot be greater than 'Range To'").min(0, "'Range From' cannot be less than 0"),
48
- to: N().required("Range To is required").min(a, "'Range To' cannot be less than 'Range From'").min(0, "'Range To' cannot be less than 0")
51
+ schema: K({
52
+ from: $().required("Range From is required").max(i, "'Range From' cannot be greater than 'Range To'").min(0, "'Range From' cannot be less than 0"),
53
+ to: $().required("Range To is required").min(a, "'Range To' cannot be less than 'Range From'").min(0, "'Range To' cannot be less than 0")
49
54
  }),
50
55
  value: {
51
56
  from: a,
52
- to: o
57
+ to: i
53
58
  }
54
59
  };
55
- case m.GREATER_THAN:
56
- case m.LESS_THAN:
57
- case m.EQUAL:
58
- return t.dataType === I.PERCENTAGE ? {
59
- schema: N().required("Percentage is required").min(0, "Percentage cannot be less than 0").max(100, "Percentage cannot be greater than 100"),
60
+ case b.GREATER_THAN:
61
+ case b.LESS_THAN:
62
+ case b.EQUAL:
63
+ return n.dataType === O.PERCENTAGE ? {
64
+ schema: $().required("Percentage is required").min(0, "Percentage cannot be less than 0").max(100, "Percentage cannot be greater than 100"),
60
65
  value: e
61
66
  } : {
62
- schema: L().required("Required"),
67
+ schema: H().required("Required"),
63
68
  value: e
64
69
  };
65
70
  default:
66
71
  return {
67
- schema: L(),
72
+ schema: H(),
68
73
  value: void 0
69
74
  };
70
75
  }
71
76
  }
72
- }, ae = (t) => {
77
+ }, pe = (n) => {
73
78
  const e = {}, a = {};
74
- if (t) {
75
- const o = P(t);
76
- o && (e[t.name] = o.schema, a[t.name] = o.value);
79
+ if (n) {
80
+ const i = B(n);
81
+ i && (e[n.name] = i.schema, a[n.name] = i.value);
77
82
  }
78
- return t.conditions && t.conditions.forEach((o) => {
79
- const l = P(o);
80
- l && (e[o.name] = l.schema, a[o.name] = l.value);
81
- }), { validationSchema: J().shape(e), initialValues: a };
82
- }, M = (t) => {
83
- if (typeof t == "string")
84
- return t;
85
- if (typeof t == "object" && ("from" in t || "to" in t))
83
+ return n.conditions && n.conditions.forEach((i) => {
84
+ const d = B(i);
85
+ d && (e[i.name] = d.schema, a[i.name] = d.value);
86
+ }), { validationSchema: K().shape(e), initialValues: a };
87
+ }, U = (n) => {
88
+ if (typeof n == "string")
89
+ return n;
90
+ if (typeof n == "object" && ("from" in n || "to" in n))
86
91
  return {
87
- from: t.from || "",
88
- to: t.to || ""
92
+ from: n.from || "",
93
+ to: n.to || ""
89
94
  };
90
- for (const e in t)
91
- if (Object.prototype.hasOwnProperty.call(t, e)) {
92
- const a = M(t[e]);
95
+ for (const e in n)
96
+ if (Object.prototype.hasOwnProperty.call(n, e)) {
97
+ const a = U(n[e]);
93
98
  if (a) return a;
94
99
  }
95
100
  return "";
96
- }, oe = (t) => {
101
+ }, ue = (n) => {
97
102
  const {
98
103
  checked: e,
99
104
  children: a,
100
- handleToggleChange: o,
101
- id: l,
102
- labelToggle: s,
105
+ handleToggleChange: i,
106
+ id: d,
107
+ labelToggle: u,
103
108
  name: c,
104
- valueToggle: d = ""
105
- } = t, [g, h] = y(e), b = (f) => {
106
- h(f.target.checked), o(f);
109
+ valueToggle: s = ""
110
+ } = n, [x, m] = k(e), y = (h) => {
111
+ m(h.target.checked), i(h);
107
112
  };
108
- return Q(() => {
109
- h(e);
110
- }, [e]), /* @__PURE__ */ p(R, { children: [
111
- /* @__PURE__ */ n(u, { children: /* @__PURE__ */ n(
112
- Z,
113
+ return Z(() => {
114
+ m(e);
115
+ }, [e]), /* @__PURE__ */ p(A, { children: [
116
+ /* @__PURE__ */ t(l, { children: /* @__PURE__ */ t(
117
+ J,
113
118
  {
114
- checked: g,
115
- id: l,
119
+ checked: x,
120
+ id: d,
116
121
  margin: "10px",
117
122
  name: c,
118
- onChange: b,
123
+ onChange: y,
119
124
  size: "small",
120
- value: d,
121
- children: /* @__PURE__ */ n(D, { size: "medium", type: "label", weight: "bold", children: s })
125
+ value: s,
126
+ children: /* @__PURE__ */ t(f, { size: "medium", type: "label", weight: "bold", children: u })
122
127
  }
123
128
  ) }),
124
- g && /* @__PURE__ */ n(R, { children: a })
129
+ x && /* @__PURE__ */ t(A, { children: a })
125
130
  ] });
126
- }, ie = (t) => {
131
+ }, he = (n) => {
127
132
  const {
128
133
  onHandleStartChange: e,
129
134
  onHandleEndChange: a,
130
- labelStart: o,
131
- labelEnd: l,
132
- checkedClosed: s = !1,
135
+ labelStart: i,
136
+ labelEnd: d,
137
+ checkedClosed: u = !1,
133
138
  required: c = !1,
134
- valueStart: d = "",
135
- valueEnd: g = ""
136
- } = t, [h, b] = y(s), [f, E] = y(d), [w, S] = y(g);
137
- return /* @__PURE__ */ p(R, { children: [
138
- /* @__PURE__ */ p(u, { direction: "row", justifyContent: "space-between", margin: "10px 0", children: [
139
- /* @__PURE__ */ n(u, { children: /* @__PURE__ */ n(
140
- D,
139
+ valueStart: s = "",
140
+ valueEnd: x = ""
141
+ } = n, [m, y] = k(u), [h, v] = k(s), [E, T] = k(x);
142
+ return /* @__PURE__ */ p(A, { children: [
143
+ /* @__PURE__ */ p(l, { direction: "row", justifyContent: "space-between", margin: "10px 0", children: [
144
+ /* @__PURE__ */ t(l, { children: /* @__PURE__ */ t(
145
+ f,
141
146
  {
142
147
  appearance: "gray",
143
148
  margin: "10px 0",
@@ -147,62 +152,62 @@ const P = (t) => {
147
152
  children: "Vigencia"
148
153
  }
149
154
  ) }),
150
- /* @__PURE__ */ n(
151
- u,
155
+ /* @__PURE__ */ t(
156
+ l,
152
157
  {
153
158
  alignContent: "center",
154
159
  justifyContent: "center",
155
160
  wrap: "wrap",
156
161
  gap: "4px",
157
- children: /* @__PURE__ */ n(
162
+ children: /* @__PURE__ */ t(
158
163
  te,
159
164
  {
160
165
  label: "Cerrada",
161
- onChange: ({ target: i }) => {
162
- b(i.checked);
166
+ onChange: ({ target: o }) => {
167
+ y(o.checked);
163
168
  },
164
- checked: h,
169
+ checked: m,
165
170
  value: ""
166
171
  }
167
172
  )
168
173
  }
169
174
  )
170
175
  ] }),
171
- /* @__PURE__ */ p(u, { justifyContent: "space-between", gap: "24px", children: [
172
- /* @__PURE__ */ n(u, { width: "189px", children: /* @__PURE__ */ n(
173
- q,
176
+ /* @__PURE__ */ p(l, { justifyContent: "space-between", gap: "24px", children: [
177
+ /* @__PURE__ */ t(l, { width: "189px", children: /* @__PURE__ */ t(
178
+ G,
174
179
  {
175
180
  id: "dateStart",
176
- label: o,
177
- onChange: (i) => {
178
- E(i.target.value), e(i);
181
+ label: i,
182
+ onChange: (o) => {
183
+ v(o.target.value), e(o);
179
184
  },
180
- value: f,
185
+ value: h,
181
186
  required: c,
182
187
  size: "compact"
183
188
  }
184
189
  ) }),
185
- h && /* @__PURE__ */ n(u, { width: "189px", children: /* @__PURE__ */ n(
186
- q,
190
+ m && /* @__PURE__ */ t(l, { width: "189px", children: /* @__PURE__ */ t(
191
+ G,
187
192
  {
188
193
  id: "dateEnd",
189
- label: l,
190
- onChange: (i) => {
191
- S(i.target.value), a(i);
194
+ label: d,
195
+ onChange: (o) => {
196
+ T(o.target.value), a(o);
192
197
  },
193
- value: w,
198
+ value: E,
194
199
  required: c,
195
200
  size: "compact"
196
201
  }
197
202
  ) })
198
203
  ] })
199
204
  ] });
200
- }, le = x.div`
205
+ }, ge = g.div`
201
206
  & > div {
202
207
  border-radius: 8px;
203
- border: 1px solid ${V.palette.neutral.N30};
208
+ border: 1px solid ${w.palette.neutral.N30};
204
209
  }
205
- `, de = x.div`
210
+ `, me = g.div`
206
211
  width: 100%;
207
212
  height: 100%;
208
213
  overflow-y: auto;
@@ -219,45 +224,45 @@ const P = (t) => {
219
224
  background-color: #ebecf0;
220
225
  border-radius: 8px;
221
226
  }
222
- `, ce = (t) => {
227
+ `, be = (n) => {
223
228
  const {
224
229
  decision: e,
225
230
  formik: a,
226
- onChangeCondition: o,
227
- onChangeDecision: l,
228
- onStartChange: s,
231
+ onChangeCondition: i,
232
+ onChangeDecision: d,
233
+ onStartChange: u,
229
234
  onEndChange: c,
230
- textValues: d,
231
- onCancel: g,
232
- onSubmit: h
233
- } = t, [b, f] = y(!0), [E] = y(!0), w = {
235
+ textValues: s,
236
+ onCancel: x,
237
+ onSubmit: m
238
+ } = n, [y, h] = k(!0), [v] = k(!0), E = {
234
239
  name: e.name,
235
240
  dataType: e.dataType,
236
241
  value: e.value,
237
242
  valueUse: e.valueUse,
238
243
  possibleValue: e.possibleValue
239
244
  };
240
- Q(() => {
245
+ Z(() => {
241
246
  console.log("Updated formik.errors in RulesFormUI:", a.errors);
242
247
  }, [a.errors]);
243
- const S = (r) => {
244
- f(r.target.checked);
245
- }, k = (r) => {
246
- const i = M(a.errors[r] || {});
247
- return typeof i == "string" ? i ? "invalid" : "pending" : i;
248
- }, T = (r) => {
249
- const i = M(a.errors[r] || {});
250
- return i;
248
+ const T = (r) => {
249
+ h(r.target.checked);
250
+ }, C = (r) => {
251
+ const o = U(a.errors[r] || {});
252
+ return typeof o == "string" ? o ? "invalid" : "pending" : o;
253
+ }, D = (r) => {
254
+ const o = U(a.errors[r] || {});
255
+ return o;
251
256
  };
252
- return /* @__PURE__ */ p(u, { direction: "column", gap: "24px", children: [
253
- e && /* @__PURE__ */ n(
254
- z,
257
+ return /* @__PURE__ */ p(l, { direction: "column", gap: "24px", children: [
258
+ e && /* @__PURE__ */ t(
259
+ _,
255
260
  {
256
- element: w,
257
- onDecision: l,
261
+ element: E,
262
+ onDecision: d,
258
263
  valueData: a.values[e.name],
259
264
  message: a.errors[e.name],
260
- status: k(e.name),
265
+ status: C(e.name),
261
266
  textValues: {
262
267
  selectOptions: "Select an option",
263
268
  selectOption: "Option selected",
@@ -266,34 +271,34 @@ const P = (t) => {
266
271
  }
267
272
  }
268
273
  ),
269
- /* @__PURE__ */ n(C, { dashed: !0 }),
270
- /* @__PURE__ */ n(le, { children: /* @__PURE__ */ n(de, { children: /* @__PURE__ */ p(
271
- u,
274
+ /* @__PURE__ */ t(S, { dashed: !0 }),
275
+ /* @__PURE__ */ t(ge, { children: /* @__PURE__ */ t(me, { children: /* @__PURE__ */ p(
276
+ l,
272
277
  {
273
278
  direction: "column",
274
279
  padding: "6px 12px",
275
280
  gap: "16px",
276
281
  height: "272px",
277
282
  children: [
278
- /* @__PURE__ */ p(u, { direction: "row", justifyContent: "space-between", children: [
279
- /* @__PURE__ */ n(D, { children: d.factsThatConditionIt }),
280
- /* @__PURE__ */ n(
281
- Z,
283
+ /* @__PURE__ */ p(l, { direction: "row", justifyContent: "space-between", children: [
284
+ /* @__PURE__ */ t(f, { children: s.factsThatConditionIt }),
285
+ /* @__PURE__ */ t(
286
+ J,
282
287
  {
283
288
  id: "toogleNone",
284
- onChange: S,
285
- checked: b,
289
+ onChange: T,
290
+ checked: y,
286
291
  size: "small",
287
- children: /* @__PURE__ */ n(D, { size: "medium", type: "label", weight: "bold", children: d.none })
292
+ children: /* @__PURE__ */ t(f, { size: "medium", type: "label", weight: "bold", children: s.none })
288
293
  }
289
294
  )
290
295
  ] }),
291
- /* @__PURE__ */ n(u, { direction: "column", gap: "20px", children: e.conditions && e.conditions.filter((r) => !r.hidden).map((r) => /* @__PURE__ */ n(
292
- oe,
296
+ /* @__PURE__ */ t(l, { direction: "column", gap: "20px", children: e.conditions && e.conditions.filter((r) => !r.hidden).map((r) => /* @__PURE__ */ t(
297
+ ue,
293
298
  {
294
- checked: !b,
295
- handleToggleChange: (i) => {
296
- i.target.checked || o(
299
+ checked: !y,
300
+ handleToggleChange: (o) => {
301
+ o.target.checked || i(
297
302
  {
298
303
  value: "",
299
304
  to: 0,
@@ -306,20 +311,21 @@ const P = (t) => {
306
311
  id: r.name.replace(" ", ""),
307
312
  labelToggle: r.name.split(/(?=[A-Z])/).join(" "),
308
313
  name: r.name.replace(" ", ""),
309
- children: /* @__PURE__ */ n(
310
- z,
314
+ children: /* @__PURE__ */ t(
315
+ _,
311
316
  {
312
317
  element: r,
313
- onDecision: o,
318
+ onDecision: i,
314
319
  valueData: a.values[r.name],
315
- message: T(r.name),
316
- status: k(r.name),
320
+ message: D(r.name),
321
+ status: C(r.name),
317
322
  textValues: {
318
323
  selectOptions: "Select an option",
319
324
  selectOption: "Option selected",
320
- rangeMin: (i) => `Minimum ${i}`,
321
- rangeMax: (i) => `Maximum ${i}`
322
- }
325
+ rangeMin: (o) => `Minimum ${o}`,
326
+ rangeMax: (o) => `Maximum ${o}`
327
+ },
328
+ type: "condition"
323
329
  }
324
330
  )
325
331
  },
@@ -328,102 +334,102 @@ const P = (t) => {
328
334
  ]
329
335
  }
330
336
  ) }) }),
331
- /* @__PURE__ */ n(C, { dashed: !0 }),
332
- /* @__PURE__ */ n(u, { direction: "column", children: e && /* @__PURE__ */ n(
333
- ie,
337
+ /* @__PURE__ */ t(S, { dashed: !0 }),
338
+ /* @__PURE__ */ t(l, { direction: "column", children: e && /* @__PURE__ */ t(
339
+ he,
334
340
  {
335
- onHandleStartChange: (r) => s(r.target.value),
341
+ onHandleStartChange: (r) => u(r.target.value),
336
342
  onHandleEndChange: (r) => c(r.target.value),
337
- labelStart: d.termStart,
338
- labelEnd: d.termEnd,
343
+ labelStart: s.termStart,
344
+ labelEnd: s.termEnd,
339
345
  checkedClosed: !!e.endDate,
340
346
  valueStart: String(e.startDate),
341
347
  valueEnd: String(e.endDate) || ""
342
348
  }
343
349
  ) }),
344
- /* @__PURE__ */ n(C, {}),
345
- /* @__PURE__ */ p(u, { direction: "row", justifyContent: "end", gap: "16px", children: [
346
- /* @__PURE__ */ n(_, { appearance: "gray", onClick: g, children: d.cancel }),
347
- /* @__PURE__ */ n(
348
- _,
350
+ /* @__PURE__ */ t(S, {}),
351
+ /* @__PURE__ */ p(l, { direction: "row", justifyContent: "end", gap: "16px", children: [
352
+ /* @__PURE__ */ t(L, { appearance: "gray", onClick: x, children: s.cancel }),
353
+ /* @__PURE__ */ t(
354
+ L,
349
355
  {
350
- onClick: h,
351
- disabled: E || !a.isValid,
356
+ onClick: m,
357
+ disabled: v || !a.isValid,
352
358
  type: "submit",
353
- children: d.confirm
359
+ children: s.confirm
354
360
  }
355
361
  )
356
362
  ] })
357
363
  ] });
358
- }, Oe = (t) => {
359
- const { id: e, decision: a, onCancel: o, onSubmitEvent: l, textValues: s } = t, [c, d] = y(a), g = (r, i) => {
360
- k.setFieldValue(r, i), k.validateField(r);
361
- }, h = (r, i) => {
362
- const A = r instanceof Date ? r.toISOString() : r;
363
- d((O) => {
364
- if (!O.conditions)
365
- return O;
366
- const Y = O.conditions.map((U) => U.name === i ? { ...U, value: A } : U);
364
+ }, fe = (n) => {
365
+ const { id: e, decision: a, onCancel: i, onSubmitEvent: d, textValues: u } = n, [c, s] = k(a), x = (r, o) => {
366
+ C.setFieldValue(r, o), C.validateField(r);
367
+ }, m = (r, o) => {
368
+ const I = r instanceof Date ? r.toISOString() : r;
369
+ s((j) => {
370
+ if (!j.conditions)
371
+ return j;
372
+ const X = j.conditions.map((R) => R.name === o ? { ...R, value: I } : R);
367
373
  return {
368
- ...O,
369
- conditions: Y
374
+ ...j,
375
+ conditions: X
370
376
  };
371
- }), g(i, A);
372
- }, b = (r) => {
373
- d(
374
- (i) => T(i, "value", r)
377
+ }), x(o, I);
378
+ }, y = (r) => {
379
+ s(
380
+ (o) => D(o, "value", r)
375
381
  );
376
- }, f = (r) => {
377
- d(
378
- (i) => T(i, "endDate", r)
382
+ }, h = (r) => {
383
+ s(
384
+ (o) => D(o, "endDate", r)
379
385
  );
380
- }, E = (r) => {
381
- d(
382
- (i) => T(i, "startDate", r)
386
+ }, v = (r) => {
387
+ s(
388
+ (o) => D(o, "startDate", r)
383
389
  );
384
- }, { validationSchema: w, initialValues: S } = ae(c);
385
- w.validate(S, { abortEarly: !1 }).then(() => console.log("Validation passed")).catch((r) => console.log("Validation failed:", r.errors));
386
- const k = ee({
387
- initialValues: S,
388
- validationSchema: w,
390
+ }, { validationSchema: E, initialValues: T } = pe(c);
391
+ E.validate(T, { abortEarly: !1 }).then(() => console.log("Validation passed")).catch((r) => console.log("Validation failed:", r.errors));
392
+ const C = ee({
393
+ initialValues: T,
394
+ validationSchema: E,
389
395
  validateOnChange: !0,
390
396
  validateOnBlur: !0,
391
397
  onSubmit: () => {
392
- l(c);
398
+ d(c);
393
399
  }
394
- }), T = (r, i, A) => ({
400
+ }), D = (r, o, I) => ({
395
401
  ...r,
396
402
  ...r.decision,
397
- [i]: A
403
+ [o]: I
398
404
  });
399
- return /* @__PURE__ */ n(
400
- ce,
405
+ return /* @__PURE__ */ t(
406
+ be,
401
407
  {
402
408
  id: e,
403
- formik: k,
409
+ formik: C,
404
410
  decision: c,
405
- onCancel: o,
406
- onSubmit: () => l(c),
407
- onChangeCondition: h,
408
- onChangeDecision: b,
409
- onStartChange: E,
410
- onEndChange: f,
411
- textValues: s
411
+ onCancel: i,
412
+ onSubmit: () => d(c),
413
+ onChangeCondition: m,
414
+ onChangeDecision: y,
415
+ onStartChange: v,
416
+ onEndChange: h,
417
+ textValues: u
412
418
  }
413
419
  );
414
- }, j = (t) => {
415
- if (!t)
420
+ }, N = (n) => {
421
+ if (!n)
416
422
  return;
417
- const e = t.value;
423
+ const e = n.value;
418
424
  if (!e)
419
425
  return;
420
- if (((o) => typeof o == "object" && o !== null)(e))
421
- switch (t.valueUse) {
422
- case m.LIST_OF_VALUES_MULTI:
426
+ if (((i) => typeof i == "object" && i !== null)(e))
427
+ switch (n.valueUse) {
428
+ case b.LIST_OF_VALUES_MULTI:
423
429
  return e;
424
- case m.LIST_OF_VALUES:
430
+ case b.LIST_OF_VALUES:
425
431
  return e;
426
- case m.RANGE:
432
+ case b.RANGE:
427
433
  return {
428
434
  from: e.from,
429
435
  to: e.to
@@ -432,12 +438,12 @@ const P = (t) => {
432
438
  return e.value;
433
439
  }
434
440
  return e;
435
- }, B = x.div`
441
+ }, P = g.div`
436
442
  & > div {
437
443
  border-radius: 8px;
438
- border: 1px solid ${V.palette.neutral.N30};
444
+ border: 1px solid ${w.palette.neutral.N30};
439
445
  }
440
- `, X = x.div`
446
+ `, Q = g.div`
441
447
  width: 100%;
442
448
  height: 100%;
443
449
  overflow-y: auto;
@@ -455,201 +461,117 @@ const P = (t) => {
455
461
  background-color: #ebecf0;
456
462
  border-radius: 8px;
457
463
  }
458
- `, v = {
459
- background: {
460
- color: V.palette.neutral.N30
461
- },
462
- animation: {
463
- color: V.palette.neutral.N10
464
- }
465
- }, se = K`
466
- 0% {
467
- transform: translateX(-100%);
468
- }
469
- 100% {
470
- transform: translateX(100%);
471
- }
472
- `;
473
- x.div`
474
- position: relative;
475
- border-radius: 6px;
476
- overflow: hidden;
477
- width: ${({ $size: t }) => t};
478
- height: ${({ $size: t }) => t};
479
- background: ${({ theme: t }) => {
480
- var e, a;
481
- return ((a = (e = t == null ? void 0 : t.skeleton) == null ? void 0 : e.background) == null ? void 0 : a.color) || v.background.color;
482
- }};
483
-
484
- ${({ $animated: t }) => t && W`
485
- &::after {
486
- content: "";
487
- position: absolute;
488
- height: 100%;
489
- width: 100%;
490
- background: ${({ theme: e }) => {
491
- var a, o, l, s, c, d;
492
- return `linear-gradient(
493
- 100deg,
494
- ${((o = (a = e == null ? void 0 : e.skeleton) == null ? void 0 : a.background) == null ? void 0 : o.color) || v.background.color} 0%,
495
- ${((s = (l = e == null ? void 0 : e.skeleton) == null ? void 0 : l.animation) == null ? void 0 : s.color) || v.animation.color} 50%,
496
- ${((d = (c = e == null ? void 0 : e.skeleton) == null ? void 0 : c.background) == null ? void 0 : d.color) || v.background.color} 100%
497
- );`;
498
- }};
499
- animation: ${se} 2s linear infinite;
500
- }
501
- `}
502
- `;
503
- const ue = K`
504
- 0% {
505
- transform: translateX(-100%);
506
- }
507
- 100% {
508
- transform: translateX(100%);
509
- }
510
- `, pe = x.div`
511
- position: relative;
512
- border-radius: 6px;
513
- overflow: hidden;
514
- height: 16px;
515
- width: ${({ $width: t }) => t};
516
- background: ${({ theme: t }) => {
517
- var e, a;
518
- return ((a = (e = t == null ? void 0 : t.skeleton) == null ? void 0 : e.background) == null ? void 0 : a.color) || v.background.color;
519
- }};
520
-
521
- ${({ $animated: t }) => t && W`
522
- &::after {
523
- content: "";
524
- position: absolute;
525
- height: 100%;
526
- width: 100%;
527
- background: ${({ theme: e }) => {
528
- var a, o, l, s, c, d;
529
- return `linear-gradient(
530
- 100deg,
531
- ${((o = (a = e == null ? void 0 : e.skeleton) == null ? void 0 : a.background) == null ? void 0 : o.color) || v.background.color} 0%,
532
- ${((s = (l = e == null ? void 0 : e.skeleton) == null ? void 0 : l.animation) == null ? void 0 : s.color) || v.animation.color} 50%,
533
- ${((d = (c = e == null ? void 0 : e.skeleton) == null ? void 0 : c.background) == null ? void 0 : d.color) || v.background.color} 100%
534
- );`;
535
- }};
536
- animation: ${ue} 2s linear infinite;
537
- }
538
- `}
539
- `, $ = (t) => {
540
- const { width: e = "100%", animated: a = !1 } = t;
541
- return /* @__PURE__ */ n(pe, { $width: e, $animated: a });
542
- }, je = (t) => {
543
- const { decision: e, loading: a = !1, textValues: o } = t, l = (c) => c && Object.keys(c).length > 0, s = {
464
+ `, Y = (n) => {
465
+ const { decision: e, loading: a = !1, textValues: i } = n, d = (c) => c && Object.keys(c).length > 0, u = {
544
466
  name: (e == null ? void 0 : e.name) || "",
545
467
  dataType: (e == null ? void 0 : e.dataType) || "alphabetical",
546
- value: j(e),
468
+ value: N(e),
547
469
  valueUse: (e == null ? void 0 : e.valueUse) || "equal"
548
470
  };
549
- return !a && e && o ? /* @__PURE__ */ p(u, { direction: "column", gap: "12px", children: [
550
- e && /* @__PURE__ */ n(u, { direction: "column", alignItems: "center", children: /* @__PURE__ */ n(
551
- F,
471
+ return !a && e && i ? /* @__PURE__ */ p(l, { direction: "column", gap: "12px", children: [
472
+ e && /* @__PURE__ */ t(l, { direction: "column", alignItems: "center", children: /* @__PURE__ */ t(
473
+ z,
552
474
  {
553
- element: s,
554
- valueData: j(s),
475
+ element: u,
476
+ valueData: N(u),
555
477
  type: "decision"
556
478
  }
557
479
  ) }, e.name),
558
- /* @__PURE__ */ n(C, { dashed: !0 }),
559
- /* @__PURE__ */ n(X, { children: /* @__PURE__ */ p(
560
- u,
480
+ /* @__PURE__ */ t(S, { dashed: !0 }),
481
+ /* @__PURE__ */ t(Q, { children: /* @__PURE__ */ p(
482
+ l,
561
483
  {
562
484
  direction: "column",
563
485
  gap: "12px",
564
486
  justifyContent: "space-between",
565
487
  height: "203px",
566
488
  children: [
567
- /* @__PURE__ */ n(
568
- D,
489
+ /* @__PURE__ */ t(
490
+ f,
569
491
  {
570
492
  type: "label",
571
493
  size: "large",
572
494
  appearance: "dark",
573
495
  weight: "bold",
574
496
  textAlign: "center",
575
- children: o.factsThatConditionIt
497
+ children: i.factsThatConditionIt
576
498
  }
577
499
  ),
578
500
  e.conditions && e.conditions.map((c) => {
579
501
  if (c.hidden) return null;
580
- const d = c.value;
581
- return (typeof d == "object" && l(d) || d) && /* @__PURE__ */ n(B, { children: /* @__PURE__ */ n(u, { direction: "column", padding: "8px", children: /* @__PURE__ */ n(
582
- F,
502
+ const s = c.value;
503
+ return (typeof s == "object" && d(s) || s) && /* @__PURE__ */ t(P, { children: /* @__PURE__ */ t(l, { direction: "column", padding: "8px", children: /* @__PURE__ */ t(
504
+ z,
583
505
  {
584
506
  element: {
585
507
  ...c,
586
- value: d
508
+ value: s
587
509
  },
588
- valueData: j(c)
510
+ valueData: N(c)
589
511
  }
590
512
  ) }) }, c.name);
591
513
  }),
592
- /* @__PURE__ */ n(C, { dashed: !0 }),
593
- /* @__PURE__ */ n(u, { direction: "column", gap: "12px", children: (e == null ? void 0 : e.startDate) && (e == null ? void 0 : e.endDate) && /* @__PURE__ */ n(
594
- F,
514
+ /* @__PURE__ */ t(S, { dashed: !0 }),
515
+ /* @__PURE__ */ t(l, { direction: "column", gap: "12px", children: (e == null ? void 0 : e.startDate) && (e == null ? void 0 : e.endDate) && /* @__PURE__ */ t(
516
+ z,
595
517
  {
596
518
  element: {
597
- name: o.terms,
519
+ name: i.terms,
598
520
  value: String(e.startDate),
599
- valueUse: m.RANGE,
600
- dataType: I.DATE
521
+ valueUse: b.RANGE,
522
+ dataType: O.DATE
601
523
  },
602
- valueData: j({
603
- name: o.terms,
524
+ valueData: N({
525
+ name: i.terms,
604
526
  value: {
605
527
  from: String(e.startDate),
606
528
  to: String(e.endDate)
607
529
  },
608
- valueUse: m.RANGE,
609
- dataType: I.DATE
530
+ valueUse: b.RANGE,
531
+ dataType: O.DATE
610
532
  }),
611
533
  type: "decision"
612
534
  },
613
- o.terms
535
+ i.terms
614
536
  ) })
615
537
  ]
616
538
  }
617
539
  ) })
618
- ] }) : /* @__PURE__ */ p(u, { direction: "column", gap: "12px", children: [
619
- /* @__PURE__ */ p(u, { direction: "column", alignItems: "center", gap: "4px", children: [
620
- /* @__PURE__ */ n($, { animated: !0, width: "180px" }),
621
- /* @__PURE__ */ n($, { animated: !0, width: "85px" })
540
+ ] }) : /* @__PURE__ */ p(l, { direction: "column", gap: "12px", children: [
541
+ /* @__PURE__ */ p(l, { direction: "column", alignItems: "center", gap: "4px", children: [
542
+ /* @__PURE__ */ t(V, { animated: !0, width: "180px" }),
543
+ /* @__PURE__ */ t(V, { animated: !0, width: "85px" })
622
544
  ] }, "loading"),
623
- /* @__PURE__ */ p(u, { direction: "column", gap: "12px", alignItems: "center", children: [
624
- /* @__PURE__ */ n(C, { dashed: !0 }),
625
- /* @__PURE__ */ n($, { animated: !0, width: "150px" })
545
+ /* @__PURE__ */ p(l, { direction: "column", gap: "12px", alignItems: "center", children: [
546
+ /* @__PURE__ */ t(S, { dashed: !0 }),
547
+ /* @__PURE__ */ t(V, { animated: !0, width: "150px" })
626
548
  ] }),
627
- /* @__PURE__ */ n(X, { children: /* @__PURE__ */ n(
628
- u,
549
+ /* @__PURE__ */ t(Q, { children: /* @__PURE__ */ t(
550
+ l,
629
551
  {
630
552
  direction: "column",
631
553
  gap: "12px",
632
554
  justifyContent: "space-between",
633
555
  height: "203px",
634
- children: Array.from({ length: 5 }).map((c, d) => /* @__PURE__ */ n(B, { children: /* @__PURE__ */ p(
635
- u,
556
+ children: Array.from({ length: 5 }).map((c, s) => /* @__PURE__ */ t(P, { children: /* @__PURE__ */ p(
557
+ l,
636
558
  {
637
559
  direction: "column",
638
560
  gap: "12px",
639
561
  alignItems: "start",
640
562
  padding: "8px",
641
563
  children: [
642
- /* @__PURE__ */ n($, { animated: !0, width: "180px" }),
643
- /* @__PURE__ */ n($, { animated: !0, width: "85px" })
564
+ /* @__PURE__ */ t(V, { animated: !0, width: "180px" }),
565
+ /* @__PURE__ */ t(V, { animated: !0, width: "85px" })
644
566
  ]
645
567
  }
646
- ) }, `condition-${d}`))
568
+ ) }, `condition-${s}`))
647
569
  }
648
570
  ) })
649
571
  ] });
650
- }, me = x.div`
572
+ }, xe = g.div`
651
573
  border-radius: 8px;
652
- border: 1px solid ${V.palette.neutral.N30};
574
+ border: 1px solid ${w.palette.neutral.N30};
653
575
  box-sizing: border-box;
654
576
  display: flex;
655
577
  flex-direction: column;
@@ -659,7 +581,7 @@ const ue = K`
659
581
  height: 100%;
660
582
  box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
661
583
  `;
662
- x.div`
584
+ g.div`
663
585
  width: 100%;
664
586
  height: 100%;
665
587
  overflow-y: auto;
@@ -678,43 +600,342 @@ x.div`
678
600
  border-radius: 8px;
679
601
  }
680
602
  `;
681
- const Re = (t) => {
682
- const { children: e, controls: a = !0, handleDelete: o, handleView: l, id: s } = t;
683
- return /* @__PURE__ */ n(me, { children: /* @__PURE__ */ p(u, { direction: "column", gap: "16px", padding: "12px 16px", children: [
603
+ const M = (n) => {
604
+ const { children: e, controls: a = !0, handleDelete: i, handleView: d, id: u } = n;
605
+ return /* @__PURE__ */ t(xe, { children: /* @__PURE__ */ p(l, { direction: "column", gap: "16px", padding: "12px 16px", children: [
684
606
  e,
685
- a && /* @__PURE__ */ p(R, { children: [
686
- /* @__PURE__ */ n(C, {}),
687
- /* @__PURE__ */ p(u, { gap: "16px", justifyContent: "end", children: [
688
- /* @__PURE__ */ n(
689
- G,
607
+ a && /* @__PURE__ */ p(A, { children: [
608
+ /* @__PURE__ */ t(S, {}),
609
+ /* @__PURE__ */ p(l, { gap: "16px", justifyContent: "end", children: [
610
+ /* @__PURE__ */ t(
611
+ F,
690
612
  {
691
613
  appearance: "dark",
692
614
  size: "24px",
693
615
  cursorHover: !0,
694
- icon: /* @__PURE__ */ n(ne, {}),
616
+ icon: /* @__PURE__ */ t(re, {}),
695
617
  onClick: () => {
696
- l(s);
618
+ d(u);
697
619
  }
698
620
  }
699
621
  ),
700
- /* @__PURE__ */ n(
701
- G,
622
+ /* @__PURE__ */ t(
623
+ F,
702
624
  {
703
625
  cursorHover: !0,
704
626
  appearance: "dark",
705
627
  size: "24px",
706
- icon: /* @__PURE__ */ n(re, {}),
628
+ icon: /* @__PURE__ */ t(ae, {}),
707
629
  onClick: () => {
708
- o(s);
630
+ i(u);
709
631
  }
710
632
  }
711
633
  )
712
634
  ] })
713
635
  ] })
714
636
  ] }) });
637
+ }, ye = g.div`
638
+ position: relative;
639
+ & > div {
640
+ padding: 24px 16px;
641
+ }
642
+ `, ve = g.div`
643
+ background-color: ${({ theme: n }) => {
644
+ var e, a;
645
+ return ((a = (e = n == null ? void 0 : n.palette) == null ? void 0 : e.neutral) == null ? void 0 : a.N0) || w.palette.neutral.N0;
646
+ }};
647
+ max-width: 450px;
648
+ max-height: 90vh;
649
+ overflow-y: hidden;
650
+ border-radius: 8px;
651
+ transition: overflow-y 0.3s ease-in-out;
652
+ & > div {
653
+ padding: 24px;
654
+ }
655
+
656
+ &:hover {
657
+ overflow-y: auto;
658
+ }
659
+
660
+ &::-webkit-scrollbar {
661
+ width: 4px;
662
+ }
663
+
664
+ &::-webkit-scrollbar-thumb {
665
+ background-color: #c1c7d0;
666
+ border-radius: 8px;
667
+ }
668
+
669
+ &::-webkit-scrollbar-track {
670
+ background-color: #ebecf0;
671
+ border-radius: 8px;
672
+ }
673
+ `, we = (n) => {
674
+ const { children: e, portalId: a, onCloseModal: i, title: d } = n, u = document.getElementById(a);
675
+ if (!u)
676
+ throw new Error(
677
+ "The portal node is not defined. This can occur when the specific node used to render the portal has not been defined correctly."
678
+ );
679
+ return le(
680
+ /* @__PURE__ */ t(ye, { children: /* @__PURE__ */ t(de, { children: /* @__PURE__ */ t(ve, { children: /* @__PURE__ */ p(l, { direction: "column", gap: "24px", children: [
681
+ /* @__PURE__ */ t(l, { direction: "column", gap: "24px", children: /* @__PURE__ */ p(l, { alignItems: "center", justifyContent: "space-between", children: [
682
+ /* @__PURE__ */ t(f, { type: "title", size: "large", appearance: "dark", weight: "bold", children: d }),
683
+ /* @__PURE__ */ t(ie, { size: "24px", cursor: "pointer", onClick: i })
684
+ ] }) }),
685
+ e
686
+ ] }) }) }) }),
687
+ u
688
+ );
689
+ }, Ce = ne`
690
+ from {
691
+ opacity: 0;
692
+ transform: translateY(20px);
693
+ }
694
+ to {
695
+ opacity: 1;
696
+ transform: translateY(0);
697
+ }
698
+ `, W = g.div`
699
+ width: 100%;
700
+ height: 100%;
701
+ & > div {
702
+ animation: ${Ce} 600ms ease-out;
703
+ }
704
+ `;
705
+ g.div`
706
+ border-radius: 8px;
707
+ border: 1px solid ${w.palette.neutral.N30};
708
+ box-sizing: border-box;
709
+ display: flex;
710
+ flex-direction: column;
711
+ // height: 364px;
712
+ // width: 332px;
713
+ width: 100%;
714
+ height: 100%;
715
+ box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
716
+ `;
717
+ const ke = g.div`
718
+ & > div {
719
+ width: 100%;
720
+ height: 100%;
721
+ overflow-y: auto;
722
+
723
+ &::-webkit-scrollbar {
724
+ width: 8px;
725
+ }
726
+
727
+ &::-webkit-scrollbar-thumb {
728
+ background-color: #c1c7d0;
729
+ border-radius: 8px;
730
+ }
731
+
732
+ &::-webkit-scrollbar-track {
733
+ background-color: #ebecf0;
734
+ border-radius: 8px;
735
+ }
736
+ }
737
+ `, Se = g.div`
738
+ & > div > div {
739
+ border-radius: 8px;
740
+ border: 1px solid ${w.palette.neutral.N30};
741
+ box-sizing: border-box;
742
+ box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
743
+ }
744
+ `, Ee = g.div`
745
+ & > div {
746
+ background-color: ${w.palette.neutral.N30};
747
+ justify-content: center;
748
+ }
749
+ min-height: 300px;
750
+ width: 100%;
751
+ height: 100%;
752
+ padding-bottom: 12px;
753
+ `;
754
+ g.div`
755
+ & > div {
756
+ border-radius: 8px;
757
+ border: 1px solid ${w.palette.neutral.N30};
758
+ }
759
+ `;
760
+ const Ye = ({
761
+ decisions: n,
762
+ textValues: e,
763
+ decisionTemplate: a,
764
+ isModalOpen: i,
765
+ selectedDecision: d,
766
+ loading: u,
767
+ handleOpenModal: c,
768
+ handleCloseModal: s,
769
+ handleSubmitForm: x,
770
+ handleDelete: m
771
+ }) => {
772
+ const y = se("(max-width: 681px)");
773
+ return /* @__PURE__ */ p(A, { children: [
774
+ /* @__PURE__ */ t(Se, { children: /* @__PURE__ */ t(ke, { children: /* @__PURE__ */ p(l, { direction: "column", gap: "16px", padding: "6px", children: [
775
+ n.length === 0 && /* @__PURE__ */ p(f, { as: "span", type: "label", size: "large", appearance: "gray", children: [
776
+ "Aún no tienes definidas tasas de interés efectivas. Presiona",
777
+ " ",
778
+ /* @__PURE__ */ t(
779
+ f,
780
+ {
781
+ as: "span",
782
+ type: "label",
783
+ size: "large",
784
+ appearance: "gray",
785
+ weight: "bold",
786
+ children: "“+ Agregar decisión”"
787
+ }
788
+ ),
789
+ " ",
790
+ "para empezar."
791
+ ] }),
792
+ /* @__PURE__ */ p(
793
+ ce,
794
+ {
795
+ templateColumns: "repeat(auto-fill, minmax(300px, 1fr))",
796
+ autoFlow: "row dense",
797
+ gap: "24px",
798
+ alignItems: "start",
799
+ justifyContent: "center",
800
+ autoRows: "1fr",
801
+ justifyItems: "center",
802
+ padding: "6px",
803
+ height: y ? "auto" : "484px",
804
+ children: [
805
+ u ? Array.from({ length: 3 }).map((h, v) => /* @__PURE__ */ t(
806
+ M,
807
+ {
808
+ id: `loading-card-${v}`,
809
+ handleDelete: () => {
810
+ },
811
+ handleView: () => c(),
812
+ controls: !1,
813
+ children: /* @__PURE__ */ t(Y, { loading: !0 })
814
+ },
815
+ `loading-card-${v}`
816
+ )) : n.map((h) => /* @__PURE__ */ t(W, { children: /* @__PURE__ */ p(
817
+ l,
818
+ {
819
+ direction: "column",
820
+ gap: "4px",
821
+ width: "100%",
822
+ padding: "0 0 12px 0",
823
+ children: [
824
+ /* @__PURE__ */ t(
825
+ f,
826
+ {
827
+ type: "title",
828
+ size: "medium",
829
+ appearance: "gray",
830
+ weight: "bold",
831
+ children: h.id
832
+ }
833
+ ),
834
+ /* @__PURE__ */ t(
835
+ M,
836
+ {
837
+ id: h.id,
838
+ handleDelete: () => m(h.id),
839
+ handleView: () => c(h),
840
+ children: /* @__PURE__ */ t(
841
+ Y,
842
+ {
843
+ decision: h,
844
+ textValues: e
845
+ }
846
+ )
847
+ }
848
+ )
849
+ ]
850
+ },
851
+ h.id
852
+ ) }, h.id)),
853
+ (n.length === 0 || n.length < Math.floor(window.innerWidth / 300)) && !u && /* @__PURE__ */ t(W, { children: /* @__PURE__ */ p(
854
+ l,
855
+ {
856
+ direction: "column",
857
+ gap: "4px",
858
+ width: "100%",
859
+ height: "100%",
860
+ children: [
861
+ /* @__PURE__ */ t(
862
+ f,
863
+ {
864
+ type: "title",
865
+ size: "medium",
866
+ appearance: "gray",
867
+ weight: "bold",
868
+ children: "Nueva decisión"
869
+ }
870
+ ),
871
+ /* @__PURE__ */ t(
872
+ Ee,
873
+ {
874
+ onClick: () => c(),
875
+ children: /* @__PURE__ */ t(
876
+ M,
877
+ {
878
+ id: `add-decision-${n.length}`,
879
+ handleDelete: () => {
880
+ },
881
+ handleView: () => c(),
882
+ controls: !1,
883
+ children: /* @__PURE__ */ p(
884
+ l,
885
+ {
886
+ direction: "column",
887
+ gap: "12px",
888
+ alignItems: "center",
889
+ children: [
890
+ /* @__PURE__ */ t(
891
+ F,
892
+ {
893
+ appearance: "gray",
894
+ icon: /* @__PURE__ */ t(oe, {}),
895
+ size: "35px"
896
+ }
897
+ ),
898
+ /* @__PURE__ */ t(f, { appearance: "gray", type: "body", size: "large", children: "Agregar decisión" })
899
+ ]
900
+ }
901
+ )
902
+ }
903
+ )
904
+ }
905
+ )
906
+ ]
907
+ },
908
+ `add-decision-${n.length}`
909
+ ) }, `add-decision-${n.length}`)
910
+ ]
911
+ }
912
+ )
913
+ ] }) }) }),
914
+ i && /* @__PURE__ */ t(
915
+ we,
916
+ {
917
+ portalId: "modal-portal",
918
+ onCloseModal: s,
919
+ title: d ? "Editar Decisión" : "Nueva decisión",
920
+ children: /* @__PURE__ */ t(
921
+ fe,
922
+ {
923
+ id: d ? d.id : `decision-${n.length + 1}`,
924
+ decision: d || a,
925
+ onCloseModal: s,
926
+ onSubmitEvent: x,
927
+ textValues: e,
928
+ onCancel: () => s()
929
+ }
930
+ )
931
+ }
932
+ )
933
+ ] });
715
934
  };
716
935
  export {
717
- Re as BusinessRuleCard,
718
- je as BusinessRuleView,
719
- Oe as RulesForm
936
+ M as BusinessRuleCard,
937
+ Y as BusinessRuleView,
938
+ Ye as BusinessRules,
939
+ we as ModalRules,
940
+ fe as RulesForm
720
941
  };
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "description": "",
12
12
  "private": false,
13
- "version": "0.1.20",
13
+ "version": "0.1.22",
14
14
  "type": "module",
15
15
  "exports": {
16
16
  ".": {
@@ -42,6 +42,7 @@
42
42
  "@inubekit/date": "^2.39.1",
43
43
  "@inubekit/divider": "^0.16.1",
44
44
  "@inubekit/foundations": "^5.11.3",
45
+ "@inubekit/hooks": "^1.2.0",
45
46
  "@inubekit/grid": "^2.14.1",
46
47
  "@inubekit/icon": "^2.18.1",
47
48
  "@inubekit/input": "^1.6.3",
@@ -50,7 +51,7 @@
50
51
  "@inubekit/text": "^2.17.0",
51
52
  "@inubekit/textarea": "^2.45.0",
52
53
  "@inubekit/toggle": "^3.8.2",
53
- "@isettingkit/input": "^0.1.28",
54
+ "@isettingkit/input": "^0.1.30",
54
55
  "@isettingkit/view": "^0.1.18"
55
56
  },
56
57
  "peerDependencies": {