@kopexa/extension-controlref 1.0.0 → 2.0.0

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 (126) hide show
  1. package/dist/chunk-4C72VBLP.mjs +52 -0
  2. package/dist/chunk-A7FWOQDN.mjs +210 -0
  3. package/dist/chunk-AQTNFDGA.mjs +57 -0
  4. package/dist/chunk-D53W4HWR.mjs +245 -0
  5. package/dist/chunk-FTEE5U3H.mjs +37 -0
  6. package/dist/chunk-GYDJVHHG.mjs +250 -0
  7. package/dist/chunk-IMHLTRZJ.mjs +29 -0
  8. package/dist/chunk-JM66CQVD.mjs +10 -0
  9. package/dist/chunk-LMKP3DDN.mjs +189 -0
  10. package/dist/chunk-RTBFRPB3.mjs +186 -0
  11. package/dist/chunk-TEDXYIGO.mjs +38 -0
  12. package/dist/chunk-WIS7ZNTO.mjs +4 -0
  13. package/dist/chunk-X46EFFCE.mjs +148 -0
  14. package/dist/chunk-XHD2KFKQ.mjs +16 -0
  15. package/dist/chunk-ZRKYAFRY.mjs +46 -0
  16. package/dist/chunk-ZUR6XKMG.mjs +21 -0
  17. package/dist/components/control-block-view.d.mts +6 -0
  18. package/dist/components/control-block-view.d.ts +6 -0
  19. package/dist/components/control-block-view.js +789 -0
  20. package/dist/components/control-block-view.mjs +11 -0
  21. package/dist/components/control-implementation-view.d.mts +6 -0
  22. package/dist/components/control-implementation-view.d.ts +6 -0
  23. package/dist/components/control-implementation-view.js +52 -0
  24. package/dist/components/control-implementation-view.mjs +7 -0
  25. package/dist/components/control-picker.d.mts +25 -0
  26. package/dist/components/control-picker.d.ts +25 -0
  27. package/dist/components/control-picker.js +522 -0
  28. package/dist/components/control-picker.mjs +10 -0
  29. package/dist/components/control-view.js +677 -122
  30. package/dist/components/control-view.mjs +5 -5
  31. package/dist/components/use-control.d.mts +20 -0
  32. package/dist/components/use-control.d.ts +20 -0
  33. package/dist/components/use-control.js +127 -0
  34. package/dist/components/use-control.mjs +9 -0
  35. package/dist/control-block.d.mts +35 -0
  36. package/dist/control-block.d.ts +35 -0
  37. package/dist/control-block.js +1012 -0
  38. package/dist/control-block.mjs +17 -0
  39. package/dist/control-implementation.d.mts +7 -0
  40. package/dist/control-implementation.d.ts +7 -0
  41. package/dist/control-implementation.js +92 -0
  42. package/dist/control-implementation.mjs +9 -0
  43. package/dist/control.d.mts +31 -1
  44. package/dist/control.d.ts +31 -1
  45. package/dist/control.js +819 -136
  46. package/dist/control.mjs +7 -6
  47. package/dist/defaults.d.mts +3 -9
  48. package/dist/defaults.d.ts +3 -9
  49. package/dist/defaults.js +3 -20
  50. package/dist/defaults.mjs +3 -6
  51. package/dist/index.d.mts +10 -10
  52. package/dist/index.d.ts +10 -10
  53. package/dist/index.js +1229 -569
  54. package/dist/index.mjs +58 -21
  55. package/dist/messages/index.d.mts +135 -0
  56. package/dist/messages/index.d.ts +135 -0
  57. package/dist/messages/index.js +137 -2
  58. package/dist/messages/index.mjs +1 -2
  59. package/dist/role.d.mts +17 -0
  60. package/dist/role.d.ts +17 -0
  61. package/dist/role.js +5 -0
  62. package/dist/role.mjs +2 -0
  63. package/dist/types.d.mts +23 -16
  64. package/dist/types.d.ts +23 -16
  65. package/dist/utils/create-control-block.d.mts +7 -0
  66. package/dist/utils/create-control-block.d.ts +7 -0
  67. package/dist/utils/create-control-block.js +85 -0
  68. package/dist/utils/create-control-block.mjs +10 -0
  69. package/dist/utils/create-control-implementation.d.mts +8 -0
  70. package/dist/utils/create-control-implementation.d.ts +8 -0
  71. package/dist/utils/create-control-implementation.js +39 -0
  72. package/dist/utils/create-control-implementation.mjs +7 -0
  73. package/dist/utils/getControlNodeTypes.d.mts +5 -0
  74. package/dist/utils/getControlNodeTypes.d.ts +5 -0
  75. package/dist/utils/getControlNodeTypes.js +44 -0
  76. package/dist/utils/getControlNodeTypes.mjs +7 -0
  77. package/dist/utils/index.d.mts +7 -2
  78. package/dist/utils/index.d.ts +7 -2
  79. package/dist/utils/index.js +35 -3
  80. package/dist/utils/index.mjs +7 -4
  81. package/dist/utils/status-indicator.d.mts +18 -0
  82. package/dist/utils/status-indicator.d.ts +18 -0
  83. package/dist/utils/status-indicator.js +80 -0
  84. package/dist/utils/status-indicator.mjs +7 -0
  85. package/package.json +9 -9
  86. package/dist/card-variant.d.mts +0 -12
  87. package/dist/card-variant.d.ts +0 -12
  88. package/dist/card-variant.js +0 -66
  89. package/dist/card-variant.mjs +0 -8
  90. package/dist/chunk-AC4KL3WX.mjs +0 -29
  91. package/dist/chunk-AZ5M5MVC.mjs +0 -36
  92. package/dist/chunk-DTFR234X.mjs +0 -244
  93. package/dist/chunk-EDD7DYLE.mjs +0 -29
  94. package/dist/chunk-GC5EBQ7G.mjs +0 -10
  95. package/dist/chunk-H2ECPGOG.mjs +0 -81
  96. package/dist/chunk-KLX7Q3HL.mjs +0 -109
  97. package/dist/chunk-LKRTUIEV.mjs +0 -46
  98. package/dist/chunk-NAJ6IC4Y.mjs +0 -43
  99. package/dist/chunk-QI3ZPZTR.mjs +0 -26
  100. package/dist/chunk-SNRVOTF5.mjs +0 -8
  101. package/dist/chunk-VP5POY44.mjs +0 -57
  102. package/dist/chunk-WIR5FCIC.mjs +0 -110
  103. package/dist/control-ref-view.d.mts +0 -6
  104. package/dist/control-ref-view.d.ts +0 -6
  105. package/dist/control-ref-view.js +0 -615
  106. package/dist/control-ref-view.mjs +0 -15
  107. package/dist/control-ref.d.mts +0 -28
  108. package/dist/control-ref.d.ts +0 -28
  109. package/dist/control-ref.js +0 -687
  110. package/dist/control-ref.mjs +0 -16
  111. package/dist/i18n.d.mts +0 -4
  112. package/dist/i18n.d.ts +0 -4
  113. package/dist/i18n.js +0 -128
  114. package/dist/i18n.mjs +0 -10
  115. package/dist/lang/de.d.mts +0 -24
  116. package/dist/lang/de.d.ts +0 -24
  117. package/dist/lang/de.js +0 -25
  118. package/dist/lang/de.mjs +0 -8
  119. package/dist/lang/en.d.mts +0 -24
  120. package/dist/lang/en.d.ts +0 -24
  121. package/dist/lang/en.js +0 -25
  122. package/dist/lang/en.mjs +0 -8
  123. package/dist/settings-dialog.d.mts +0 -19
  124. package/dist/settings-dialog.d.ts +0 -19
  125. package/dist/settings-dialog.js +0 -371
  126. package/dist/settings-dialog.mjs +0 -9
@@ -0,0 +1,52 @@
1
+ "use client";
2
+ import {
3
+ getIndicatorProps
4
+ } from "./chunk-AQTNFDGA.mjs";
5
+
6
+ // src/components/use-control.ts
7
+ import { useEffect, useRef, useState } from "react";
8
+ function useControl({ attrs, resolver, editor }) {
9
+ var _a;
10
+ const isEdit = !!editor.isEditable;
11
+ const interactive = !!editor.isEditable && !!resolver;
12
+ const [isMissing, setIsMissing] = useState(false);
13
+ const [isOutdated, setIsOutdated] = useState(false);
14
+ const lastCheckedRef = useRef(0);
15
+ const mapped = !!attrs.id;
16
+ const ind = getIndicatorProps(attrs.status, {
17
+ mapped,
18
+ enable: !!((_a = attrs == null ? void 0 : attrs.options) == null ? void 0 : _a.showStatus)
19
+ });
20
+ useEffect(() => {
21
+ if (!isEdit || !(resolver == null ? void 0 : resolver.getControl) || !mapped || !attrs.id) return;
22
+ let cancelled = false;
23
+ const now = Date.now();
24
+ if (now - lastCheckedRef.current < 1e4) return;
25
+ (async () => {
26
+ try {
27
+ if (!attrs.id) return;
28
+ lastCheckedRef.current = now;
29
+ const latest = await resolver.getControl(attrs.id);
30
+ if (cancelled) return;
31
+ if (!latest) {
32
+ setIsMissing(true);
33
+ setIsOutdated(false);
34
+ return;
35
+ }
36
+ setIsMissing(false);
37
+ const localUpdated = attrs.updatedAt ? new Date(attrs.updatedAt).getTime() : 0;
38
+ const remoteUpdated = latest.updatedAt ? new Date(latest.updatedAt).getTime() : 0;
39
+ setIsOutdated(remoteUpdated > localUpdated);
40
+ } catch {
41
+ }
42
+ })();
43
+ return () => {
44
+ cancelled = true;
45
+ };
46
+ }, [isEdit, resolver, mapped, attrs.id, attrs.updatedAt]);
47
+ return { isEdit, interactive, ind, mapped, isMissing, isOutdated };
48
+ }
49
+
50
+ export {
51
+ useControl
52
+ };
@@ -0,0 +1,210 @@
1
+ "use client";
2
+ import {
3
+ getIndicatorProps
4
+ } from "./chunk-AQTNFDGA.mjs";
5
+ import {
6
+ messages
7
+ } from "./chunk-D53W4HWR.mjs";
8
+
9
+ // src/components/control-picker.tsx
10
+ import { Autocomplete, Button, Chip, Label, Spinner } from "@kopexa/sight";
11
+ import { useEffect, useId, useMemo, useState } from "react";
12
+ import { useIntl } from "react-intl";
13
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
14
+ function ControlPicker({
15
+ resolver,
16
+ value,
17
+ onChange,
18
+ debounceMs = 300,
19
+ timeoutMs = 5e3,
20
+ initialQuery = "",
21
+ showItemStatus = true
22
+ }) {
23
+ const intl = useIntl();
24
+ const searchId = useId();
25
+ const [search, setSearch] = useState(initialQuery);
26
+ const [debouncedSearch, setDebouncedSearch] = useState(search);
27
+ const [loading, setLoading] = useState(false);
28
+ const [error, setError] = useState(null);
29
+ const [results, setResults] = useState([]);
30
+ useEffect(() => {
31
+ const t = setTimeout(() => setDebouncedSearch(search), debounceMs);
32
+ return () => clearTimeout(t);
33
+ }, [search, debounceMs]);
34
+ useEffect(() => {
35
+ if (!(resolver == null ? void 0 : resolver.getControls)) return;
36
+ let ignore = false;
37
+ (async () => {
38
+ setLoading(true);
39
+ setError(null);
40
+ try {
41
+ const p = resolver.getControls(debouncedSearch);
42
+ const data = await Promise.race([
43
+ p,
44
+ new Promise(
45
+ (_, rej) => setTimeout(
46
+ () => rej(new Error(intl.formatMessage(messages.error_timeout))),
47
+ timeoutMs
48
+ )
49
+ )
50
+ ]);
51
+ if (!ignore) setResults(data);
52
+ } catch (e) {
53
+ if (!ignore) {
54
+ setError(
55
+ e instanceof Error ? e.message : intl.formatMessage(messages.error_loading)
56
+ );
57
+ setResults([]);
58
+ }
59
+ } finally {
60
+ if (!ignore) setLoading(false);
61
+ }
62
+ })();
63
+ return () => {
64
+ ignore = true;
65
+ };
66
+ }, [debouncedSearch, resolver, timeoutMs, intl]);
67
+ const statusNode = useMemo(() => {
68
+ if (loading)
69
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
70
+ /* @__PURE__ */ jsx(Spinner, { size: "sm" }),
71
+ /* @__PURE__ */ jsx("span", { children: intl.formatMessage(messages.searching) })
72
+ ] });
73
+ if (error) return /* @__PURE__ */ jsx("span", { className: "text-destructive text-sm", children: error });
74
+ if (results.length === 0 && debouncedSearch)
75
+ return /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages.no_results, { query: debouncedSearch }) });
76
+ if (results.length > 0)
77
+ return /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages.results_count, {
78
+ count: results.length
79
+ }) });
80
+ return /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages.search_hint) });
81
+ }, [loading, error, results.length, debouncedSearch, intl]);
82
+ const itemToStringValue = (item) => {
83
+ var _a, _b;
84
+ return (_b = (_a = item == null ? void 0 : item.title) != null ? _a : item == null ? void 0 : item.id) != null ? _b : "";
85
+ };
86
+ const highlight = (text) => {
87
+ const t = (text != null ? text : "").toString();
88
+ const q = debouncedSearch.trim();
89
+ if (!q) return t;
90
+ const i = t.toLowerCase().indexOf(q.toLowerCase());
91
+ if (i === -1) return t;
92
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
93
+ t.slice(0, i),
94
+ /* @__PURE__ */ jsx("mark", { className: "bg-primary/15 rounded px-0.5", children: t.slice(i, i + q.length) }),
95
+ t.slice(i + q.length)
96
+ ] });
97
+ };
98
+ const indicator = getIndicatorProps(value == null ? void 0 : value.status, {
99
+ mapped: !!(value == null ? void 0 : value.id),
100
+ enable: showItemStatus
101
+ });
102
+ const selInd = value ? indicator : {
103
+ indicator: false,
104
+ indicatorColor: "default"
105
+ };
106
+ const handleClear = () => {
107
+ onChange(null);
108
+ };
109
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
110
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
111
+ /* @__PURE__ */ jsx(Label, { htmlFor: searchId, children: intl.formatMessage(messages.controls) }),
112
+ /* @__PURE__ */ jsxs(
113
+ Autocomplete,
114
+ {
115
+ items: results,
116
+ value: search,
117
+ onValueChange: setSearch,
118
+ filter: null,
119
+ itemToStringValue,
120
+ children: [
121
+ /* @__PURE__ */ jsxs(Autocomplete.Control, { children: [
122
+ /* @__PURE__ */ jsx(
123
+ Autocomplete.Input,
124
+ {
125
+ id: searchId,
126
+ placeholder: intl.formatMessage(messages.search_placeholder)
127
+ }
128
+ ),
129
+ search && /* @__PURE__ */ jsx(Autocomplete.Clear, {})
130
+ ] }),
131
+ /* @__PURE__ */ jsxs(Autocomplete.Content, { children: [
132
+ /* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 bg-background border-b px-2 py-1", children: /* @__PURE__ */ jsx(Autocomplete.Status, { children: statusNode }) }),
133
+ /* @__PURE__ */ jsx(Autocomplete.List, { children: (c) => {
134
+ var _a, _b, _c;
135
+ const id = (_a = c.id) != null ? _a : crypto.randomUUID();
136
+ const active = (value == null ? void 0 : value.id) && c.id === value.id;
137
+ const ind = getIndicatorProps(c.status, {
138
+ mapped: !!c.id,
139
+ enable: showItemStatus
140
+ });
141
+ return /* @__PURE__ */ jsx(
142
+ Autocomplete.Item,
143
+ {
144
+ value: c,
145
+ className: "rounded-lg data-[active=true]:bg-muted",
146
+ "data-active": active ? "true" : void 0,
147
+ "aria-selected": active ? "true" : "false",
148
+ onClick: () => onChange(c),
149
+ children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5 truncate", children: [
150
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
151
+ /* @__PURE__ */ jsx("div", { className: "font-medium truncate", children: highlight((_b = c.title) != null ? _b : c.id) }),
152
+ /* @__PURE__ */ jsxs("div", { className: "text-sm text-muted-foreground truncate", children: [
153
+ highlight((_c = c.id) != null ? _c : ""),
154
+ c.updatedAt ? ` \u2022 ${intl.formatMessage(messages.updated_at, {
155
+ date: intl.formatDate(new Date(c.updatedAt), {
156
+ year: "numeric",
157
+ month: "short",
158
+ day: "2-digit",
159
+ hour: "2-digit",
160
+ minute: "2-digit"
161
+ })
162
+ })}` : ""
163
+ ] })
164
+ ] }),
165
+ showItemStatus && c.status && /* @__PURE__ */ jsx(
166
+ Chip,
167
+ {
168
+ size: "sm",
169
+ variant: "ghost",
170
+ indicator: ind.indicator,
171
+ indicatorColor: ind.indicatorColor,
172
+ indicatorVariant: ind.indicatorVariant,
173
+ status: c.status,
174
+ children: c.status
175
+ }
176
+ )
177
+ ] })
178
+ },
179
+ id
180
+ );
181
+ } })
182
+ ] })
183
+ ]
184
+ }
185
+ )
186
+ ] }),
187
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 border rounded-md px-3 py-2", children: [
188
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 min-w-0", children: [
189
+ /* @__PURE__ */ jsx(Label, { children: intl.formatMessage(messages.selected) }),
190
+ value ? /* @__PURE__ */ jsx(
191
+ Chip,
192
+ {
193
+ size: "sm",
194
+ variant: "bordered",
195
+ indicator: selInd.indicator,
196
+ indicatorColor: selInd.indicatorColor,
197
+ indicatorVariant: selInd.indicatorVariant,
198
+ status: showItemStatus ? value == null ? void 0 : value.status : void 0,
199
+ children: value.title
200
+ }
201
+ ) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages.no_control_selected) })
202
+ ] }),
203
+ /* @__PURE__ */ jsx("div", { className: "flex gap-1", children: /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: handleClear, disabled: !value, children: intl.formatMessage(messages.clear) }) })
204
+ ] })
205
+ ] });
206
+ }
207
+
208
+ export {
209
+ ControlPicker
210
+ };
@@ -0,0 +1,57 @@
1
+ "use client";
2
+
3
+ // src/utils/status-indicator.ts
4
+ function norm(status) {
5
+ return (status != null ? status : "").trim().replace(/[\s-]+/g, "_").toUpperCase();
6
+ }
7
+ function colorForStatusKey(key) {
8
+ switch (key == null ? void 0 : key.toUpperCase()) {
9
+ case "FULFILLED_MANUAL":
10
+ case "FULFILLED_AUTO":
11
+ case "IMPLEMENTED":
12
+ case "APPROVED":
13
+ case "PASSED":
14
+ return "success";
15
+ case "IN_PROGRESS":
16
+ case "NEEDS_APPROVAL":
17
+ case "CHANGES_REQUESTED":
18
+ case "PENDING":
19
+ case "PARTIAL":
20
+ return "warning";
21
+ case "FAILED":
22
+ case "REJECTED":
23
+ return "destructive";
24
+ case "OUT_OF_SCOPE":
25
+ case "PREPARING":
26
+ return "secondary";
27
+ default:
28
+ return "default";
29
+ }
30
+ }
31
+ function getIndicatorProps(status, opts) {
32
+ var _a, _b;
33
+ const mapped = (_a = opts == null ? void 0 : opts.mapped) != null ? _a : true;
34
+ const enable = (_b = opts == null ? void 0 : opts.enable) != null ? _b : true;
35
+ if (!enable) {
36
+ return { indicator: false, indicatorColor: "default" };
37
+ }
38
+ if (!mapped) {
39
+ return {
40
+ indicator: true,
41
+ indicatorColor: "destructive",
42
+ indicatorVariant: "pulse"
43
+ };
44
+ }
45
+ const key = norm(status);
46
+ const indicatorColor = colorForStatusKey(key);
47
+ const shouldPulse = key === "IN_PROGRESS" || key === "NEEDS_APPROVAL" || key === "CHANGES_REQUESTED" || key === "PENDING";
48
+ return {
49
+ indicator: true,
50
+ indicatorColor,
51
+ ...shouldPulse ? { indicatorVariant: "pulse" } : {}
52
+ };
53
+ }
54
+
55
+ export {
56
+ getIndicatorProps
57
+ };
@@ -0,0 +1,245 @@
1
+ "use client";
2
+
3
+ // src/messages/index.ts
4
+ import { defineMessages } from "react-intl";
5
+ var messages = defineMessages({
6
+ control: {
7
+ id: "editor.controlref.control",
8
+ defaultMessage: "Control",
9
+ description: "Label for control"
10
+ },
11
+ settings_dialog_description: {
12
+ id: "editor.controlref.settings_dialog_description",
13
+ defaultMessage: "Customize the appearance and details of the control reference.",
14
+ description: "Description for the settings dialog"
15
+ },
16
+ controls: {
17
+ id: "editor.controlref.controls",
18
+ defaultMessage: "Controls",
19
+ description: "Label for controls"
20
+ },
21
+ change_control: {
22
+ id: "editor.controlref.change_control",
23
+ defaultMessage: "Change Control",
24
+ description: "Label for change control button"
25
+ },
26
+ map_control: {
27
+ id: "editor.controlref.map_control",
28
+ defaultMessage: "Map Control",
29
+ description: "Label for map control button"
30
+ },
31
+ settings: {
32
+ id: "editor.controlref.settings",
33
+ defaultMessage: "Settings",
34
+ description: "Label for settings button"
35
+ },
36
+ appearance: {
37
+ id: "editor.controlref.appearance",
38
+ defaultMessage: "Appearance",
39
+ description: "Label for appearance section"
40
+ },
41
+ search_controls: {
42
+ id: "editor.controlref.search_controls",
43
+ defaultMessage: "Search controls\u2026",
44
+ description: "Placeholder for search controls input"
45
+ },
46
+ variant: {
47
+ id: "editor.controlref.variant",
48
+ defaultMessage: "Variante",
49
+ description: "Label for variant section"
50
+ },
51
+ variant_hint: {
52
+ id: "editor.controlref.variant_hint",
53
+ defaultMessage: "Choose a visual emphasis for this section.",
54
+ description: "Hint for variant section"
55
+ },
56
+ variant_chip: {
57
+ id: "editor.controlref.variant_chip",
58
+ defaultMessage: "Chip",
59
+ description: "Label for variant chip"
60
+ },
61
+ variant_card: {
62
+ id: "editor.controlref.variant_card",
63
+ defaultMessage: "Card",
64
+ description: "Label for variant card"
65
+ },
66
+ show_status: {
67
+ id: "editor.controlref.show_status",
68
+ defaultMessage: "Show Status",
69
+ description: "Label for show status toggle"
70
+ },
71
+ show_description: {
72
+ id: "editor.controlref.show_description",
73
+ defaultMessage: "Show Description",
74
+ description: "Label for show description toggle"
75
+ },
76
+ show_implementations: {
77
+ id: "editor.controlref.show_implementations",
78
+ defaultMessage: "Show Implementations",
79
+ description: "Label for show implementations toggle"
80
+ },
81
+ border: {
82
+ id: "editor.controlref.border",
83
+ defaultMessage: "Border",
84
+ description: "Label for border toggle"
85
+ },
86
+ shadow: {
87
+ id: "editor.controlref.shadow",
88
+ defaultMessage: "Shadow",
89
+ description: "Label for shadow toggle"
90
+ },
91
+ radius: {
92
+ id: "editor.controlref.radius",
93
+ defaultMessage: "Radius",
94
+ description: "Label for radius toggle"
95
+ },
96
+ spacing: {
97
+ id: "editor.controlref.spacing",
98
+ defaultMessage: "Spacing",
99
+ description: "Label for spacing section"
100
+ },
101
+ cancel: {
102
+ id: "editor.controlref.cancel",
103
+ defaultMessage: "Cancel",
104
+ description: "Label for cancel button"
105
+ },
106
+ save_settings: {
107
+ id: "editor.controlref.save_settings",
108
+ defaultMessage: "Save Settings",
109
+ description: "Label for save settings button"
110
+ },
111
+ unmapped_control: {
112
+ id: "editor.controlref.unmapped_control",
113
+ defaultMessage: "Unmapped Control",
114
+ description: "Fallback label when no control is selected"
115
+ },
116
+ control_with_title: {
117
+ id: "editor.controlref.control_with_title",
118
+ defaultMessage: "Control: {title}",
119
+ description: "Dialog title with selected control"
120
+ },
121
+ search_hint: {
122
+ id: "editor.controlref.search_hint",
123
+ defaultMessage: "Start typing to search by ID, title or status.",
124
+ description: "Empty search hint"
125
+ },
126
+ no_results: {
127
+ id: "editor.controlref.no_results",
128
+ defaultMessage: "No controls found for \u201C{query}\u201D. You can keep this chip unmapped.",
129
+ description: "Shown when no controls match search query"
130
+ },
131
+ results_count: {
132
+ id: "editor.controlref.results_count",
133
+ defaultMessage: "{count, plural, one {# result} other {# results}}",
134
+ description: "Number of search results"
135
+ },
136
+ updated_at: {
137
+ id: "editor.controlref.updated_at",
138
+ defaultMessage: "Updated {date}",
139
+ description: "Updated date label"
140
+ },
141
+ selected: {
142
+ id: "editor.controlref.selected",
143
+ defaultMessage: "Selected",
144
+ description: "Label for selected item area"
145
+ },
146
+ no_control_selected: {
147
+ id: "editor.controlref.no_control_selected",
148
+ defaultMessage: "No control selected",
149
+ description: "Empty state in selected area"
150
+ },
151
+ clear: {
152
+ id: "editor.controlref.clear",
153
+ defaultMessage: "Clear",
154
+ description: "Clear selection button"
155
+ },
156
+ unmap: {
157
+ id: "editor.controlref.unmap",
158
+ defaultMessage: "Unmap",
159
+ description: "Unmap selection button"
160
+ },
161
+ live_preview: {
162
+ id: "editor.controlref.live_preview",
163
+ defaultMessage: "Live preview",
164
+ description: "Live preview section title"
165
+ },
166
+ display_options: {
167
+ id: "editor.controlref.display_options",
168
+ defaultMessage: "Display options",
169
+ description: "Display options section title"
170
+ },
171
+ show_status_indicator: {
172
+ id: "editor.controlref.show_status_indicator",
173
+ defaultMessage: "Show status indicator",
174
+ description: "Toggle for showing indicator"
175
+ },
176
+ searching: {
177
+ id: "editor.controlref.searching",
178
+ defaultMessage: "Searching\u2026",
179
+ description: "Loading indicator text"
180
+ },
181
+ map_control_aria: {
182
+ id: "editor.controlref.map_control_aria",
183
+ defaultMessage: "Map control",
184
+ description: "ARIA label for mapping control"
185
+ },
186
+ outdated_badge: {
187
+ id: "editor.controlref.outdated_badge",
188
+ defaultMessage: "A newer revision exists",
189
+ description: "Badge for outdated controls"
190
+ },
191
+ missing_badge: {
192
+ id: "editor.controlref.missing_badge",
193
+ defaultMessage: "Control no longer exists",
194
+ description: "Badge for missing controls"
195
+ },
196
+ error_loading: {
197
+ id: "editor.controlref.error_loading",
198
+ defaultMessage: "Failed to load controls",
199
+ description: "Error message when failing to load controls"
200
+ },
201
+ error_timeout: {
202
+ id: "editor.controlref.error_timeout",
203
+ defaultMessage: "The request timed out. Please try again.",
204
+ description: "Error message when the request times out"
205
+ },
206
+ missing_callout: {
207
+ id: "editor.controlref.missing_callout",
208
+ defaultMessage: "The currently mapped control could not be found. It may have been deleted or you may not have access to it anymore. Please select a different control.",
209
+ description: "Callout message when the selected control is missing"
210
+ },
211
+ outdated_callout: {
212
+ id: "editor.controlref.outdated_callout",
213
+ defaultMessage: "A newer revision of the currently mapped control exists. Consider updating to the latest version by re-selecting it below.",
214
+ description: "Callout message when the selected control is outdated"
215
+ },
216
+ search_placeholder: {
217
+ id: "editor.controlref.search_placeholder",
218
+ defaultMessage: "e.g. CTRL-001, Asset Inventory\u2026",
219
+ description: "Placeholder for search controls input"
220
+ },
221
+ control_implementations: {
222
+ id: "editor.controlref.control_implementations",
223
+ defaultMessage: "Implementations",
224
+ description: "Label for control implementations section"
225
+ },
226
+ header_status: {
227
+ id: "editor.controlblock.header_status",
228
+ defaultMessage: "Show status in header",
229
+ description: "Label for show status in header toggle"
230
+ },
231
+ header_status_aria: {
232
+ id: "editor.controlblock.header_status_aria",
233
+ defaultMessage: "Toggle status chip in card header",
234
+ description: "ARIA label for show status in header toggle"
235
+ },
236
+ header_status_avv_tip: {
237
+ id: "editor.controlblock.header_status_avv_tip",
238
+ defaultMessage: "If this document is intended for use or export as a data processing agreement (AVV), disable this option unless you explicitly want to publish the current control status.",
239
+ description: "Tooltip for show status in header toggle when used in AVV documents"
240
+ }
241
+ });
242
+
243
+ export {
244
+ messages
245
+ };
@@ -0,0 +1,37 @@
1
+ "use client";
2
+ import {
3
+ createControlImplementation
4
+ } from "./chunk-XHD2KFKQ.mjs";
5
+ import {
6
+ getControlNodeTypes
7
+ } from "./chunk-ZUR6XKMG.mjs";
8
+ import {
9
+ DEFAULT_CONTROL_REF_OPTIONS
10
+ } from "./chunk-JM66CQVD.mjs";
11
+
12
+ // src/utils/create-control-block.ts
13
+ function createControlBlock(schema, implementations) {
14
+ const types = getControlNodeTypes(schema);
15
+ const attrs = {
16
+ id: null,
17
+ title: null,
18
+ status: null,
19
+ updatedAt: null,
20
+ options: DEFAULT_CONTROL_REF_OPTIONS
21
+ };
22
+ const implNodes = [];
23
+ if (implementations == null ? void 0 : implementations.length) {
24
+ for (const impl of implementations) {
25
+ const n = createControlImplementation(types.controlImplementation, impl);
26
+ if (n) implNodes.push(n);
27
+ }
28
+ }
29
+ if (implNodes.length > 0) {
30
+ return types.controlBlock.createCheck(attrs, null);
31
+ }
32
+ return types.controlBlock.createAndFill();
33
+ }
34
+
35
+ export {
36
+ createControlBlock
37
+ };