@isettingkit/business-rules 0.1.21 → 0.1.23

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