@isettingkit/business-rules 0.1.26 → 0.1.27

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