@isettingkit/business-rules 0.1.2
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/README.md +38 -0
- package/dist/index.es.d.ts +62 -0
- package/dist/index.es.js +432 -0
- package/package.json +107 -0
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# IDS - Starter
|
|
2
|
+
|
|
3
|
+
This project is a starter repository that can be used to develop and publish new Inube Design System components. With this repository the intention is that any design-system team member can start to develop a new component without starting from scratch.
|
|
4
|
+
|
|
5
|
+
## Readme
|
|
6
|
+
|
|
7
|
+
This readme contains the details of usage of the starter. Once you create a new repo based in this template in github, please change the content of the README and make it relatable to the component you are creating.
|
|
8
|
+
|
|
9
|
+
## Instructions of usage
|
|
10
|
+
|
|
11
|
+
### Package.json
|
|
12
|
+
|
|
13
|
+
1. **name**: As you can see in the package.json file, the name of this package is "ids-starter". Please rename the name when you start your new project. Remember that all components are publish by the @inubekit organization in npm, so rename the package as @inubekit/{new-component-name}
|
|
14
|
+
2. **description**: Complete the description about the component you are creating.
|
|
15
|
+
|
|
16
|
+
### Environment variables
|
|
17
|
+
|
|
18
|
+
1. In order to control releases and package publishing, you will need to have a .env file with some environment variables.
|
|
19
|
+
2. `GH_TOKEN`: Create this token in github.com, using your profile settings. This token requires the **repo** scope.
|
|
20
|
+
3. `NPM_TOKEN`: Create this token in npmjs.com. You must ask the admin to add you as a organization admin prior to publish the package in npm.
|
|
21
|
+
|
|
22
|
+
### Pull Requests
|
|
23
|
+
|
|
24
|
+
1. All PRs must have a semver label attached to it. This is the way the publishing and versioning process will use to know if a PR demands a major, minor or patch version to be created.
|
|
25
|
+
2. To have these labels available, please run `npm run auto create-labels` to create them (you need to have already your `GH_TOKEN` in .env in order to make this command work).
|
|
26
|
+
|
|
27
|
+
### Publishing
|
|
28
|
+
|
|
29
|
+
Follow these steps to publish and release a new version of your package.
|
|
30
|
+
|
|
31
|
+
Check that you're an admin in the repository (validate with your team leader) and **execute these scripts in a release branch**.
|
|
32
|
+
|
|
33
|
+
1. `npm run changelog`: this command will create a changelog for you, including in the document the changes that the current release will publish in the new version of the package and what should be the version number of the release. The number is calculated using the labels of all the PRs that are included in this new version (see the Pull Requests details above).
|
|
34
|
+
2. `npm version <new-version>`: this command creates the new version (tag), deletes the /dist folder in your project and executes the build of the project and its files are stored in a new /dist folder.
|
|
35
|
+
3. `git push -u origin <branch>`: this command pushes the commits of changelog and package.json with the new version to github.
|
|
36
|
+
4. `npm run release`: this command executes a git push with the new version tag included and creates a new release in Github. **This step requires that you have your `GH_TOKEN` working**.
|
|
37
|
+
5. `npm login`: you must be logged in with npm to continue the process.
|
|
38
|
+
6. `npm publish`: with the new build already in /dist, you can now execute this command and the new package version will be published in npm. **This command requires tat you have you `NPM_TOKEN` working.** _Note_: if this first time you are publishing you should add `--access=public` flag to the command
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { IRuleDecision } from '@isettingkit/input';
|
|
2
|
+
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
export declare const BusinessRuleCard: (props: IBusinessRuleCard) => JSX_2.Element;
|
|
5
|
+
|
|
6
|
+
export declare const BusinessRuleView: (props: IBusinessRuleView) => JSX_2.Element;
|
|
7
|
+
|
|
8
|
+
export declare interface IBusinessRuleCard {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
handleDelete: (id: string) => void;
|
|
11
|
+
handleView: (id: string) => void;
|
|
12
|
+
id: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export declare interface IBusinessRuleView {
|
|
16
|
+
decision: IRuleDecision;
|
|
17
|
+
textValues: {
|
|
18
|
+
selectOptions: string;
|
|
19
|
+
selectOption: string;
|
|
20
|
+
rangeMin: (label: string) => string;
|
|
21
|
+
rangeMax: (label: string) => string;
|
|
22
|
+
reasonForChange: string;
|
|
23
|
+
change: string;
|
|
24
|
+
changePlaceholder: string;
|
|
25
|
+
termStart: string;
|
|
26
|
+
termEnd: string;
|
|
27
|
+
cancel: string;
|
|
28
|
+
confirm: string;
|
|
29
|
+
none: string;
|
|
30
|
+
FactsThatConditionIt: string;
|
|
31
|
+
criteria: string;
|
|
32
|
+
Terms: string;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export declare interface IRulesForm {
|
|
37
|
+
decision: IRuleDecision;
|
|
38
|
+
onCloseModal: () => void;
|
|
39
|
+
onCancel: () => void;
|
|
40
|
+
onSubmitEvent: (dataDecision: IRuleDecision) => void;
|
|
41
|
+
portalId: string;
|
|
42
|
+
textValues: {
|
|
43
|
+
selectOptions: string;
|
|
44
|
+
selectOption: string;
|
|
45
|
+
rangeMin: (label: string) => string;
|
|
46
|
+
rangeMax: (label: string) => string;
|
|
47
|
+
reasonForChange: string;
|
|
48
|
+
change: string;
|
|
49
|
+
changePlaceholder: string;
|
|
50
|
+
termStart: string;
|
|
51
|
+
termEnd: string;
|
|
52
|
+
cancel: string;
|
|
53
|
+
confirm: string;
|
|
54
|
+
none: string;
|
|
55
|
+
FactsThatConditionIt: string;
|
|
56
|
+
criteria: string;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export declare const RulesForm: (prop: IRulesForm) => JSX_2.Element;
|
|
61
|
+
|
|
62
|
+
export { }
|
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import { jsxs as o, jsx as e, Fragment as E } from "react/jsx-runtime";
|
|
2
|
+
import { useState as D, useEffect as L } from "react";
|
|
3
|
+
import { useFormik as U } from "formik";
|
|
4
|
+
import { Divider as k } from "@inubekit/divider";
|
|
5
|
+
import { Stack as a } from "@inubekit/stack";
|
|
6
|
+
import { Text as b } from "@inubekit/text";
|
|
7
|
+
import { Toggle as O } from "@inubekit/toggle";
|
|
8
|
+
import { Textarea as $ } from "@inubekit/textarea";
|
|
9
|
+
import { Date as V } from "@inubekit/date";
|
|
10
|
+
import { Checkbox as N } from "@inubekit/checkbox";
|
|
11
|
+
import { DecisionConditionRenderer as j, ValueValidationSchema as R, ValueHowToSetUp as F, ValueDataType as H } from "@isettingkit/input";
|
|
12
|
+
import { DecisionViewConditionRenderer as S } from "@isettingkit/view";
|
|
13
|
+
import { MdOutlineRemoveRedEye as I, MdOutlineDelete as q } from "react-icons/md";
|
|
14
|
+
import { Icon as M } from "@inubekit/icon";
|
|
15
|
+
import { inube as B } from "@inubekit/foundations";
|
|
16
|
+
import A from "styled-components";
|
|
17
|
+
const Q = (l) => {
|
|
18
|
+
const {
|
|
19
|
+
label: n,
|
|
20
|
+
labelText: r,
|
|
21
|
+
onHandleChange: i,
|
|
22
|
+
placeholder: h,
|
|
23
|
+
required: u,
|
|
24
|
+
value: d = ""
|
|
25
|
+
} = l, [c, g] = D(d);
|
|
26
|
+
return /* @__PURE__ */ o(a, { direction: "column", margin: "10px 4px", children: [
|
|
27
|
+
/* @__PURE__ */ e(b, { size: "large", appearance: "gray", weight: "bold", margin: "10px 0", children: r }),
|
|
28
|
+
/* @__PURE__ */ e(a, { margin: "10px 0", children: /* @__PURE__ */ e(
|
|
29
|
+
$,
|
|
30
|
+
{
|
|
31
|
+
id: "reasonChange",
|
|
32
|
+
label: n,
|
|
33
|
+
onChange: (p) => {
|
|
34
|
+
g(p.target.value), i(p);
|
|
35
|
+
},
|
|
36
|
+
placeholder: h,
|
|
37
|
+
required: u,
|
|
38
|
+
value: c,
|
|
39
|
+
maxLength: 120,
|
|
40
|
+
fullwidth: !0
|
|
41
|
+
}
|
|
42
|
+
) })
|
|
43
|
+
] });
|
|
44
|
+
}, P = (l) => {
|
|
45
|
+
const {
|
|
46
|
+
checked: n,
|
|
47
|
+
children: r,
|
|
48
|
+
handleToggleChange: i,
|
|
49
|
+
id: h,
|
|
50
|
+
labelToggle: u,
|
|
51
|
+
name: d,
|
|
52
|
+
valueToggle: c = ""
|
|
53
|
+
} = l, [g, C] = D(n), p = (f) => {
|
|
54
|
+
C(f.target.checked), i(f);
|
|
55
|
+
};
|
|
56
|
+
return L(() => {
|
|
57
|
+
C(n);
|
|
58
|
+
}, [n]), /* @__PURE__ */ o(E, { children: [
|
|
59
|
+
/* @__PURE__ */ e(
|
|
60
|
+
O,
|
|
61
|
+
{
|
|
62
|
+
checked: g,
|
|
63
|
+
id: h,
|
|
64
|
+
margin: "10px",
|
|
65
|
+
name: d,
|
|
66
|
+
onChange: p,
|
|
67
|
+
size: "small",
|
|
68
|
+
value: c,
|
|
69
|
+
children: /* @__PURE__ */ e(b, { size: "medium", type: "label", weight: "bold", children: u })
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
g && /* @__PURE__ */ e(E, { children: r })
|
|
73
|
+
] });
|
|
74
|
+
}, Z = (l) => {
|
|
75
|
+
const {
|
|
76
|
+
onHandleStartChange: n,
|
|
77
|
+
onHandleEndChange: r,
|
|
78
|
+
labelStart: i,
|
|
79
|
+
labelEnd: h,
|
|
80
|
+
checkedClosed: u = !1,
|
|
81
|
+
required: d = !1,
|
|
82
|
+
valueStart: c = "",
|
|
83
|
+
valueEnd: g = ""
|
|
84
|
+
} = l, [C, p] = D(u), [f, w] = D(c), [v, m] = D(g);
|
|
85
|
+
return /* @__PURE__ */ o(E, { children: [
|
|
86
|
+
/* @__PURE__ */ o(a, { direction: "row", justifyContent: "space-between", margin: "10px 0", children: [
|
|
87
|
+
/* @__PURE__ */ e(a, { children: /* @__PURE__ */ e(
|
|
88
|
+
b,
|
|
89
|
+
{
|
|
90
|
+
appearance: "gray",
|
|
91
|
+
margin: "10px 0",
|
|
92
|
+
size: "medium",
|
|
93
|
+
type: "title",
|
|
94
|
+
weight: "bold",
|
|
95
|
+
children: "Vigencia"
|
|
96
|
+
}
|
|
97
|
+
) }),
|
|
98
|
+
/* @__PURE__ */ e(
|
|
99
|
+
a,
|
|
100
|
+
{
|
|
101
|
+
alignContent: "center",
|
|
102
|
+
justifyContent: "center",
|
|
103
|
+
wrap: "wrap",
|
|
104
|
+
gap: "4px",
|
|
105
|
+
children: /* @__PURE__ */ e(
|
|
106
|
+
N,
|
|
107
|
+
{
|
|
108
|
+
label: "Cerrada",
|
|
109
|
+
onChange: ({ target: x }) => {
|
|
110
|
+
p(x.checked);
|
|
111
|
+
},
|
|
112
|
+
checked: C,
|
|
113
|
+
value: ""
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
] }),
|
|
119
|
+
/* @__PURE__ */ o(a, { justifyContent: "space-between", gap: "24px", children: [
|
|
120
|
+
/* @__PURE__ */ e(a, { width: "189px", children: /* @__PURE__ */ e(
|
|
121
|
+
V,
|
|
122
|
+
{
|
|
123
|
+
id: "dateStart",
|
|
124
|
+
label: i,
|
|
125
|
+
onChange: (x) => {
|
|
126
|
+
w(x.target.value), n(x);
|
|
127
|
+
},
|
|
128
|
+
value: f,
|
|
129
|
+
required: d,
|
|
130
|
+
size: "compact"
|
|
131
|
+
}
|
|
132
|
+
) }),
|
|
133
|
+
C && /* @__PURE__ */ e(a, { width: "189px", children: /* @__PURE__ */ e(
|
|
134
|
+
V,
|
|
135
|
+
{
|
|
136
|
+
id: "dateEnd",
|
|
137
|
+
label: h,
|
|
138
|
+
onChange: (x) => {
|
|
139
|
+
m(x.target.value), r(x);
|
|
140
|
+
},
|
|
141
|
+
value: v,
|
|
142
|
+
required: d,
|
|
143
|
+
size: "compact"
|
|
144
|
+
}
|
|
145
|
+
) })
|
|
146
|
+
] })
|
|
147
|
+
] });
|
|
148
|
+
}, G = (l) => {
|
|
149
|
+
var m;
|
|
150
|
+
const {
|
|
151
|
+
decision: n,
|
|
152
|
+
formik: r,
|
|
153
|
+
onChangeCondition: i,
|
|
154
|
+
onChangeDecision: h,
|
|
155
|
+
onStartChange: u,
|
|
156
|
+
onEndChange: d,
|
|
157
|
+
textValues: c
|
|
158
|
+
} = l, [g, C] = D(!1), [, p] = D(!0), f = (t) => {
|
|
159
|
+
C(t.target.checked);
|
|
160
|
+
}, w = (t) => {
|
|
161
|
+
t.target.value ? p(!1) : p(!0);
|
|
162
|
+
}, v = (t, s) => t.errors[s] ? "invalid" : "pending";
|
|
163
|
+
return /* @__PURE__ */ o(a, { direction: "column", gap: "24px", children: [
|
|
164
|
+
/* @__PURE__ */ o(a, { direction: "column", gap: "16", children: [
|
|
165
|
+
/* @__PURE__ */ e(b, { weight: "bold", size: "medium", children: c.criteria }),
|
|
166
|
+
n.decision && /* @__PURE__ */ e(
|
|
167
|
+
j,
|
|
168
|
+
{
|
|
169
|
+
element: n.decision,
|
|
170
|
+
onDecision: h,
|
|
171
|
+
valueData: r.values[n.decision.name],
|
|
172
|
+
message: r.errors[n.decision.name],
|
|
173
|
+
status: v(r, n.decision.name),
|
|
174
|
+
textValues: {
|
|
175
|
+
selectOptions: "Select an option",
|
|
176
|
+
selectOption: "Option selected",
|
|
177
|
+
rangeMin: (t) => `Minimum ${t}`,
|
|
178
|
+
rangeMax: (t) => `Maximum ${t}`
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
)
|
|
182
|
+
] }),
|
|
183
|
+
/* @__PURE__ */ e(k, { dashed: !0 }),
|
|
184
|
+
/* @__PURE__ */ o(a, { direction: "column", children: [
|
|
185
|
+
/* @__PURE__ */ o(a, { direction: "row", gap: "16px", justifyContent: "space-between", children: [
|
|
186
|
+
/* @__PURE__ */ e(b, { children: c.FactsThatConditionIt }),
|
|
187
|
+
/* @__PURE__ */ e(
|
|
188
|
+
O,
|
|
189
|
+
{
|
|
190
|
+
id: "toogleNone",
|
|
191
|
+
onChange: f,
|
|
192
|
+
checked: g,
|
|
193
|
+
size: "small",
|
|
194
|
+
children: /* @__PURE__ */ e(b, { size: "medium", type: "label", weight: "bold", children: c.none })
|
|
195
|
+
}
|
|
196
|
+
)
|
|
197
|
+
] }),
|
|
198
|
+
n.conditions && n.conditions.map((t) => /* @__PURE__ */ e(a, { direction: "column", children: /* @__PURE__ */ e(
|
|
199
|
+
P,
|
|
200
|
+
{
|
|
201
|
+
checked: !g,
|
|
202
|
+
handleToggleChange: (s) => {
|
|
203
|
+
s.target.checked || i(
|
|
204
|
+
{
|
|
205
|
+
value: "",
|
|
206
|
+
rangeTo: 0,
|
|
207
|
+
rangeFrom: 0,
|
|
208
|
+
list: t.possibleValue.list
|
|
209
|
+
},
|
|
210
|
+
t.name
|
|
211
|
+
);
|
|
212
|
+
},
|
|
213
|
+
id: t.name.replace(" ", ""),
|
|
214
|
+
labelToggle: t.name.split(/(?=[A-Z])/).join(" "),
|
|
215
|
+
name: t.name.replace(" ", ""),
|
|
216
|
+
children: /* @__PURE__ */ e(
|
|
217
|
+
j,
|
|
218
|
+
{
|
|
219
|
+
element: t,
|
|
220
|
+
onDecision: i,
|
|
221
|
+
valueData: r.values[t.name],
|
|
222
|
+
message: r.errors[t.name],
|
|
223
|
+
status: v(r, t.name),
|
|
224
|
+
textValues: {
|
|
225
|
+
selectOptions: "Select an option",
|
|
226
|
+
selectOption: "Option selected",
|
|
227
|
+
rangeMin: (s) => `Minimum ${s}`,
|
|
228
|
+
rangeMax: (s) => `Maximum ${s}`
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
)
|
|
232
|
+
}
|
|
233
|
+
) }, t.name))
|
|
234
|
+
] }),
|
|
235
|
+
/* @__PURE__ */ e(k, { dashed: !0 }),
|
|
236
|
+
/* @__PURE__ */ e(a, { direction: "column", children: /* @__PURE__ */ e(
|
|
237
|
+
Q,
|
|
238
|
+
{
|
|
239
|
+
label: c.reasonForChange,
|
|
240
|
+
labelText: c.change,
|
|
241
|
+
onHandleChange: w,
|
|
242
|
+
placeholder: c.changePlaceholder,
|
|
243
|
+
required: !0
|
|
244
|
+
}
|
|
245
|
+
) }),
|
|
246
|
+
/* @__PURE__ */ e(k, { dashed: !0 }),
|
|
247
|
+
/* @__PURE__ */ e(a, { direction: "column", children: n.decision && /* @__PURE__ */ e(
|
|
248
|
+
Z,
|
|
249
|
+
{
|
|
250
|
+
onHandleStartChange: (t) => u(t.target.value),
|
|
251
|
+
onHandleEndChange: (t) => d(t.target.value),
|
|
252
|
+
labelStart: c.termStart,
|
|
253
|
+
labelEnd: c.termEnd,
|
|
254
|
+
checkedClosed: !!n.decision.endDate,
|
|
255
|
+
valueStart: n.decision.startDate.toLocaleDateString(
|
|
256
|
+
"en-CA"
|
|
257
|
+
),
|
|
258
|
+
valueEnd: ((m = n.decision.endDate) == null ? void 0 : m.toLocaleDateString("en-CA")) || ""
|
|
259
|
+
}
|
|
260
|
+
) })
|
|
261
|
+
] });
|
|
262
|
+
}, T = (l, n, r) => ({
|
|
263
|
+
...l,
|
|
264
|
+
decision: { ...l.decision, [n]: r }
|
|
265
|
+
}), me = (l) => {
|
|
266
|
+
const { decision: n, onCancel: r, onSubmitEvent: i, textValues: h } = l, [u, d] = D(n), c = (m, t) => {
|
|
267
|
+
d((s) => {
|
|
268
|
+
var x;
|
|
269
|
+
const z = (x = s == null ? void 0 : s.conditions) == null ? void 0 : x.map((y) => y.name === t ? { ...y, value: m } : y);
|
|
270
|
+
return { ...s, conditions: z };
|
|
271
|
+
});
|
|
272
|
+
}, g = (m) => {
|
|
273
|
+
d(
|
|
274
|
+
(t) => T(t, "value", m)
|
|
275
|
+
);
|
|
276
|
+
}, C = (m) => {
|
|
277
|
+
d(
|
|
278
|
+
(t) => T(t, "startDate", new Date(m))
|
|
279
|
+
);
|
|
280
|
+
}, p = (m) => {
|
|
281
|
+
d(
|
|
282
|
+
(t) => T(t, "endDate", new Date(m))
|
|
283
|
+
);
|
|
284
|
+
}, { validationSchema: f, initialValues: w } = R(u), v = U({
|
|
285
|
+
initialValues: w,
|
|
286
|
+
validationSchema: f,
|
|
287
|
+
validateOnChange: !1,
|
|
288
|
+
onSubmit: async () => !0
|
|
289
|
+
});
|
|
290
|
+
return /* @__PURE__ */ e(
|
|
291
|
+
G,
|
|
292
|
+
{
|
|
293
|
+
formik: v,
|
|
294
|
+
decision: u,
|
|
295
|
+
onCancel: r,
|
|
296
|
+
onSubmit: () => i(u),
|
|
297
|
+
onChangeCondition: c,
|
|
298
|
+
onChangeDecision: g,
|
|
299
|
+
onStartChange: C,
|
|
300
|
+
onEndChange: p,
|
|
301
|
+
textValues: h
|
|
302
|
+
}
|
|
303
|
+
);
|
|
304
|
+
}, ue = (l) => {
|
|
305
|
+
const { decision: n, textValues: r } = l;
|
|
306
|
+
return /* @__PURE__ */ o(a, { direction: "column", gap: "24px", children: [
|
|
307
|
+
/* @__PURE__ */ o(a, { direction: "column", gap: "16px", children: [
|
|
308
|
+
/* @__PURE__ */ e(b, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: r.criteria }),
|
|
309
|
+
/* @__PURE__ */ e(a, { justifyContent: "space-between", children: n.decisions && n.decisions.map((i) => /* @__PURE__ */ e(
|
|
310
|
+
S,
|
|
311
|
+
{
|
|
312
|
+
element: i,
|
|
313
|
+
valueData: String(i.value)
|
|
314
|
+
},
|
|
315
|
+
i.name
|
|
316
|
+
)) })
|
|
317
|
+
] }),
|
|
318
|
+
/* @__PURE__ */ e(a, { direction: "column", children: /* @__PURE__ */ o(a, { direction: "column", gap: "16px", justifyContent: "space-between", children: [
|
|
319
|
+
/* @__PURE__ */ e(b, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: r.FactsThatConditionIt }),
|
|
320
|
+
n.conditions && n.conditions.map((i) => /* @__PURE__ */ e(a, { direction: "column", children: /* @__PURE__ */ e(
|
|
321
|
+
S,
|
|
322
|
+
{
|
|
323
|
+
element: i,
|
|
324
|
+
valueData: String(i.value)
|
|
325
|
+
}
|
|
326
|
+
) }, i.name))
|
|
327
|
+
] }) }),
|
|
328
|
+
/* @__PURE__ */ o(a, { direction: "column", gap: "12px", children: [
|
|
329
|
+
/* @__PURE__ */ e(b, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: r.Terms }),
|
|
330
|
+
/* @__PURE__ */ o(a, { justifyContent: "space-between", children: [
|
|
331
|
+
n.startDate && /* @__PURE__ */ e(
|
|
332
|
+
S,
|
|
333
|
+
{
|
|
334
|
+
element: {
|
|
335
|
+
name: "startDate",
|
|
336
|
+
label: r.termStart,
|
|
337
|
+
description: r.termStart,
|
|
338
|
+
value: String(n.startDate),
|
|
339
|
+
howToSetUp: F.EQUAL,
|
|
340
|
+
typeData: H.DATE
|
|
341
|
+
},
|
|
342
|
+
valueData: new Date(n.startDate).toLocaleDateString(
|
|
343
|
+
"en-CA"
|
|
344
|
+
)
|
|
345
|
+
},
|
|
346
|
+
"startDate"
|
|
347
|
+
),
|
|
348
|
+
n.endDate && /* @__PURE__ */ e(
|
|
349
|
+
S,
|
|
350
|
+
{
|
|
351
|
+
element: {
|
|
352
|
+
name: "endDate",
|
|
353
|
+
label: r.termEnd,
|
|
354
|
+
description: r.termEnd,
|
|
355
|
+
value: String(n.endDate),
|
|
356
|
+
howToSetUp: F.EQUAL,
|
|
357
|
+
typeData: H.DATE
|
|
358
|
+
},
|
|
359
|
+
valueData: new Date(n.endDate).toLocaleDateString("en-CA")
|
|
360
|
+
},
|
|
361
|
+
"endDate"
|
|
362
|
+
)
|
|
363
|
+
] })
|
|
364
|
+
] })
|
|
365
|
+
] });
|
|
366
|
+
}, J = A.div`
|
|
367
|
+
border-radius: 8px;
|
|
368
|
+
border: 1px solid ${B.palette.neutral.N30};
|
|
369
|
+
box-sizing: border-box;
|
|
370
|
+
display: flex;
|
|
371
|
+
flex-direction: column;
|
|
372
|
+
height: 340px;
|
|
373
|
+
width: 332px;
|
|
374
|
+
box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
|
|
375
|
+
`, K = A.div`
|
|
376
|
+
width: 100%;
|
|
377
|
+
height: 100%;
|
|
378
|
+
overflow-y: auto;
|
|
379
|
+
|
|
380
|
+
&::-webkit-scrollbar {
|
|
381
|
+
width: 8px;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
&::-webkit-scrollbar-thumb {
|
|
385
|
+
background-color: #c1c7d0;
|
|
386
|
+
border-radius: 8px;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
&::-webkit-scrollbar-track {
|
|
390
|
+
background-color: #ebecf0;
|
|
391
|
+
border-radius: 8px;
|
|
392
|
+
}
|
|
393
|
+
`, ge = (l) => {
|
|
394
|
+
const { children: n, handleDelete: r, handleView: i, id: h } = l;
|
|
395
|
+
return /* @__PURE__ */ o(J, { children: [
|
|
396
|
+
/* @__PURE__ */ e(a, { height: "282px", gap: "24px", direction: "column", children: /* @__PURE__ */ e(K, { children: /* @__PURE__ */ e(a, { direction: "column", margin: "10px", children: n }) }) }),
|
|
397
|
+
/* @__PURE__ */ o(a, { gap: "16px", direction: "column", margin: "2px 12px", children: [
|
|
398
|
+
/* @__PURE__ */ e(k, {}),
|
|
399
|
+
/* @__PURE__ */ o(a, { gap: "16px", justifyContent: "end", children: [
|
|
400
|
+
/* @__PURE__ */ e(
|
|
401
|
+
M,
|
|
402
|
+
{
|
|
403
|
+
appearance: "dark",
|
|
404
|
+
size: "24px",
|
|
405
|
+
cursorHover: !0,
|
|
406
|
+
icon: /* @__PURE__ */ e(I, {}),
|
|
407
|
+
onClick: () => {
|
|
408
|
+
i(h);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
),
|
|
412
|
+
/* @__PURE__ */ e(
|
|
413
|
+
M,
|
|
414
|
+
{
|
|
415
|
+
cursorHover: !0,
|
|
416
|
+
appearance: "dark",
|
|
417
|
+
size: "24px",
|
|
418
|
+
icon: /* @__PURE__ */ e(q, {}),
|
|
419
|
+
onClick: () => {
|
|
420
|
+
r(h);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
)
|
|
424
|
+
] })
|
|
425
|
+
] })
|
|
426
|
+
] });
|
|
427
|
+
};
|
|
428
|
+
export {
|
|
429
|
+
ge as BusinessRuleCard,
|
|
430
|
+
ue as BusinessRuleView,
|
|
431
|
+
me as RulesForm
|
|
432
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@isettingkit/business-rules",
|
|
3
|
+
"homepage": "https://inubeds.vercel.app/",
|
|
4
|
+
"author": "inube",
|
|
5
|
+
"main": "dist/index.es.js",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"inube",
|
|
8
|
+
"isetting",
|
|
9
|
+
"react"
|
|
10
|
+
],
|
|
11
|
+
"description": "",
|
|
12
|
+
"private": false,
|
|
13
|
+
"version": "0.1.2",
|
|
14
|
+
"type": "module",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"import": "./dist/index.es.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist/index.es.js",
|
|
22
|
+
"dist/index.es.d.ts"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"dev": "vite",
|
|
26
|
+
"build": "tsc && vite build",
|
|
27
|
+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
28
|
+
"preview": "vite preview",
|
|
29
|
+
"storybook": "storybook dev -p 6006",
|
|
30
|
+
"build-storybook": "storybook build",
|
|
31
|
+
"prepare": "husky install",
|
|
32
|
+
"auto": "auto",
|
|
33
|
+
"changelog": "npm run auto changelog",
|
|
34
|
+
"version": "rm -rf dist && npm run build",
|
|
35
|
+
"release": "git push --follow-tags && npm run auto release",
|
|
36
|
+
"autorelease": "auto shipit"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@inubekit/button": "^4.44.1",
|
|
40
|
+
"@inubekit/checkbox": "^0.2.2",
|
|
41
|
+
"@inubekit/divider": "^0.16.1",
|
|
42
|
+
"@inubekit/date": "^2.39.1",
|
|
43
|
+
"@inubekit/foundations": "^5.11.3",
|
|
44
|
+
"@inubekit/grid": "^2.14.1",
|
|
45
|
+
"@inubekit/icon": "^2.18.1",
|
|
46
|
+
"@inubekit/input": "^1.6.3",
|
|
47
|
+
"@inubekit/stack": "^3.8.1",
|
|
48
|
+
"@inubekit/text": "^2.17.0",
|
|
49
|
+
"@inubekit/textarea": "^2.45.0",
|
|
50
|
+
"@inubekit/toggle": "^3.8.1",
|
|
51
|
+
"@isettingkit/input": "^0.1.14",
|
|
52
|
+
"@isettingkit/view": "^0.1.1"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"react": "^18.2.0",
|
|
56
|
+
"react-dom": "^18.2.0",
|
|
57
|
+
"react-icons": "^5.0.1",
|
|
58
|
+
"styled-components": "^6.1.8",
|
|
59
|
+
"formik": "^2.4.6",
|
|
60
|
+
"yup": "^1.4.0"
|
|
61
|
+
},
|
|
62
|
+
"publishConfig": {
|
|
63
|
+
"registry": "https://registry.npmjs.org/",
|
|
64
|
+
"access": "public"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@commitlint/cli": "^18.4.4",
|
|
68
|
+
"@commitlint/config-conventional": "^18.4.4",
|
|
69
|
+
"@storybook/addon-essentials": "^8.0.2",
|
|
70
|
+
"@storybook/addon-interactions": "^8.0.2",
|
|
71
|
+
"@storybook/addon-links": "^8.0.2",
|
|
72
|
+
"@storybook/blocks": "^8.0.2",
|
|
73
|
+
"@storybook/react": "^8.0.2",
|
|
74
|
+
"@storybook/react-vite": "^8.0.2",
|
|
75
|
+
"@storybook/test": "^8.0.2",
|
|
76
|
+
"@types/react": "^18.2.43",
|
|
77
|
+
"@types/react-dom": "^18.2.17",
|
|
78
|
+
"@types/styled-components": "^5.1.34",
|
|
79
|
+
"@typescript-eslint/eslint-plugin": "^6.14.0",
|
|
80
|
+
"@typescript-eslint/parser": "^6.14.0",
|
|
81
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
82
|
+
"auto": "^11.0.4",
|
|
83
|
+
"eslint": "^8.55.0",
|
|
84
|
+
"eslint-config-prettier": "^9.1.0",
|
|
85
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
86
|
+
"eslint-plugin-react-refresh": "^0.4.5",
|
|
87
|
+
"husky": "^8.0.3",
|
|
88
|
+
"lint-staged": "^15.2.0",
|
|
89
|
+
"prettier": "^3.1.1",
|
|
90
|
+
"storybook": "^8.0.2",
|
|
91
|
+
"typescript": "^5.2.2",
|
|
92
|
+
"vite": "^5.0.8",
|
|
93
|
+
"vite-plugin-dts": "^3.7.2"
|
|
94
|
+
},
|
|
95
|
+
"lint-staged": {
|
|
96
|
+
"**/*": "prettier --write --ignore-unknown"
|
|
97
|
+
},
|
|
98
|
+
"repository": {
|
|
99
|
+
"type": "git",
|
|
100
|
+
"url": "git+https://github.com/selsa-inube/isettingkit-business-rules.git"
|
|
101
|
+
},
|
|
102
|
+
"auto": {
|
|
103
|
+
"plugins": [
|
|
104
|
+
"npm"
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
}
|