@kopexa/grc 0.0.2 → 0.0.3

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 (53) hide show
  1. package/dist/chunk-5TBN3JQA.mjs +66 -0
  2. package/dist/chunk-DC44K745.mjs +46 -0
  3. package/dist/chunk-HI7F2CF4.mjs +1 -0
  4. package/dist/chunk-HJUSN7FD.mjs +1 -0
  5. package/dist/chunk-QDYL5ABK.mjs +118 -0
  6. package/dist/chunk-QS5S6V26.mjs +22 -0
  7. package/dist/chunk-VFX3DASQ.mjs +57 -0
  8. package/dist/common/control/index.d.mts +3 -0
  9. package/dist/common/control/index.d.ts +3 -0
  10. package/dist/common/control/index.js +160 -0
  11. package/dist/common/control/index.mjs +11 -0
  12. package/dist/common/control/mapped-controls.d.mts +33 -0
  13. package/dist/common/control/mapped-controls.d.ts +33 -0
  14. package/dist/common/control/mapped-controls.js +159 -0
  15. package/dist/common/control/mapped-controls.mjs +11 -0
  16. package/dist/common/control/messages.d.mts +16 -0
  17. package/dist/common/control/messages.d.ts +16 -0
  18. package/dist/common/control/messages.js +45 -0
  19. package/dist/common/control/messages.mjs +7 -0
  20. package/dist/common/index.d.mts +5 -0
  21. package/dist/common/index.d.ts +5 -0
  22. package/dist/common/index.js +364 -75
  23. package/dist/common/index.mjs +26 -1
  24. package/dist/common/risk/index.d.mts +4 -0
  25. package/dist/common/risk/index.d.ts +4 -0
  26. package/dist/common/risk/index.js +185 -0
  27. package/dist/common/risk/index.mjs +20 -0
  28. package/dist/common/risk/messages.d.mts +40 -0
  29. package/dist/common/risk/messages.d.ts +40 -0
  30. package/dist/common/risk/messages.js +69 -0
  31. package/dist/common/risk/messages.mjs +7 -0
  32. package/dist/common/risk/risk-rating-display.d.mts +21 -0
  33. package/dist/common/risk/risk-rating-display.d.ts +21 -0
  34. package/dist/common/risk/risk-rating-display.js +139 -0
  35. package/dist/common/risk/risk-rating-display.mjs +10 -0
  36. package/dist/common/risk/types.d.mts +37 -0
  37. package/dist/common/risk/types.d.ts +37 -0
  38. package/dist/common/risk/types.js +82 -0
  39. package/dist/common/risk/types.mjs +11 -0
  40. package/dist/index.d.mts +5 -0
  41. package/dist/index.d.ts +5 -0
  42. package/dist/index.js +364 -75
  43. package/dist/index.mjs +26 -1
  44. package/package.json +8 -7
  45. package/src/common/control/index.ts +6 -0
  46. package/src/common/control/mapped-controls.tsx +192 -0
  47. package/src/common/control/messages.ts +16 -0
  48. package/src/common/index.ts +2 -0
  49. package/src/common/risk/index.ts +12 -0
  50. package/src/common/risk/messages.ts +40 -0
  51. package/src/common/risk/risk-rating-display.tsx +86 -0
  52. package/src/common/risk/types.ts +91 -0
  53. /package/dist/{chunk-BFZPRJQT.mjs → chunk-CND77GVC.mjs} +0 -0
@@ -1,6 +1,24 @@
1
1
  "use client";
2
- import "../chunk-BFZPRJQT.mjs";
2
+ import "../chunk-HJUSN7FD.mjs";
3
+ import "../chunk-HI7F2CF4.mjs";
4
+ import {
5
+ RiskRatingDisplay
6
+ } from "../chunk-5TBN3JQA.mjs";
7
+ import {
8
+ messages as messages2
9
+ } from "../chunk-DC44K745.mjs";
10
+ import {
11
+ getRiskLevelFromRating,
12
+ isRatingUnrated,
13
+ riskLevelConfig
14
+ } from "../chunk-VFX3DASQ.mjs";
3
15
  import "../chunk-TICWEZUI.mjs";
16
+ import "../chunk-CND77GVC.mjs";
17
+ import {
18
+ ControlChip,
19
+ MappedControls
20
+ } from "../chunk-QDYL5ABK.mjs";
21
+ import "../chunk-QS5S6V26.mjs";
4
22
  import "../chunk-GFABGXAO.mjs";
5
23
  import {
6
24
  ImpactCard
@@ -23,13 +41,20 @@ import {
23
41
  import "../chunk-B47KDUYY.mjs";
24
42
  export {
25
43
  ComplianceBadges,
44
+ ControlChip,
26
45
  DoraBadge,
27
46
  ImpactCard,
47
+ MappedControls,
28
48
  Nis2Badge,
49
+ RiskRatingDisplay,
29
50
  assetScale,
51
+ getRiskLevelFromRating,
30
52
  getScale,
31
53
  impactLevels,
32
54
  messages as impactMessages,
55
+ isRatingUnrated,
33
56
  processScale,
57
+ riskLevelConfig,
58
+ messages2 as riskMessages,
34
59
  riskScale
35
60
  };
@@ -0,0 +1,4 @@
1
+ export { messages as riskMessages } from './messages.mjs';
2
+ export { RiskRatingDisplay, RiskRatingDisplayProps } from './risk-rating-display.mjs';
3
+ export { RiskLevel, RiskRating, getRiskLevelFromRating, isRatingUnrated, riskLevelConfig } from './types.mjs';
4
+ import 'react/jsx-runtime';
@@ -0,0 +1,4 @@
1
+ export { messages as riskMessages } from './messages.js';
2
+ export { RiskRatingDisplay, RiskRatingDisplayProps } from './risk-rating-display.js';
3
+ export { RiskLevel, RiskRating, getRiskLevelFromRating, isRatingUnrated, riskLevelConfig } from './types.js';
4
+ import 'react/jsx-runtime';
@@ -0,0 +1,185 @@
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/risk/index.ts
22
+ var risk_exports = {};
23
+ __export(risk_exports, {
24
+ RiskRatingDisplay: () => RiskRatingDisplay,
25
+ getRiskLevelFromRating: () => getRiskLevelFromRating,
26
+ isRatingUnrated: () => isRatingUnrated,
27
+ riskLevelConfig: () => riskLevelConfig,
28
+ riskMessages: () => messages
29
+ });
30
+ module.exports = __toCommonJS(risk_exports);
31
+
32
+ // src/common/risk/messages.ts
33
+ var import_i18n = require("@kopexa/i18n");
34
+ var messages = (0, import_i18n.defineMessages)({
35
+ level_unrated: {
36
+ id: "grc.risk.level.unrated",
37
+ defaultMessage: "Not rated"
38
+ },
39
+ level_low: {
40
+ id: "grc.risk.level.low",
41
+ defaultMessage: "Low"
42
+ },
43
+ level_medium: {
44
+ id: "grc.risk.level.medium",
45
+ defaultMessage: "Medium"
46
+ },
47
+ level_high: {
48
+ id: "grc.risk.level.high",
49
+ defaultMessage: "High"
50
+ },
51
+ level_critical: {
52
+ id: "grc.risk.level.critical",
53
+ defaultMessage: "Critical"
54
+ },
55
+ likelihood: {
56
+ id: "grc.risk.likelihood",
57
+ defaultMessage: "Likelihood"
58
+ },
59
+ consequence: {
60
+ id: "grc.risk.consequence",
61
+ defaultMessage: "Consequence"
62
+ },
63
+ rating: {
64
+ id: "grc.risk.rating",
65
+ defaultMessage: "Rating"
66
+ },
67
+ not_rated_hint: {
68
+ id: "grc.risk.not_rated_hint",
69
+ defaultMessage: "Risk has not been assessed yet"
70
+ }
71
+ });
72
+
73
+ // src/common/risk/risk-rating-display.tsx
74
+ var import_i18n2 = require("@kopexa/i18n");
75
+ var import_sight = require("@kopexa/sight");
76
+ var import_theme = require("@kopexa/theme");
77
+
78
+ // src/common/risk/types.ts
79
+ function getRiskLevelFromRating(rating) {
80
+ if (rating === 0) return "unrated";
81
+ if (rating <= 4) return "low";
82
+ if (rating <= 9) return "medium";
83
+ if (rating <= 16) return "high";
84
+ return "critical";
85
+ }
86
+ function isRatingUnrated(rating) {
87
+ if (!rating) return true;
88
+ return rating.rating === 0 || rating.likelihood === 0 || rating.consequence === 0;
89
+ }
90
+ var riskLevelConfig = {
91
+ unrated: {
92
+ label: "Nicht bewertet",
93
+ bgColor: "bg-muted",
94
+ textColor: "text-muted-foreground",
95
+ iconBgColor: "bg-muted/50",
96
+ iconTextColor: "text-muted-foreground"
97
+ },
98
+ low: {
99
+ label: "Niedrig",
100
+ bgColor: "bg-success",
101
+ textColor: "text-success",
102
+ iconBgColor: "bg-success/10",
103
+ iconTextColor: "text-success"
104
+ },
105
+ medium: {
106
+ label: "Mittel",
107
+ bgColor: "bg-warning",
108
+ textColor: "text-warning",
109
+ iconBgColor: "bg-warning/10",
110
+ iconTextColor: "text-warning"
111
+ },
112
+ high: {
113
+ label: "Hoch",
114
+ bgColor: "bg-orange-500",
115
+ textColor: "text-orange-500",
116
+ iconBgColor: "bg-orange-500/10",
117
+ iconTextColor: "text-orange-500"
118
+ },
119
+ critical: {
120
+ label: "Kritisch",
121
+ bgColor: "bg-destructive",
122
+ textColor: "text-destructive",
123
+ iconBgColor: "bg-destructive/10",
124
+ iconTextColor: "text-destructive"
125
+ }
126
+ };
127
+
128
+ // src/common/risk/risk-rating-display.tsx
129
+ var import_jsx_runtime = require("react/jsx-runtime");
130
+ function RiskRatingDisplay({
131
+ rating,
132
+ showBadge = true,
133
+ showLabel = true,
134
+ size = "md"
135
+ }) {
136
+ const intl = (0, import_i18n2.useSafeIntl)();
137
+ if (isRatingUnrated(rating)) {
138
+ const styles2 = (0, import_theme.riskRating)({ size, level: "unrated" });
139
+ const levelLabel2 = intl.formatMessage(messages.level_unrated);
140
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Tooltip, { content: intl.formatMessage(messages.not_rated_hint), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: styles2.base(), children: [
141
+ showBadge && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles2.badge(), children: "\u2014" }),
142
+ showLabel && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: styles2.label(), children: levelLabel2 })
143
+ ] }) });
144
+ }
145
+ const ratedValue = rating;
146
+ const level = getRiskLevelFromRating(ratedValue.rating);
147
+ const styles = (0, import_theme.riskRating)({
148
+ size,
149
+ level
150
+ });
151
+ const levelLabelKey = `level_${level}`;
152
+ const levelLabel = intl.formatMessage(messages[levelLabelKey]);
153
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
154
+ import_sight.Tooltip,
155
+ {
156
+ content: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "text-xs space-y-1", children: [
157
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
158
+ intl.formatMessage(messages.likelihood),
159
+ ": ",
160
+ ratedValue.likelihood,
161
+ "/5"
162
+ ] }),
163
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
164
+ intl.formatMessage(messages.consequence),
165
+ ": ",
166
+ ratedValue.consequence,
167
+ "/5"
168
+ ] }),
169
+ ratedValue.comment && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-muted-foreground", children: ratedValue.comment })
170
+ ] }),
171
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: styles.base(), children: [
172
+ showBadge && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.badge(), children: ratedValue.rating }),
173
+ showLabel && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: styles.label(), children: levelLabel })
174
+ ] })
175
+ }
176
+ );
177
+ }
178
+ // Annotate the CommonJS export names for ESM import in node:
179
+ 0 && (module.exports = {
180
+ RiskRatingDisplay,
181
+ getRiskLevelFromRating,
182
+ isRatingUnrated,
183
+ riskLevelConfig,
184
+ riskMessages
185
+ });
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import "../../chunk-HI7F2CF4.mjs";
3
+ import {
4
+ RiskRatingDisplay
5
+ } from "../../chunk-5TBN3JQA.mjs";
6
+ import {
7
+ messages
8
+ } from "../../chunk-DC44K745.mjs";
9
+ import {
10
+ getRiskLevelFromRating,
11
+ isRatingUnrated,
12
+ riskLevelConfig
13
+ } from "../../chunk-VFX3DASQ.mjs";
14
+ export {
15
+ RiskRatingDisplay,
16
+ getRiskLevelFromRating,
17
+ isRatingUnrated,
18
+ riskLevelConfig,
19
+ messages as riskMessages
20
+ };
@@ -0,0 +1,40 @@
1
+ declare const messages: {
2
+ level_unrated: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ };
6
+ level_low: {
7
+ id: string;
8
+ defaultMessage: string;
9
+ };
10
+ level_medium: {
11
+ id: string;
12
+ defaultMessage: string;
13
+ };
14
+ level_high: {
15
+ id: string;
16
+ defaultMessage: string;
17
+ };
18
+ level_critical: {
19
+ id: string;
20
+ defaultMessage: string;
21
+ };
22
+ likelihood: {
23
+ id: string;
24
+ defaultMessage: string;
25
+ };
26
+ consequence: {
27
+ id: string;
28
+ defaultMessage: string;
29
+ };
30
+ rating: {
31
+ id: string;
32
+ defaultMessage: string;
33
+ };
34
+ not_rated_hint: {
35
+ id: string;
36
+ defaultMessage: string;
37
+ };
38
+ };
39
+
40
+ export { messages };
@@ -0,0 +1,40 @@
1
+ declare const messages: {
2
+ level_unrated: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ };
6
+ level_low: {
7
+ id: string;
8
+ defaultMessage: string;
9
+ };
10
+ level_medium: {
11
+ id: string;
12
+ defaultMessage: string;
13
+ };
14
+ level_high: {
15
+ id: string;
16
+ defaultMessage: string;
17
+ };
18
+ level_critical: {
19
+ id: string;
20
+ defaultMessage: string;
21
+ };
22
+ likelihood: {
23
+ id: string;
24
+ defaultMessage: string;
25
+ };
26
+ consequence: {
27
+ id: string;
28
+ defaultMessage: string;
29
+ };
30
+ rating: {
31
+ id: string;
32
+ defaultMessage: string;
33
+ };
34
+ not_rated_hint: {
35
+ id: string;
36
+ defaultMessage: string;
37
+ };
38
+ };
39
+
40
+ export { messages };
@@ -0,0 +1,69 @@
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/risk/messages.ts
22
+ var messages_exports = {};
23
+ __export(messages_exports, {
24
+ messages: () => messages
25
+ });
26
+ module.exports = __toCommonJS(messages_exports);
27
+ var import_i18n = require("@kopexa/i18n");
28
+ var messages = (0, import_i18n.defineMessages)({
29
+ level_unrated: {
30
+ id: "grc.risk.level.unrated",
31
+ defaultMessage: "Not rated"
32
+ },
33
+ level_low: {
34
+ id: "grc.risk.level.low",
35
+ defaultMessage: "Low"
36
+ },
37
+ level_medium: {
38
+ id: "grc.risk.level.medium",
39
+ defaultMessage: "Medium"
40
+ },
41
+ level_high: {
42
+ id: "grc.risk.level.high",
43
+ defaultMessage: "High"
44
+ },
45
+ level_critical: {
46
+ id: "grc.risk.level.critical",
47
+ defaultMessage: "Critical"
48
+ },
49
+ likelihood: {
50
+ id: "grc.risk.likelihood",
51
+ defaultMessage: "Likelihood"
52
+ },
53
+ consequence: {
54
+ id: "grc.risk.consequence",
55
+ defaultMessage: "Consequence"
56
+ },
57
+ rating: {
58
+ id: "grc.risk.rating",
59
+ defaultMessage: "Rating"
60
+ },
61
+ not_rated_hint: {
62
+ id: "grc.risk.not_rated_hint",
63
+ defaultMessage: "Risk has not been assessed yet"
64
+ }
65
+ });
66
+ // Annotate the CommonJS export names for ESM import in node:
67
+ 0 && (module.exports = {
68
+ messages
69
+ });
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import {
3
+ messages
4
+ } from "../../chunk-DC44K745.mjs";
5
+ export {
6
+ messages
7
+ };
@@ -0,0 +1,21 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { RiskRating } from './types.mjs';
3
+
4
+ interface RiskRatingDisplayProps {
5
+ /** The risk rating to display */
6
+ rating: RiskRating | null | undefined;
7
+ /** Show the rating value badge */
8
+ showBadge?: boolean;
9
+ /** Show the level label text */
10
+ showLabel?: boolean;
11
+ /** Size variant */
12
+ size?: "sm" | "md";
13
+ }
14
+ /**
15
+ * Display component for risk ratings.
16
+ * Shows a colored badge with the rating value and level label.
17
+ * Handles "not rated" state gracefully.
18
+ */
19
+ declare function RiskRatingDisplay({ rating, showBadge, showLabel, size, }: RiskRatingDisplayProps): react_jsx_runtime.JSX.Element;
20
+
21
+ export { RiskRatingDisplay, type RiskRatingDisplayProps };
@@ -0,0 +1,21 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { RiskRating } from './types.js';
3
+
4
+ interface RiskRatingDisplayProps {
5
+ /** The risk rating to display */
6
+ rating: RiskRating | null | undefined;
7
+ /** Show the rating value badge */
8
+ showBadge?: boolean;
9
+ /** Show the level label text */
10
+ showLabel?: boolean;
11
+ /** Size variant */
12
+ size?: "sm" | "md";
13
+ }
14
+ /**
15
+ * Display component for risk ratings.
16
+ * Shows a colored badge with the rating value and level label.
17
+ * Handles "not rated" state gracefully.
18
+ */
19
+ declare function RiskRatingDisplay({ rating, showBadge, showLabel, size, }: RiskRatingDisplayProps): react_jsx_runtime.JSX.Element;
20
+
21
+ export { RiskRatingDisplay, type RiskRatingDisplayProps };
@@ -0,0 +1,139 @@
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/risk/risk-rating-display.tsx
23
+ var risk_rating_display_exports = {};
24
+ __export(risk_rating_display_exports, {
25
+ RiskRatingDisplay: () => RiskRatingDisplay
26
+ });
27
+ module.exports = __toCommonJS(risk_rating_display_exports);
28
+ var import_i18n2 = require("@kopexa/i18n");
29
+ var import_sight = require("@kopexa/sight");
30
+ var import_theme = require("@kopexa/theme");
31
+
32
+ // src/common/risk/messages.ts
33
+ var import_i18n = require("@kopexa/i18n");
34
+ var messages = (0, import_i18n.defineMessages)({
35
+ level_unrated: {
36
+ id: "grc.risk.level.unrated",
37
+ defaultMessage: "Not rated"
38
+ },
39
+ level_low: {
40
+ id: "grc.risk.level.low",
41
+ defaultMessage: "Low"
42
+ },
43
+ level_medium: {
44
+ id: "grc.risk.level.medium",
45
+ defaultMessage: "Medium"
46
+ },
47
+ level_high: {
48
+ id: "grc.risk.level.high",
49
+ defaultMessage: "High"
50
+ },
51
+ level_critical: {
52
+ id: "grc.risk.level.critical",
53
+ defaultMessage: "Critical"
54
+ },
55
+ likelihood: {
56
+ id: "grc.risk.likelihood",
57
+ defaultMessage: "Likelihood"
58
+ },
59
+ consequence: {
60
+ id: "grc.risk.consequence",
61
+ defaultMessage: "Consequence"
62
+ },
63
+ rating: {
64
+ id: "grc.risk.rating",
65
+ defaultMessage: "Rating"
66
+ },
67
+ not_rated_hint: {
68
+ id: "grc.risk.not_rated_hint",
69
+ defaultMessage: "Risk has not been assessed yet"
70
+ }
71
+ });
72
+
73
+ // src/common/risk/types.ts
74
+ function getRiskLevelFromRating(rating) {
75
+ if (rating === 0) return "unrated";
76
+ if (rating <= 4) return "low";
77
+ if (rating <= 9) return "medium";
78
+ if (rating <= 16) return "high";
79
+ return "critical";
80
+ }
81
+ function isRatingUnrated(rating) {
82
+ if (!rating) return true;
83
+ return rating.rating === 0 || rating.likelihood === 0 || rating.consequence === 0;
84
+ }
85
+
86
+ // src/common/risk/risk-rating-display.tsx
87
+ var import_jsx_runtime = require("react/jsx-runtime");
88
+ function RiskRatingDisplay({
89
+ rating,
90
+ showBadge = true,
91
+ showLabel = true,
92
+ size = "md"
93
+ }) {
94
+ const intl = (0, import_i18n2.useSafeIntl)();
95
+ if (isRatingUnrated(rating)) {
96
+ const styles2 = (0, import_theme.riskRating)({ size, level: "unrated" });
97
+ const levelLabel2 = intl.formatMessage(messages.level_unrated);
98
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Tooltip, { content: intl.formatMessage(messages.not_rated_hint), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: styles2.base(), children: [
99
+ showBadge && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles2.badge(), children: "\u2014" }),
100
+ showLabel && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: styles2.label(), children: levelLabel2 })
101
+ ] }) });
102
+ }
103
+ const ratedValue = rating;
104
+ const level = getRiskLevelFromRating(ratedValue.rating);
105
+ const styles = (0, import_theme.riskRating)({
106
+ size,
107
+ level
108
+ });
109
+ const levelLabelKey = `level_${level}`;
110
+ const levelLabel = intl.formatMessage(messages[levelLabelKey]);
111
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
112
+ import_sight.Tooltip,
113
+ {
114
+ content: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "text-xs space-y-1", children: [
115
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
116
+ intl.formatMessage(messages.likelihood),
117
+ ": ",
118
+ ratedValue.likelihood,
119
+ "/5"
120
+ ] }),
121
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
122
+ intl.formatMessage(messages.consequence),
123
+ ": ",
124
+ ratedValue.consequence,
125
+ "/5"
126
+ ] }),
127
+ ratedValue.comment && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-muted-foreground", children: ratedValue.comment })
128
+ ] }),
129
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: styles.base(), children: [
130
+ showBadge && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.badge(), children: ratedValue.rating }),
131
+ showLabel && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: styles.label(), children: levelLabel })
132
+ ] })
133
+ }
134
+ );
135
+ }
136
+ // Annotate the CommonJS export names for ESM import in node:
137
+ 0 && (module.exports = {
138
+ RiskRatingDisplay
139
+ });
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ "use client";
3
+ import {
4
+ RiskRatingDisplay
5
+ } from "../../chunk-5TBN3JQA.mjs";
6
+ import "../../chunk-DC44K745.mjs";
7
+ import "../../chunk-VFX3DASQ.mjs";
8
+ export {
9
+ RiskRatingDisplay
10
+ };
@@ -0,0 +1,37 @@
1
+ /**
2
+ * RiskRating represents the risk assessment details.
3
+ * Aligned with backend Go struct.
4
+ */
5
+ interface RiskRating {
6
+ /** Likelihood of the risk occurring (1-5). 0 = not rated. */
7
+ likelihood: number;
8
+ /** Consequence/impact if the risk occurs (1-5). 0 = not rated. */
9
+ consequence: number;
10
+ /** Calculated rating: likelihood × consequence (0-25). 0 = not rated. */
11
+ rating: number;
12
+ /** Optional comment for context */
13
+ comment?: string;
14
+ }
15
+ type RiskLevel = "unrated" | "low" | "medium" | "high" | "critical";
16
+ /**
17
+ * Get risk level from rating (0-25).
18
+ * - 0: Unrated
19
+ * - 1-4: Low
20
+ * - 5-9: Medium
21
+ * - 10-16: High
22
+ * - 17-25: Critical
23
+ */
24
+ declare function getRiskLevelFromRating(rating: number): RiskLevel;
25
+ /**
26
+ * Check if a rating is considered "not rated"
27
+ */
28
+ declare function isRatingUnrated(rating: RiskRating | null | undefined): boolean;
29
+ declare const riskLevelConfig: Record<RiskLevel, {
30
+ label: string;
31
+ bgColor: string;
32
+ textColor: string;
33
+ iconBgColor: string;
34
+ iconTextColor: string;
35
+ }>;
36
+
37
+ export { type RiskLevel, type RiskRating, getRiskLevelFromRating, isRatingUnrated, riskLevelConfig };