@kopexa/grc 0.0.4 → 0.0.6
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/chunk-AHKTFAZC.mjs +110 -0
- package/dist/chunk-BAC3SZJH.mjs +1 -0
- package/dist/chunk-GC6CS627.mjs +248 -0
- package/dist/common/index.mjs +19 -19
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +344 -2
- package/dist/index.mjs +28 -19
- package/dist/risk/index.d.mts +4 -2
- package/dist/risk/index.d.ts +4 -2
- package/dist/risk/index.js +351 -0
- package/dist/risk/index.mjs +11 -0
- package/dist/risk/messages.d.mts +96 -0
- package/dist/risk/messages.d.ts +96 -0
- package/dist/risk/messages.js +133 -0
- package/dist/risk/messages.mjs +7 -0
- package/dist/risk/risk-treatment-card.d.mts +18 -0
- package/dist/risk/risk-treatment-card.d.ts +18 -0
- package/dist/risk/risk-treatment-card.js +369 -0
- package/dist/risk/risk-treatment-card.mjs +9 -0
- package/dist/risk/types.d.mts +15 -0
- package/dist/risk/types.d.ts +15 -0
- package/dist/risk/types.js +19 -0
- package/dist/risk/types.mjs +1 -0
- package/package.json +7 -7
- package/src/index.ts +3 -0
- package/src/risk/index.ts +10 -2
- package/src/risk/messages.ts +116 -0
- package/src/risk/risk-treatment-card.tsx +339 -0
- package/src/risk/types.ts +24 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { RiskTreatmentValue, RiskTreatment } from './types.mjs';
|
|
3
|
+
|
|
4
|
+
interface RiskTreatmentCardProps {
|
|
5
|
+
/** The current treatment value */
|
|
6
|
+
value?: RiskTreatmentValue;
|
|
7
|
+
/** Callback when the treatment changes */
|
|
8
|
+
onChange?: (value: RiskTreatmentValue) => void;
|
|
9
|
+
/** Make the component read-only */
|
|
10
|
+
readOnly?: boolean;
|
|
11
|
+
/** Custom title for the card */
|
|
12
|
+
title?: string;
|
|
13
|
+
/** Recommended treatment based on risk level */
|
|
14
|
+
recommended?: RiskTreatment;
|
|
15
|
+
}
|
|
16
|
+
declare function RiskTreatmentCard({ value, onChange, readOnly, title, recommended, }: RiskTreatmentCardProps): react_jsx_runtime.JSX.Element;
|
|
17
|
+
|
|
18
|
+
export { RiskTreatmentCard, type RiskTreatmentCardProps };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { RiskTreatmentValue, RiskTreatment } from './types.js';
|
|
3
|
+
|
|
4
|
+
interface RiskTreatmentCardProps {
|
|
5
|
+
/** The current treatment value */
|
|
6
|
+
value?: RiskTreatmentValue;
|
|
7
|
+
/** Callback when the treatment changes */
|
|
8
|
+
onChange?: (value: RiskTreatmentValue) => void;
|
|
9
|
+
/** Make the component read-only */
|
|
10
|
+
readOnly?: boolean;
|
|
11
|
+
/** Custom title for the card */
|
|
12
|
+
title?: string;
|
|
13
|
+
/** Recommended treatment based on risk level */
|
|
14
|
+
recommended?: RiskTreatment;
|
|
15
|
+
}
|
|
16
|
+
declare function RiskTreatmentCard({ value, onChange, readOnly, title, recommended, }: RiskTreatmentCardProps): react_jsx_runtime.JSX.Element;
|
|
17
|
+
|
|
18
|
+
export { RiskTreatmentCard, type RiskTreatmentCardProps };
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
"use client";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/risk/risk-treatment-card.tsx
|
|
23
|
+
var risk_treatment_card_exports = {};
|
|
24
|
+
__export(risk_treatment_card_exports, {
|
|
25
|
+
RiskTreatmentCard: () => RiskTreatmentCard
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(risk_treatment_card_exports);
|
|
28
|
+
var import_i18n2 = require("@kopexa/i18n");
|
|
29
|
+
var import_icons = require("@kopexa/icons");
|
|
30
|
+
var import_sight = require("@kopexa/sight");
|
|
31
|
+
var import_react = require("react");
|
|
32
|
+
|
|
33
|
+
// src/risk/messages.ts
|
|
34
|
+
var import_i18n = require("@kopexa/i18n");
|
|
35
|
+
var messages = (0, import_i18n.defineMessages)({
|
|
36
|
+
// Card title
|
|
37
|
+
title: {
|
|
38
|
+
id: "grc.risk_treatment.title",
|
|
39
|
+
defaultMessage: "Risk Treatment"
|
|
40
|
+
},
|
|
41
|
+
// Strategy selection
|
|
42
|
+
strategy_label: {
|
|
43
|
+
id: "grc.risk_treatment.strategy_label",
|
|
44
|
+
defaultMessage: "Selected Strategy"
|
|
45
|
+
},
|
|
46
|
+
strategy_prompt: {
|
|
47
|
+
id: "grc.risk_treatment.strategy_prompt",
|
|
48
|
+
defaultMessage: "How do you want to handle this risk?"
|
|
49
|
+
},
|
|
50
|
+
// Treatment options - labels
|
|
51
|
+
accept_label: {
|
|
52
|
+
id: "grc.risk_treatment.accept.label",
|
|
53
|
+
defaultMessage: "Accept"
|
|
54
|
+
},
|
|
55
|
+
mitigate_label: {
|
|
56
|
+
id: "grc.risk_treatment.mitigate.label",
|
|
57
|
+
defaultMessage: "Mitigate"
|
|
58
|
+
},
|
|
59
|
+
transfer_label: {
|
|
60
|
+
id: "grc.risk_treatment.transfer.label",
|
|
61
|
+
defaultMessage: "Transfer"
|
|
62
|
+
},
|
|
63
|
+
avoid_label: {
|
|
64
|
+
id: "grc.risk_treatment.avoid.label",
|
|
65
|
+
defaultMessage: "Avoid"
|
|
66
|
+
},
|
|
67
|
+
not_defined_label: {
|
|
68
|
+
id: "grc.risk_treatment.not_defined.label",
|
|
69
|
+
defaultMessage: "No strategy defined"
|
|
70
|
+
},
|
|
71
|
+
// Treatment options - descriptions
|
|
72
|
+
accept_description: {
|
|
73
|
+
id: "grc.risk_treatment.accept.description",
|
|
74
|
+
defaultMessage: "Consciously accept the risk because treatment costs exceed potential damage or the risk is within acceptable limits."
|
|
75
|
+
},
|
|
76
|
+
mitigate_description: {
|
|
77
|
+
id: "grc.risk_treatment.mitigate.description",
|
|
78
|
+
defaultMessage: "Reduce the risk to an acceptable level through implementation of controls and measures."
|
|
79
|
+
},
|
|
80
|
+
transfer_description: {
|
|
81
|
+
id: "grc.risk_treatment.transfer.description",
|
|
82
|
+
defaultMessage: "Transfer the risk to third parties (e.g., insurance, outsourcing)."
|
|
83
|
+
},
|
|
84
|
+
avoid_description: {
|
|
85
|
+
id: "grc.risk_treatment.avoid.description",
|
|
86
|
+
defaultMessage: "Completely eliminate the risk by avoiding the risky activity or changing business processes."
|
|
87
|
+
},
|
|
88
|
+
// Treatment options - hints (requirements)
|
|
89
|
+
mitigate_hint: {
|
|
90
|
+
id: "grc.risk_treatment.mitigate.hint",
|
|
91
|
+
defaultMessage: "Requires: Action plan, Control mapping"
|
|
92
|
+
},
|
|
93
|
+
transfer_hint: {
|
|
94
|
+
id: "grc.risk_treatment.transfer.hint",
|
|
95
|
+
defaultMessage: "Requires: Contract documentation, Residual risk assessment"
|
|
96
|
+
},
|
|
97
|
+
avoid_hint: {
|
|
98
|
+
id: "grc.risk_treatment.avoid.hint",
|
|
99
|
+
defaultMessage: "Requires: Business Impact Analysis"
|
|
100
|
+
},
|
|
101
|
+
accept_hint: {
|
|
102
|
+
id: "grc.risk_treatment.accept.hint",
|
|
103
|
+
defaultMessage: "Requires: Documented approval"
|
|
104
|
+
},
|
|
105
|
+
// Rationale
|
|
106
|
+
rationale_label: {
|
|
107
|
+
id: "grc.risk_treatment.rationale_label",
|
|
108
|
+
defaultMessage: "Rationale"
|
|
109
|
+
},
|
|
110
|
+
rationale_placeholder: {
|
|
111
|
+
id: "grc.risk_treatment.rationale_placeholder",
|
|
112
|
+
defaultMessage: "Document why this strategy was chosen..."
|
|
113
|
+
},
|
|
114
|
+
no_rationale: {
|
|
115
|
+
id: "grc.risk_treatment.no_rationale",
|
|
116
|
+
defaultMessage: "No rationale defined"
|
|
117
|
+
},
|
|
118
|
+
// Actions
|
|
119
|
+
edit: {
|
|
120
|
+
id: "grc.risk_treatment.edit",
|
|
121
|
+
defaultMessage: "Edit"
|
|
122
|
+
},
|
|
123
|
+
cancel: {
|
|
124
|
+
id: "grc.risk_treatment.cancel",
|
|
125
|
+
defaultMessage: "Cancel"
|
|
126
|
+
},
|
|
127
|
+
save: {
|
|
128
|
+
id: "grc.risk_treatment.save",
|
|
129
|
+
defaultMessage: "Save"
|
|
130
|
+
},
|
|
131
|
+
// Recommendation badge
|
|
132
|
+
recommended: {
|
|
133
|
+
id: "grc.risk_treatment.recommended",
|
|
134
|
+
defaultMessage: "Recommended"
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
// src/risk/risk-treatment-card.tsx
|
|
139
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
140
|
+
function TreatmentOption({
|
|
141
|
+
id,
|
|
142
|
+
label,
|
|
143
|
+
description,
|
|
144
|
+
hint,
|
|
145
|
+
isSelected,
|
|
146
|
+
isRecommended,
|
|
147
|
+
recommendedLabel,
|
|
148
|
+
onSelect
|
|
149
|
+
}) {
|
|
150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
151
|
+
"button",
|
|
152
|
+
{
|
|
153
|
+
type: "button",
|
|
154
|
+
onClick: () => onSelect(id),
|
|
155
|
+
className: `
|
|
156
|
+
w-full text-left p-4 rounded-lg border-2 transition-all
|
|
157
|
+
${isSelected ? "border-primary bg-primary/5" : "border-border hover:border-primary/50 hover:bg-muted/50"}
|
|
158
|
+
`,
|
|
159
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-start gap-3", children: [
|
|
160
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
161
|
+
"div",
|
|
162
|
+
{
|
|
163
|
+
className: `
|
|
164
|
+
mt-0.5 size-5 rounded-full border-2 flex items-center justify-center flex-shrink-0
|
|
165
|
+
${isSelected ? "border-primary bg-primary" : "border-muted-foreground"}
|
|
166
|
+
`,
|
|
167
|
+
children: isSelected && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "size-2 rounded-full bg-primary-foreground" })
|
|
168
|
+
}
|
|
169
|
+
),
|
|
170
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
171
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2 flex-wrap", children: [
|
|
172
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-medium", children: label }),
|
|
173
|
+
isRecommended && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Chip, { size: "sm", color: "success", variant: "flat", children: recommendedLabel })
|
|
174
|
+
] }),
|
|
175
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground mt-1", children: description }),
|
|
176
|
+
hint && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "text-xs text-muted-foreground mt-2 flex items-center gap-1", children: [
|
|
177
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-primary", children: "\u2192" }),
|
|
178
|
+
hint
|
|
179
|
+
] })
|
|
180
|
+
] })
|
|
181
|
+
] })
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
var defaultValue = {
|
|
186
|
+
treatment: "not_defined",
|
|
187
|
+
rationale: void 0
|
|
188
|
+
};
|
|
189
|
+
function RiskTreatmentCard({
|
|
190
|
+
value,
|
|
191
|
+
onChange,
|
|
192
|
+
readOnly = false,
|
|
193
|
+
title,
|
|
194
|
+
recommended
|
|
195
|
+
}) {
|
|
196
|
+
const intl = (0, import_i18n2.useSafeIntl)();
|
|
197
|
+
const [isEditing, setIsEditing] = (0, import_react.useState)(false);
|
|
198
|
+
const [editValues, setEditValues] = (0, import_react.useState)(
|
|
199
|
+
value || defaultValue
|
|
200
|
+
);
|
|
201
|
+
const t = {
|
|
202
|
+
title: intl.formatMessage(messages.title),
|
|
203
|
+
strategyLabel: intl.formatMessage(messages.strategy_label),
|
|
204
|
+
strategyPrompt: intl.formatMessage(messages.strategy_prompt),
|
|
205
|
+
rationaleLabel: intl.formatMessage(messages.rationale_label),
|
|
206
|
+
rationalePlaceholder: intl.formatMessage(messages.rationale_placeholder),
|
|
207
|
+
noRationale: intl.formatMessage(messages.no_rationale),
|
|
208
|
+
edit: intl.formatMessage(messages.edit),
|
|
209
|
+
cancel: intl.formatMessage(messages.cancel),
|
|
210
|
+
save: intl.formatMessage(messages.save),
|
|
211
|
+
recommended: intl.formatMessage(messages.recommended),
|
|
212
|
+
// Treatment labels
|
|
213
|
+
acceptLabel: intl.formatMessage(messages.accept_label),
|
|
214
|
+
mitigateLabel: intl.formatMessage(messages.mitigate_label),
|
|
215
|
+
transferLabel: intl.formatMessage(messages.transfer_label),
|
|
216
|
+
avoidLabel: intl.formatMessage(messages.avoid_label),
|
|
217
|
+
notDefinedLabel: intl.formatMessage(messages.not_defined_label),
|
|
218
|
+
// Treatment descriptions
|
|
219
|
+
acceptDescription: intl.formatMessage(messages.accept_description),
|
|
220
|
+
mitigateDescription: intl.formatMessage(messages.mitigate_description),
|
|
221
|
+
transferDescription: intl.formatMessage(messages.transfer_description),
|
|
222
|
+
avoidDescription: intl.formatMessage(messages.avoid_description),
|
|
223
|
+
// Treatment hints
|
|
224
|
+
acceptHint: intl.formatMessage(messages.accept_hint),
|
|
225
|
+
mitigateHint: intl.formatMessage(messages.mitigate_hint),
|
|
226
|
+
transferHint: intl.formatMessage(messages.transfer_hint),
|
|
227
|
+
avoidHint: intl.formatMessage(messages.avoid_hint)
|
|
228
|
+
};
|
|
229
|
+
const treatmentLabels = {
|
|
230
|
+
accept: t.acceptLabel,
|
|
231
|
+
mitigate: t.mitigateLabel,
|
|
232
|
+
transfer: t.transferLabel,
|
|
233
|
+
avoid: t.avoidLabel,
|
|
234
|
+
not_defined: t.notDefinedLabel
|
|
235
|
+
};
|
|
236
|
+
const treatmentOptions = [
|
|
237
|
+
{
|
|
238
|
+
id: "accept",
|
|
239
|
+
label: t.acceptLabel,
|
|
240
|
+
description: t.acceptDescription,
|
|
241
|
+
hint: t.acceptHint
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
id: "mitigate",
|
|
245
|
+
label: t.mitigateLabel,
|
|
246
|
+
description: t.mitigateDescription,
|
|
247
|
+
hint: t.mitigateHint
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
id: "transfer",
|
|
251
|
+
label: t.transferLabel,
|
|
252
|
+
description: t.transferDescription,
|
|
253
|
+
hint: t.transferHint
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
id: "avoid",
|
|
257
|
+
label: t.avoidLabel,
|
|
258
|
+
description: t.avoidDescription,
|
|
259
|
+
hint: t.avoidHint
|
|
260
|
+
}
|
|
261
|
+
];
|
|
262
|
+
const cardTitle = title != null ? title : t.title;
|
|
263
|
+
const currentValue = isEditing ? editValues : value || defaultValue;
|
|
264
|
+
const isNotDefined = currentValue.treatment === "not_defined";
|
|
265
|
+
const handleSave = () => {
|
|
266
|
+
onChange == null ? void 0 : onChange(editValues);
|
|
267
|
+
setIsEditing(false);
|
|
268
|
+
};
|
|
269
|
+
const handleCancel = () => {
|
|
270
|
+
setEditValues(value || defaultValue);
|
|
271
|
+
setIsEditing(false);
|
|
272
|
+
};
|
|
273
|
+
const handleStartEdit = () => {
|
|
274
|
+
setEditValues(value || defaultValue);
|
|
275
|
+
setIsEditing(true);
|
|
276
|
+
};
|
|
277
|
+
const handleTreatmentSelect = (treatment) => {
|
|
278
|
+
setEditValues((prev) => ({ ...prev, treatment }));
|
|
279
|
+
};
|
|
280
|
+
const handleRationaleChange = (rationale) => {
|
|
281
|
+
setEditValues((prev) => ({ ...prev, rationale: rationale || void 0 }));
|
|
282
|
+
};
|
|
283
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_sight.Card.Root, { variant: "accent", children: [
|
|
284
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_sight.Card.Header, { className: "flex flex-row items-center justify-between", children: [
|
|
285
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
286
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Heading, { level: "h3", className: "text-base", children: cardTitle }),
|
|
287
|
+
isEditing && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Chip, { size: "sm", color: "primary", children: t.edit })
|
|
288
|
+
] }),
|
|
289
|
+
!readOnly && (!isEditing ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
290
|
+
import_sight.Button,
|
|
291
|
+
{
|
|
292
|
+
variant: "ghost",
|
|
293
|
+
size: "sm",
|
|
294
|
+
isIconOnly: true,
|
|
295
|
+
onClick: handleStartEdit,
|
|
296
|
+
"aria-label": t.edit,
|
|
297
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.EditIcon, { className: "size-4" })
|
|
298
|
+
}
|
|
299
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
300
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Button, { variant: "ghost", size: "sm", onClick: handleCancel, children: t.cancel }),
|
|
301
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Button, { size: "sm", onClick: handleSave, children: t.save })
|
|
302
|
+
] }))
|
|
303
|
+
] }),
|
|
304
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Card.Body, { className: "space-y-4", children: isEditing ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
305
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-3", children: [
|
|
306
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground", children: t.strategyPrompt }),
|
|
307
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid gap-3", children: treatmentOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
308
|
+
TreatmentOption,
|
|
309
|
+
{
|
|
310
|
+
id: option.id,
|
|
311
|
+
label: option.label,
|
|
312
|
+
description: option.description,
|
|
313
|
+
hint: option.hint,
|
|
314
|
+
isSelected: editValues.treatment === option.id,
|
|
315
|
+
isRecommended: recommended === option.id,
|
|
316
|
+
recommendedLabel: t.recommended,
|
|
317
|
+
onSelect: handleTreatmentSelect
|
|
318
|
+
},
|
|
319
|
+
option.id
|
|
320
|
+
)) })
|
|
321
|
+
] }),
|
|
322
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Separator, {}),
|
|
323
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
|
|
324
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
325
|
+
"label",
|
|
326
|
+
{
|
|
327
|
+
htmlFor: "treatment-rationale",
|
|
328
|
+
className: "text-sm font-medium",
|
|
329
|
+
children: t.rationaleLabel
|
|
330
|
+
}
|
|
331
|
+
),
|
|
332
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
333
|
+
import_sight.Textarea,
|
|
334
|
+
{
|
|
335
|
+
id: "treatment-rationale",
|
|
336
|
+
value: editValues.rationale || "",
|
|
337
|
+
onChange: (e) => handleRationaleChange(e.target.value),
|
|
338
|
+
placeholder: t.rationalePlaceholder,
|
|
339
|
+
rows: 3,
|
|
340
|
+
className: "text-sm"
|
|
341
|
+
}
|
|
342
|
+
)
|
|
343
|
+
] })
|
|
344
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
345
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
346
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm font-medium mb-1", children: t.strategyLabel }),
|
|
347
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
348
|
+
!isNotDefined && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CheckCirleIcon, { className: "size-4 text-success" }),
|
|
349
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
350
|
+
"p",
|
|
351
|
+
{
|
|
352
|
+
className: `text-sm ${isNotDefined ? "text-muted-foreground" : ""}`,
|
|
353
|
+
children: treatmentLabels[currentValue.treatment]
|
|
354
|
+
}
|
|
355
|
+
)
|
|
356
|
+
] })
|
|
357
|
+
] }),
|
|
358
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Separator, {}),
|
|
359
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
360
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm font-medium mb-1", children: t.rationaleLabel }),
|
|
361
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground", children: currentValue.rationale || t.noRationale })
|
|
362
|
+
] })
|
|
363
|
+
] }) })
|
|
364
|
+
] });
|
|
365
|
+
}
|
|
366
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
367
|
+
0 && (module.exports = {
|
|
368
|
+
RiskTreatmentCard
|
|
369
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type RiskTreatment = "accept" | "mitigate" | "transfer" | "avoid" | "not_defined";
|
|
2
|
+
interface RiskTreatmentValue {
|
|
3
|
+
/** The selected treatment strategy */
|
|
4
|
+
treatment: RiskTreatment;
|
|
5
|
+
/** Human-readable explanation for the chosen strategy */
|
|
6
|
+
rationale?: string;
|
|
7
|
+
}
|
|
8
|
+
interface TreatmentOption {
|
|
9
|
+
id: RiskTreatment;
|
|
10
|
+
label: string;
|
|
11
|
+
description: string;
|
|
12
|
+
hint?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type { RiskTreatment, RiskTreatmentValue, TreatmentOption };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type RiskTreatment = "accept" | "mitigate" | "transfer" | "avoid" | "not_defined";
|
|
2
|
+
interface RiskTreatmentValue {
|
|
3
|
+
/** The selected treatment strategy */
|
|
4
|
+
treatment: RiskTreatment;
|
|
5
|
+
/** Human-readable explanation for the chosen strategy */
|
|
6
|
+
rationale?: string;
|
|
7
|
+
}
|
|
8
|
+
interface TreatmentOption {
|
|
9
|
+
id: RiskTreatment;
|
|
10
|
+
label: string;
|
|
11
|
+
description: string;
|
|
12
|
+
hint?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type { RiskTreatment, RiskTreatmentValue, TreatmentOption };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __copyProps = (to, from, except, desc) => {
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
+
for (let key of __getOwnPropNames(from))
|
|
10
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
11
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
}
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
|
|
17
|
+
// src/risk/types.ts
|
|
18
|
+
var types_exports = {};
|
|
19
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kopexa/grc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "GRC (Governance, Risk, Compliance) components for Kopexa",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -42,15 +42,15 @@
|
|
|
42
42
|
"react": ">=19.0.0-rc.0",
|
|
43
43
|
"react-dom": ">=19.0.0-rc.0",
|
|
44
44
|
"react-intl": "^7.1.14",
|
|
45
|
-
"@kopexa/theme": "17.8.
|
|
46
|
-
"@kopexa/sight": "17.
|
|
45
|
+
"@kopexa/theme": "17.8.2",
|
|
46
|
+
"@kopexa/sight": "17.3.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@kopexa/krn": "^1.0.1",
|
|
50
|
-
"@kopexa/react-utils": "17.0.
|
|
51
|
-
"@kopexa/
|
|
52
|
-
"@kopexa/
|
|
53
|
-
"@kopexa/
|
|
50
|
+
"@kopexa/react-utils": "17.0.16",
|
|
51
|
+
"@kopexa/icons": "17.2.4",
|
|
52
|
+
"@kopexa/i18n": "17.3.2",
|
|
53
|
+
"@kopexa/shared-utils": "17.0.16"
|
|
54
54
|
},
|
|
55
55
|
"clean-package": "../../clean-package.config.json",
|
|
56
56
|
"publishConfig": {
|
package/src/index.ts
CHANGED
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
// Common components
|
|
16
16
|
export * from "./common";
|
|
17
17
|
|
|
18
|
+
// Risk management components
|
|
19
|
+
export * from "./risk";
|
|
20
|
+
|
|
18
21
|
// Domain-specific components (re-export for convenience)
|
|
19
22
|
// These can also be imported directly from their subpaths:
|
|
20
23
|
// import { ... } from "@kopexa/grc/risk"
|
package/src/risk/index.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
// Risk management components
|
|
2
|
-
// TODO: Add components as they are extracted from the demo
|
|
3
2
|
|
|
4
|
-
export {};
|
|
3
|
+
export { messages as riskTreatmentMessages } from "./messages";
|
|
4
|
+
export {
|
|
5
|
+
RiskTreatmentCard,
|
|
6
|
+
type RiskTreatmentCardProps,
|
|
7
|
+
} from "./risk-treatment-card";
|
|
8
|
+
export type {
|
|
9
|
+
RiskTreatment,
|
|
10
|
+
RiskTreatmentValue,
|
|
11
|
+
TreatmentOption,
|
|
12
|
+
} from "./types";
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { defineMessages } from "@kopexa/i18n";
|
|
2
|
+
|
|
3
|
+
export const messages = defineMessages({
|
|
4
|
+
// Card title
|
|
5
|
+
title: {
|
|
6
|
+
id: "grc.risk_treatment.title",
|
|
7
|
+
defaultMessage: "Risk Treatment",
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
// Strategy selection
|
|
11
|
+
strategy_label: {
|
|
12
|
+
id: "grc.risk_treatment.strategy_label",
|
|
13
|
+
defaultMessage: "Selected Strategy",
|
|
14
|
+
},
|
|
15
|
+
strategy_prompt: {
|
|
16
|
+
id: "grc.risk_treatment.strategy_prompt",
|
|
17
|
+
defaultMessage: "How do you want to handle this risk?",
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
// Treatment options - labels
|
|
21
|
+
accept_label: {
|
|
22
|
+
id: "grc.risk_treatment.accept.label",
|
|
23
|
+
defaultMessage: "Accept",
|
|
24
|
+
},
|
|
25
|
+
mitigate_label: {
|
|
26
|
+
id: "grc.risk_treatment.mitigate.label",
|
|
27
|
+
defaultMessage: "Mitigate",
|
|
28
|
+
},
|
|
29
|
+
transfer_label: {
|
|
30
|
+
id: "grc.risk_treatment.transfer.label",
|
|
31
|
+
defaultMessage: "Transfer",
|
|
32
|
+
},
|
|
33
|
+
avoid_label: {
|
|
34
|
+
id: "grc.risk_treatment.avoid.label",
|
|
35
|
+
defaultMessage: "Avoid",
|
|
36
|
+
},
|
|
37
|
+
not_defined_label: {
|
|
38
|
+
id: "grc.risk_treatment.not_defined.label",
|
|
39
|
+
defaultMessage: "No strategy defined",
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
// Treatment options - descriptions
|
|
43
|
+
accept_description: {
|
|
44
|
+
id: "grc.risk_treatment.accept.description",
|
|
45
|
+
defaultMessage:
|
|
46
|
+
"Consciously accept the risk because treatment costs exceed potential damage or the risk is within acceptable limits.",
|
|
47
|
+
},
|
|
48
|
+
mitigate_description: {
|
|
49
|
+
id: "grc.risk_treatment.mitigate.description",
|
|
50
|
+
defaultMessage:
|
|
51
|
+
"Reduce the risk to an acceptable level through implementation of controls and measures.",
|
|
52
|
+
},
|
|
53
|
+
transfer_description: {
|
|
54
|
+
id: "grc.risk_treatment.transfer.description",
|
|
55
|
+
defaultMessage:
|
|
56
|
+
"Transfer the risk to third parties (e.g., insurance, outsourcing).",
|
|
57
|
+
},
|
|
58
|
+
avoid_description: {
|
|
59
|
+
id: "grc.risk_treatment.avoid.description",
|
|
60
|
+
defaultMessage:
|
|
61
|
+
"Completely eliminate the risk by avoiding the risky activity or changing business processes.",
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
// Treatment options - hints (requirements)
|
|
65
|
+
mitigate_hint: {
|
|
66
|
+
id: "grc.risk_treatment.mitigate.hint",
|
|
67
|
+
defaultMessage: "Requires: Action plan, Control mapping",
|
|
68
|
+
},
|
|
69
|
+
transfer_hint: {
|
|
70
|
+
id: "grc.risk_treatment.transfer.hint",
|
|
71
|
+
defaultMessage:
|
|
72
|
+
"Requires: Contract documentation, Residual risk assessment",
|
|
73
|
+
},
|
|
74
|
+
avoid_hint: {
|
|
75
|
+
id: "grc.risk_treatment.avoid.hint",
|
|
76
|
+
defaultMessage: "Requires: Business Impact Analysis",
|
|
77
|
+
},
|
|
78
|
+
accept_hint: {
|
|
79
|
+
id: "grc.risk_treatment.accept.hint",
|
|
80
|
+
defaultMessage: "Requires: Documented approval",
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
// Rationale
|
|
84
|
+
rationale_label: {
|
|
85
|
+
id: "grc.risk_treatment.rationale_label",
|
|
86
|
+
defaultMessage: "Rationale",
|
|
87
|
+
},
|
|
88
|
+
rationale_placeholder: {
|
|
89
|
+
id: "grc.risk_treatment.rationale_placeholder",
|
|
90
|
+
defaultMessage: "Document why this strategy was chosen...",
|
|
91
|
+
},
|
|
92
|
+
no_rationale: {
|
|
93
|
+
id: "grc.risk_treatment.no_rationale",
|
|
94
|
+
defaultMessage: "No rationale defined",
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
// Actions
|
|
98
|
+
edit: {
|
|
99
|
+
id: "grc.risk_treatment.edit",
|
|
100
|
+
defaultMessage: "Edit",
|
|
101
|
+
},
|
|
102
|
+
cancel: {
|
|
103
|
+
id: "grc.risk_treatment.cancel",
|
|
104
|
+
defaultMessage: "Cancel",
|
|
105
|
+
},
|
|
106
|
+
save: {
|
|
107
|
+
id: "grc.risk_treatment.save",
|
|
108
|
+
defaultMessage: "Save",
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
// Recommendation badge
|
|
112
|
+
recommended: {
|
|
113
|
+
id: "grc.risk_treatment.recommended",
|
|
114
|
+
defaultMessage: "Recommended",
|
|
115
|
+
},
|
|
116
|
+
});
|