@isettingkit/business-rules 0.1.17 → 0.1.18

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.
Files changed (2) hide show
  1. package/dist/index.es.js +57 -57
  2. package/package.json +1 -1
package/dist/index.es.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsxs as g, jsx as n, Fragment as j } from "react/jsx-runtime";
2
2
  import { useFormik as Q } from "formik";
3
3
  import { useState as x, useEffect as q } from "react";
4
- import { Divider as w } from "@inubekit/divider";
4
+ import { Divider as E } from "@inubekit/divider";
5
5
  import { Stack as o } from "@inubekit/stack";
6
6
  import { Text as y } from "@inubekit/text";
7
7
  import { Toggle as P } from "@inubekit/toggle";
@@ -22,7 +22,7 @@ const Y = (t) => {
22
22
  labelText: a,
23
23
  onHandleChange: i,
24
24
  placeholder: l,
25
- required: s,
25
+ required: c,
26
26
  value: m = ""
27
27
  } = t, [d, b] = x(m);
28
28
  return /* @__PURE__ */ g(o, { direction: "column", margin: "10px 4px", children: [
@@ -36,7 +36,7 @@ const Y = (t) => {
36
36
  b(p.target.value), i(p);
37
37
  },
38
38
  placeholder: l,
39
- required: s,
39
+ required: c,
40
40
  value: d,
41
41
  maxLength: 120,
42
42
  fullwidth: !0
@@ -49,7 +49,7 @@ const Y = (t) => {
49
49
  children: a,
50
50
  handleToggleChange: i,
51
51
  id: l,
52
- labelToggle: s,
52
+ labelToggle: c,
53
53
  name: m,
54
54
  valueToggle: d = ""
55
55
  } = t, [b, C] = x(e), p = (v) => {
@@ -68,7 +68,7 @@ const Y = (t) => {
68
68
  onChange: p,
69
69
  size: "small",
70
70
  value: d,
71
- children: /* @__PURE__ */ n(y, { size: "medium", type: "label", weight: "bold", children: s })
71
+ children: /* @__PURE__ */ n(y, { size: "medium", type: "label", weight: "bold", children: c })
72
72
  }
73
73
  ) }),
74
74
  b && /* @__PURE__ */ n(j, { children: a })
@@ -79,11 +79,11 @@ const Y = (t) => {
79
79
  onHandleEndChange: a,
80
80
  labelStart: i,
81
81
  labelEnd: l,
82
- checkedClosed: s = !1,
82
+ checkedClosed: c = !1,
83
83
  required: m = !1,
84
84
  valueStart: d = "",
85
85
  valueEnd: b = ""
86
- } = t, [C, p] = x(s), [v, E] = x(d), [S, T] = x(b);
86
+ } = t, [C, p] = x(c), [v, w] = x(d), [S, T] = x(b);
87
87
  return /* @__PURE__ */ g(j, { children: [
88
88
  /* @__PURE__ */ g(o, { direction: "row", justifyContent: "space-between", margin: "10px 0", children: [
89
89
  /* @__PURE__ */ n(o, { children: /* @__PURE__ */ n(
@@ -108,8 +108,8 @@ const Y = (t) => {
108
108
  J,
109
109
  {
110
110
  label: "Cerrada",
111
- onChange: ({ target: c }) => {
112
- p(c.checked);
111
+ onChange: ({ target: s }) => {
112
+ p(s.checked);
113
113
  },
114
114
  checked: C,
115
115
  value: ""
@@ -124,8 +124,8 @@ const Y = (t) => {
124
124
  {
125
125
  id: "dateStart",
126
126
  label: i,
127
- onChange: (c) => {
128
- E(c.target.value), e(c);
127
+ onChange: (s) => {
128
+ w(s.target.value), e(s);
129
129
  },
130
130
  value: v,
131
131
  required: m,
@@ -137,8 +137,8 @@ const Y = (t) => {
137
137
  {
138
138
  id: "dateEnd",
139
139
  label: l,
140
- onChange: (c) => {
141
- T(c.target.value), a(c);
140
+ onChange: (s) => {
141
+ T(s.target.value), a(s);
142
142
  },
143
143
  value: S,
144
144
  required: m,
@@ -157,7 +157,7 @@ const Y = (t) => {
157
157
  "isArrayOrString",
158
158
  "Must be an array of strings/numbers or a single string",
159
159
  (l) => Array.isArray(l) ? l.every(
160
- (s) => typeof s == "string" || typeof s == "number"
160
+ (c) => typeof c == "string" || typeof c == "number"
161
161
  ) : typeof l == "string"
162
162
  ),
163
163
  value: e
@@ -168,7 +168,7 @@ const Y = (t) => {
168
168
  "isArrayOrString",
169
169
  "Must be an array of strings/numbers or a single string",
170
170
  (l) => Array.isArray(l) ? l.every(
171
- (s) => typeof s == "string" || typeof s == "number"
171
+ (c) => typeof c == "string" || typeof c == "number"
172
172
  ) : typeof l == "string"
173
173
  ),
174
174
  value: e
@@ -231,12 +231,12 @@ const Y = (t) => {
231
231
  formik: a,
232
232
  onChangeCondition: i,
233
233
  onChangeDecision: l,
234
- onStartChange: s,
234
+ onStartChange: c,
235
235
  onEndChange: m,
236
236
  textValues: d,
237
237
  onCancel: b,
238
238
  onSubmit: C
239
- } = t, [p, v] = x(!1), [E, S] = x(!0), T = {
239
+ } = t, [p, v] = x(!1), [w, S] = x(!0), T = {
240
240
  name: e.name,
241
241
  dataType: e.dataType,
242
242
  value: e.value,
@@ -253,7 +253,7 @@ const Y = (t) => {
253
253
  }, u = (r) => {
254
254
  const h = U(a.errors[r] || {});
255
255
  return typeof h == "string" ? h ? "invalid" : "pending" : h;
256
- }, c = (r) => {
256
+ }, s = (r) => {
257
257
  const h = U(a.errors[r] || {});
258
258
  return h;
259
259
  };
@@ -277,7 +277,7 @@ const Y = (t) => {
277
277
  }
278
278
  )
279
279
  ] }),
280
- /* @__PURE__ */ n(w, { dashed: !0 }),
280
+ /* @__PURE__ */ n(E, { dashed: !0 }),
281
281
  /* @__PURE__ */ g(o, { direction: "column", children: [
282
282
  /* @__PURE__ */ g(o, { direction: "row", gap: "16px", justifyContent: "space-between", children: [
283
283
  /* @__PURE__ */ n(y, { children: d.factsThatConditionIt }),
@@ -316,7 +316,7 @@ const Y = (t) => {
316
316
  element: r,
317
317
  onDecision: i,
318
318
  valueData: a.values[r.name],
319
- message: c(r.name),
319
+ message: s(r.name),
320
320
  status: u(r.name),
321
321
  textValues: {
322
322
  selectOptions: "Select an option",
@@ -329,7 +329,7 @@ const Y = (t) => {
329
329
  }
330
330
  ) }, r.name))
331
331
  ] }),
332
- /* @__PURE__ */ n(w, { dashed: !0 }),
332
+ /* @__PURE__ */ n(E, { dashed: !0 }),
333
333
  /* @__PURE__ */ n(o, { direction: "column", children: /* @__PURE__ */ n(
334
334
  Y,
335
335
  {
@@ -340,11 +340,11 @@ const Y = (t) => {
340
340
  required: !0
341
341
  }
342
342
  ) }),
343
- /* @__PURE__ */ n(w, { dashed: !0 }),
343
+ /* @__PURE__ */ n(E, { dashed: !0 }),
344
344
  /* @__PURE__ */ n(o, { direction: "column", children: e && /* @__PURE__ */ n(
345
345
  ne,
346
346
  {
347
- onHandleStartChange: (r) => s(r.target.value),
347
+ onHandleStartChange: (r) => c(r.target.value),
348
348
  onHandleEndChange: (r) => m(r.target.value),
349
349
  labelStart: d.termStart,
350
350
  labelEnd: d.termEnd,
@@ -353,14 +353,14 @@ const Y = (t) => {
353
353
  valueEnd: String(e.endDate) || ""
354
354
  }
355
355
  ) }),
356
- /* @__PURE__ */ n(w, { dashed: !0 }),
356
+ /* @__PURE__ */ n(E, { dashed: !0 }),
357
357
  /* @__PURE__ */ g(o, { direction: "row", justifyContent: "end", gap: "16px", children: [
358
358
  /* @__PURE__ */ n(L, { appearance: "gray", onClick: b, children: d.cancel }),
359
359
  /* @__PURE__ */ n(
360
360
  L,
361
361
  {
362
362
  onClick: C,
363
- disabled: E || !a.isValid,
363
+ disabled: w || !a.isValid,
364
364
  type: "submit",
365
365
  children: d.confirm
366
366
  }
@@ -368,30 +368,30 @@ const Y = (t) => {
368
368
  ] })
369
369
  ] });
370
370
  }, ke = (t) => {
371
- const { id: e, decision: a, onCancel: i, onSubmitEvent: l, textValues: s } = t, [m, d] = x(a), b = (u, c) => {
372
- k.setFieldValue(u, c), k.validateField(u);
373
- }, C = (u, c) => {
371
+ const { id: e, decision: a, onCancel: i, onSubmitEvent: l, textValues: c } = t, [m, d] = x(a), b = (u, s) => {
372
+ k.setFieldValue(u, s), k.validateField(u);
373
+ }, C = (u, s) => {
374
374
  const r = u instanceof Date ? u.toISOString() : u;
375
375
  d((h) => {
376
376
  if (!h.conditions)
377
377
  return h;
378
- const G = h.conditions.map((O) => O.name === c ? { ...O, value: r } : O);
378
+ const G = h.conditions.map((O) => O.name === s ? { ...O, value: r } : O);
379
379
  return {
380
380
  ...h,
381
381
  conditions: G
382
382
  };
383
- }), b(c, r);
383
+ }), b(s, r);
384
384
  }, p = (u) => {
385
385
  d(
386
- (c) => D(c, "value", u)
386
+ (s) => D(s, "value", u)
387
387
  );
388
388
  }, v = (u) => {
389
389
  d(
390
- (c) => D(c, "endDate", u)
390
+ (s) => D(s, "endDate", u)
391
391
  );
392
- }, E = (u) => {
392
+ }, w = (u) => {
393
393
  d(
394
- (c) => D(c, "startDate", u)
394
+ (s) => D(s, "startDate", u)
395
395
  );
396
396
  }, { validationSchema: S, initialValues: T } = te(m);
397
397
  S.validate(T, { abortEarly: !1 }).then(() => console.log("Validation passed")).catch((u) => console.log("Validation failed:", u.errors));
@@ -403,10 +403,10 @@ const Y = (t) => {
403
403
  onSubmit: () => {
404
404
  l(m);
405
405
  }
406
- }), D = (u, c, r) => ({
406
+ }), D = (u, s, r) => ({
407
407
  ...u,
408
408
  ...u.decision,
409
- [c]: r
409
+ [s]: r
410
410
  });
411
411
  return /* @__PURE__ */ n(
412
412
  ae,
@@ -418,9 +418,9 @@ const Y = (t) => {
418
418
  onSubmit: () => l(m),
419
419
  onChangeCondition: C,
420
420
  onChangeDecision: p,
421
- onStartChange: E,
421
+ onStartChange: w,
422
422
  onEndChange: v,
423
- textValues: s
423
+ textValues: c
424
424
  }
425
425
  );
426
426
  }, R = (t) => {
@@ -445,7 +445,7 @@ const Y = (t) => {
445
445
  }
446
446
  return e;
447
447
  }, De = (t) => {
448
- const { decision: e, textValues: a } = t, i = (s) => s && Object.keys(s).length > 0, l = {
448
+ const { decision: e, textValues: a } = t, i = (c) => c && Object.keys(c).length > 0, l = {
449
449
  name: e.name,
450
450
  dataType: e.dataType,
451
451
  value: R(e),
@@ -464,18 +464,18 @@ const Y = (t) => {
464
464
  ] }),
465
465
  /* @__PURE__ */ g(o, { direction: "column", gap: "16px", justifyContent: "space-between", children: [
466
466
  /* @__PURE__ */ n(y, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: a.factsThatConditionIt }),
467
- e.conditions && e.conditions.map((s) => {
468
- const m = s.value;
467
+ e.conditions && e.conditions.map((c) => {
468
+ const m = c.value;
469
469
  return (typeof m == "object" && i(m) || m) && /* @__PURE__ */ n(o, { direction: "column", children: /* @__PURE__ */ n(
470
470
  V,
471
471
  {
472
472
  element: {
473
- ...s,
473
+ ...c,
474
474
  value: m
475
475
  },
476
- valueData: R(s)
476
+ valueData: R(c)
477
477
  }
478
- ) }, s.name);
478
+ ) }, c.name);
479
479
  })
480
480
  ] }),
481
481
  /* @__PURE__ */ g(o, { direction: "column", gap: "12px", children: [
@@ -511,14 +511,14 @@ const Y = (t) => {
511
511
  ] })
512
512
  ] });
513
513
  }, re = B.div`
514
- border-radius: 8px;
515
- border: 1px solid ${X.palette.neutral.N30};
516
- box-sizing: border-box;
517
- display: flex;
518
- flex-direction: column;
519
- height: 340px;
520
- width: 332px;
521
- box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
514
+ & > div {
515
+ border-radius: 8px;
516
+ border: 1px solid ${X.palette.neutral.N30};
517
+ box-sizing: border-box;
518
+ // height: 340px;
519
+ // width: 332px;
520
+ box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
521
+ }
522
522
  `, oe = B.div`
523
523
  width: 100%;
524
524
  height: 100%;
@@ -537,12 +537,12 @@ const Y = (t) => {
537
537
  background-color: #ebecf0;
538
538
  border-radius: 8px;
539
539
  }
540
- `, Ee = (t) => {
540
+ `, we = (t) => {
541
541
  const { children: e, handleDelete: a, handleView: i, id: l } = t;
542
- return /* @__PURE__ */ g(re, { children: [
542
+ return /* @__PURE__ */ n(re, { children: /* @__PURE__ */ g(o, { direction: "column", width: "100%", height: "100%", children: [
543
543
  /* @__PURE__ */ n(o, { height: "282px", gap: "24px", direction: "column", children: /* @__PURE__ */ n(oe, { children: /* @__PURE__ */ n(o, { direction: "column", margin: "10px", children: e }) }) }),
544
544
  /* @__PURE__ */ g(o, { gap: "16px", direction: "column", margin: "2px 12px", children: [
545
- /* @__PURE__ */ n(w, {}),
545
+ /* @__PURE__ */ n(E, {}),
546
546
  /* @__PURE__ */ g(o, { gap: "16px", justifyContent: "end", children: [
547
547
  /* @__PURE__ */ n(
548
548
  N,
@@ -570,10 +570,10 @@ const Y = (t) => {
570
570
  )
571
571
  ] })
572
572
  ] })
573
- ] });
573
+ ] }) });
574
574
  };
575
575
  export {
576
- Ee as BusinessRuleCard,
576
+ we as BusinessRuleCard,
577
577
  De as BusinessRuleView,
578
578
  ke as RulesForm
579
579
  };
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "description": "",
12
12
  "private": false,
13
- "version": "0.1.17",
13
+ "version": "0.1.18",
14
14
  "type": "module",
15
15
  "exports": {
16
16
  ".": {