@veltrixsecops/app-sdk 3.2.0 → 3.5.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 (77) hide show
  1. package/README.md +1 -1
  2. package/dist/byol/index.cjs +3802 -0
  3. package/dist/byol/index.cjs.map +1 -0
  4. package/dist/byol/index.d.cts +578 -0
  5. package/dist/byol/index.d.ts +578 -0
  6. package/dist/byol/index.js +2587 -0
  7. package/dist/byol/index.js.map +1 -0
  8. package/dist/chunk-3WK4EVQ3.js +842 -0
  9. package/dist/chunk-3WK4EVQ3.js.map +1 -0
  10. package/dist/{chunk-EOOEHZGC.js → chunk-HIL6RIDG.js} +107 -3
  11. package/dist/chunk-HIL6RIDG.js.map +1 -0
  12. package/dist/{chunk-VWFTOFTI.js → chunk-Y6XBNZGR.js} +8 -2
  13. package/dist/chunk-Y6XBNZGR.js.map +1 -0
  14. package/dist/client/index.cjs +112 -2
  15. package/dist/client/index.cjs.map +1 -1
  16. package/dist/client/index.d.cts +118 -6
  17. package/dist/client/index.d.ts +118 -6
  18. package/dist/client/index.js +13 -1
  19. package/dist/connections/index.cjs +1787 -0
  20. package/dist/connections/index.cjs.map +1 -0
  21. package/dist/connections/index.d.cts +78 -0
  22. package/dist/connections/index.d.ts +78 -0
  23. package/dist/connections/index.js +754 -0
  24. package/dist/connections/index.js.map +1 -0
  25. package/dist/hooks/index.cjs.map +1 -1
  26. package/dist/hooks/index.d.cts +2 -2
  27. package/dist/hooks/index.d.ts +2 -2
  28. package/dist/hooks/index.js +1 -1
  29. package/dist/index.cjs +7 -0
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +3 -3
  32. package/dist/index.d.ts +3 -3
  33. package/dist/index.js +3 -1
  34. package/dist/index.js.map +1 -1
  35. package/dist/opentofu/index.cjs +138 -0
  36. package/dist/opentofu/index.cjs.map +1 -0
  37. package/dist/opentofu/index.d.cts +131 -0
  38. package/dist/opentofu/index.d.ts +131 -0
  39. package/dist/opentofu/index.js +109 -0
  40. package/dist/opentofu/index.js.map +1 -0
  41. package/dist/pipeline/index.cjs +7 -0
  42. package/dist/pipeline/index.cjs.map +1 -1
  43. package/dist/pipeline/index.d.cts +9 -2
  44. package/dist/pipeline/index.d.ts +9 -2
  45. package/dist/pipeline/index.js +3 -1
  46. package/dist/pipeline-beeT8dje.d.cts +408 -0
  47. package/dist/pipeline-beeT8dje.d.ts +408 -0
  48. package/dist/ui/index.cjs +136 -0
  49. package/dist/ui/index.cjs.map +1 -1
  50. package/dist/ui/index.d.cts +109 -1
  51. package/dist/ui/index.d.ts +109 -1
  52. package/dist/ui/index.js +35 -677
  53. package/dist/ui/index.js.map +1 -1
  54. package/dist/{use-app-context-OQlcmq7t.d.cts → use-app-context-Byv_fam0.d.cts} +206 -4
  55. package/dist/{use-app-context-OQlcmq7t.d.ts → use-app-context-Byv_fam0.d.ts} +206 -4
  56. package/opentofu/README.md +114 -0
  57. package/opentofu/modules/aws/main.tf +1008 -0
  58. package/opentofu/modules/aws/outputs.tf +90 -0
  59. package/opentofu/modules/aws/variables.tf +437 -0
  60. package/opentofu/modules/aws/versions.tf +23 -0
  61. package/opentofu/modules/azure/main.tf +920 -0
  62. package/opentofu/modules/azure/outputs.tf +72 -0
  63. package/opentofu/modules/azure/variables.tf +498 -0
  64. package/opentofu/modules/azure/versions.tf +27 -0
  65. package/opentofu/modules/gcp/main.tf +645 -0
  66. package/opentofu/modules/gcp/outputs.tf +73 -0
  67. package/opentofu/modules/gcp/variables.tf +428 -0
  68. package/opentofu/modules/gcp/versions.tf +27 -0
  69. package/opentofu/modules/hetzner/main.tf +432 -0
  70. package/opentofu/modules/hetzner/outputs.tf +72 -0
  71. package/opentofu/modules/hetzner/variables.tf +423 -0
  72. package/opentofu/modules/hetzner/versions.tf +26 -0
  73. package/package.json +33 -1
  74. package/dist/chunk-EOOEHZGC.js.map +0 -1
  75. package/dist/chunk-VWFTOFTI.js.map +0 -1
  76. package/dist/pipeline-A-gSsPRR.d.cts +0 -189
  77. package/dist/pipeline-A-gSsPRR.d.ts +0 -189
package/dist/ui/index.js CHANGED
@@ -1,682 +1,38 @@
1
1
  import {
2
- getHostRuntime
3
- } from "../chunk-EOOEHZGC.js";
4
-
5
- // src/ui/index.tsx
6
- import * as React from "react";
7
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
- function getHostUi(name) {
9
- return getHostRuntime()?.ui?.[name];
10
- }
11
- var fallbackNote = { fontFamily: "inherit" };
12
- var Button = React.forwardRef((props, ref) => {
13
- const HostButton = getHostUi("Button");
14
- if (HostButton) return /* @__PURE__ */ jsx(HostButton, { ref, ...props });
15
- const {
16
- variant: _variant,
17
- size: _size,
18
- isLoading,
19
- loadingText,
20
- fullWidth,
21
- leftIcon,
22
- rightIcon,
23
- children,
24
- disabled,
25
- type,
26
- style,
27
- ...rest
28
- } = props;
29
- return /* @__PURE__ */ jsxs(
30
- "button",
31
- {
32
- ref,
33
- type: type ?? "button",
34
- disabled: disabled || isLoading,
35
- "aria-busy": isLoading || void 0,
36
- style: {
37
- ...fallbackNote,
38
- display: "inline-flex",
39
- alignItems: "center",
40
- gap: 6,
41
- padding: "6px 14px",
42
- borderRadius: 6,
43
- border: "1px solid currentColor",
44
- background: "transparent",
45
- cursor: disabled || isLoading ? "not-allowed" : "pointer",
46
- width: fullWidth ? "100%" : void 0,
47
- opacity: disabled || isLoading ? 0.6 : 1,
48
- justifyContent: "center",
49
- ...style
50
- },
51
- ...rest,
52
- children: [
53
- leftIcon,
54
- isLoading ? loadingText ?? children : children,
55
- rightIcon
56
- ]
57
- }
58
- );
59
- });
60
- Button.displayName = "Button";
61
- var BADGE_FALLBACK_COLORS = {
62
- default: "#6b7280",
63
- primary: "#4f46e5",
64
- secondary: "#6b7280",
65
- success: "#16a34a",
66
- danger: "#dc2626",
67
- warning: "#d97706",
68
- info: "#0284c7"
69
- };
70
- var Badge = ({ variant = "default", size = "md", rounded, dot, children, style, ...rest }) => {
71
- const HostBadge = getHostUi("Badge");
72
- if (HostBadge) return /* @__PURE__ */ jsx(HostBadge, { variant, size, rounded, dot, style, ...rest, children });
73
- const color = BADGE_FALLBACK_COLORS[variant];
74
- const fontSize = size === "sm" ? 11 : size === "lg" ? 14 : 12;
75
- return /* @__PURE__ */ jsxs(
76
- "span",
77
- {
78
- style: {
79
- ...fallbackNote,
80
- display: "inline-flex",
81
- alignItems: "center",
82
- gap: 4,
83
- padding: size === "sm" ? "1px 6px" : size === "lg" ? "3px 10px" : "2px 8px",
84
- borderRadius: rounded ? 999 : 4,
85
- border: `1px solid ${color}`,
86
- color,
87
- fontSize,
88
- fontWeight: 500,
89
- ...style
90
- },
91
- ...rest,
92
- children: [
93
- dot && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: { width: 6, height: 6, borderRadius: "50%", background: color } }),
94
- children
95
- ]
96
- }
97
- );
98
- };
99
- Badge.displayName = "Badge";
100
- var Card = ({ children, style, ...rest }) => {
101
- const HostCard = getHostUi("Card");
102
- if (HostCard) return /* @__PURE__ */ jsx(HostCard, { style, ...rest, children });
103
- return /* @__PURE__ */ jsx("div", { style: { ...fallbackNote, border: "1px solid #d1d5db", borderRadius: 8, overflow: "hidden", ...style }, ...rest, children });
104
- };
105
- Card.displayName = "Card";
106
- var CardHeader = ({ actions, children, style, ...rest }) => {
107
- const HostCardHeader = getHostUi("CardHeader");
108
- if (HostCardHeader) return /* @__PURE__ */ jsx(HostCardHeader, { actions, style, ...rest, children });
109
- return /* @__PURE__ */ jsxs(
110
- "div",
111
- {
112
- style: {
113
- ...fallbackNote,
114
- padding: "12px 16px",
115
- borderBottom: "1px solid #d1d5db",
116
- display: "flex",
117
- alignItems: "center",
118
- justifyContent: "space-between",
119
- gap: 12,
120
- ...style
121
- },
122
- ...rest,
123
- children: [
124
- /* @__PURE__ */ jsx("div", { style: { flex: 1, minWidth: 0 }, children }),
125
- actions && /* @__PURE__ */ jsx("div", { children: actions })
126
- ]
127
- }
128
- );
129
- };
130
- CardHeader.displayName = "CardHeader";
131
- var CardBody = ({ children, style, ...rest }) => {
132
- const HostCardBody = getHostUi("CardBody");
133
- if (HostCardBody) return /* @__PURE__ */ jsx(HostCardBody, { style, ...rest, children });
134
- return /* @__PURE__ */ jsx("div", { style: { ...fallbackNote, padding: "12px 16px", ...style }, ...rest, children });
135
- };
136
- CardBody.displayName = "CardBody";
137
- var CardFooter = ({ children, style, ...rest }) => {
138
- const HostCardFooter = getHostUi("CardFooter");
139
- if (HostCardFooter) return /* @__PURE__ */ jsx(HostCardFooter, { style, ...rest, children });
140
- return /* @__PURE__ */ jsx("div", { style: { ...fallbackNote, padding: "12px 16px", borderTop: "1px solid #d1d5db", ...style }, ...rest, children });
141
- };
142
- CardFooter.displayName = "CardFooter";
143
- var Input = React.forwardRef((props, ref) => {
144
- const HostInput = getHostUi("Input");
145
- if (HostInput) return /* @__PURE__ */ jsx(HostInput, { ref, ...props });
146
- const { label, error, helperText, leftIcon, rightIcon, fullWidth = true, id, style, ...rest } = props;
147
- const inputId = id ?? (label ? `vx-input-${label.toLowerCase().replace(/\s+/g, "-")}` : void 0);
148
- return /* @__PURE__ */ jsxs("div", { style: { ...fallbackNote, width: fullWidth ? "100%" : void 0 }, children: [
149
- label && /* @__PURE__ */ jsx("label", { htmlFor: inputId, style: { display: "block", fontSize: 13, fontWeight: 500, marginBottom: 4 }, children: label }),
150
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
151
- leftIcon,
152
- /* @__PURE__ */ jsx(
153
- "input",
154
- {
155
- ref,
156
- id: inputId,
157
- "aria-invalid": !!error || void 0,
158
- style: { flex: 1, padding: "6px 10px", borderRadius: 6, border: "1px solid #9ca3af", ...style },
159
- ...rest
160
- }
161
- ),
162
- rightIcon
163
- ] }),
164
- error && /* @__PURE__ */ jsx("p", { role: "alert", style: { marginTop: 4, fontSize: 12, color: "#dc2626" }, children: error }),
165
- helperText && !error && /* @__PURE__ */ jsx("p", { style: { marginTop: 4, fontSize: 12, color: "#6b7280" }, children: helperText })
166
- ] });
167
- });
168
- Input.displayName = "Input";
169
- var Textarea = React.forwardRef((props, ref) => {
170
- const HostTextarea = getHostUi("Textarea");
171
- if (HostTextarea) return /* @__PURE__ */ jsx(HostTextarea, { ref, ...props });
172
- const { label, error, helperText, fullWidth = true, id, rows = 4, style, ...rest } = props;
173
- const textareaId = id ?? (label ? `vx-textarea-${label.toLowerCase().replace(/\s+/g, "-")}` : void 0);
174
- return /* @__PURE__ */ jsxs("div", { style: { ...fallbackNote, width: fullWidth ? "100%" : void 0 }, children: [
175
- label && /* @__PURE__ */ jsx("label", { htmlFor: textareaId, style: { display: "block", fontSize: 13, fontWeight: 500, marginBottom: 4 }, children: label }),
176
- /* @__PURE__ */ jsx(
177
- "textarea",
178
- {
179
- ref,
180
- id: textareaId,
181
- rows,
182
- "aria-invalid": !!error || void 0,
183
- style: { width: "100%", padding: "6px 10px", borderRadius: 6, border: "1px solid #9ca3af", ...style },
184
- ...rest
185
- }
186
- ),
187
- error && /* @__PURE__ */ jsx("p", { role: "alert", style: { marginTop: 4, fontSize: 12, color: "#dc2626" }, children: error }),
188
- helperText && !error && /* @__PURE__ */ jsx("p", { style: { marginTop: 4, fontSize: 12, color: "#6b7280" }, children: helperText })
189
- ] });
190
- });
191
- Textarea.displayName = "Textarea";
192
- var Checkbox = React.forwardRef((props, ref) => {
193
- const HostCheckbox = getHostUi("Checkbox");
194
- if (HostCheckbox) return /* @__PURE__ */ jsx(HostCheckbox, { ref, ...props });
195
- const { label, error, helperText, id, disabled, ...rest } = props;
196
- const generatedId = React.useId();
197
- const inputId = id ?? generatedId;
198
- return /* @__PURE__ */ jsxs("div", { style: fallbackNote, children: [
199
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
200
- /* @__PURE__ */ jsx("input", { ref, id: inputId, type: "checkbox", disabled, "aria-invalid": !!error || void 0, ...rest }),
201
- label && /* @__PURE__ */ jsx("label", { htmlFor: inputId, style: { fontSize: 13, cursor: disabled ? "not-allowed" : "pointer", opacity: disabled ? 0.6 : 1 }, children: label })
202
- ] }),
203
- error && /* @__PURE__ */ jsx("p", { role: "alert", style: { marginTop: 4, fontSize: 12, color: "#dc2626" }, children: error }),
204
- helperText && !error && /* @__PURE__ */ jsx("p", { style: { marginTop: 4, fontSize: 12, color: "#6b7280" }, children: helperText })
205
- ] });
206
- });
207
- Checkbox.displayName = "Checkbox";
208
- var Select = (props) => {
209
- const HostSelect = getHostUi("Select");
210
- if (HostSelect) return /* @__PURE__ */ jsx(HostSelect, { ...props });
211
- const { options, value, onChange, placeholder = "Select\u2026", label, error, helperText, disabled, fullWidth = true, id, name, className } = props;
212
- const selectId = id ?? (label ? `vx-select-${label.toLowerCase().replace(/\s+/g, "-")}` : void 0);
213
- return /* @__PURE__ */ jsxs("div", { className, style: { ...fallbackNote, width: fullWidth ? "100%" : void 0 }, children: [
214
- label && /* @__PURE__ */ jsx("label", { htmlFor: selectId, style: { display: "block", fontSize: 13, fontWeight: 500, marginBottom: 4 }, children: label }),
215
- /* @__PURE__ */ jsxs(
216
- "select",
217
- {
218
- id: selectId,
219
- name,
220
- "aria-label": props["aria-label"],
221
- "aria-invalid": !!error || void 0,
222
- disabled,
223
- value: value ?? "",
224
- onChange: (event) => onChange?.(event.target.value),
225
- style: { width: "100%", padding: "6px 10px", borderRadius: 6, border: "1px solid #9ca3af" },
226
- children: [
227
- placeholder && /* @__PURE__ */ jsx("option", { value: "", disabled: true, children: placeholder }),
228
- options.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, disabled: option.disabled, children: option.label }, option.value))
229
- ]
230
- }
231
- ),
232
- error && /* @__PURE__ */ jsx("p", { role: "alert", style: { marginTop: 4, fontSize: 12, color: "#dc2626" }, children: error }),
233
- helperText && !error && /* @__PURE__ */ jsx("p", { style: { marginTop: 4, fontSize: 12, color: "#6b7280" }, children: helperText })
234
- ] });
235
- };
236
- Select.displayName = "Select";
237
- var SearchBox = (props) => {
238
- const HostSearchBox = getHostUi("SearchBox");
239
- if (HostSearchBox) return /* @__PURE__ */ jsx(HostSearchBox, { ...props });
240
- const { value, onChange, placeholder, disabled, className, "aria-label": ariaLabel } = props;
241
- return /* @__PURE__ */ jsx(
242
- "input",
243
- {
244
- type: "search",
245
- value,
246
- onChange: (event) => onChange(event.target.value),
247
- placeholder,
248
- disabled,
249
- "aria-label": ariaLabel ?? placeholder ?? "Search",
250
- className,
251
- style: { ...fallbackNote, width: "100%", padding: "6px 10px", borderRadius: 6, border: "1px solid #9ca3af" }
252
- }
253
- );
254
- };
255
- SearchBox.displayName = "SearchBox";
256
- var Pagination = (props) => {
257
- const HostPagination = getHostUi("Pagination");
258
- if (HostPagination) return /* @__PURE__ */ jsx(HostPagination, { ...props });
259
- const { page, pageSize, totalItems, onPageChange, disabled, className } = props;
260
- const pageCount = Math.max(1, Math.ceil(totalItems / pageSize));
261
- const canGoPrev = !disabled && page > 1;
262
- const canGoNext = !disabled && page < pageCount;
263
- return /* @__PURE__ */ jsxs("nav", { "aria-label": "Pagination", className, style: { ...fallbackNote, display: "flex", alignItems: "center", gap: 12 }, children: [
264
- /* @__PURE__ */ jsx("button", { type: "button", onClick: () => onPageChange(page - 1), disabled: !canGoPrev, style: { padding: "4px 10px" }, children: "Prev" }),
265
- /* @__PURE__ */ jsxs("span", { children: [
266
- "page ",
267
- page,
268
- " of ",
269
- pageCount
270
- ] }),
271
- /* @__PURE__ */ jsx("button", { type: "button", onClick: () => onPageChange(page + 1), disabled: !canGoNext, style: { padding: "4px 10px" }, children: "Next" })
272
- ] });
273
- };
274
- Pagination.displayName = "Pagination";
275
- var FilterBar = (props) => {
276
- const HostFilterBar = getHostUi("FilterBar");
277
- if (HostFilterBar) return /* @__PURE__ */ jsx(HostFilterBar, { ...props });
278
- const { filters, search, className } = props;
279
- return /* @__PURE__ */ jsxs("div", { className, style: { ...fallbackNote, display: "flex", flexWrap: "wrap", gap: 8, alignItems: "center" }, children: [
280
- search && /* @__PURE__ */ jsx(
281
- "input",
282
- {
283
- type: "search",
284
- "aria-label": search.placeholder ?? "Search",
285
- placeholder: search.placeholder,
286
- value: search.value,
287
- onChange: (event) => search.onChange(event.target.value),
288
- style: { padding: "6px 10px", borderRadius: 6, border: "1px solid #9ca3af" }
289
- }
290
- ),
291
- filters.map((filter) => /* @__PURE__ */ jsxs("label", { style: { display: "flex", flexDirection: "column", fontSize: 12 }, children: [
292
- filter.label,
293
- /* @__PURE__ */ jsxs(
294
- "select",
295
- {
296
- "aria-label": filter.label,
297
- value: filter.value ?? "",
298
- onChange: (event) => filter.onChange(event.target.value === "" ? null : event.target.value),
299
- style: { padding: "6px 10px", borderRadius: 6, border: "1px solid #9ca3af" },
300
- children: [
301
- /* @__PURE__ */ jsx("option", { value: "", children: filter.label }),
302
- filter.options.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.value))
303
- ]
304
- }
305
- )
306
- ] }, filter.key))
307
- ] });
308
- };
309
- FilterBar.displayName = "FilterBar";
310
- var SortSelect = (props) => {
311
- const HostSortSelect = getHostUi("SortSelect");
312
- if (HostSortSelect) return /* @__PURE__ */ jsx(HostSortSelect, { ...props });
313
- const { options, value, direction, onChange, disabled, className } = props;
314
- const directionLabel = direction === "asc" ? "Sort ascending" : "Sort descending";
315
- return /* @__PURE__ */ jsxs("div", { className, style: { ...fallbackNote, display: "flex", alignItems: "center", gap: 6 }, children: [
316
- /* @__PURE__ */ jsx(
317
- "select",
318
- {
319
- "aria-label": "Sort by",
320
- value,
321
- disabled,
322
- onChange: (event) => onChange(event.target.value, direction),
323
- style: { padding: "6px 10px", borderRadius: 6, border: "1px solid #9ca3af" },
324
- children: options.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.value))
325
- }
326
- ),
327
- /* @__PURE__ */ jsx(
328
- "button",
329
- {
330
- type: "button",
331
- disabled,
332
- onClick: () => onChange(value, direction === "asc" ? "desc" : "asc"),
333
- "aria-label": directionLabel,
334
- style: { padding: "4px 10px" },
335
- children: direction === "asc" ? "\u2191" : "\u2193"
336
- }
337
- )
338
- ] });
339
- };
340
- SortSelect.displayName = "SortSelect";
341
- var FormField = (props) => {
342
- const HostFormField = getHostUi("FormField");
343
- if (HostFormField) return /* @__PURE__ */ jsx(HostFormField, { ...props });
344
- const { label, htmlFor, error, hint, required, className, children } = props;
345
- return /* @__PURE__ */ jsxs("div", { className, style: fallbackNote, children: [
346
- label && /* @__PURE__ */ jsxs("label", { htmlFor, style: { display: "block", fontSize: 13, fontWeight: 500, marginBottom: 4 }, children: [
347
- label,
348
- required && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: { color: "#dc2626", marginLeft: 2 }, children: "*" })
349
- ] }),
350
- children,
351
- error && /* @__PURE__ */ jsx("p", { role: "alert", style: { marginTop: 4, fontSize: 12, color: "#dc2626" }, children: error }),
352
- hint && !error && /* @__PURE__ */ jsx("p", { style: { marginTop: 4, fontSize: 12, color: "#6b7280" }, children: hint })
353
- ] });
354
- };
355
- FormField.displayName = "FormField";
356
- var Tabs = (props) => {
357
- const HostTabs = getHostUi("Tabs");
358
- if (HostTabs) return /* @__PURE__ */ jsx(HostTabs, { ...props });
359
- const { tabs, defaultActiveIndex = 0, activeIndex, onTabChange, children, className } = props;
360
- const [internalIndex, setInternalIndex] = React.useState(defaultActiveIndex);
361
- const isControlled = activeIndex !== void 0;
362
- const currentIndex = isControlled ? activeIndex : internalIndex;
363
- const activeTab = tabs[currentIndex];
364
- const selectTab = (index) => {
365
- if (tabs[index]?.disabled) return;
366
- if (!isControlled) setInternalIndex(index);
367
- onTabChange?.(index);
368
- };
369
- return /* @__PURE__ */ jsxs("div", { className, style: fallbackNote, children: [
370
- /* @__PURE__ */ jsx("div", { role: "tablist", style: { display: "flex", gap: 4, borderBottom: "1px solid #d1d5db" }, children: tabs.map((tab, index) => /* @__PURE__ */ jsx(
371
- "button",
372
- {
373
- type: "button",
374
- role: "tab",
375
- "aria-selected": index === currentIndex,
376
- disabled: tab.disabled,
377
- onClick: () => selectTab(index),
378
- style: {
379
- padding: "6px 12px",
380
- border: "none",
381
- borderBottom: index === currentIndex ? "2px solid currentColor" : "2px solid transparent",
382
- background: "transparent",
383
- cursor: tab.disabled ? "not-allowed" : "pointer",
384
- fontWeight: index === currentIndex ? 600 : 400,
385
- opacity: tab.disabled ? 0.5 : 1
386
- },
387
- children: tab.label
388
- },
389
- tab.key ?? index
390
- )) }),
391
- /* @__PURE__ */ jsx("div", { role: "tabpanel", style: { padding: 12 }, children: children || activeTab?.content })
392
- ] });
393
- };
394
- Tabs.displayName = "Tabs";
395
- var EmptyState = (props) => {
396
- const HostEmptyState = getHostUi("EmptyState");
397
- if (HostEmptyState) return /* @__PURE__ */ jsx(HostEmptyState, { ...props });
398
- const { icon, title, description, action, className } = props;
399
- return /* @__PURE__ */ jsxs("div", { className, style: { ...fallbackNote, textAlign: "center", padding: "32px 16px" }, children: [
400
- icon && /* @__PURE__ */ jsx("div", { style: { marginBottom: 12 }, children: icon }),
401
- /* @__PURE__ */ jsx("p", { style: { fontWeight: 600, marginBottom: description ? 4 : 0 }, children: title }),
402
- description && /* @__PURE__ */ jsx("p", { style: { fontSize: 13, color: "#6b7280", marginBottom: action ? 12 : 0 }, children: description }),
403
- action
404
- ] });
405
- };
406
- EmptyState.displayName = "EmptyState";
407
- var skeletonRadius = { text: 4, circular: "50%", rectangular: 8 };
408
- var Skeleton = (props) => {
409
- const HostSkeleton = getHostUi("Skeleton");
410
- if (HostSkeleton) return /* @__PURE__ */ jsx(HostSkeleton, { ...props });
411
- const { variant = "text", width, height, style, ...rest } = props;
412
- return /* @__PURE__ */ jsx(
413
- "div",
414
- {
415
- "aria-hidden": "true",
416
- style: {
417
- background: "#e5e7eb",
418
- borderRadius: skeletonRadius[variant],
419
- width: width ?? (variant === "text" ? "100%" : void 0),
420
- height: height ?? (variant === "text" ? 14 : void 0),
421
- ...style
422
- },
423
- ...rest
424
- }
425
- );
426
- };
427
- Skeleton.displayName = "Skeleton";
428
- var SkeletonText = (props) => {
429
- const HostSkeletonText = getHostUi("SkeletonText");
430
- if (HostSkeletonText) return /* @__PURE__ */ jsx(HostSkeletonText, { ...props });
431
- const { lines = 3, width = "100%", lastLineWidth = "80%", className } = props;
432
- return /* @__PURE__ */ jsx("div", { className, style: { display: "flex", flexDirection: "column", gap: 8 }, children: Array.from({ length: lines }).map((_, index) => /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: index === lines - 1 ? lastLineWidth : width }, index)) });
433
- };
434
- SkeletonText.displayName = "SkeletonText";
435
- var SkeletonCard = (props) => {
436
- const HostSkeletonCard = getHostUi("SkeletonCard");
437
- if (HostSkeletonCard) return /* @__PURE__ */ jsx(HostSkeletonCard, { ...props });
438
- const { hasAvatar, hasActions, className } = props;
439
- return /* @__PURE__ */ jsxs("div", { className, style: { border: "1px solid #e5e7eb", borderRadius: 8, padding: 16 }, children: [
440
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 12 }, children: [
441
- hasAvatar && /* @__PURE__ */ jsx(Skeleton, { variant: "circular", width: 40, height: 40 }),
442
- /* @__PURE__ */ jsxs("div", { style: { flex: 1 }, children: [
443
- /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: "60%" }),
444
- /* @__PURE__ */ jsx("div", { style: { marginTop: 8 }, children: /* @__PURE__ */ jsx(SkeletonText, { lines: 2 }) })
445
- ] })
446
- ] }),
447
- hasActions && /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 8, marginTop: 12 }, children: [
448
- /* @__PURE__ */ jsx(Skeleton, { variant: "rectangular", width: 72, height: 30 }),
449
- /* @__PURE__ */ jsx(Skeleton, { variant: "rectangular", width: 72, height: 30 })
450
- ] })
451
- ] });
452
- };
453
- SkeletonCard.displayName = "SkeletonCard";
454
- var Tooltip = (props) => {
455
- const HostTooltip = getHostUi("Tooltip");
456
- if (HostTooltip) return /* @__PURE__ */ jsx(HostTooltip, { ...props });
457
- const { content, disabled, className, children } = props;
458
- const titleText = typeof content === "string" ? content : void 0;
459
- if (disabled || !titleText) return /* @__PURE__ */ jsx(Fragment, { children });
460
- return /* @__PURE__ */ jsx("span", { className, title: titleText, style: { display: "inline-flex" }, children });
461
- };
462
- Tooltip.displayName = "Tooltip";
463
- var spinnerDiameter = { sm: 16, md: 24, lg: 32 };
464
- var Spinner = (props) => {
465
- const HostSpinner = getHostUi("Spinner");
466
- if (HostSpinner) return /* @__PURE__ */ jsx(HostSpinner, { ...props });
467
- const { size = "md", className, label } = props;
468
- const diameter = spinnerDiameter[size];
469
- return /* @__PURE__ */ jsxs("div", { className, role: "status", "aria-live": "polite", style: { display: "flex", flexDirection: "column", alignItems: "center" }, children: [
470
- /* @__PURE__ */ jsx(
471
- "div",
472
- {
473
- "aria-hidden": "true",
474
- style: {
475
- width: diameter,
476
- height: diameter,
477
- borderRadius: "50%",
478
- border: "2px solid currentColor",
479
- borderTopColor: "transparent",
480
- animation: "vx-sdk-spin 0.8s linear infinite"
481
- }
482
- }
483
- ),
484
- label && /* @__PURE__ */ jsx("p", { style: { marginTop: 8, fontSize: 12, color: "#6b7280" }, children: label }),
485
- /* @__PURE__ */ jsx("span", { style: { position: "absolute", width: 1, height: 1, overflow: "hidden", clip: "rect(0 0 0 0)" }, children: label || "Loading" }),
486
- /* @__PURE__ */ jsx("style", { children: "@keyframes vx-sdk-spin { to { transform: rotate(360deg) } }" })
487
- ] });
488
- };
489
- Spinner.displayName = "Spinner";
490
- function FallbackDataTable(props) {
491
- const { columns, data, rowKey, isLoading, emptyState, onRowClick, rowActions, className } = props;
492
- const showEmpty = !isLoading && data.length === 0;
493
- return /* @__PURE__ */ jsx("div", { className, style: fallbackNote, children: /* @__PURE__ */ jsxs("table", { style: { width: "100%", borderCollapse: "collapse" }, children: [
494
- /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
495
- columns.map((column) => /* @__PURE__ */ jsx("th", { style: { textAlign: column.align ?? "left", padding: "8px 10px", borderBottom: "1px solid #d1d5db" }, children: column.header }, column.key)),
496
- rowActions && /* @__PURE__ */ jsx("th", { style: { padding: "8px 10px", borderBottom: "1px solid #d1d5db" } })
497
- ] }) }),
498
- /* @__PURE__ */ jsxs("tbody", { children: [
499
- isLoading && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: Math.max(columns.length + (rowActions ? 1 : 0), 1), style: { padding: "12px 10px" }, children: "Loading\u2026" }) }),
500
- showEmpty && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: Math.max(columns.length + (rowActions ? 1 : 0), 1), children: /* @__PURE__ */ jsx(EmptyState, { title: emptyState?.title ?? "No data", description: emptyState?.description, icon: emptyState?.icon, action: emptyState?.action }) }) }),
501
- !isLoading && !showEmpty && data.map((row) => /* @__PURE__ */ jsxs(
502
- "tr",
503
- {
504
- onClick: onRowClick ? () => onRowClick(row) : void 0,
505
- style: { cursor: onRowClick ? "pointer" : void 0, borderBottom: "1px solid #e5e7eb" },
506
- children: [
507
- columns.map((column) => /* @__PURE__ */ jsx("td", { style: { textAlign: column.align ?? "left", padding: "8px 10px" }, children: column.render ? column.render(row) : String(row[column.key] ?? "") }, column.key)),
508
- rowActions && /* @__PURE__ */ jsx("td", { style: { padding: "8px 10px" }, onClick: (event) => event.stopPropagation(), children: rowActions(row) })
509
- ]
510
- },
511
- rowKey(row)
512
- ))
513
- ] })
514
- ] }) });
515
- }
516
- function DataTable(props) {
517
- const HostDataTable = getHostUi("DataTable");
518
- if (HostDataTable) return /* @__PURE__ */ jsx(HostDataTable, { ...props });
519
- return /* @__PURE__ */ jsx(FallbackDataTable, { ...props });
520
- }
521
- var DELTA_FALLBACK_COLOR = {
522
- up: "#16a34a",
523
- down: "#dc2626",
524
- neutral: "#6b7280"
525
- };
526
- var StatsCard = (props) => {
527
- const HostStatsCard = getHostUi("StatsCard");
528
- if (HostStatsCard) return /* @__PURE__ */ jsx(HostStatsCard, { ...props });
529
- const { label, value, icon, delta, isLoading, onClick, className } = props;
530
- const isClickable = Boolean(onClick);
531
- return /* @__PURE__ */ jsxs(
532
- "div",
533
- {
534
- role: isClickable ? "button" : void 0,
535
- tabIndex: isClickable ? 0 : void 0,
536
- onClick,
537
- onKeyDown: isClickable ? (event) => {
538
- if (event.key === "Enter" || event.key === " ") {
539
- event.preventDefault();
540
- onClick?.();
541
- }
542
- } : void 0,
543
- className,
544
- style: {
545
- ...fallbackNote,
546
- border: "1px solid #d1d5db",
547
- borderRadius: 8,
548
- padding: 16,
549
- display: "flex",
550
- alignItems: "flex-start",
551
- justifyContent: "space-between",
552
- gap: 12,
553
- cursor: isClickable ? "pointer" : void 0
554
- },
555
- children: [
556
- /* @__PURE__ */ jsxs("div", { style: { minWidth: 0, flex: 1 }, children: [
557
- /* @__PURE__ */ jsx("p", { style: { fontSize: 13, color: "#6b7280", margin: 0 }, children: label }),
558
- /* @__PURE__ */ jsx("p", { style: { fontSize: 28, fontWeight: 700, margin: "4px 0 0" }, children: isLoading ? "\u2026" : value }),
559
- delta && !isLoading && /* @__PURE__ */ jsxs("p", { style: { fontSize: 13, color: DELTA_FALLBACK_COLOR[delta.direction], margin: "4px 0 0" }, children: [
560
- delta.value,
561
- " ",
562
- delta.label
563
- ] })
564
- ] }),
565
- icon && /* @__PURE__ */ jsx("div", { "aria-hidden": "true", children: icon })
566
- ]
567
- }
568
- );
569
- };
570
- StatsCard.displayName = "StatsCard";
571
- var FORM_DIALOG_MAX_WIDTH = { sm: 420, md: 520, lg: 680 };
572
- var FormDialog = (props) => {
573
- const HostFormDialog = getHostUi("FormDialog");
574
- if (HostFormDialog) return /* @__PURE__ */ jsx(HostFormDialog, { ...props });
575
- const {
576
- isOpen,
577
- onClose,
578
- title,
579
- description,
580
- children,
581
- onSubmit,
582
- submitText = "Save",
583
- cancelText = "Cancel",
584
- isSubmitting = false,
585
- error = null,
586
- size = "md",
587
- disableBackdropClose = false,
588
- submitDisabled = false
589
- } = props;
590
- React.useEffect(() => {
591
- if (!isOpen) return;
592
- const handleKeyDown = (event) => {
593
- if (event.key === "Escape" && !isSubmitting) onClose();
594
- };
595
- document.addEventListener("keydown", handleKeyDown);
596
- return () => document.removeEventListener("keydown", handleKeyDown);
597
- }, [isOpen, isSubmitting, onClose]);
598
- if (!isOpen) return null;
599
- const requestClose = () => {
600
- if (!isSubmitting) onClose();
601
- };
602
- return /* @__PURE__ */ jsx(
603
- "div",
604
- {
605
- style: { position: "fixed", inset: 0, background: "rgba(0,0,0,0.5)", display: "flex", alignItems: "center", justifyContent: "center", zIndex: 50 },
606
- onClick: disableBackdropClose ? void 0 : requestClose,
607
- children: /* @__PURE__ */ jsx(
608
- "div",
609
- {
610
- role: "dialog",
611
- "aria-modal": "true",
612
- "aria-label": title,
613
- style: { background: "white", color: "black", borderRadius: 8, width: "100%", maxWidth: FORM_DIALOG_MAX_WIDTH[size], maxHeight: "80vh", overflow: "auto", ...fallbackNote },
614
- onClick: (event) => event.stopPropagation(),
615
- children: /* @__PURE__ */ jsxs(
616
- "form",
617
- {
618
- onSubmit: (event) => {
619
- event.preventDefault();
620
- void onSubmit();
621
- },
622
- children: [
623
- /* @__PURE__ */ jsxs("div", { style: { padding: 16, borderBottom: "1px solid #d1d5db" }, children: [
624
- /* @__PURE__ */ jsx("h3", { style: { margin: 0, fontSize: 16, fontWeight: 600 }, children: title }),
625
- description && /* @__PURE__ */ jsx("p", { style: { margin: "4px 0 0", fontSize: 13, color: "#6b7280" }, children: description })
626
- ] }),
627
- /* @__PURE__ */ jsxs("div", { style: { padding: 16, display: "flex", flexDirection: "column", gap: 12 }, children: [
628
- error && /* @__PURE__ */ jsx("p", { role: "alert", style: { margin: 0, fontSize: 13, color: "#dc2626" }, children: error }),
629
- children
630
- ] }),
631
- /* @__PURE__ */ jsxs("div", { style: { padding: 16, borderTop: "1px solid #d1d5db", display: "flex", justifyContent: "flex-end", gap: 8 }, children: [
632
- /* @__PURE__ */ jsx(Button, { type: "button", variant: "secondary", onClick: requestClose, disabled: isSubmitting, children: cancelText }),
633
- /* @__PURE__ */ jsx(Button, { type: "submit", variant: "primary", isLoading: isSubmitting, disabled: submitDisabled, children: submitText })
634
- ] })
635
- ]
636
- }
637
- )
638
- }
639
- )
640
- }
641
- );
642
- };
643
- FormDialog.displayName = "FormDialog";
644
- function fallbackToast(message, options) {
645
- console.warn(`[@veltrixsecops/app-sdk/ui] Toast (${options?.variant ?? "info"}): ${message}`);
646
- return "fallback-toast";
647
- }
648
- var fallbackToastContext = {
649
- toasts: [],
650
- toast: fallbackToast,
651
- success: (message) => fallbackToast(message, { variant: "success" }),
652
- error: (message) => fallbackToast(message, { variant: "error" }),
653
- warning: (message) => fallbackToast(message, { variant: "warning" }),
654
- info: (message) => fallbackToast(message, { variant: "info" }),
655
- promise: (promise) => promise,
656
- dismiss: () => {
657
- },
658
- dismissAll: () => {
659
- }
660
- };
661
- function useToast() {
662
- const hostUseToast = getHostUi("useToast");
663
- if (hostUseToast) return hostUseToast();
664
- return fallbackToastContext;
665
- }
666
- var fallbackConfirmationContext = {
667
- confirm: (options) => {
668
- console.warn(
669
- `[@veltrixsecops/app-sdk/ui] ConfirmationDialog is only available inside the Veltrix platform \u2014 "${options.title}" auto-resolved to "not confirmed" (fail closed).`
670
- );
671
- return Promise.resolve(false);
672
- }
673
- };
674
- function useConfirmDialog() {
675
- const hostUseConfirmDialog = getHostUi("useConfirmDialog");
676
- if (hostUseConfirmDialog) return hostUseConfirmDialog();
677
- return fallbackConfirmationContext;
678
- }
2
+ Alert,
3
+ Badge,
4
+ Button,
5
+ Card,
6
+ CardBody,
7
+ CardFooter,
8
+ CardHeader,
9
+ Checkbox,
10
+ DataTable,
11
+ EmptyState,
12
+ FilterBar,
13
+ FormDialog,
14
+ FormField,
15
+ Input,
16
+ Modal,
17
+ MultiSelect,
18
+ Pagination,
19
+ SearchBox,
20
+ Select,
21
+ Skeleton,
22
+ SkeletonCard,
23
+ SkeletonText,
24
+ SortSelect,
25
+ Spinner,
26
+ StatsCard,
27
+ Tabs,
28
+ Textarea,
29
+ Tooltip,
30
+ useConfirmDialog,
31
+ useToast
32
+ } from "../chunk-3WK4EVQ3.js";
33
+ import "../chunk-HIL6RIDG.js";
679
34
  export {
35
+ Alert,
680
36
  Badge,
681
37
  Button,
682
38
  Card,
@@ -690,6 +46,8 @@ export {
690
46
  FormDialog,
691
47
  FormField,
692
48
  Input,
49
+ Modal,
50
+ MultiSelect,
693
51
  Pagination,
694
52
  SearchBox,
695
53
  Select,