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