@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.
- package/dist/chunk-5TBN3JQA.mjs +66 -0
- package/dist/chunk-DC44K745.mjs +46 -0
- package/dist/chunk-HI7F2CF4.mjs +1 -0
- package/dist/chunk-HJUSN7FD.mjs +1 -0
- package/dist/chunk-QDYL5ABK.mjs +118 -0
- package/dist/chunk-QS5S6V26.mjs +22 -0
- package/dist/chunk-VFX3DASQ.mjs +57 -0
- package/dist/common/control/index.d.mts +3 -0
- package/dist/common/control/index.d.ts +3 -0
- package/dist/common/control/index.js +160 -0
- package/dist/common/control/index.mjs +11 -0
- package/dist/common/control/mapped-controls.d.mts +33 -0
- package/dist/common/control/mapped-controls.d.ts +33 -0
- package/dist/common/control/mapped-controls.js +159 -0
- package/dist/common/control/mapped-controls.mjs +11 -0
- package/dist/common/control/messages.d.mts +16 -0
- package/dist/common/control/messages.d.ts +16 -0
- package/dist/common/control/messages.js +45 -0
- package/dist/common/control/messages.mjs +7 -0
- package/dist/common/index.d.mts +5 -0
- package/dist/common/index.d.ts +5 -0
- package/dist/common/index.js +364 -75
- package/dist/common/index.mjs +26 -1
- package/dist/common/risk/index.d.mts +4 -0
- package/dist/common/risk/index.d.ts +4 -0
- package/dist/common/risk/index.js +185 -0
- package/dist/common/risk/index.mjs +20 -0
- package/dist/common/risk/messages.d.mts +40 -0
- package/dist/common/risk/messages.d.ts +40 -0
- package/dist/common/risk/messages.js +69 -0
- package/dist/common/risk/messages.mjs +7 -0
- package/dist/common/risk/risk-rating-display.d.mts +21 -0
- package/dist/common/risk/risk-rating-display.d.ts +21 -0
- package/dist/common/risk/risk-rating-display.js +139 -0
- package/dist/common/risk/risk-rating-display.mjs +10 -0
- package/dist/common/risk/types.d.mts +37 -0
- package/dist/common/risk/types.d.ts +37 -0
- package/dist/common/risk/types.js +82 -0
- package/dist/common/risk/types.mjs +11 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +364 -75
- package/dist/index.mjs +26 -1
- package/package.json +8 -7
- package/src/common/control/index.ts +6 -0
- package/src/common/control/mapped-controls.tsx +192 -0
- package/src/common/control/messages.ts +16 -0
- package/src/common/index.ts +2 -0
- package/src/common/risk/index.ts +12 -0
- package/src/common/risk/messages.ts +40 -0
- package/src/common/risk/risk-rating-display.tsx +86 -0
- package/src/common/risk/types.ts +91 -0
- /package/dist/{chunk-BFZPRJQT.mjs → chunk-CND77GVC.mjs} +0 -0
|
@@ -0,0 +1,159 @@
|
|
|
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/control/mapped-controls.tsx
|
|
23
|
+
var mapped_controls_exports = {};
|
|
24
|
+
__export(mapped_controls_exports, {
|
|
25
|
+
ControlChip: () => ControlChip,
|
|
26
|
+
MappedControls: () => MappedControls
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(mapped_controls_exports);
|
|
29
|
+
var import_i18n2 = require("@kopexa/i18n");
|
|
30
|
+
var import_krn = require("@kopexa/krn");
|
|
31
|
+
var import_sight = require("@kopexa/sight");
|
|
32
|
+
var import_theme = require("@kopexa/theme");
|
|
33
|
+
|
|
34
|
+
// src/common/control/messages.ts
|
|
35
|
+
var import_i18n = require("@kopexa/i18n");
|
|
36
|
+
var messages = (0, import_i18n.defineMessages)({
|
|
37
|
+
more_controls: {
|
|
38
|
+
id: "grc.control.mapped.more",
|
|
39
|
+
defaultMessage: "+{count} more"
|
|
40
|
+
},
|
|
41
|
+
view_all: {
|
|
42
|
+
id: "grc.control.mapped.view_all",
|
|
43
|
+
defaultMessage: "View all {count} controls"
|
|
44
|
+
},
|
|
45
|
+
no_controls: {
|
|
46
|
+
id: "grc.control.mapped.no_controls",
|
|
47
|
+
defaultMessage: "No mapped controls"
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// src/common/control/mapped-controls.tsx
|
|
52
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
53
|
+
function formatControlKrn(krnString) {
|
|
54
|
+
const parsed = import_krn.KRN.tryParse(krnString);
|
|
55
|
+
if (!parsed) {
|
|
56
|
+
return { framework: null, controlId: krnString, full: krnString };
|
|
57
|
+
}
|
|
58
|
+
const framework = parsed.tryResourceId("frameworks");
|
|
59
|
+
const control = parsed.tryResourceId("controls");
|
|
60
|
+
if (framework && control) {
|
|
61
|
+
return {
|
|
62
|
+
framework,
|
|
63
|
+
controlId: control,
|
|
64
|
+
full: `${framework}:${control}`
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const basename = parsed.basename();
|
|
68
|
+
return {
|
|
69
|
+
framework: null,
|
|
70
|
+
controlId: basename || krnString,
|
|
71
|
+
full: basename || krnString
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function ControlChip({
|
|
75
|
+
krn,
|
|
76
|
+
size = "md",
|
|
77
|
+
interactive = false,
|
|
78
|
+
onClick,
|
|
79
|
+
className
|
|
80
|
+
}) {
|
|
81
|
+
const styles = (0, import_theme.relatedControlChip)({ size, interactive });
|
|
82
|
+
const { controlId, full } = formatControlKrn(krn);
|
|
83
|
+
const displayId = controlId.toUpperCase();
|
|
84
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: styles.chipId(), children: displayId });
|
|
85
|
+
const chip = interactive && onClick ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
86
|
+
"button",
|
|
87
|
+
{
|
|
88
|
+
type: "button",
|
|
89
|
+
className: styles.chip({ className }),
|
|
90
|
+
onClick,
|
|
91
|
+
children: content
|
|
92
|
+
}
|
|
93
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: styles.chip({ className }), children: content });
|
|
94
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Tooltip, { content: full, children: chip });
|
|
95
|
+
}
|
|
96
|
+
function MappedControls({
|
|
97
|
+
controls,
|
|
98
|
+
maxVisible = 2,
|
|
99
|
+
size = "md",
|
|
100
|
+
interactive = false,
|
|
101
|
+
onControlClick,
|
|
102
|
+
showEmpty = false,
|
|
103
|
+
className,
|
|
104
|
+
...rest
|
|
105
|
+
}) {
|
|
106
|
+
const intl = (0, import_i18n2.useSafeIntl)();
|
|
107
|
+
const styles = (0, import_theme.relatedControlChip)({ size, interactive });
|
|
108
|
+
if (controls.length === 0) {
|
|
109
|
+
if (!showEmpty) return null;
|
|
110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-xs text-muted-foreground", children: intl.formatMessage(messages.no_controls) });
|
|
111
|
+
}
|
|
112
|
+
const visibleControls = controls.slice(0, maxVisible);
|
|
113
|
+
const hiddenCount = controls.length - maxVisible;
|
|
114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: styles.root({ className }), ...rest, children: [
|
|
115
|
+
visibleControls.map((krn) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
116
|
+
ControlChip,
|
|
117
|
+
{
|
|
118
|
+
krn,
|
|
119
|
+
size,
|
|
120
|
+
interactive,
|
|
121
|
+
onClick: onControlClick ? () => onControlClick(krn) : void 0
|
|
122
|
+
},
|
|
123
|
+
krn
|
|
124
|
+
)),
|
|
125
|
+
hiddenCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_sight.Popover.Root, { children: [
|
|
126
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Popover.Trigger, { className: styles.overflow(), children: intl.formatMessage(messages.more_controls, {
|
|
127
|
+
count: hiddenCount
|
|
128
|
+
}) }),
|
|
129
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
130
|
+
import_sight.Popover.Content,
|
|
131
|
+
{
|
|
132
|
+
align: "start",
|
|
133
|
+
className: "p-2 max-w-xs",
|
|
134
|
+
showArrow: false,
|
|
135
|
+
children: [
|
|
136
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-xs font-medium text-muted-foreground mb-2", children: intl.formatMessage(messages.view_all, {
|
|
137
|
+
count: controls.length
|
|
138
|
+
}) }),
|
|
139
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-wrap gap-1", children: controls.map((krn) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
140
|
+
ControlChip,
|
|
141
|
+
{
|
|
142
|
+
krn,
|
|
143
|
+
size,
|
|
144
|
+
interactive,
|
|
145
|
+
onClick: onControlClick ? () => onControlClick(krn) : void 0
|
|
146
|
+
},
|
|
147
|
+
krn
|
|
148
|
+
)) })
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
] })
|
|
153
|
+
] });
|
|
154
|
+
}
|
|
155
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
156
|
+
0 && (module.exports = {
|
|
157
|
+
ControlChip,
|
|
158
|
+
MappedControls
|
|
159
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
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/control/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
|
+
more_controls: {
|
|
30
|
+
id: "grc.control.mapped.more",
|
|
31
|
+
defaultMessage: "+{count} more"
|
|
32
|
+
},
|
|
33
|
+
view_all: {
|
|
34
|
+
id: "grc.control.mapped.view_all",
|
|
35
|
+
defaultMessage: "View all {count} controls"
|
|
36
|
+
},
|
|
37
|
+
no_controls: {
|
|
38
|
+
id: "grc.control.mapped.no_controls",
|
|
39
|
+
defaultMessage: "No mapped controls"
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
messages
|
|
45
|
+
});
|
package/dist/common/index.d.mts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export { ComplianceBadges, ComplianceBadgesProps, DoraBadge, DoraBadgeProps, Nis2Badge, Nis2BadgeProps } from './compliance/compliance-badge.mjs';
|
|
2
|
+
export { ControlChip, ControlChipProps, MappedControls, MappedControlsProps } from './control/mapped-controls.mjs';
|
|
2
3
|
export { ImpactCard, ImpactCardProps, ImpactValue } from './impact/impact-card.mjs';
|
|
3
4
|
export { messages as impactMessages } from './impact/messages.mjs';
|
|
4
5
|
export { ImpactLevel, ImpactLevelConfig, ImpactScaleConfig, ImpactScalePreset, assetScale, getScale, impactLevels, processScale, riskScale } from './impact/scales.mjs';
|
|
6
|
+
export { messages as riskMessages } from './risk/messages.mjs';
|
|
7
|
+
export { RiskRatingDisplay, RiskRatingDisplayProps } from './risk/risk-rating-display.mjs';
|
|
8
|
+
export { RiskLevel, RiskRating, getRiskLevelFromRating, isRatingUnrated, riskLevelConfig } from './risk/types.mjs';
|
|
5
9
|
import 'react/jsx-runtime';
|
|
10
|
+
import 'react';
|
|
6
11
|
import 'react-intl';
|
package/dist/common/index.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export { ComplianceBadges, ComplianceBadgesProps, DoraBadge, DoraBadgeProps, Nis2Badge, Nis2BadgeProps } from './compliance/compliance-badge.js';
|
|
2
|
+
export { ControlChip, ControlChipProps, MappedControls, MappedControlsProps } from './control/mapped-controls.js';
|
|
2
3
|
export { ImpactCard, ImpactCardProps, ImpactValue } from './impact/impact-card.js';
|
|
3
4
|
export { messages as impactMessages } from './impact/messages.js';
|
|
4
5
|
export { ImpactLevel, ImpactLevelConfig, ImpactScaleConfig, ImpactScalePreset, assetScale, getScale, impactLevels, processScale, riskScale } from './impact/scales.js';
|
|
6
|
+
export { messages as riskMessages } from './risk/messages.js';
|
|
7
|
+
export { RiskRatingDisplay, RiskRatingDisplayProps } from './risk/risk-rating-display.js';
|
|
8
|
+
export { RiskLevel, RiskRating, getRiskLevelFromRating, isRatingUnrated, riskLevelConfig } from './risk/types.js';
|
|
5
9
|
import 'react/jsx-runtime';
|
|
10
|
+
import 'react';
|
|
6
11
|
import 'react-intl';
|