@kopexa/grc 0.0.22 → 0.0.24
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-VQUPRJG7.mjs +41 -0
- package/dist/common/impact/impact-badge.d.mts +26 -0
- package/dist/common/impact/impact-badge.d.ts +26 -0
- package/dist/common/impact/impact-badge.js +348 -0
- package/dist/common/impact/impact-badge.mjs +10 -0
- package/dist/common/impact/index.d.mts +1 -0
- package/dist/common/impact/index.d.ts +1 -0
- package/dist/common/impact/index.js +79 -44
- package/dist/common/impact/index.mjs +5 -1
- package/dist/common/index.d.mts +1 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.js +95 -60
- package/dist/common/index.mjs +17 -13
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +139 -104
- package/dist/index.mjs +17 -13
- package/package.json +8 -8
- package/src/common/impact/impact-badge.tsx +72 -0
- package/src/common/impact/index.ts +2 -0
- /package/dist/{chunk-GFABGXAO.mjs → chunk-4DMM2HCE.mjs} +0 -0
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
// src/common/impact/index.ts
|
|
22
22
|
var impact_exports = {};
|
|
23
23
|
__export(impact_exports, {
|
|
24
|
+
ImpactBadge: () => ImpactBadge,
|
|
24
25
|
ImpactCard: () => ImpactCard,
|
|
25
26
|
assetScale: () => assetScale,
|
|
26
27
|
getScale: () => getScale,
|
|
@@ -31,12 +32,9 @@ __export(impact_exports, {
|
|
|
31
32
|
});
|
|
32
33
|
module.exports = __toCommonJS(impact_exports);
|
|
33
34
|
|
|
34
|
-
// src/common/impact/impact-
|
|
35
|
+
// src/common/impact/impact-badge.tsx
|
|
35
36
|
var import_i18n2 = require("@kopexa/i18n");
|
|
36
|
-
var
|
|
37
|
-
var import_sight = require("@kopexa/sight");
|
|
38
|
-
var import_theme = require("@kopexa/theme");
|
|
39
|
-
var import_react = require("react");
|
|
37
|
+
var import_shared_utils = require("@kopexa/shared-utils");
|
|
40
38
|
|
|
41
39
|
// src/common/impact/messages.ts
|
|
42
40
|
var import_i18n = require("@kopexa/i18n");
|
|
@@ -323,8 +321,44 @@ function getScale(preset) {
|
|
|
323
321
|
}
|
|
324
322
|
}
|
|
325
323
|
|
|
326
|
-
// src/common/impact/impact-
|
|
324
|
+
// src/common/impact/impact-badge.tsx
|
|
327
325
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
326
|
+
function ImpactBadge({
|
|
327
|
+
level,
|
|
328
|
+
scale = "risk",
|
|
329
|
+
showValue = false,
|
|
330
|
+
className
|
|
331
|
+
}) {
|
|
332
|
+
var _a;
|
|
333
|
+
const intl = (0, import_i18n2.useSafeIntl)();
|
|
334
|
+
const normalizedLevel = level === null || level === void 0 ? 0 : (_a = Math.min(5, Math.max(0, Math.round(level)))) != null ? _a : 0;
|
|
335
|
+
const scaleConfig = typeof scale === "string" ? getScale(scale) : scale;
|
|
336
|
+
const config = scaleConfig[normalizedLevel];
|
|
337
|
+
const isUnrated = normalizedLevel === 0;
|
|
338
|
+
const label = intl.formatMessage(config.message);
|
|
339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
340
|
+
"span",
|
|
341
|
+
{
|
|
342
|
+
className: (0, import_shared_utils.cn)(
|
|
343
|
+
"inline-flex items-center gap-1.5 text-sm font-medium px-2 py-0.5 rounded",
|
|
344
|
+
isUnrated ? "text-muted-foreground bg-muted" : `${config.color} ${config.bgColor}`,
|
|
345
|
+
className
|
|
346
|
+
),
|
|
347
|
+
children: [
|
|
348
|
+
showValue && !isUnrated && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-xs font-mono opacity-70", children: normalizedLevel }),
|
|
349
|
+
label
|
|
350
|
+
]
|
|
351
|
+
}
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// src/common/impact/impact-card.tsx
|
|
356
|
+
var import_i18n3 = require("@kopexa/i18n");
|
|
357
|
+
var import_icons = require("@kopexa/icons");
|
|
358
|
+
var import_sight = require("@kopexa/sight");
|
|
359
|
+
var import_theme = require("@kopexa/theme");
|
|
360
|
+
var import_react = require("react");
|
|
361
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
328
362
|
function ImpactItemRow({
|
|
329
363
|
label,
|
|
330
364
|
shortLabel,
|
|
@@ -338,28 +372,28 @@ function ImpactItemRow({
|
|
|
338
372
|
const isUnrated = value === 0;
|
|
339
373
|
const percentage = isUnrated ? 0 : value / 5 * 100;
|
|
340
374
|
const styles = (0, import_theme.impactCard)({ unrated: isUnrated });
|
|
341
|
-
return /* @__PURE__ */ (0,
|
|
342
|
-
/* @__PURE__ */ (0,
|
|
343
|
-
/* @__PURE__ */ (0,
|
|
344
|
-
/* @__PURE__ */ (0,
|
|
345
|
-
/* @__PURE__ */ (0,
|
|
346
|
-
isEditing ? /* @__PURE__ */ (0,
|
|
375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.row(), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: styles.rowContent(), children: [
|
|
376
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.rowIcon(), children: shortLabel }),
|
|
377
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: styles.rowBody(), children: [
|
|
378
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: styles.rowHeader(), children: [
|
|
379
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.rowLabel(), children: label }),
|
|
380
|
+
isEditing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
347
381
|
import_sight.Select,
|
|
348
382
|
{
|
|
349
383
|
value: String(value),
|
|
350
384
|
onValueChange: (val) => onLevelChange(Number(val)),
|
|
351
385
|
size: "sm",
|
|
352
386
|
children: [
|
|
353
|
-
/* @__PURE__ */ (0,
|
|
354
|
-
/* @__PURE__ */ (0,
|
|
355
|
-
/* @__PURE__ */ (0,
|
|
387
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight.Select.Trigger, { className: "w-36", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight.Select.Value, {}) }),
|
|
388
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight.Select.Content, { children: impactLevels.map((level) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight.Select.Item, { value: String(level), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "flex items-center gap-2", children: [
|
|
389
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "text-xs text-muted-foreground w-3", children: level }),
|
|
356
390
|
formatLabel(level)
|
|
357
391
|
] }) }, level)) })
|
|
358
392
|
]
|
|
359
393
|
}
|
|
360
|
-
) : /* @__PURE__ */ (0,
|
|
361
|
-
!isUnrated && /* @__PURE__ */ (0,
|
|
362
|
-
/* @__PURE__ */ (0,
|
|
394
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: styles.rowValue(), children: [
|
|
395
|
+
!isUnrated && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.rowValueNumber(), children: value }),
|
|
396
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
363
397
|
"span",
|
|
364
398
|
{
|
|
365
399
|
className: styles.rowValueBadge({
|
|
@@ -370,7 +404,7 @@ function ImpactItemRow({
|
|
|
370
404
|
)
|
|
371
405
|
] })
|
|
372
406
|
] }),
|
|
373
|
-
!isUnrated && !isEditing && /* @__PURE__ */ (0,
|
|
407
|
+
!isUnrated && !isEditing && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.progressContainer(), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
374
408
|
"div",
|
|
375
409
|
{
|
|
376
410
|
className: styles.progressBar({ className: config.barColor }),
|
|
@@ -398,7 +432,7 @@ function ImpactCard({
|
|
|
398
432
|
needsAttention = false
|
|
399
433
|
}) {
|
|
400
434
|
var _a, _b;
|
|
401
|
-
const intl = (0,
|
|
435
|
+
const intl = (0, import_i18n3.useSafeIntl)();
|
|
402
436
|
const isInline = variant === "inline";
|
|
403
437
|
const [isEditing, setIsEditing] = (0, import_react.useState)(false);
|
|
404
438
|
const [editValues, setEditValues] = (0, import_react.useState)(
|
|
@@ -475,8 +509,8 @@ function ImpactCard({
|
|
|
475
509
|
const justificationHint = intl.formatMessage(messages.justification_hint, {
|
|
476
510
|
level: highestLabel
|
|
477
511
|
});
|
|
478
|
-
const impactRows = /* @__PURE__ */ (0,
|
|
479
|
-
/* @__PURE__ */ (0,
|
|
512
|
+
const impactRows = /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
513
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
480
514
|
ImpactItemRow,
|
|
481
515
|
{
|
|
482
516
|
label: t.confidentiality,
|
|
@@ -488,7 +522,7 @@ function ImpactCard({
|
|
|
488
522
|
onLevelChange: handleLevelChange("impactConfidentiality")
|
|
489
523
|
}
|
|
490
524
|
),
|
|
491
|
-
/* @__PURE__ */ (0,
|
|
525
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
492
526
|
ImpactItemRow,
|
|
493
527
|
{
|
|
494
528
|
label: t.integrity,
|
|
@@ -500,7 +534,7 @@ function ImpactCard({
|
|
|
500
534
|
onLevelChange: handleLevelChange("impactIntegrity")
|
|
501
535
|
}
|
|
502
536
|
),
|
|
503
|
-
/* @__PURE__ */ (0,
|
|
537
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
504
538
|
ImpactItemRow,
|
|
505
539
|
{
|
|
506
540
|
label: t.availability,
|
|
@@ -512,7 +546,7 @@ function ImpactCard({
|
|
|
512
546
|
onLevelChange: handleLevelChange("impactAvailability")
|
|
513
547
|
}
|
|
514
548
|
),
|
|
515
|
-
showAuthenticity && /* @__PURE__ */ (0,
|
|
549
|
+
showAuthenticity && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
516
550
|
ImpactItemRow,
|
|
517
551
|
{
|
|
518
552
|
label: t.authenticity,
|
|
@@ -525,19 +559,19 @@ function ImpactCard({
|
|
|
525
559
|
}
|
|
526
560
|
)
|
|
527
561
|
] });
|
|
528
|
-
const justificationContent = showJustification && /* @__PURE__ */ (0,
|
|
529
|
-
/* @__PURE__ */ (0,
|
|
562
|
+
const justificationContent = showJustification && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: styles.justificationSection(), children: [
|
|
563
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
530
564
|
"label",
|
|
531
565
|
{
|
|
532
566
|
htmlFor: "impact-justification",
|
|
533
567
|
className: styles.justificationLabel(),
|
|
534
568
|
children: [
|
|
535
569
|
t.justification,
|
|
536
|
-
highestImpact > 0 && /* @__PURE__ */ (0,
|
|
570
|
+
highestImpact > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.justificationHint(), children: justificationHint })
|
|
537
571
|
]
|
|
538
572
|
}
|
|
539
573
|
),
|
|
540
|
-
effectiveIsEditing ? /* @__PURE__ */ (0,
|
|
574
|
+
effectiveIsEditing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
541
575
|
import_sight.Textarea,
|
|
542
576
|
{
|
|
543
577
|
id: "impact-justification",
|
|
@@ -547,43 +581,43 @@ function ImpactCard({
|
|
|
547
581
|
rows: 3,
|
|
548
582
|
className: "text-sm"
|
|
549
583
|
}
|
|
550
|
-
) : currentImpact.impactJustification ? /* @__PURE__ */ (0,
|
|
584
|
+
) : 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 })
|
|
551
585
|
] });
|
|
552
586
|
if (isInline) {
|
|
553
|
-
return /* @__PURE__ */ (0,
|
|
554
|
-
title && /* @__PURE__ */ (0,
|
|
587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: styles.wrapper(), children: [
|
|
588
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.inlineHeader(), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight.Heading, { level: "h4", className: "text-sm font-medium", children: title }) }),
|
|
555
589
|
impactRows,
|
|
556
590
|
justificationContent
|
|
557
591
|
] });
|
|
558
592
|
}
|
|
559
|
-
return /* @__PURE__ */ (0,
|
|
560
|
-
/* @__PURE__ */ (0,
|
|
593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_sight.Card.Root, { className: styles.root(), children: [
|
|
594
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
561
595
|
import_sight.Card.Header,
|
|
562
596
|
{
|
|
563
597
|
className: `flex flex-row items-center justify-between ${needsAttention ? "bg-destructive/10 rounded-t-lg" : ""}`,
|
|
564
598
|
children: [
|
|
565
|
-
/* @__PURE__ */ (0,
|
|
566
|
-
/* @__PURE__ */ (0,
|
|
567
|
-
isEditing && /* @__PURE__ */ (0,
|
|
568
|
-
needsAttention && !isEditing && /* @__PURE__ */ (0,
|
|
599
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
600
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight.Heading, { level: "h4", className: "text-sm font-medium", children: cardTitle }),
|
|
601
|
+
isEditing && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight.Chip, { size: "sm", color: "primary", children: t.edit }),
|
|
602
|
+
needsAttention && !isEditing && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight.Chip, { size: "sm", color: "destructive", variant: "solid", children: t.required })
|
|
569
603
|
] }),
|
|
570
|
-
!readOnly && (!isEditing ? /* @__PURE__ */ (0,
|
|
604
|
+
!readOnly && (!isEditing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
571
605
|
"button",
|
|
572
606
|
{
|
|
573
607
|
type: "button",
|
|
574
608
|
onClick: handleStartEdit,
|
|
575
609
|
className: styles.editButton(),
|
|
576
610
|
"aria-label": t.edit,
|
|
577
|
-
children: /* @__PURE__ */ (0,
|
|
611
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.EditIcon, { className: "size-4" })
|
|
578
612
|
}
|
|
579
|
-
) : /* @__PURE__ */ (0,
|
|
580
|
-
/* @__PURE__ */ (0,
|
|
581
|
-
/* @__PURE__ */ (0,
|
|
613
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
614
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight.Button, { variant: "ghost", size: "sm", onClick: handleCancel, children: t.cancel }),
|
|
615
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight.Button, { size: "sm", onClick: handleSave, children: t.save })
|
|
582
616
|
] }))
|
|
583
617
|
]
|
|
584
618
|
}
|
|
585
619
|
),
|
|
586
|
-
/* @__PURE__ */ (0,
|
|
620
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_sight.Card.Body, { className: "space-y-3", children: [
|
|
587
621
|
impactRows,
|
|
588
622
|
justificationContent
|
|
589
623
|
] })
|
|
@@ -591,6 +625,7 @@ function ImpactCard({
|
|
|
591
625
|
}
|
|
592
626
|
// Annotate the CommonJS export names for ESM import in node:
|
|
593
627
|
0 && (module.exports = {
|
|
628
|
+
ImpactBadge,
|
|
594
629
|
ImpactCard,
|
|
595
630
|
assetScale,
|
|
596
631
|
getScale,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "../../chunk-
|
|
2
|
+
import "../../chunk-4DMM2HCE.mjs";
|
|
3
|
+
import {
|
|
4
|
+
ImpactBadge
|
|
5
|
+
} from "../../chunk-VQUPRJG7.mjs";
|
|
3
6
|
import {
|
|
4
7
|
ImpactCard
|
|
5
8
|
} from "../../chunk-C2GUKNBG.mjs";
|
|
@@ -14,6 +17,7 @@ import {
|
|
|
14
17
|
messages
|
|
15
18
|
} from "../../chunk-AXBL7YBB.mjs";
|
|
16
19
|
export {
|
|
20
|
+
ImpactBadge,
|
|
17
21
|
ImpactCard,
|
|
18
22
|
assetScale,
|
|
19
23
|
getScale,
|
package/dist/common/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { ComplianceBadges, ComplianceBadgesProps, DoraBadge, DoraBadgeProps, Nis2Badge, Nis2BadgeProps } from './compliance/compliance-badge.mjs';
|
|
2
2
|
export { ControlChip, ControlChipProps, MappedControls, MappedControlsProps } from './control/mapped-controls.mjs';
|
|
3
3
|
export { EditorCard, EditorCardProps } from './editor/editor-card.mjs';
|
|
4
|
+
export { ImpactBadge, ImpactBadgeProps } from './impact/impact-badge.mjs';
|
|
4
5
|
export { ImpactCard, ImpactCardProps, ImpactValue } from './impact/impact-card.mjs';
|
|
5
6
|
export { messages as impactMessages } from './impact/messages.mjs';
|
|
6
7
|
export { ImpactLevel, ImpactLevelConfig, ImpactScaleConfig, ImpactScalePreset, assetScale, getScale, impactLevels, processScale, riskScale } from './impact/scales.mjs';
|
package/dist/common/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { ComplianceBadges, ComplianceBadgesProps, DoraBadge, DoraBadgeProps, Nis2Badge, Nis2BadgeProps } from './compliance/compliance-badge.js';
|
|
2
2
|
export { ControlChip, ControlChipProps, MappedControls, MappedControlsProps } from './control/mapped-controls.js';
|
|
3
3
|
export { EditorCard, EditorCardProps } from './editor/editor-card.js';
|
|
4
|
+
export { ImpactBadge, ImpactBadgeProps } from './impact/impact-badge.js';
|
|
4
5
|
export { ImpactCard, ImpactCardProps, ImpactValue } from './impact/impact-card.js';
|
|
5
6
|
export { messages as impactMessages } from './impact/messages.js';
|
|
6
7
|
export { ImpactLevel, ImpactLevelConfig, ImpactScaleConfig, ImpactScalePreset, assetScale, getScale, impactLevels, processScale, riskScale } from './impact/scales.js';
|
package/dist/common/index.js
CHANGED
|
@@ -25,6 +25,7 @@ __export(common_exports, {
|
|
|
25
25
|
ControlChip: () => ControlChip,
|
|
26
26
|
DoraBadge: () => DoraBadge,
|
|
27
27
|
EditorCard: () => EditorCard,
|
|
28
|
+
ImpactBadge: () => ImpactBadge,
|
|
28
29
|
ImpactCard: () => ImpactCard,
|
|
29
30
|
MappedControls: () => MappedControls,
|
|
30
31
|
Nis2Badge: () => Nis2Badge,
|
|
@@ -361,12 +362,9 @@ function EditorCard({
|
|
|
361
362
|
);
|
|
362
363
|
}
|
|
363
364
|
|
|
364
|
-
// src/common/impact/impact-
|
|
365
|
+
// src/common/impact/impact-badge.tsx
|
|
365
366
|
var import_i18n7 = require("@kopexa/i18n");
|
|
366
|
-
var
|
|
367
|
-
var import_sight4 = require("@kopexa/sight");
|
|
368
|
-
var import_theme3 = require("@kopexa/theme");
|
|
369
|
-
var import_react2 = require("react");
|
|
367
|
+
var import_shared_utils = require("@kopexa/shared-utils");
|
|
370
368
|
|
|
371
369
|
// src/common/impact/messages.ts
|
|
372
370
|
var import_i18n6 = require("@kopexa/i18n");
|
|
@@ -653,8 +651,44 @@ function getScale(preset) {
|
|
|
653
651
|
}
|
|
654
652
|
}
|
|
655
653
|
|
|
656
|
-
// src/common/impact/impact-
|
|
654
|
+
// src/common/impact/impact-badge.tsx
|
|
657
655
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
656
|
+
function ImpactBadge({
|
|
657
|
+
level,
|
|
658
|
+
scale = "risk",
|
|
659
|
+
showValue = false,
|
|
660
|
+
className
|
|
661
|
+
}) {
|
|
662
|
+
var _a;
|
|
663
|
+
const intl = (0, import_i18n7.useSafeIntl)();
|
|
664
|
+
const normalizedLevel = level === null || level === void 0 ? 0 : (_a = Math.min(5, Math.max(0, Math.round(level)))) != null ? _a : 0;
|
|
665
|
+
const scaleConfig = typeof scale === "string" ? getScale(scale) : scale;
|
|
666
|
+
const config = scaleConfig[normalizedLevel];
|
|
667
|
+
const isUnrated = normalizedLevel === 0;
|
|
668
|
+
const label = intl.formatMessage(config.message);
|
|
669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
670
|
+
"span",
|
|
671
|
+
{
|
|
672
|
+
className: (0, import_shared_utils.cn)(
|
|
673
|
+
"inline-flex items-center gap-1.5 text-sm font-medium px-2 py-0.5 rounded",
|
|
674
|
+
isUnrated ? "text-muted-foreground bg-muted" : `${config.color} ${config.bgColor}`,
|
|
675
|
+
className
|
|
676
|
+
),
|
|
677
|
+
children: [
|
|
678
|
+
showValue && !isUnrated && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-xs font-mono opacity-70", children: normalizedLevel }),
|
|
679
|
+
label
|
|
680
|
+
]
|
|
681
|
+
}
|
|
682
|
+
);
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
// src/common/impact/impact-card.tsx
|
|
686
|
+
var import_i18n8 = require("@kopexa/i18n");
|
|
687
|
+
var import_icons3 = require("@kopexa/icons");
|
|
688
|
+
var import_sight4 = require("@kopexa/sight");
|
|
689
|
+
var import_theme3 = require("@kopexa/theme");
|
|
690
|
+
var import_react2 = require("react");
|
|
691
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
658
692
|
function ImpactItemRow({
|
|
659
693
|
label,
|
|
660
694
|
shortLabel,
|
|
@@ -668,28 +702,28 @@ function ImpactItemRow({
|
|
|
668
702
|
const isUnrated = value === 0;
|
|
669
703
|
const percentage = isUnrated ? 0 : value / 5 * 100;
|
|
670
704
|
const styles = (0, import_theme3.impactCard)({ unrated: isUnrated });
|
|
671
|
-
return /* @__PURE__ */ (0,
|
|
672
|
-
/* @__PURE__ */ (0,
|
|
673
|
-
/* @__PURE__ */ (0,
|
|
674
|
-
/* @__PURE__ */ (0,
|
|
675
|
-
/* @__PURE__ */ (0,
|
|
676
|
-
isEditing ? /* @__PURE__ */ (0,
|
|
705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: styles.row(), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: styles.rowContent(), children: [
|
|
706
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: styles.rowIcon(), children: shortLabel }),
|
|
707
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: styles.rowBody(), children: [
|
|
708
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: styles.rowHeader(), children: [
|
|
709
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: styles.rowLabel(), children: label }),
|
|
710
|
+
isEditing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
677
711
|
import_sight4.Select,
|
|
678
712
|
{
|
|
679
713
|
value: String(value),
|
|
680
714
|
onValueChange: (val) => onLevelChange(Number(val)),
|
|
681
715
|
size: "sm",
|
|
682
716
|
children: [
|
|
683
|
-
/* @__PURE__ */ (0,
|
|
684
|
-
/* @__PURE__ */ (0,
|
|
685
|
-
/* @__PURE__ */ (0,
|
|
717
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_sight4.Select.Trigger, { className: "w-36", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_sight4.Select.Value, {}) }),
|
|
718
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_sight4.Select.Content, { children: impactLevels.map((level) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_sight4.Select.Item, { value: String(level), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "flex items-center gap-2", children: [
|
|
719
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-xs text-muted-foreground w-3", children: level }),
|
|
686
720
|
formatLabel(level)
|
|
687
721
|
] }) }, level)) })
|
|
688
722
|
]
|
|
689
723
|
}
|
|
690
|
-
) : /* @__PURE__ */ (0,
|
|
691
|
-
!isUnrated && /* @__PURE__ */ (0,
|
|
692
|
-
/* @__PURE__ */ (0,
|
|
724
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: styles.rowValue(), children: [
|
|
725
|
+
!isUnrated && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: styles.rowValueNumber(), children: value }),
|
|
726
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
693
727
|
"span",
|
|
694
728
|
{
|
|
695
729
|
className: styles.rowValueBadge({
|
|
@@ -700,7 +734,7 @@ function ImpactItemRow({
|
|
|
700
734
|
)
|
|
701
735
|
] })
|
|
702
736
|
] }),
|
|
703
|
-
!isUnrated && !isEditing && /* @__PURE__ */ (0,
|
|
737
|
+
!isUnrated && !isEditing && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: styles.progressContainer(), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
704
738
|
"div",
|
|
705
739
|
{
|
|
706
740
|
className: styles.progressBar({ className: config.barColor }),
|
|
@@ -728,7 +762,7 @@ function ImpactCard({
|
|
|
728
762
|
needsAttention = false
|
|
729
763
|
}) {
|
|
730
764
|
var _a, _b;
|
|
731
|
-
const intl = (0,
|
|
765
|
+
const intl = (0, import_i18n8.useSafeIntl)();
|
|
732
766
|
const isInline = variant === "inline";
|
|
733
767
|
const [isEditing, setIsEditing] = (0, import_react2.useState)(false);
|
|
734
768
|
const [editValues, setEditValues] = (0, import_react2.useState)(
|
|
@@ -805,8 +839,8 @@ function ImpactCard({
|
|
|
805
839
|
const justificationHint = intl.formatMessage(messages4.justification_hint, {
|
|
806
840
|
level: highestLabel
|
|
807
841
|
});
|
|
808
|
-
const impactRows = /* @__PURE__ */ (0,
|
|
809
|
-
/* @__PURE__ */ (0,
|
|
842
|
+
const impactRows = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
843
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
810
844
|
ImpactItemRow,
|
|
811
845
|
{
|
|
812
846
|
label: t.confidentiality,
|
|
@@ -818,7 +852,7 @@ function ImpactCard({
|
|
|
818
852
|
onLevelChange: handleLevelChange("impactConfidentiality")
|
|
819
853
|
}
|
|
820
854
|
),
|
|
821
|
-
/* @__PURE__ */ (0,
|
|
855
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
822
856
|
ImpactItemRow,
|
|
823
857
|
{
|
|
824
858
|
label: t.integrity,
|
|
@@ -830,7 +864,7 @@ function ImpactCard({
|
|
|
830
864
|
onLevelChange: handleLevelChange("impactIntegrity")
|
|
831
865
|
}
|
|
832
866
|
),
|
|
833
|
-
/* @__PURE__ */ (0,
|
|
867
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
834
868
|
ImpactItemRow,
|
|
835
869
|
{
|
|
836
870
|
label: t.availability,
|
|
@@ -842,7 +876,7 @@ function ImpactCard({
|
|
|
842
876
|
onLevelChange: handleLevelChange("impactAvailability")
|
|
843
877
|
}
|
|
844
878
|
),
|
|
845
|
-
showAuthenticity && /* @__PURE__ */ (0,
|
|
879
|
+
showAuthenticity && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
846
880
|
ImpactItemRow,
|
|
847
881
|
{
|
|
848
882
|
label: t.authenticity,
|
|
@@ -855,19 +889,19 @@ function ImpactCard({
|
|
|
855
889
|
}
|
|
856
890
|
)
|
|
857
891
|
] });
|
|
858
|
-
const justificationContent = showJustification && /* @__PURE__ */ (0,
|
|
859
|
-
/* @__PURE__ */ (0,
|
|
892
|
+
const justificationContent = showJustification && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: styles.justificationSection(), children: [
|
|
893
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
860
894
|
"label",
|
|
861
895
|
{
|
|
862
896
|
htmlFor: "impact-justification",
|
|
863
897
|
className: styles.justificationLabel(),
|
|
864
898
|
children: [
|
|
865
899
|
t.justification,
|
|
866
|
-
highestImpact > 0 && /* @__PURE__ */ (0,
|
|
900
|
+
highestImpact > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: styles.justificationHint(), children: justificationHint })
|
|
867
901
|
]
|
|
868
902
|
}
|
|
869
903
|
),
|
|
870
|
-
effectiveIsEditing ? /* @__PURE__ */ (0,
|
|
904
|
+
effectiveIsEditing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
871
905
|
import_sight4.Textarea,
|
|
872
906
|
{
|
|
873
907
|
id: "impact-justification",
|
|
@@ -877,43 +911,43 @@ function ImpactCard({
|
|
|
877
911
|
rows: 3,
|
|
878
912
|
className: "text-sm"
|
|
879
913
|
}
|
|
880
|
-
) : currentImpact.impactJustification ? /* @__PURE__ */ (0,
|
|
914
|
+
) : currentImpact.impactJustification ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: styles.justificationText(), children: currentImpact.impactJustification }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: styles.justificationEmpty(), children: t.noJustification })
|
|
881
915
|
] });
|
|
882
916
|
if (isInline) {
|
|
883
|
-
return /* @__PURE__ */ (0,
|
|
884
|
-
title && /* @__PURE__ */ (0,
|
|
917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: styles.wrapper(), children: [
|
|
918
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: styles.inlineHeader(), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_sight4.Heading, { level: "h4", className: "text-sm font-medium", children: title }) }),
|
|
885
919
|
impactRows,
|
|
886
920
|
justificationContent
|
|
887
921
|
] });
|
|
888
922
|
}
|
|
889
|
-
return /* @__PURE__ */ (0,
|
|
890
|
-
/* @__PURE__ */ (0,
|
|
923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_sight4.Card.Root, { className: styles.root(), children: [
|
|
924
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
891
925
|
import_sight4.Card.Header,
|
|
892
926
|
{
|
|
893
927
|
className: `flex flex-row items-center justify-between ${needsAttention ? "bg-destructive/10 rounded-t-lg" : ""}`,
|
|
894
928
|
children: [
|
|
895
|
-
/* @__PURE__ */ (0,
|
|
896
|
-
/* @__PURE__ */ (0,
|
|
897
|
-
isEditing && /* @__PURE__ */ (0,
|
|
898
|
-
needsAttention && !isEditing && /* @__PURE__ */ (0,
|
|
929
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
930
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_sight4.Heading, { level: "h4", className: "text-sm font-medium", children: cardTitle }),
|
|
931
|
+
isEditing && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_sight4.Chip, { size: "sm", color: "primary", children: t.edit }),
|
|
932
|
+
needsAttention && !isEditing && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_sight4.Chip, { size: "sm", color: "destructive", variant: "solid", children: t.required })
|
|
899
933
|
] }),
|
|
900
|
-
!readOnly && (!isEditing ? /* @__PURE__ */ (0,
|
|
934
|
+
!readOnly && (!isEditing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
901
935
|
"button",
|
|
902
936
|
{
|
|
903
937
|
type: "button",
|
|
904
938
|
onClick: handleStartEdit,
|
|
905
939
|
className: styles.editButton(),
|
|
906
940
|
"aria-label": t.edit,
|
|
907
|
-
children: /* @__PURE__ */ (0,
|
|
941
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons3.EditIcon, { className: "size-4" })
|
|
908
942
|
}
|
|
909
|
-
) : /* @__PURE__ */ (0,
|
|
910
|
-
/* @__PURE__ */ (0,
|
|
911
|
-
/* @__PURE__ */ (0,
|
|
943
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
944
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_sight4.Button, { variant: "ghost", size: "sm", onClick: handleCancel, children: t.cancel }),
|
|
945
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_sight4.Button, { size: "sm", onClick: handleSave, children: t.save })
|
|
912
946
|
] }))
|
|
913
947
|
]
|
|
914
948
|
}
|
|
915
949
|
),
|
|
916
|
-
/* @__PURE__ */ (0,
|
|
950
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_sight4.Card.Body, { className: "space-y-3", children: [
|
|
917
951
|
impactRows,
|
|
918
952
|
justificationContent
|
|
919
953
|
] })
|
|
@@ -921,8 +955,8 @@ function ImpactCard({
|
|
|
921
955
|
}
|
|
922
956
|
|
|
923
957
|
// src/common/risk/messages.ts
|
|
924
|
-
var
|
|
925
|
-
var messages5 = (0,
|
|
958
|
+
var import_i18n9 = require("@kopexa/i18n");
|
|
959
|
+
var messages5 = (0, import_i18n9.defineMessages)({
|
|
926
960
|
level_unrated: {
|
|
927
961
|
id: "grc.risk.level.unrated",
|
|
928
962
|
defaultMessage: "Not rated"
|
|
@@ -962,7 +996,7 @@ var messages5 = (0, import_i18n8.defineMessages)({
|
|
|
962
996
|
});
|
|
963
997
|
|
|
964
998
|
// src/common/risk/risk-rating-display.tsx
|
|
965
|
-
var
|
|
999
|
+
var import_i18n10 = require("@kopexa/i18n");
|
|
966
1000
|
var import_sight5 = require("@kopexa/sight");
|
|
967
1001
|
var import_theme4 = require("@kopexa/theme");
|
|
968
1002
|
|
|
@@ -1017,20 +1051,20 @@ var riskLevelConfig = {
|
|
|
1017
1051
|
};
|
|
1018
1052
|
|
|
1019
1053
|
// src/common/risk/risk-rating-display.tsx
|
|
1020
|
-
var
|
|
1054
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1021
1055
|
function RiskRatingDisplay({
|
|
1022
1056
|
rating,
|
|
1023
1057
|
showBadge = true,
|
|
1024
1058
|
showLabel = true,
|
|
1025
1059
|
size = "md"
|
|
1026
1060
|
}) {
|
|
1027
|
-
const intl = (0,
|
|
1061
|
+
const intl = (0, import_i18n10.useSafeIntl)();
|
|
1028
1062
|
if (isRatingUnrated(rating)) {
|
|
1029
1063
|
const styles2 = (0, import_theme4.riskRating)({ size, level: "unrated" });
|
|
1030
1064
|
const levelLabel2 = intl.formatMessage(messages5.level_unrated);
|
|
1031
|
-
return /* @__PURE__ */ (0,
|
|
1032
|
-
showBadge && /* @__PURE__ */ (0,
|
|
1033
|
-
showLabel && /* @__PURE__ */ (0,
|
|
1065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_sight5.Tooltip, { content: intl.formatMessage(messages5.not_rated_hint), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: styles2.base(), children: [
|
|
1066
|
+
showBadge && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: styles2.badge(), children: "\u2014" }),
|
|
1067
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: styles2.label(), children: levelLabel2 })
|
|
1034
1068
|
] }) });
|
|
1035
1069
|
}
|
|
1036
1070
|
const ratedValue = rating;
|
|
@@ -1041,27 +1075,27 @@ function RiskRatingDisplay({
|
|
|
1041
1075
|
});
|
|
1042
1076
|
const levelLabelKey = `level_${level}`;
|
|
1043
1077
|
const levelLabel = intl.formatMessage(messages5[levelLabelKey]);
|
|
1044
|
-
return /* @__PURE__ */ (0,
|
|
1078
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1045
1079
|
import_sight5.Tooltip,
|
|
1046
1080
|
{
|
|
1047
|
-
content: /* @__PURE__ */ (0,
|
|
1048
|
-
/* @__PURE__ */ (0,
|
|
1081
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "text-xs space-y-1", children: [
|
|
1082
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
1049
1083
|
intl.formatMessage(messages5.likelihood),
|
|
1050
1084
|
": ",
|
|
1051
1085
|
ratedValue.likelihood,
|
|
1052
1086
|
"/5"
|
|
1053
1087
|
] }),
|
|
1054
|
-
/* @__PURE__ */ (0,
|
|
1088
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
1055
1089
|
intl.formatMessage(messages5.consequence),
|
|
1056
1090
|
": ",
|
|
1057
1091
|
ratedValue.consequence,
|
|
1058
1092
|
"/5"
|
|
1059
1093
|
] }),
|
|
1060
|
-
ratedValue.comment && /* @__PURE__ */ (0,
|
|
1094
|
+
ratedValue.comment && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "text-muted-foreground", children: ratedValue.comment })
|
|
1061
1095
|
] }),
|
|
1062
|
-
children: /* @__PURE__ */ (0,
|
|
1063
|
-
showBadge && /* @__PURE__ */ (0,
|
|
1064
|
-
showLabel && /* @__PURE__ */ (0,
|
|
1096
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: styles.base(), children: [
|
|
1097
|
+
showBadge && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: styles.badge(), children: ratedValue.rating }),
|
|
1098
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: styles.label(), children: levelLabel })
|
|
1065
1099
|
] })
|
|
1066
1100
|
}
|
|
1067
1101
|
);
|
|
@@ -1072,6 +1106,7 @@ function RiskRatingDisplay({
|
|
|
1072
1106
|
ControlChip,
|
|
1073
1107
|
DoraBadge,
|
|
1074
1108
|
EditorCard,
|
|
1109
|
+
ImpactBadge,
|
|
1075
1110
|
ImpactCard,
|
|
1076
1111
|
MappedControls,
|
|
1077
1112
|
Nis2Badge,
|