@kopexa/grc 0.0.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.
Files changed (80) hide show
  1. package/LICENSE +201 -0
  2. package/dist/asset/index.d.mts +2 -0
  3. package/dist/asset/index.d.ts +2 -0
  4. package/dist/asset/index.js +19 -0
  5. package/dist/asset/index.mjs +1 -0
  6. package/dist/chunk-7754RETD.mjs +57 -0
  7. package/dist/chunk-B47KDUYY.mjs +26 -0
  8. package/dist/chunk-BFZPRJQT.mjs +1 -0
  9. package/dist/chunk-GF3WJZVI.mjs +141 -0
  10. package/dist/chunk-GFABGXAO.mjs +1 -0
  11. package/dist/chunk-KNGEZZFI.mjs +157 -0
  12. package/dist/chunk-TICWEZUI.mjs +1 -0
  13. package/dist/chunk-TW3S4OE2.mjs +251 -0
  14. package/dist/common/compliance/compliance-badge.d.mts +33 -0
  15. package/dist/common/compliance/compliance-badge.d.ts +33 -0
  16. package/dist/common/compliance/compliance-badge.js +103 -0
  17. package/dist/common/compliance/compliance-badge.mjs +13 -0
  18. package/dist/common/compliance/index.d.mts +2 -0
  19. package/dist/common/compliance/index.d.ts +2 -0
  20. package/dist/common/compliance/index.js +104 -0
  21. package/dist/common/compliance/index.mjs +13 -0
  22. package/dist/common/compliance/messages.d.mts +20 -0
  23. package/dist/common/compliance/messages.d.ts +20 -0
  24. package/dist/common/compliance/messages.js +49 -0
  25. package/dist/common/compliance/messages.mjs +7 -0
  26. package/dist/common/impact/impact-card.d.mts +35 -0
  27. package/dist/common/impact/impact-card.d.ts +35 -0
  28. package/dist/common/impact/impact-card.js +551 -0
  29. package/dist/common/impact/impact-card.mjs +10 -0
  30. package/dist/common/impact/index.d.mts +5 -0
  31. package/dist/common/impact/index.d.ts +5 -0
  32. package/dist/common/impact/index.js +564 -0
  33. package/dist/common/impact/index.mjs +24 -0
  34. package/dist/common/impact/messages.d.mts +128 -0
  35. package/dist/common/impact/messages.d.ts +128 -0
  36. package/dist/common/impact/messages.js +164 -0
  37. package/dist/common/impact/messages.mjs +7 -0
  38. package/dist/common/impact/scales.d.mts +46 -0
  39. package/dist/common/impact/scales.d.ts +46 -0
  40. package/dist/common/impact/scales.js +319 -0
  41. package/dist/common/impact/scales.mjs +16 -0
  42. package/dist/common/index.d.mts +6 -0
  43. package/dist/common/index.d.ts +6 -0
  44. package/dist/common/index.js +640 -0
  45. package/dist/common/index.mjs +35 -0
  46. package/dist/control/index.d.mts +2 -0
  47. package/dist/control/index.d.ts +2 -0
  48. package/dist/control/index.js +19 -0
  49. package/dist/control/index.mjs +1 -0
  50. package/dist/incident/index.d.mts +2 -0
  51. package/dist/incident/index.d.ts +2 -0
  52. package/dist/incident/index.js +19 -0
  53. package/dist/incident/index.mjs +1 -0
  54. package/dist/index.d.mts +6 -0
  55. package/dist/index.d.ts +6 -0
  56. package/dist/index.js +640 -0
  57. package/dist/index.mjs +35 -0
  58. package/dist/risk/index.d.mts +2 -0
  59. package/dist/risk/index.d.ts +2 -0
  60. package/dist/risk/index.js +19 -0
  61. package/dist/risk/index.mjs +1 -0
  62. package/dist/vendor/index.d.mts +2 -0
  63. package/dist/vendor/index.d.ts +2 -0
  64. package/dist/vendor/index.js +19 -0
  65. package/dist/vendor/index.mjs +1 -0
  66. package/package.json +66 -0
  67. package/src/asset/index.ts +4 -0
  68. package/src/common/compliance/compliance-badge.tsx +110 -0
  69. package/src/common/compliance/index.ts +8 -0
  70. package/src/common/compliance/messages.ts +20 -0
  71. package/src/common/impact/impact-card.tsx +367 -0
  72. package/src/common/impact/index.ts +14 -0
  73. package/src/common/impact/messages.ts +141 -0
  74. package/src/common/impact/scales.ts +191 -0
  75. package/src/common/index.ts +4 -0
  76. package/src/control/index.ts +4 -0
  77. package/src/incident/index.ts +4 -0
  78. package/src/index.ts +20 -0
  79. package/src/risk/index.ts +4 -0
  80. package/src/vendor/index.ts +4 -0
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import {
3
+ assetScale,
4
+ getScale,
5
+ impactLevels,
6
+ processScale,
7
+ riskScale
8
+ } from "../../chunk-KNGEZZFI.mjs";
9
+ import "../../chunk-GF3WJZVI.mjs";
10
+ export {
11
+ assetScale,
12
+ getScale,
13
+ impactLevels,
14
+ processScale,
15
+ riskScale
16
+ };
@@ -0,0 +1,6 @@
1
+ export { ComplianceBadges, ComplianceBadgesProps, DoraBadge, DoraBadgeProps, Nis2Badge, Nis2BadgeProps } from './compliance/compliance-badge.mjs';
2
+ export { ImpactCard, ImpactCardProps, ImpactValue } from './impact/impact-card.mjs';
3
+ export { messages as impactMessages } from './impact/messages.mjs';
4
+ export { ImpactLevel, ImpactLevelConfig, ImpactScaleConfig, ImpactScalePreset, assetScale, getScale, impactLevels, processScale, riskScale } from './impact/scales.mjs';
5
+ import 'react/jsx-runtime';
6
+ import 'react-intl';
@@ -0,0 +1,6 @@
1
+ export { ComplianceBadges, ComplianceBadgesProps, DoraBadge, DoraBadgeProps, Nis2Badge, Nis2BadgeProps } from './compliance/compliance-badge.js';
2
+ export { ImpactCard, ImpactCardProps, ImpactValue } from './impact/impact-card.js';
3
+ export { messages as impactMessages } from './impact/messages.js';
4
+ export { ImpactLevel, ImpactLevelConfig, ImpactScaleConfig, ImpactScalePreset, assetScale, getScale, impactLevels, processScale, riskScale } from './impact/scales.js';
5
+ import 'react/jsx-runtime';
6
+ import 'react-intl';
@@ -0,0 +1,640 @@
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 __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/common/index.ts
22
+ var common_exports = {};
23
+ __export(common_exports, {
24
+ ComplianceBadges: () => ComplianceBadges,
25
+ DoraBadge: () => DoraBadge,
26
+ ImpactCard: () => ImpactCard,
27
+ Nis2Badge: () => Nis2Badge,
28
+ assetScale: () => assetScale,
29
+ getScale: () => getScale,
30
+ impactLevels: () => impactLevels,
31
+ impactMessages: () => messages2,
32
+ processScale: () => processScale,
33
+ riskScale: () => riskScale
34
+ });
35
+ module.exports = __toCommonJS(common_exports);
36
+
37
+ // src/common/compliance/compliance-badge.tsx
38
+ var import_i18n2 = require("@kopexa/i18n");
39
+ var import_icons = require("@kopexa/icons");
40
+ var import_sight = require("@kopexa/sight");
41
+ var import_theme = require("@kopexa/theme");
42
+
43
+ // src/common/compliance/messages.ts
44
+ var import_i18n = require("@kopexa/i18n");
45
+ var messages = (0, import_i18n.defineMessages)({
46
+ dora_label: {
47
+ id: "grc.compliance.dora.label",
48
+ defaultMessage: "DORA"
49
+ },
50
+ dora_tooltip: {
51
+ id: "grc.compliance.dora.tooltip",
52
+ defaultMessage: "DORA Critical - Affects critical ICT functions"
53
+ },
54
+ nis2_label: {
55
+ id: "grc.compliance.nis2.label",
56
+ defaultMessage: "NIS2"
57
+ },
58
+ nis2_tooltip: {
59
+ id: "grc.compliance.nis2.tooltip",
60
+ defaultMessage: "NIS2 Significant - All-hazards risk"
61
+ }
62
+ });
63
+
64
+ // src/common/compliance/compliance-badge.tsx
65
+ var import_jsx_runtime = require("react/jsx-runtime");
66
+ function DoraBadge({
67
+ tooltip,
68
+ iconSize = 12,
69
+ className
70
+ }) {
71
+ const intl = (0, import_i18n2.useSafeIntl)();
72
+ const styles = (0, import_theme.complianceBadge)({ color: "dora" });
73
+ const tooltipContent = tooltip != null ? tooltip : intl.formatMessage(messages.dora_tooltip);
74
+ const label = intl.formatMessage(messages.dora_label);
75
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Tooltip, { content: tooltipContent, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: styles.root({ className }), children: [
76
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.DORAIcon, { size: iconSize, className: styles.icon() }),
77
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: styles.label(), children: label })
78
+ ] }) });
79
+ }
80
+ function Nis2Badge({
81
+ tooltip,
82
+ iconSize = 12,
83
+ className
84
+ }) {
85
+ const intl = (0, import_i18n2.useSafeIntl)();
86
+ const styles = (0, import_theme.complianceBadge)({ color: "nis2" });
87
+ const tooltipContent = tooltip != null ? tooltip : intl.formatMessage(messages.nis2_tooltip);
88
+ const label = intl.formatMessage(messages.nis2_label);
89
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Tooltip, { content: tooltipContent, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: styles.root({ className }), children: [
90
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.NIS2Icon, { size: iconSize, className: styles.icon() }),
91
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: styles.label(), children: label })
92
+ ] }) });
93
+ }
94
+ function ComplianceBadges({
95
+ doraCritical,
96
+ nis2Significant,
97
+ iconSize = 12,
98
+ className
99
+ }) {
100
+ if (!doraCritical && !nis2Significant) return null;
101
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: className != null ? className : "flex items-center gap-1", children: [
102
+ doraCritical && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DoraBadge, { iconSize }),
103
+ nis2Significant && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Nis2Badge, { iconSize })
104
+ ] });
105
+ }
106
+
107
+ // src/common/impact/impact-card.tsx
108
+ var import_i18n4 = require("@kopexa/i18n");
109
+ var import_icons2 = require("@kopexa/icons");
110
+ var import_sight2 = require("@kopexa/sight");
111
+ var import_theme2 = require("@kopexa/theme");
112
+ var import_react = require("react");
113
+
114
+ // src/common/impact/messages.ts
115
+ var import_i18n3 = require("@kopexa/i18n");
116
+ var messages2 = (0, import_i18n3.defineMessages)({
117
+ // Card titles
118
+ title_cia: {
119
+ id: "grc.impact.title_cia",
120
+ defaultMessage: "CIA Impact"
121
+ },
122
+ title_ciaa: {
123
+ id: "grc.impact.title_ciaa",
124
+ defaultMessage: "CIAA Impact"
125
+ },
126
+ // Dimensions
127
+ confidentiality: {
128
+ id: "grc.impact.confidentiality",
129
+ defaultMessage: "Confidentiality"
130
+ },
131
+ integrity: {
132
+ id: "grc.impact.integrity",
133
+ defaultMessage: "Integrity"
134
+ },
135
+ availability: {
136
+ id: "grc.impact.availability",
137
+ defaultMessage: "Availability"
138
+ },
139
+ authenticity: {
140
+ id: "grc.impact.authenticity",
141
+ defaultMessage: "Authenticity"
142
+ },
143
+ // Justification
144
+ justification: {
145
+ id: "grc.impact.justification",
146
+ defaultMessage: "Justification"
147
+ },
148
+ justification_hint: {
149
+ id: "grc.impact.justification_hint",
150
+ defaultMessage: "(highest impact: {level})"
151
+ },
152
+ justification_placeholder: {
153
+ id: "grc.impact.justification_placeholder",
154
+ defaultMessage: "Enter justification for the chosen impact values..."
155
+ },
156
+ no_justification: {
157
+ id: "grc.impact.no_justification",
158
+ defaultMessage: "No justification provided"
159
+ },
160
+ // Actions
161
+ edit: {
162
+ id: "grc.impact.edit",
163
+ defaultMessage: "Edit"
164
+ },
165
+ cancel: {
166
+ id: "grc.impact.cancel",
167
+ defaultMessage: "Cancel"
168
+ },
169
+ save: {
170
+ id: "grc.impact.save",
171
+ defaultMessage: "Save"
172
+ },
173
+ // Risk Scale (default)
174
+ risk_0: {
175
+ id: "grc.impact.scale.risk.0",
176
+ defaultMessage: "Not rated"
177
+ },
178
+ risk_1: {
179
+ id: "grc.impact.scale.risk.1",
180
+ defaultMessage: "Negligible"
181
+ },
182
+ risk_2: {
183
+ id: "grc.impact.scale.risk.2",
184
+ defaultMessage: "Low"
185
+ },
186
+ risk_3: {
187
+ id: "grc.impact.scale.risk.3",
188
+ defaultMessage: "Medium"
189
+ },
190
+ risk_4: {
191
+ id: "grc.impact.scale.risk.4",
192
+ defaultMessage: "High"
193
+ },
194
+ risk_5: {
195
+ id: "grc.impact.scale.risk.5",
196
+ defaultMessage: "Critical"
197
+ },
198
+ // Process Scale
199
+ process_0: {
200
+ id: "grc.impact.scale.process.0",
201
+ defaultMessage: "Not rated"
202
+ },
203
+ process_1: {
204
+ id: "grc.impact.scale.process.1",
205
+ defaultMessage: "Insignificant"
206
+ },
207
+ process_2: {
208
+ id: "grc.impact.scale.process.2",
209
+ defaultMessage: "Low"
210
+ },
211
+ process_3: {
212
+ id: "grc.impact.scale.process.3",
213
+ defaultMessage: "Relevant"
214
+ },
215
+ process_4: {
216
+ id: "grc.impact.scale.process.4",
217
+ defaultMessage: "Important"
218
+ },
219
+ process_5: {
220
+ id: "grc.impact.scale.process.5",
221
+ defaultMessage: "Vital"
222
+ },
223
+ // Asset Scale
224
+ asset_0: {
225
+ id: "grc.impact.scale.asset.0",
226
+ defaultMessage: "Not classified"
227
+ },
228
+ asset_1: {
229
+ id: "grc.impact.scale.asset.1",
230
+ defaultMessage: "Insignificant"
231
+ },
232
+ asset_2: {
233
+ id: "grc.impact.scale.asset.2",
234
+ defaultMessage: "Low"
235
+ },
236
+ asset_3: {
237
+ id: "grc.impact.scale.asset.3",
238
+ defaultMessage: "Medium"
239
+ },
240
+ asset_4: {
241
+ id: "grc.impact.scale.asset.4",
242
+ defaultMessage: "High"
243
+ },
244
+ asset_5: {
245
+ id: "grc.impact.scale.asset.5",
246
+ defaultMessage: "Business Critical"
247
+ }
248
+ });
249
+
250
+ // src/common/impact/scales.ts
251
+ var riskScale = {
252
+ 0: {
253
+ message: messages2.risk_0,
254
+ fallbackLabel: "Not rated",
255
+ color: "text-muted-foreground",
256
+ bgColor: "bg-muted",
257
+ barColor: "bg-muted"
258
+ },
259
+ 1: {
260
+ message: messages2.risk_1,
261
+ fallbackLabel: "Negligible",
262
+ color: "text-green-700",
263
+ bgColor: "bg-green-100",
264
+ barColor: "bg-green-500"
265
+ },
266
+ 2: {
267
+ message: messages2.risk_2,
268
+ fallbackLabel: "Low",
269
+ color: "text-lime-700",
270
+ bgColor: "bg-lime-100",
271
+ barColor: "bg-lime-500"
272
+ },
273
+ 3: {
274
+ message: messages2.risk_3,
275
+ fallbackLabel: "Medium",
276
+ color: "text-yellow-700",
277
+ bgColor: "bg-yellow-100",
278
+ barColor: "bg-yellow-500"
279
+ },
280
+ 4: {
281
+ message: messages2.risk_4,
282
+ fallbackLabel: "High",
283
+ color: "text-orange-700",
284
+ bgColor: "bg-orange-100",
285
+ barColor: "bg-orange-500"
286
+ },
287
+ 5: {
288
+ message: messages2.risk_5,
289
+ fallbackLabel: "Critical",
290
+ color: "text-red-700",
291
+ bgColor: "bg-red-100",
292
+ barColor: "bg-red-500"
293
+ }
294
+ };
295
+ var processScale = {
296
+ 0: {
297
+ message: messages2.process_0,
298
+ fallbackLabel: "Not rated",
299
+ color: "text-muted-foreground",
300
+ bgColor: "bg-muted",
301
+ barColor: "bg-muted"
302
+ },
303
+ 1: {
304
+ message: messages2.process_1,
305
+ fallbackLabel: "Insignificant",
306
+ color: "text-green-700",
307
+ bgColor: "bg-green-100",
308
+ barColor: "bg-green-500"
309
+ },
310
+ 2: {
311
+ message: messages2.process_2,
312
+ fallbackLabel: "Low",
313
+ color: "text-lime-700",
314
+ bgColor: "bg-lime-100",
315
+ barColor: "bg-lime-500"
316
+ },
317
+ 3: {
318
+ message: messages2.process_3,
319
+ fallbackLabel: "Relevant",
320
+ color: "text-yellow-700",
321
+ bgColor: "bg-yellow-100",
322
+ barColor: "bg-yellow-500"
323
+ },
324
+ 4: {
325
+ message: messages2.process_4,
326
+ fallbackLabel: "Important",
327
+ color: "text-orange-700",
328
+ bgColor: "bg-orange-100",
329
+ barColor: "bg-orange-500"
330
+ },
331
+ 5: {
332
+ message: messages2.process_5,
333
+ fallbackLabel: "Vital",
334
+ color: "text-red-700",
335
+ bgColor: "bg-red-100",
336
+ barColor: "bg-red-500"
337
+ }
338
+ };
339
+ var assetScale = {
340
+ 0: {
341
+ message: messages2.asset_0,
342
+ fallbackLabel: "Not classified",
343
+ color: "text-muted-foreground",
344
+ bgColor: "bg-muted",
345
+ barColor: "bg-muted"
346
+ },
347
+ 1: {
348
+ message: messages2.asset_1,
349
+ fallbackLabel: "Insignificant",
350
+ color: "text-green-700",
351
+ bgColor: "bg-green-100",
352
+ barColor: "bg-green-500"
353
+ },
354
+ 2: {
355
+ message: messages2.asset_2,
356
+ fallbackLabel: "Low",
357
+ color: "text-lime-700",
358
+ bgColor: "bg-lime-100",
359
+ barColor: "bg-lime-500"
360
+ },
361
+ 3: {
362
+ message: messages2.asset_3,
363
+ fallbackLabel: "Medium",
364
+ color: "text-yellow-700",
365
+ bgColor: "bg-yellow-100",
366
+ barColor: "bg-yellow-500"
367
+ },
368
+ 4: {
369
+ message: messages2.asset_4,
370
+ fallbackLabel: "High",
371
+ color: "text-orange-700",
372
+ bgColor: "bg-orange-100",
373
+ barColor: "bg-orange-500"
374
+ },
375
+ 5: {
376
+ message: messages2.asset_5,
377
+ fallbackLabel: "Business Critical",
378
+ color: "text-red-700",
379
+ bgColor: "bg-red-100",
380
+ barColor: "bg-red-500"
381
+ }
382
+ };
383
+ var impactLevels = [0, 1, 2, 3, 4, 5];
384
+ function getScale(preset) {
385
+ switch (preset) {
386
+ case "process":
387
+ return processScale;
388
+ case "asset":
389
+ return assetScale;
390
+ default:
391
+ return riskScale;
392
+ }
393
+ }
394
+
395
+ // src/common/impact/impact-card.tsx
396
+ var import_jsx_runtime2 = require("react/jsx-runtime");
397
+ function ImpactItemRow({
398
+ label,
399
+ shortLabel,
400
+ value,
401
+ isEditing,
402
+ scale,
403
+ formatLabel,
404
+ onLevelChange
405
+ }) {
406
+ const config = scale[value];
407
+ const isUnrated = value === 0;
408
+ const percentage = isUnrated ? 0 : value / 5 * 100;
409
+ const styles = (0, import_theme2.impactCard)({ unrated: isUnrated });
410
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.row(), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: styles.rowContent(), children: [
411
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.rowIcon(), children: shortLabel }),
412
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: styles.rowBody(), children: [
413
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: styles.rowHeader(), children: [
414
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.rowLabel(), children: label }),
415
+ isEditing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
416
+ import_sight2.Select,
417
+ {
418
+ value: String(value),
419
+ onValueChange: (val) => onLevelChange(Number(val)),
420
+ size: "sm",
421
+ children: [
422
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Trigger, { className: "w-36", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Value, {}) }),
423
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Content, { children: impactLevels.map((level) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Item, { value: String(level), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "flex items-center gap-2", children: [
424
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "text-xs text-muted-foreground w-3", children: level }),
425
+ formatLabel(level)
426
+ ] }) }, level)) })
427
+ ]
428
+ }
429
+ ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: styles.rowValue(), children: [
430
+ !isUnrated && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.rowValueNumber(), children: value }),
431
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
432
+ "span",
433
+ {
434
+ className: styles.rowValueBadge({
435
+ className: isUnrated ? void 0 : `${config.color} ${config.bgColor}`
436
+ }),
437
+ children: formatLabel(value)
438
+ }
439
+ )
440
+ ] })
441
+ ] }),
442
+ !isUnrated && !isEditing && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.progressContainer(), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
443
+ "div",
444
+ {
445
+ className: styles.progressBar({ className: config.barColor }),
446
+ style: { width: `${percentage}%` }
447
+ }
448
+ ) })
449
+ ] })
450
+ ] }) });
451
+ }
452
+ var defaultImpact = {
453
+ impactConfidentiality: 0,
454
+ impactIntegrity: 0,
455
+ impactAvailability: 0,
456
+ impactAuthenticity: 0
457
+ };
458
+ function ImpactCard({
459
+ value,
460
+ onChange,
461
+ showJustification = false,
462
+ showAuthenticity = false,
463
+ readOnly = false,
464
+ scale = "risk",
465
+ title
466
+ }) {
467
+ var _a, _b;
468
+ const intl = (0, import_i18n4.useSafeIntl)();
469
+ const [isEditing, setIsEditing] = (0, import_react.useState)(false);
470
+ const [editValues, setEditValues] = (0, import_react.useState)(
471
+ value || defaultImpact
472
+ );
473
+ const styles = (0, import_theme2.impactCard)({ editing: isEditing });
474
+ const scaleConfig = typeof scale === "string" ? getScale(scale) : scale;
475
+ const formatLabel = (level) => {
476
+ const config = scaleConfig[level];
477
+ return intl.formatMessage(config.message);
478
+ };
479
+ const t = {
480
+ titleCia: intl.formatMessage(messages2.title_cia),
481
+ titleCiaa: intl.formatMessage(messages2.title_ciaa),
482
+ confidentiality: intl.formatMessage(messages2.confidentiality),
483
+ integrity: intl.formatMessage(messages2.integrity),
484
+ availability: intl.formatMessage(messages2.availability),
485
+ authenticity: intl.formatMessage(messages2.authenticity),
486
+ justification: intl.formatMessage(messages2.justification),
487
+ justificationPlaceholder: intl.formatMessage(
488
+ messages2.justification_placeholder
489
+ ),
490
+ noJustification: intl.formatMessage(messages2.no_justification),
491
+ edit: intl.formatMessage(messages2.edit),
492
+ cancel: intl.formatMessage(messages2.cancel),
493
+ save: intl.formatMessage(messages2.save)
494
+ };
495
+ const defaultTitle = showAuthenticity ? t.titleCiaa : t.titleCia;
496
+ const cardTitle = title != null ? title : defaultTitle;
497
+ const handleSave = () => {
498
+ onChange == null ? void 0 : onChange(editValues);
499
+ setIsEditing(false);
500
+ };
501
+ const handleCancel = () => {
502
+ setEditValues(value || defaultImpact);
503
+ setIsEditing(false);
504
+ };
505
+ const handleStartEdit = () => {
506
+ setEditValues(value || defaultImpact);
507
+ setIsEditing(true);
508
+ };
509
+ const currentImpact = isEditing ? editValues : value || defaultImpact;
510
+ const handleLevelChange = (key) => (level) => {
511
+ setEditValues((prev) => ({
512
+ ...prev,
513
+ [key]: level
514
+ }));
515
+ };
516
+ const handleJustificationChange = (justification) => {
517
+ setEditValues((prev) => ({
518
+ ...prev,
519
+ impactJustification: justification || void 0
520
+ }));
521
+ };
522
+ const highestImpact = Math.max(
523
+ currentImpact.impactConfidentiality,
524
+ currentImpact.impactIntegrity,
525
+ currentImpact.impactAvailability,
526
+ (_a = currentImpact.impactAuthenticity) != null ? _a : 0
527
+ );
528
+ const highestLabel = formatLabel(highestImpact);
529
+ const justificationHint = intl.formatMessage(messages2.justification_hint, {
530
+ level: highestLabel
531
+ });
532
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_sight2.Card.Root, { className: styles.root(), children: [
533
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_sight2.Card.Header, { className: "flex flex-row items-center justify-between", children: [
534
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center gap-2", children: [
535
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Heading, { level: "h4", className: "text-sm font-medium", children: cardTitle }),
536
+ isEditing && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Chip, { size: "sm", color: "primary", children: t.edit })
537
+ ] }),
538
+ !readOnly && (!isEditing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
539
+ "button",
540
+ {
541
+ type: "button",
542
+ onClick: handleStartEdit,
543
+ className: styles.editButton(),
544
+ "aria-label": t.edit,
545
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.EditIcon, { className: "size-4" })
546
+ }
547
+ ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center gap-2", children: [
548
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Button, { variant: "ghost", size: "sm", onClick: handleCancel, children: t.cancel }),
549
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Button, { size: "sm", onClick: handleSave, children: t.save })
550
+ ] }))
551
+ ] }),
552
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_sight2.Card.Body, { className: "space-y-3", children: [
553
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
554
+ ImpactItemRow,
555
+ {
556
+ label: t.confidentiality,
557
+ shortLabel: "C",
558
+ value: currentImpact.impactConfidentiality,
559
+ isEditing,
560
+ scale: scaleConfig,
561
+ formatLabel,
562
+ onLevelChange: handleLevelChange("impactConfidentiality")
563
+ }
564
+ ),
565
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
566
+ ImpactItemRow,
567
+ {
568
+ label: t.integrity,
569
+ shortLabel: "I",
570
+ value: currentImpact.impactIntegrity,
571
+ isEditing,
572
+ scale: scaleConfig,
573
+ formatLabel,
574
+ onLevelChange: handleLevelChange("impactIntegrity")
575
+ }
576
+ ),
577
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
578
+ ImpactItemRow,
579
+ {
580
+ label: t.availability,
581
+ shortLabel: "A",
582
+ value: currentImpact.impactAvailability,
583
+ isEditing,
584
+ scale: scaleConfig,
585
+ formatLabel,
586
+ onLevelChange: handleLevelChange("impactAvailability")
587
+ }
588
+ ),
589
+ showAuthenticity && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
590
+ ImpactItemRow,
591
+ {
592
+ label: t.authenticity,
593
+ shortLabel: "Au",
594
+ value: (_b = currentImpact.impactAuthenticity) != null ? _b : 0,
595
+ isEditing,
596
+ scale: scaleConfig,
597
+ formatLabel,
598
+ onLevelChange: handleLevelChange("impactAuthenticity")
599
+ }
600
+ ),
601
+ showJustification && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: styles.justificationSection(), children: [
602
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
603
+ "label",
604
+ {
605
+ htmlFor: "impact-justification",
606
+ className: styles.justificationLabel(),
607
+ children: [
608
+ t.justification,
609
+ highestImpact > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.justificationHint(), children: justificationHint })
610
+ ]
611
+ }
612
+ ),
613
+ isEditing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
614
+ import_sight2.Textarea,
615
+ {
616
+ id: "impact-justification",
617
+ value: currentImpact.impactJustification || "",
618
+ onChange: (e) => handleJustificationChange(e.target.value),
619
+ placeholder: t.justificationPlaceholder,
620
+ rows: 3,
621
+ className: "text-sm"
622
+ }
623
+ ) : currentImpact.impactJustification ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: styles.justificationText(), children: currentImpact.impactJustification }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: styles.justificationEmpty(), children: t.noJustification })
624
+ ] })
625
+ ] })
626
+ ] });
627
+ }
628
+ // Annotate the CommonJS export names for ESM import in node:
629
+ 0 && (module.exports = {
630
+ ComplianceBadges,
631
+ DoraBadge,
632
+ ImpactCard,
633
+ Nis2Badge,
634
+ assetScale,
635
+ getScale,
636
+ impactLevels,
637
+ impactMessages,
638
+ processScale,
639
+ riskScale
640
+ });
@@ -0,0 +1,35 @@
1
+ "use client";
2
+ import "../chunk-BFZPRJQT.mjs";
3
+ import "../chunk-TICWEZUI.mjs";
4
+ import "../chunk-GFABGXAO.mjs";
5
+ import {
6
+ ImpactCard
7
+ } from "../chunk-TW3S4OE2.mjs";
8
+ import {
9
+ assetScale,
10
+ getScale,
11
+ impactLevels,
12
+ processScale,
13
+ riskScale
14
+ } from "../chunk-KNGEZZFI.mjs";
15
+ import {
16
+ messages
17
+ } from "../chunk-GF3WJZVI.mjs";
18
+ import {
19
+ ComplianceBadges,
20
+ DoraBadge,
21
+ Nis2Badge
22
+ } from "../chunk-7754RETD.mjs";
23
+ import "../chunk-B47KDUYY.mjs";
24
+ export {
25
+ ComplianceBadges,
26
+ DoraBadge,
27
+ ImpactCard,
28
+ Nis2Badge,
29
+ assetScale,
30
+ getScale,
31
+ impactLevels,
32
+ messages as impactMessages,
33
+ processScale,
34
+ riskScale
35
+ };