@burdenoff/microfe-security 2026.525.2 → 2026.527.1
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/security/SecurityAdminRoot.js +4 -4
- package/dist/security/SecurityAdminRoot.js.map +1 -1
- package/dist/security/SecurityRoot.js +4 -4
- package/dist/security/SecurityRoot.js.map +1 -1
- package/dist/security/SecurityUserRoot.js +4 -4
- package/dist/security/SecurityUserRoot.js.map +1 -1
- package/dist/security/components/ActivityTimeline.js +1 -1
- package/dist/security/components/ActivityTimeline.js.map +1 -1
- package/dist/security/components/BulkActionBar.js +6 -5
- package/dist/security/components/BulkActionBar.js.map +1 -1
- package/dist/security/components/ConfirmDialog.js +5 -3
- package/dist/security/components/ConfirmDialog.js.map +1 -1
- package/dist/security/components/CopyButton.js +4 -3
- package/dist/security/components/CopyButton.js.map +1 -1
- package/dist/security/components/ExportDialog.js +39 -38
- package/dist/security/components/ExportDialog.js.map +1 -1
- package/dist/security/components/ImportWizard.js +14 -13
- package/dist/security/components/ImportWizard.js.map +1 -1
- package/dist/security/components/PasswordGenerator.js +8 -4
- package/dist/security/components/PasswordGenerator.js.map +1 -1
- package/dist/security/components/RotationStatusBadge.js +1 -1
- package/dist/security/components/RotationStatusBadge.js.map +1 -1
- package/dist/security/components/SecretFormFields.js +88 -75
- package/dist/security/components/SecretFormFields.js.map +1 -1
- package/dist/security/components/SecretRow.js +11 -9
- package/dist/security/components/SecretRow.js.map +1 -1
- package/dist/security/components/SecretValueDisplay.js +45 -44
- package/dist/security/components/SecretValueDisplay.js.map +1 -1
- package/dist/security/components/SecurityPermissionGuard.js +1 -1
- package/dist/security/components/SecurityPermissionGuard.js.map +1 -1
- package/dist/security/components/VaultCard.js +5 -5
- package/dist/security/components/VaultCard.js.map +1 -1
- package/dist/security/components/VaultShareDialog.js +9 -6
- package/dist/security/components/VaultShareDialog.js.map +1 -1
- package/dist/security/components/ui.js +9 -8
- package/dist/security/components/ui.js.map +1 -1
- package/dist/security/constants/providers.js.map +1 -1
- package/dist/security/hooks/useProviderQueries.js.map +1 -1
- package/dist/security/hooks/useSecretQueries.js.map +1 -1
- package/dist/security/hooks/useSecretValue.js +12 -11
- package/dist/security/hooks/useSecretValue.js.map +1 -1
- package/dist/security/hooks/useSecurityDashboard.js +10 -10
- package/dist/security/hooks/useSecurityDashboard.js.map +1 -1
- package/dist/security/hooks/useSecuritySubscriptions.js.map +1 -1
- package/dist/security/pages/AccessReviewPage.js +4 -4
- package/dist/security/pages/AccessReviewPage.js.map +1 -1
- package/dist/security/pages/AuditLogPage.js +11 -5
- package/dist/security/pages/AuditLogPage.js.map +1 -1
- package/dist/security/pages/ImportExportPage.js +4 -2
- package/dist/security/pages/ImportExportPage.js.map +1 -1
- package/dist/security/pages/ProviderDetailPage.js +12 -12
- package/dist/security/pages/ProviderDetailPage.js.map +1 -1
- package/dist/security/pages/ProvidersPage.js +9 -9
- package/dist/security/pages/ProvidersPage.js.map +1 -1
- package/dist/security/pages/SecretCreatePage.js +5 -5
- package/dist/security/pages/SecretCreatePage.js.map +1 -1
- package/dist/security/pages/SecretDetailPage.js +213 -205
- package/dist/security/pages/SecretDetailPage.js.map +1 -1
- package/dist/security/pages/SecurityDashboardPage.js +7 -7
- package/dist/security/pages/SecurityDashboardPage.js.map +1 -1
- package/dist/security/pages/VaultCreatePage.js +2 -2
- package/dist/security/pages/VaultCreatePage.js.map +1 -1
- package/dist/security/pages/VaultDetailPage.js +13 -13
- package/dist/security/pages/VaultDetailPage.js.map +1 -1
- package/dist/security/pages/VaultSettingsPage.js +160 -140
- package/dist/security/pages/VaultSettingsPage.js.map +1 -1
- package/dist/security/pages/VaultsDashboardPage.js +147 -143
- package/dist/security/pages/VaultsDashboardPage.js.map +1 -1
- package/dist/security/providers/SecurityProvider.js +1 -1
- package/dist/security/providers/SecurityProvider.js.map +1 -1
- package/dist/security/routes/routeUtils.js +4 -3
- package/dist/security/routes/routeUtils.js.map +1 -1
- package/dist/security/utils/clipboard.js.map +1 -1
- package/dist/security/utils/fileParser.js +4 -1
- package/dist/security/utils/fileParser.js.map +1 -1
- package/package.json +1 -1
- package/dist/dev/main.d.ts +0 -2
- package/dist/dev/main.d.ts.map +0 -1
- package/dist/generated/global-operations.d.ts +0 -2
- package/dist/generated/global-operations.d.ts.map +0 -1
- package/dist/generated/global-types.d.ts +0 -23527
- package/dist/generated/global-types.d.ts.map +0 -1
- package/dist/generated/wspace-operations.d.ts +0 -1461
- package/dist/generated/wspace-operations.d.ts.map +0 -1
- package/dist/generated/wspace-types.d.ts +0 -57851
- package/dist/generated/wspace-types.d.ts.map +0 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/security/SecurityAdminRoot.d.ts +0 -19
- package/dist/security/SecurityAdminRoot.d.ts.map +0 -1
- package/dist/security/SecurityRoot.d.ts +0 -18
- package/dist/security/SecurityRoot.d.ts.map +0 -1
- package/dist/security/SecurityRootBase.d.ts +0 -19
- package/dist/security/SecurityRootBase.d.ts.map +0 -1
- package/dist/security/SecurityUserRoot.d.ts +0 -18
- package/dist/security/SecurityUserRoot.d.ts.map +0 -1
- package/dist/security/components/ActivityTimeline.d.ts +0 -12
- package/dist/security/components/ActivityTimeline.d.ts.map +0 -1
- package/dist/security/components/AuditLogTable.d.ts +0 -12
- package/dist/security/components/AuditLogTable.d.ts.map +0 -1
- package/dist/security/components/BulkActionBar.d.ts +0 -9
- package/dist/security/components/BulkActionBar.d.ts.map +0 -1
- package/dist/security/components/ConfirmDialog.d.ts +0 -19
- package/dist/security/components/ConfirmDialog.d.ts.map +0 -1
- package/dist/security/components/CopyButton.d.ts +0 -20
- package/dist/security/components/CopyButton.d.ts.map +0 -1
- package/dist/security/components/ExportDialog.d.ts +0 -7
- package/dist/security/components/ExportDialog.d.ts.map +0 -1
- package/dist/security/components/ImportWizard.d.ts +0 -7
- package/dist/security/components/ImportWizard.d.ts.map +0 -1
- package/dist/security/components/PageLayout.d.ts +0 -23
- package/dist/security/components/PageLayout.d.ts.map +0 -1
- package/dist/security/components/PasswordGenerator.d.ts +0 -17
- package/dist/security/components/PasswordGenerator.d.ts.map +0 -1
- package/dist/security/components/ProviderSetupWizard.d.ts +0 -13
- package/dist/security/components/ProviderSetupWizard.d.ts.map +0 -1
- package/dist/security/components/RotationStatusBadge.d.ts +0 -13
- package/dist/security/components/RotationStatusBadge.d.ts.map +0 -1
- package/dist/security/components/SecretFormFields.d.ts +0 -23
- package/dist/security/components/SecretFormFields.d.ts.map +0 -1
- package/dist/security/components/SecretRow.d.ts +0 -13
- package/dist/security/components/SecretRow.d.ts.map +0 -1
- package/dist/security/components/SecretTypeBadge.d.ts +0 -13
- package/dist/security/components/SecretTypeBadge.d.ts.map +0 -1
- package/dist/security/components/SecretTypeIcon.d.ts +0 -14
- package/dist/security/components/SecretTypeIcon.d.ts.map +0 -1
- package/dist/security/components/SecretValueDisplay.d.ts +0 -26
- package/dist/security/components/SecretValueDisplay.d.ts.map +0 -1
- package/dist/security/components/SecurityPermissionGuard.d.ts +0 -16
- package/dist/security/components/SecurityPermissionGuard.d.ts.map +0 -1
- package/dist/security/components/SecurityScoreCard.d.ts +0 -12
- package/dist/security/components/SecurityScoreCard.d.ts.map +0 -1
- package/dist/security/components/VaultCard.d.ts +0 -13
- package/dist/security/components/VaultCard.d.ts.map +0 -1
- package/dist/security/components/VaultFormFields.d.ts +0 -17
- package/dist/security/components/VaultFormFields.d.ts.map +0 -1
- package/dist/security/components/VaultShareDialog.d.ts +0 -16
- package/dist/security/components/VaultShareDialog.d.ts.map +0 -1
- package/dist/security/components/ui.d.ts +0 -55
- package/dist/security/components/ui.d.ts.map +0 -1
- package/dist/security/config/navigation.d.ts +0 -10
- package/dist/security/config/navigation.d.ts.map +0 -1
- package/dist/security/constants/featureFlags.d.ts +0 -36
- package/dist/security/constants/featureFlags.d.ts.map +0 -1
- package/dist/security/constants/permissions.d.ts +0 -11
- package/dist/security/constants/permissions.d.ts.map +0 -1
- package/dist/security/constants/providers.d.ts +0 -12
- package/dist/security/constants/providers.d.ts.map +0 -1
- package/dist/security/constants/secretTypes.d.ts +0 -16
- package/dist/security/constants/secretTypes.d.ts.map +0 -1
- package/dist/security/hooks/useAuditLog.d.ts +0 -4
- package/dist/security/hooks/useAuditLog.d.ts.map +0 -1
- package/dist/security/hooks/useBulkSecretOperations.d.ts +0 -7
- package/dist/security/hooks/useBulkSecretOperations.d.ts.map +0 -1
- package/dist/security/hooks/useClipboardAutoClear.d.ts +0 -10
- package/dist/security/hooks/useClipboardAutoClear.d.ts.map +0 -1
- package/dist/security/hooks/useImportExport.d.ts +0 -55
- package/dist/security/hooks/useImportExport.d.ts.map +0 -1
- package/dist/security/hooks/usePasswordGenerator.d.ts +0 -18
- package/dist/security/hooks/usePasswordGenerator.d.ts.map +0 -1
- package/dist/security/hooks/useProviderQueries.d.ts +0 -8
- package/dist/security/hooks/useProviderQueries.d.ts.map +0 -1
- package/dist/security/hooks/useSecretQueries.d.ts +0 -10
- package/dist/security/hooks/useSecretQueries.d.ts.map +0 -1
- package/dist/security/hooks/useSecretValue.d.ts +0 -12
- package/dist/security/hooks/useSecretValue.d.ts.map +0 -1
- package/dist/security/hooks/useSecurityCacheInvalidation.d.ts +0 -2
- package/dist/security/hooks/useSecurityCacheInvalidation.d.ts.map +0 -1
- package/dist/security/hooks/useSecurityDashboard.d.ts +0 -21
- package/dist/security/hooks/useSecurityDashboard.d.ts.map +0 -1
- package/dist/security/hooks/useSecurityEventEmitter.d.ts +0 -14
- package/dist/security/hooks/useSecurityEventEmitter.d.ts.map +0 -1
- package/dist/security/hooks/useSecuritySubscriptions.d.ts +0 -21
- package/dist/security/hooks/useSecuritySubscriptions.d.ts.map +0 -1
- package/dist/security/hooks/useVaultQueries.d.ts +0 -14
- package/dist/security/hooks/useVaultQueries.d.ts.map +0 -1
- package/dist/security/index.d.ts +0 -31
- package/dist/security/index.d.ts.map +0 -1
- package/dist/security/pages/AccessReviewPage.d.ts +0 -2
- package/dist/security/pages/AccessReviewPage.d.ts.map +0 -1
- package/dist/security/pages/AuditLogPage.d.ts +0 -2
- package/dist/security/pages/AuditLogPage.d.ts.map +0 -1
- package/dist/security/pages/ImportExportPage.d.ts +0 -2
- package/dist/security/pages/ImportExportPage.d.ts.map +0 -1
- package/dist/security/pages/ProviderDetailPage.d.ts +0 -2
- package/dist/security/pages/ProviderDetailPage.d.ts.map +0 -1
- package/dist/security/pages/ProvidersPage.d.ts +0 -2
- package/dist/security/pages/ProvidersPage.d.ts.map +0 -1
- package/dist/security/pages/SecretCreatePage.d.ts +0 -2
- package/dist/security/pages/SecretCreatePage.d.ts.map +0 -1
- package/dist/security/pages/SecretDetailPage.d.ts +0 -2
- package/dist/security/pages/SecretDetailPage.d.ts.map +0 -1
- package/dist/security/pages/SecurityDashboardPage.d.ts +0 -2
- package/dist/security/pages/SecurityDashboardPage.d.ts.map +0 -1
- package/dist/security/pages/VaultCreatePage.d.ts +0 -2
- package/dist/security/pages/VaultCreatePage.d.ts.map +0 -1
- package/dist/security/pages/VaultDetailPage.d.ts +0 -2
- package/dist/security/pages/VaultDetailPage.d.ts.map +0 -1
- package/dist/security/pages/VaultLandingPage.d.ts +0 -10
- package/dist/security/pages/VaultLandingPage.d.ts.map +0 -1
- package/dist/security/pages/VaultSettingsPage.d.ts +0 -2
- package/dist/security/pages/VaultSettingsPage.d.ts.map +0 -1
- package/dist/security/pages/VaultsDashboardPage.d.ts +0 -2
- package/dist/security/pages/VaultsDashboardPage.d.ts.map +0 -1
- package/dist/security/providers/SecurityProvider.d.ts +0 -13
- package/dist/security/providers/SecurityProvider.d.ts.map +0 -1
- package/dist/security/routes/SecurityAdminRoutes.d.ts +0 -7
- package/dist/security/routes/SecurityAdminRoutes.d.ts.map +0 -1
- package/dist/security/routes/SecurityRoutes.d.ts +0 -19
- package/dist/security/routes/SecurityRoutes.d.ts.map +0 -1
- package/dist/security/routes/SecurityUserRoutes.d.ts +0 -11
- package/dist/security/routes/SecurityUserRoutes.d.ts.map +0 -1
- package/dist/security/routes/routeUtils.d.ts +0 -28
- package/dist/security/routes/routeUtils.d.ts.map +0 -1
- package/dist/security/store/securityStore.d.ts +0 -35
- package/dist/security/store/securityStore.d.ts.map +0 -1
- package/dist/security/types/index.d.ts +0 -283
- package/dist/security/types/index.d.ts.map +0 -1
- package/dist/security/utils/clipboard.d.ts +0 -20
- package/dist/security/utils/clipboard.d.ts.map +0 -1
- package/dist/security/utils/cn.d.ts +0 -7
- package/dist/security/utils/cn.d.ts.map +0 -1
- package/dist/security/utils/fileParser.d.ts +0 -18
- package/dist/security/utils/fileParser.d.ts.map +0 -1
- package/dist/security/utils/i18n.d.ts +0 -5
- package/dist/security/utils/i18n.d.ts.map +0 -1
- package/dist/security/utils/importParsers.d.ts +0 -30
- package/dist/security/utils/importParsers.d.ts.map +0 -1
- package/dist/security/utils/mappers.d.ts +0 -35
- package/dist/security/utils/mappers.d.ts.map +0 -1
- package/dist/security/utils/passwordGenerator.d.ts +0 -22
- package/dist/security/utils/passwordGenerator.d.ts.map +0 -1
- package/dist/utils/nativeBridge.d.ts +0 -3
- package/dist/utils/nativeBridge.d.ts.map +0 -1
|
@@ -31,7 +31,7 @@ var b = () => {
|
|
|
31
31
|
children: [
|
|
32
32
|
/* @__PURE__ */ u("div", {
|
|
33
33
|
className: "p-3 rounded-full bg-primary/10",
|
|
34
|
-
children: /* @__PURE__ */ u(v, { className: "
|
|
34
|
+
children: /* @__PURE__ */ u(v, { className: "size-8 text-primary" })
|
|
35
35
|
}),
|
|
36
36
|
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("h3", {
|
|
37
37
|
className: "font-semibold text-foreground",
|
|
@@ -53,7 +53,8 @@ var b = () => {
|
|
|
53
53
|
type: "file",
|
|
54
54
|
accept: ".json,.csv,.env,.zip.enc,.boffbackup,.backup.enc",
|
|
55
55
|
onChange: P,
|
|
56
|
-
className: "hidden"
|
|
56
|
+
className: "hidden",
|
|
57
|
+
"aria-label": "Choose secrets file to import"
|
|
57
58
|
})]
|
|
58
59
|
});
|
|
59
60
|
if (x.status === "error") return /* @__PURE__ */ u(r, {
|
|
@@ -62,7 +63,7 @@ var b = () => {
|
|
|
62
63
|
className: "flex items-start gap-4",
|
|
63
64
|
children: [/* @__PURE__ */ u("div", {
|
|
64
65
|
className: "p-2 rounded-lg bg-destructive/10",
|
|
65
|
-
children: /* @__PURE__ */ u(y, { className: "
|
|
66
|
+
children: /* @__PURE__ */ u(y, { className: "size-6 text-destructive" })
|
|
66
67
|
}), /* @__PURE__ */ d("div", {
|
|
67
68
|
className: "flex-1",
|
|
68
69
|
children: [
|
|
@@ -93,7 +94,7 @@ var b = () => {
|
|
|
93
94
|
className: "p-6",
|
|
94
95
|
children: [/* @__PURE__ */ d("div", {
|
|
95
96
|
className: "flex items-center gap-3 mb-4",
|
|
96
|
-
children: [u(e ? p : h, { className: "
|
|
97
|
+
children: [u(e ? p : h, { className: "size-5 text-primary" }), /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("h3", {
|
|
97
98
|
className: "font-semibold text-foreground",
|
|
98
99
|
children: x.fileName
|
|
99
100
|
}), /* @__PURE__ */ u("p", {
|
|
@@ -124,7 +125,7 @@ var b = () => {
|
|
|
124
125
|
children: "Value"
|
|
125
126
|
})
|
|
126
127
|
]
|
|
127
|
-
}) }), /* @__PURE__ */ u("tbody", { children: x.parsedSecrets.slice(0, 20).map((e
|
|
128
|
+
}) }), /* @__PURE__ */ u("tbody", { children: x.parsedSecrets.slice(0, 20).map((e) => /* @__PURE__ */ d("tr", {
|
|
128
129
|
className: "border-b border-border last:border-b-0",
|
|
129
130
|
children: [
|
|
130
131
|
/* @__PURE__ */ u("td", {
|
|
@@ -147,7 +148,7 @@ var b = () => {
|
|
|
147
148
|
children: "*".repeat(Math.min(16, e.value.length))
|
|
148
149
|
})
|
|
149
150
|
]
|
|
150
|
-
},
|
|
151
|
+
}, `${e.name}:${e.key ?? ""}`)) })]
|
|
151
152
|
}), x.parsedSecrets.length > 20 && /* @__PURE__ */ d("p", {
|
|
152
153
|
className: "text-xs text-muted-foreground text-center py-2",
|
|
153
154
|
children: [
|
|
@@ -188,7 +189,7 @@ var b = () => {
|
|
|
188
189
|
}), /* @__PURE__ */ d(n, {
|
|
189
190
|
onClick: () => w(O, A),
|
|
190
191
|
disabled: !O || S || e && !A.trim(),
|
|
191
|
-
children: [S ? /* @__PURE__ */ u(_, { className: "
|
|
192
|
+
children: [S ? /* @__PURE__ */ u(_, { className: "size-4 animate-spin" }) : u(e ? g : v, { className: "size-4" }), S ? "Importing..." : e ? "Restore Backup" : `Import ${x.parsedSecrets.length} Secrets`]
|
|
192
193
|
})]
|
|
193
194
|
})
|
|
194
195
|
]
|
|
@@ -200,10 +201,10 @@ var b = () => {
|
|
|
200
201
|
children: /* @__PURE__ */ d("div", {
|
|
201
202
|
className: "flex flex-col items-center gap-3 text-center",
|
|
202
203
|
children: [
|
|
203
|
-
/* @__PURE__ */ u(_, { className: "
|
|
204
|
+
/* @__PURE__ */ u(_, { className: "size-8 animate-spin text-primary" }),
|
|
204
205
|
/* @__PURE__ */ u("h3", {
|
|
205
206
|
className: "font-semibold text-foreground",
|
|
206
|
-
children: "Importing secrets
|
|
207
|
+
children: "Importing secrets…"
|
|
207
208
|
}),
|
|
208
209
|
/* @__PURE__ */ u("p", {
|
|
209
210
|
className: "text-sm text-muted-foreground",
|
|
@@ -220,7 +221,7 @@ var b = () => {
|
|
|
220
221
|
className: "flex items-start gap-4",
|
|
221
222
|
children: [/* @__PURE__ */ u("div", {
|
|
222
223
|
className: e("p-2 rounded-lg", s),
|
|
223
|
-
children: u(i ? f : a ? h : m, { className: e("
|
|
224
|
+
children: u(i ? f : a ? h : m, { className: e("size-6", c) })
|
|
224
225
|
}), /* @__PURE__ */ d("div", {
|
|
225
226
|
className: "flex-1",
|
|
226
227
|
children: [
|
|
@@ -251,10 +252,10 @@ var b = () => {
|
|
|
251
252
|
}),
|
|
252
253
|
x.results.errors.length > 0 && /* @__PURE__ */ u("ul", {
|
|
253
254
|
className: "mt-3 space-y-1",
|
|
254
|
-
children: x.results.errors.map((e
|
|
255
|
+
children: x.results.errors.map((e) => /* @__PURE__ */ d("li", {
|
|
255
256
|
className: "text-sm text-destructive flex items-center gap-1",
|
|
256
|
-
children: [/* @__PURE__ */ u(f, { className: "
|
|
257
|
-
},
|
|
257
|
+
children: [/* @__PURE__ */ u(f, { className: "size-3 shrink-0" }), e]
|
|
258
|
+
}, e))
|
|
258
259
|
}),
|
|
259
260
|
/* @__PURE__ */ u(n, {
|
|
260
261
|
variant: "outline",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImportWizard.js","names":[],"sources":["../../../src/security/components/ImportWizard.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useRef, useState } from 'react';\nimport {\n Upload,\n FileText,\n CheckCircle,\n XCircle,\n AlertTriangle,\n Loader2,\n KeyRound,\n ArchiveRestore,\n} from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { Button, Card, Badge, Select, Input } from './ui';\nimport { useImportExport } from '../hooks/useImportExport';\nimport { useGetVaults } from '../hooks/useVaultQueries';\n\n/**\n * Multi-step import wizard supporting plain secret imports and encrypted backup restores.\n */\nexport const ImportWizard: FC = () => {\n const fileInputRef = useRef<HTMLInputElement>(null);\n const { importState, importing, handleFileSelect, executeImport, resetImport } =\n useImportExport();\n const { data: vaultsData } = useGetVaults(undefined, { limit: 100 });\n const vaults = vaultsData?.getVaults?.items ?? [];\n const [selectedVaultId, setSelectedVaultId] = useState('');\n const [backupPassword, setBackupPassword] = useState('');\n\n const vaultOptions = [\n { value: '', label: 'Select a vault...' },\n ...vaults.map((vault: Record<string, unknown>) => ({\n value: vault.id as string,\n label: vault.name as string,\n })),\n ];\n\n const handleFileDrop = (event: React.DragEvent) => {\n event.preventDefault();\n const file = event.dataTransfer.files[0];\n if (file) handleFileSelect(file);\n };\n\n const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const file = event.target.files?.[0];\n if (file) handleFileSelect(file);\n };\n\n if (importState.status === 'idle') {\n return (\n <Card\n className={cn(\n 'p-8 border-2 border-dashed border-border',\n 'flex flex-col items-center justify-center text-center cursor-pointer',\n 'hover:border-primary/50 transition-colors'\n )}\n onClick={() => fileInputRef.current?.click()}\n >\n <div\n onDragOver={(event) => event.preventDefault()}\n onDrop={handleFileDrop}\n className=\"flex flex-col items-center gap-3\"\n >\n <div className=\"p-3 rounded-full bg-primary/10\">\n <Upload className=\"h-8 w-8 text-primary\" />\n </div>\n <div>\n <h3 className=\"font-semibold text-foreground\">Upload import file</h3>\n <p className=\"text-sm text-muted-foreground mt-1\">\n Supported: .json, .csv, .env, .zip.enc, .boffbackup\n </p>\n </div>\n <Button\n variant=\"outline\"\n onClick={(event) => {\n event.stopPropagation();\n fileInputRef.current?.click();\n }}\n >\n Browse Files\n </Button>\n </div>\n <input\n ref={fileInputRef}\n type=\"file\"\n accept=\".json,.csv,.env,.zip.enc,.boffbackup,.backup.enc\"\n onChange={handleFileChange}\n className=\"hidden\"\n />\n </Card>\n );\n }\n\n if (importState.status === 'error') {\n return (\n <Card className=\"p-6\">\n <div className=\"flex items-start gap-4\">\n <div className=\"p-2 rounded-lg bg-destructive/10\">\n <XCircle className=\"h-6 w-6 text-destructive\" />\n </div>\n <div className=\"flex-1\">\n <h3 className=\"font-semibold text-destructive\">Import failed</h3>\n <p className=\"text-sm text-muted-foreground mt-1\">{importState.error}</p>\n <Button variant=\"outline\" size=\"sm\" className=\"mt-3\" onClick={resetImport}>\n Try Again\n </Button>\n </div>\n </div>\n </Card>\n );\n }\n\n if (importState.status === 'ready') {\n const isBackup = importState.sourceType === 'backup';\n\n return (\n <div className=\"space-y-4\">\n <Card className=\"p-6\">\n <div className=\"flex items-center gap-3 mb-4\">\n {isBackup ? (\n <ArchiveRestore className=\"h-5 w-5 text-primary\" />\n ) : (\n <FileText className=\"h-5 w-5 text-primary\" />\n )}\n <div>\n <h3 className=\"font-semibold text-foreground\">{importState.fileName}</h3>\n <p className=\"text-sm text-muted-foreground\">\n {isBackup\n ? 'Encrypted backup archive detected. Provide the emailed password to restore it.'\n : `${importState.parsedSecrets.length} secrets found`}\n </p>\n </div>\n </div>\n\n {!isBackup && (\n <div className=\"overflow-x-auto border rounded-md border-border\">\n <table className=\"w-full text-sm\">\n <thead>\n <tr className=\"border-b border-border bg-muted/50\">\n <th className=\"text-left py-2 px-3 font-medium text-muted-foreground\">Name</th>\n <th className=\"text-left py-2 px-3 font-medium text-muted-foreground\">Key</th>\n <th className=\"text-left py-2 px-3 font-medium text-muted-foreground\">Type</th>\n <th className=\"text-left py-2 px-3 font-medium text-muted-foreground\">Value</th>\n </tr>\n </thead>\n <tbody>\n {importState.parsedSecrets.slice(0, 20).map((secret, index) => (\n <tr key={index} className=\"border-b border-border last:border-b-0\">\n <td className=\"py-2 px-3 font-medium\">{secret.name}</td>\n <td className=\"py-2 px-3 font-mono text-muted-foreground\">{secret.key}</td>\n <td className=\"py-2 px-3\">\n <Badge variant=\"outline\">{secret.type}</Badge>\n </td>\n <td className=\"py-2 px-3 font-mono text-muted-foreground\">\n {'*'.repeat(Math.min(16, secret.value.length))}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n {importState.parsedSecrets.length > 20 && (\n <p className=\"text-xs text-muted-foreground text-center py-2\">\n ...and {importState.parsedSecrets.length - 20} more\n </p>\n )}\n </div>\n )}\n </Card>\n\n <Card className=\"p-6 space-y-3\">\n <h3 className=\"font-semibold text-foreground\">Import destination</h3>\n <Select\n label=\"Target Vault\"\n value={selectedVaultId}\n onChange={setSelectedVaultId}\n options={vaultOptions}\n />\n\n {isBackup && (\n <Input\n id=\"backup-password\"\n label=\"Backup Password\"\n type=\"password\"\n value={backupPassword}\n onChange={(event) => setBackupPassword(event.target.value)}\n placeholder=\"Paste the password from your email\"\n required\n />\n )}\n\n <div className=\"flex justify-end gap-2 pt-2\">\n <Button variant=\"outline\" onClick={resetImport}>\n Cancel\n </Button>\n <Button\n onClick={() => executeImport(selectedVaultId, backupPassword)}\n disabled={!selectedVaultId || importing || (isBackup && !backupPassword.trim())}\n >\n {importing ? (\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n ) : isBackup ? (\n <KeyRound className=\"h-4 w-4\" />\n ) : (\n <Upload className=\"h-4 w-4\" />\n )}\n {importing\n ? 'Importing...'\n : isBackup\n ? 'Restore Backup'\n : `Import ${importState.parsedSecrets.length} Secrets`}\n </Button>\n </div>\n </Card>\n </div>\n );\n }\n\n if (importState.status === 'importing') {\n return (\n <Card className=\"p-8\">\n <div className=\"flex flex-col items-center gap-3 text-center\">\n <Loader2 className=\"h-8 w-8 animate-spin text-primary\" />\n <h3 className=\"font-semibold text-foreground\">Importing secrets...</h3>\n <p className=\"text-sm text-muted-foreground\">This may take a moment.</p>\n </div>\n </Card>\n );\n }\n\n if (\n (importState.status === 'completed' ||\n importState.status === 'partial' ||\n importState.status === 'skipped') &&\n importState.results\n ) {\n const isPartial = importState.status === 'partial';\n const isSkipped = importState.status === 'skipped';\n\n const headerCopy = isPartial\n ? 'Import partially completed'\n : isSkipped\n ? 'Nothing imported'\n : 'Import complete';\n\n const headerIconClass = isPartial\n ? 'bg-status-warning-bg-subtle'\n : isSkipped\n ? 'bg-muted'\n : 'bg-status-success-bg-subtle';\n const headerIconColor = isPartial\n ? 'text-status-warning-text'\n : isSkipped\n ? 'text-muted-foreground'\n : 'text-status-success-text';\n\n return (\n <Card className=\"p-6\">\n <div className=\"flex items-start gap-4\">\n <div className={cn('p-2 rounded-lg', headerIconClass)}>\n {isPartial ? (\n <AlertTriangle className={cn('h-6 w-6', headerIconColor)} />\n ) : isSkipped ? (\n <FileText className={cn('h-6 w-6', headerIconColor)} />\n ) : (\n <CheckCircle className={cn('h-6 w-6', headerIconColor)} />\n )}\n </div>\n <div className=\"flex-1\">\n <h3 className=\"font-semibold text-foreground\">{headerCopy}</h3>\n {/*\n The summary message is only rendered for the partial /\n skipped statuses by design — `completed` should always have\n `error: null` per the state machine contract. Gating\n explicitly on the status here (rather than just\n `importState.error && ...`) means a future caller that\n forgets to clear `error` when transitioning to `completed`\n cannot accidentally show a muted message under the green\n success header.\n */}\n {(isPartial || isSkipped) && importState.error && (\n <p className=\"text-sm text-muted-foreground mt-1\">{importState.error}</p>\n )}\n <div className=\"flex items-center gap-3 mt-2\">\n <Badge variant=\"success\">{importState.results.imported} imported</Badge>\n {importState.results.skipped > 0 && (\n <Badge variant=\"warning\">{importState.results.skipped} skipped</Badge>\n )}\n {importState.results.errors.length > 0 && (\n <Badge variant=\"destructive\">{importState.results.errors.length} errors</Badge>\n )}\n </div>\n {importState.results.errors.length > 0 && (\n <ul className=\"mt-3 space-y-1\">\n {importState.results.errors.map((error, index) => (\n <li key={index} className=\"text-sm text-destructive flex items-center gap-1\">\n <AlertTriangle className=\"h-3 w-3 shrink-0\" />\n {error}\n </li>\n ))}\n </ul>\n )}\n <Button variant=\"outline\" size=\"sm\" className=\"mt-4\" onClick={resetImport}>\n Import More\n </Button>\n </div>\n </div>\n </Card>\n );\n }\n\n return null;\n};\n"],"mappings":";;;;;;;;AAoBA,IAAa,UAAyB;CACpC,IAAM,IAAe,EAAyB,KAAK,EAC7C,EAAE,gBAAa,cAAW,qBAAkB,kBAAe,mBAC/D,GAAiB,EACb,EAAE,MAAM,MAAe,EAAa,KAAA,GAAW,EAAE,OAAO,KAAK,CAAC,EAC9D,IAAS,GAAY,WAAW,SAAS,EAAE,EAC3C,CAAC,GAAiB,KAAsB,EAAS,GAAG,EACpD,CAAC,GAAgB,KAAqB,EAAS,GAAG,EAElD,IAAe,CACnB;EAAE,OAAO;EAAI,OAAO;EAAqB,EACzC,GAAG,EAAO,KAAK,OAAoC;EACjD,OAAO,EAAM;EACb,OAAO,EAAM;EACd,EAAE,CACJ,EAEK,KAAkB,MAA2B;AACjD,IAAM,gBAAgB;EACtB,IAAM,IAAO,EAAM,aAAa,MAAM;AACtC,EAAI,KAAM,EAAiB,EAAK;IAG5B,KAAoB,MAA+C;EACvE,IAAM,IAAO,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B,gCACA,IACE,aACA,+BACA,IAAkB,IACpB,6BACA,IACE,0BACA;AAEN,SACE,kBAAC,GAAD;GAAM,WAAU;aACd,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,OAAD;KAAK,WAAW,EAAG,kBAAkB,EAAgB;eAEjD,EADD,IACE,IACC,IACD,IAEA,GAJD,EAAe,WAAW,EAAG,WAAW,EAAgB,EAAI,CAIF;KAExD,CAAA,EACN,kBAAC,OAAD;KAAK,WAAU;eAAf;MACE,kBAAC,MAAD;OAAI,WAAU;iBAAiC;OAAgB,CAAA;OAW7D,KAAa,MAAc,EAAY,SACvC,kBAAC,KAAD;OAAG,WAAU;iBAAsC,EAAY;OAAU,CAAA;MAE3E,kBAAC,OAAD;OAAK,WAAU;iBAAf;QACE,kBAAC,GAAD;SAAO,SAAQ;mBAAf,CAA0B,EAAY,QAAQ,UAAS,YAAiB;;QACvE,EAAY,QAAQ,UAAU,KAC7B,kBAAC,GAAD;SAAO,SAAQ;mBAAf,CAA0B,EAAY,QAAQ,SAAQ,WAAgB;;QAEvE,EAAY,QAAQ,OAAO,SAAS,KACnC,kBAAC,GAAD;SAAO,SAAQ;mBAAf,CAA8B,EAAY,QAAQ,OAAO,QAAO,UAAe;;QAE7E;;MACL,EAAY,QAAQ,OAAO,SAAS,KACnC,kBAAC,MAAD;OAAI,WAAU;iBACX,EAAY,QAAQ,OAAO,KAAK,GAAO,MACtC,kBAAC,MAAD;QAAgB,WAAU;kBAA1B,CACE,kBAAC,GAAD,EAAe,WAAU,oBAAqB,CAAA,EAC7C,EACE;UAHI,EAGJ,CACL;OACC,CAAA;MAEP,kBAAC,GAAD;OAAQ,SAAQ;OAAU,MAAK;OAAK,WAAU;OAAO,SAAS;iBAAa;OAElE,CAAA;MACL;OACF;;GACD,CAAA;;AAIX,QAAO"}
|
|
1
|
+
{"version":3,"file":"ImportWizard.js","names":[],"sources":["../../../src/security/components/ImportWizard.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useRef, useState } from 'react';\nimport {\n Upload,\n FileText,\n CheckCircle,\n XCircle,\n AlertTriangle,\n Loader2,\n KeyRound,\n ArchiveRestore,\n} from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { Button, Card, Badge, Select, Input } from './ui';\nimport { useImportExport } from '../hooks/useImportExport';\nimport { useGetVaults } from '../hooks/useVaultQueries';\n\n/**\n * Multi-step import wizard supporting plain secret imports and encrypted backup restores.\n */\nexport const ImportWizard: FC = () => {\n const fileInputRef = useRef<HTMLInputElement>(null);\n const { importState, importing, handleFileSelect, executeImport, resetImport } =\n useImportExport();\n const { data: vaultsData } = useGetVaults(undefined, { limit: 100 });\n const vaults = vaultsData?.getVaults?.items ?? [];\n const [selectedVaultId, setSelectedVaultId] = useState('');\n const [backupPassword, setBackupPassword] = useState('');\n\n const vaultOptions = [\n { value: '', label: 'Select a vault...' },\n ...vaults.map((vault: Record<string, unknown>) => ({\n value: vault.id as string,\n label: vault.name as string,\n })),\n ];\n\n const handleFileDrop = (event: React.DragEvent) => {\n event.preventDefault();\n const file = event.dataTransfer.files[0];\n if (file) handleFileSelect(file);\n };\n\n const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const file = event.target.files?.[0];\n if (file) handleFileSelect(file);\n };\n\n if (importState.status === 'idle') {\n return (\n <Card\n className={cn(\n 'p-8 border-2 border-dashed border-border',\n 'flex flex-col items-center justify-center text-center cursor-pointer',\n 'hover:border-primary/50 transition-colors'\n )}\n onClick={() => fileInputRef.current?.click()}\n >\n <div\n onDragOver={(event) => event.preventDefault()}\n onDrop={handleFileDrop}\n className=\"flex flex-col items-center gap-3\"\n >\n <div className=\"p-3 rounded-full bg-primary/10\">\n <Upload className=\"size-8 text-primary\" />\n </div>\n <div>\n <h3 className=\"font-semibold text-foreground\">Upload import file</h3>\n <p className=\"text-sm text-muted-foreground mt-1\">\n Supported: .json, .csv, .env, .zip.enc, .boffbackup\n </p>\n </div>\n <Button\n variant=\"outline\"\n onClick={(event) => {\n event.stopPropagation();\n fileInputRef.current?.click();\n }}\n >\n Browse Files\n </Button>\n </div>\n <input\n ref={fileInputRef}\n type=\"file\"\n accept=\".json,.csv,.env,.zip.enc,.boffbackup,.backup.enc\"\n onChange={handleFileChange}\n className=\"hidden\"\n aria-label=\"Choose secrets file to import\"\n />\n </Card>\n );\n }\n\n if (importState.status === 'error') {\n return (\n <Card className=\"p-6\">\n <div className=\"flex items-start gap-4\">\n <div className=\"p-2 rounded-lg bg-destructive/10\">\n <XCircle className=\"size-6 text-destructive\" />\n </div>\n <div className=\"flex-1\">\n <h3 className=\"font-semibold text-destructive\">Import failed</h3>\n <p className=\"text-sm text-muted-foreground mt-1\">{importState.error}</p>\n <Button variant=\"outline\" size=\"sm\" className=\"mt-3\" onClick={resetImport}>\n Try Again\n </Button>\n </div>\n </div>\n </Card>\n );\n }\n\n if (importState.status === 'ready') {\n const isBackup = importState.sourceType === 'backup';\n\n return (\n <div className=\"space-y-4\">\n <Card className=\"p-6\">\n <div className=\"flex items-center gap-3 mb-4\">\n {isBackup ? (\n <ArchiveRestore className=\"size-5 text-primary\" />\n ) : (\n <FileText className=\"size-5 text-primary\" />\n )}\n <div>\n <h3 className=\"font-semibold text-foreground\">{importState.fileName}</h3>\n <p className=\"text-sm text-muted-foreground\">\n {isBackup\n ? 'Encrypted backup archive detected. Provide the emailed password to restore it.'\n : `${importState.parsedSecrets.length} secrets found`}\n </p>\n </div>\n </div>\n\n {!isBackup && (\n <div className=\"overflow-x-auto border rounded-md border-border\">\n <table className=\"w-full text-sm\">\n <thead>\n <tr className=\"border-b border-border bg-muted/50\">\n <th className=\"text-left py-2 px-3 font-medium text-muted-foreground\">Name</th>\n <th className=\"text-left py-2 px-3 font-medium text-muted-foreground\">Key</th>\n <th className=\"text-left py-2 px-3 font-medium text-muted-foreground\">Type</th>\n <th className=\"text-left py-2 px-3 font-medium text-muted-foreground\">Value</th>\n </tr>\n </thead>\n <tbody>\n {importState.parsedSecrets.slice(0, 20).map((secret) => (\n <tr\n key={`${secret.name}:${secret.key ?? ''}`}\n className=\"border-b border-border last:border-b-0\"\n >\n <td className=\"py-2 px-3 font-medium\">{secret.name}</td>\n <td className=\"py-2 px-3 font-mono text-muted-foreground\">{secret.key}</td>\n <td className=\"py-2 px-3\">\n <Badge variant=\"outline\">{secret.type}</Badge>\n </td>\n <td className=\"py-2 px-3 font-mono text-muted-foreground\">\n {'*'.repeat(Math.min(16, secret.value.length))}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n {importState.parsedSecrets.length > 20 && (\n <p className=\"text-xs text-muted-foreground text-center py-2\">\n ...and {importState.parsedSecrets.length - 20} more\n </p>\n )}\n </div>\n )}\n </Card>\n\n <Card className=\"p-6 space-y-3\">\n <h3 className=\"font-semibold text-foreground\">Import destination</h3>\n <Select\n label=\"Target Vault\"\n value={selectedVaultId}\n onChange={setSelectedVaultId}\n options={vaultOptions}\n />\n\n {isBackup && (\n <Input\n id=\"backup-password\"\n label=\"Backup Password\"\n type=\"password\"\n value={backupPassword}\n onChange={(event) => setBackupPassword(event.target.value)}\n placeholder=\"Paste the password from your email\"\n required\n />\n )}\n\n <div className=\"flex justify-end gap-2 pt-2\">\n <Button variant=\"outline\" onClick={resetImport}>\n Cancel\n </Button>\n <Button\n onClick={() => executeImport(selectedVaultId, backupPassword)}\n disabled={!selectedVaultId || importing || (isBackup && !backupPassword.trim())}\n >\n {importing ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : isBackup ? (\n <KeyRound className=\"size-4\" />\n ) : (\n <Upload className=\"size-4\" />\n )}\n {importing\n ? 'Importing...'\n : isBackup\n ? 'Restore Backup'\n : `Import ${importState.parsedSecrets.length} Secrets`}\n </Button>\n </div>\n </Card>\n </div>\n );\n }\n\n if (importState.status === 'importing') {\n return (\n <Card className=\"p-8\">\n <div className=\"flex flex-col items-center gap-3 text-center\">\n <Loader2 className=\"size-8 animate-spin text-primary\" />\n <h3 className=\"font-semibold text-foreground\">Importing secrets…</h3>\n <p className=\"text-sm text-muted-foreground\">This may take a moment.</p>\n </div>\n </Card>\n );\n }\n\n if (\n (importState.status === 'completed' ||\n importState.status === 'partial' ||\n importState.status === 'skipped') &&\n importState.results\n ) {\n const isPartial = importState.status === 'partial';\n const isSkipped = importState.status === 'skipped';\n\n const headerCopy = isPartial\n ? 'Import partially completed'\n : isSkipped\n ? 'Nothing imported'\n : 'Import complete';\n\n const headerIconClass = isPartial\n ? 'bg-status-warning-bg-subtle'\n : isSkipped\n ? 'bg-muted'\n : 'bg-status-success-bg-subtle';\n const headerIconColor = isPartial\n ? 'text-status-warning-text'\n : isSkipped\n ? 'text-muted-foreground'\n : 'text-status-success-text';\n\n return (\n <Card className=\"p-6\">\n <div className=\"flex items-start gap-4\">\n <div className={cn('p-2 rounded-lg', headerIconClass)}>\n {isPartial ? (\n <AlertTriangle className={cn('size-6', headerIconColor)} />\n ) : isSkipped ? (\n <FileText className={cn('size-6', headerIconColor)} />\n ) : (\n <CheckCircle className={cn('size-6', headerIconColor)} />\n )}\n </div>\n <div className=\"flex-1\">\n <h3 className=\"font-semibold text-foreground\">{headerCopy}</h3>\n {/*\n The summary message is only rendered for the partial /\n skipped statuses by design — `completed` should always have\n `error: null` per the state machine contract. Gating\n explicitly on the status here (rather than just\n `importState.error && ...`) means a future caller that\n forgets to clear `error` when transitioning to `completed`\n cannot accidentally show a muted message under the green\n success header.\n */}\n {(isPartial || isSkipped) && importState.error && (\n <p className=\"text-sm text-muted-foreground mt-1\">{importState.error}</p>\n )}\n <div className=\"flex items-center gap-3 mt-2\">\n <Badge variant=\"success\">{importState.results.imported} imported</Badge>\n {importState.results.skipped > 0 && (\n <Badge variant=\"warning\">{importState.results.skipped} skipped</Badge>\n )}\n {importState.results.errors.length > 0 && (\n <Badge variant=\"destructive\">{importState.results.errors.length} errors</Badge>\n )}\n </div>\n {importState.results.errors.length > 0 && (\n <ul className=\"mt-3 space-y-1\">\n {importState.results.errors.map((error) => (\n <li key={error} className=\"text-sm text-destructive flex items-center gap-1\">\n <AlertTriangle className=\"size-3 shrink-0\" />\n {error}\n </li>\n ))}\n </ul>\n )}\n <Button variant=\"outline\" size=\"sm\" className=\"mt-4\" onClick={resetImport}>\n Import More\n </Button>\n </div>\n </div>\n </Card>\n );\n }\n\n return null;\n};\n"],"mappings":";;;;;;;;AAoBA,IAAa,UAAyB;CACpC,IAAM,IAAe,EAAyB,KAAK,EAC7C,EAAE,gBAAa,cAAW,qBAAkB,kBAAe,mBAC/D,GAAiB,EACb,EAAE,MAAM,MAAe,EAAa,KAAA,GAAW,EAAE,OAAO,KAAK,CAAC,EAC9D,IAAS,GAAY,WAAW,SAAS,EAAE,EAC3C,CAAC,GAAiB,KAAsB,EAAS,GAAG,EACpD,CAAC,GAAgB,KAAqB,EAAS,GAAG,EAElD,IAAe,CACnB;EAAE,OAAO;EAAI,OAAO;EAAqB,EACzC,GAAG,EAAO,KAAK,OAAoC;EACjD,OAAO,EAAM;EACb,OAAO,EAAM;EACd,EAAE,CACJ,EAEK,KAAkB,MAA2B;AACjD,IAAM,gBAAgB;EACtB,IAAM,IAAO,EAAM,aAAa,MAAM;AACtC,EAAI,KAAM,EAAiB,EAAK;IAG5B,KAAoB,MAA+C;EACvE,IAAM,IAAO,EAAM,OAAO,QAAQ;AAClC,EAAI,KAAM,EAAiB,EAAK;;AAGlC,KAAI,EAAY,WAAW,OACzB,QACE,kBAAC,GAAD;EACE,WAAW,EACT,4CACA,wEACA,4CACD;EACD,eAAe,EAAa,SAAS,OAAO;YAN9C,CAQE,kBAAC,OAAD;GACE,aAAa,MAAU,EAAM,gBAAgB;GAC7C,QAAQ;GACR,WAAU;aAHZ;IAKE,kBAAC,OAAD;KAAK,WAAU;eACb,kBAAC,GAAD,EAAQ,WAAU,uBAAwB,CAAA;KACtC,CAAA;IACN,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,MAAD;KAAI,WAAU;eAAgC;KAAuB,CAAA,EACrE,kBAAC,KAAD;KAAG,WAAU;eAAqC;KAE9C,CAAA,CACA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U,CAAA;MAE3E,kBAAC,OAAD;OAAK,WAAU;iBAAf;QACE,kBAAC,GAAD;SAAO,SAAQ;mBAAf,CAA0B,EAAY,QAAQ,UAAS,YAAiB;;QACvE,EAAY,QAAQ,UAAU,KAC7B,kBAAC,GAAD;SAAO,SAAQ;mBAAf,CAA0B,EAAY,QAAQ,SAAQ,WAAgB;;QAEvE,EAAY,QAAQ,OAAO,SAAS,KACnC,kBAAC,GAAD;SAAO,SAAQ;mBAAf,CAA8B,EAAY,QAAQ,OAAO,QAAO,UAAe;;QAE7E;;MACL,EAAY,QAAQ,OAAO,SAAS,KACnC,kBAAC,MAAD;OAAI,WAAU;iBACX,EAAY,QAAQ,OAAO,KAAK,MAC/B,kBAAC,MAAD;QAAgB,WAAU;kBAA1B,CACE,kBAAC,GAAD,EAAe,WAAU,mBAAoB,CAAA,EAC5C,EACE;UAHI,EAGJ,CACL;OACC,CAAA;MAEP,kBAAC,GAAD;OAAQ,SAAQ;OAAU,MAAK;OAAK,WAAU;OAAO,SAAS;iBAAa;OAElE,CAAA;MACL;OACF;;GACD,CAAA;;AAIX,QAAO"}
|
|
@@ -27,10 +27,11 @@ var d = ({ onAccept: d, clipboardAutoClearMs: f = 3e4, className: p }) => {
|
|
|
27
27
|
children: g
|
|
28
28
|
}),
|
|
29
29
|
/* @__PURE__ */ c("button", {
|
|
30
|
+
type: "button",
|
|
30
31
|
onClick: v,
|
|
31
32
|
className: "p-2 rounded-md text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",
|
|
32
33
|
title: "Generate new password",
|
|
33
|
-
children: /* @__PURE__ */ c(u, { className: "
|
|
34
|
+
children: /* @__PURE__ */ c(u, { className: "size-4" })
|
|
34
35
|
}),
|
|
35
36
|
/* @__PURE__ */ c(a, {
|
|
36
37
|
value: g,
|
|
@@ -74,7 +75,8 @@ var d = ({ onAccept: d, clipboardAutoClearMs: f = 3e4, className: p }) => {
|
|
|
74
75
|
max: 128,
|
|
75
76
|
value: m.length,
|
|
76
77
|
onChange: (e) => y("length", parseInt(e.target.value, 10)),
|
|
77
|
-
className: "w-full accent-primary"
|
|
78
|
+
className: "w-full accent-primary",
|
|
79
|
+
"aria-label": "Password length"
|
|
78
80
|
})]
|
|
79
81
|
}),
|
|
80
82
|
/* @__PURE__ */ l("div", {
|
|
@@ -102,7 +104,8 @@ var d = ({ onAccept: d, clipboardAutoClearMs: f = 3e4, className: p }) => {
|
|
|
102
104
|
type: "checkbox",
|
|
103
105
|
checked: m[e],
|
|
104
106
|
onChange: (t) => y(e, t.target.checked),
|
|
105
|
-
className: "rounded accent-primary"
|
|
107
|
+
className: "rounded accent-primary",
|
|
108
|
+
"aria-label": t
|
|
106
109
|
}), t]
|
|
107
110
|
}, e)), /* @__PURE__ */ l("label", {
|
|
108
111
|
className: "flex items-center gap-2 text-sm cursor-pointer col-span-2",
|
|
@@ -110,7 +113,8 @@ var d = ({ onAccept: d, clipboardAutoClearMs: f = 3e4, className: p }) => {
|
|
|
110
113
|
type: "checkbox",
|
|
111
114
|
checked: m.excludeAmbiguous,
|
|
112
115
|
onChange: (e) => y("excludeAmbiguous", e.target.checked),
|
|
113
|
-
className: "rounded accent-primary"
|
|
116
|
+
className: "rounded accent-primary",
|
|
117
|
+
"aria-label": "Exclude ambiguous characters"
|
|
114
118
|
}), "Exclude ambiguous (0, O, l, 1, I)"]
|
|
115
119
|
})]
|
|
116
120
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordGenerator.js","names":[],"sources":["../../../src/security/components/PasswordGenerator.tsx"],"sourcesContent":["import { type FC, useState, useCallback } from 'react';\nimport { RefreshCw } from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport {\n generatePassword,\n calculatePasswordStrength,\n DEFAULT_PASSWORD_OPTIONS,\n type PasswordOptions,\n} from '../utils/passwordGenerator';\nimport { CopyButton } from './CopyButton';\nimport { Button } from './ui';\n\ninterface PasswordGeneratorProps {\n /** Called when user accepts the generated password */\n onAccept: (password: string) => void;\n /** Auto-clear clipboard timer */\n clipboardAutoClearMs?: number;\n /** Additional CSS classes */\n className?: string;\n}\n\n/**\n * Password generator with configurable length, character sets, and strength meter.\n * Uses crypto.getRandomValues for cryptographically secure generation.\n */\nexport const PasswordGenerator: FC<PasswordGeneratorProps> = ({\n onAccept,\n clipboardAutoClearMs = 30000,\n className,\n}) => {\n const [options, setOptions] = useState<PasswordOptions>(DEFAULT_PASSWORD_OPTIONS);\n const [password, setPassword] = useState(() => generatePassword(DEFAULT_PASSWORD_OPTIONS));\n\n const regenerate = useCallback(() => {\n setPassword(generatePassword(options));\n }, [options]);\n\n const handleOptionChange = useCallback(\n (key: keyof PasswordOptions, value: boolean | number) => {\n const newOptions = { ...options, [key]: value };\n setOptions(newOptions);\n setPassword(generatePassword(newOptions));\n },\n [options]\n );\n\n const strength = calculatePasswordStrength(password);\n\n return (\n <div className={cn('space-y-4 rounded-lg border border-border p-4', className)}>\n {/* Generated password display */}\n <div className=\"flex items-center gap-2\">\n <div className=\"flex-1 px-3 py-2 rounded-md border border-border bg-muted/50 font-mono text-sm break-all select-all\">\n {password}\n </div>\n <button\n onClick={regenerate}\n className=\"p-2 rounded-md text-muted-foreground hover:text-foreground hover:bg-accent transition-colors\"\n title=\"Generate new password\"\n >\n <RefreshCw className=\"
|
|
1
|
+
{"version":3,"file":"PasswordGenerator.js","names":[],"sources":["../../../src/security/components/PasswordGenerator.tsx"],"sourcesContent":["import { type FC, useState, useCallback } from 'react';\nimport { RefreshCw } from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport {\n generatePassword,\n calculatePasswordStrength,\n DEFAULT_PASSWORD_OPTIONS,\n type PasswordOptions,\n} from '../utils/passwordGenerator';\nimport { CopyButton } from './CopyButton';\nimport { Button } from './ui';\n\ninterface PasswordGeneratorProps {\n /** Called when user accepts the generated password */\n onAccept: (password: string) => void;\n /** Auto-clear clipboard timer */\n clipboardAutoClearMs?: number;\n /** Additional CSS classes */\n className?: string;\n}\n\n/**\n * Password generator with configurable length, character sets, and strength meter.\n * Uses crypto.getRandomValues for cryptographically secure generation.\n */\nexport const PasswordGenerator: FC<PasswordGeneratorProps> = ({\n onAccept,\n clipboardAutoClearMs = 30000,\n className,\n}) => {\n const [options, setOptions] = useState<PasswordOptions>(DEFAULT_PASSWORD_OPTIONS);\n const [password, setPassword] = useState(() => generatePassword(DEFAULT_PASSWORD_OPTIONS));\n\n const regenerate = useCallback(() => {\n setPassword(generatePassword(options));\n }, [options]);\n\n const handleOptionChange = useCallback(\n (key: keyof PasswordOptions, value: boolean | number) => {\n const newOptions = { ...options, [key]: value };\n setOptions(newOptions);\n setPassword(generatePassword(newOptions));\n },\n [options]\n );\n\n const strength = calculatePasswordStrength(password);\n\n return (\n <div className={cn('space-y-4 rounded-lg border border-border p-4', className)}>\n {/* Generated password display */}\n <div className=\"flex items-center gap-2\">\n <div className=\"flex-1 px-3 py-2 rounded-md border border-border bg-muted/50 font-mono text-sm break-all select-all\">\n {password}\n </div>\n <button type=\"button\"\n onClick={regenerate}\n className=\"p-2 rounded-md text-muted-foreground hover:text-foreground hover:bg-accent transition-colors\"\n title=\"Generate new password\"\n >\n <RefreshCw className=\"size-4\" />\n </button>\n <CopyButton value={password} autoClearMs={clipboardAutoClearMs} />\n </div>\n\n {/* Strength meter */}\n <div className=\"space-y-1\">\n <div className=\"flex justify-between text-xs\">\n <span className=\"text-muted-foreground\">Strength</span>\n <span className=\"font-medium capitalize\">{strength.label}</span>\n </div>\n <div className=\"h-1.5 rounded-full bg-muted overflow-hidden\">\n <div\n className={cn('h-full rounded-full transition-all duration-300', strength.color)}\n style={{ width: `${strength.score}%` }}\n />\n </div>\n </div>\n\n {/* Length slider */}\n <div className=\"space-y-1\">\n <div className=\"flex justify-between text-xs\">\n <span className=\"text-muted-foreground\">Length</span>\n <span className=\"font-medium tabular-nums\">{options.length}</span>\n </div>\n <input\n type=\"range\"\n min={8}\n max={128}\n value={options.length}\n onChange={(e) => handleOptionChange('length', parseInt(e.target.value, 10))}\n className=\"w-full accent-primary\"\n aria-label=\"Password length\"\n />\n </div>\n\n {/* Character set toggles */}\n <div className=\"grid grid-cols-2 gap-2\">\n {[\n { key: 'uppercase' as const, label: 'Uppercase (A-Z)' },\n { key: 'lowercase' as const, label: 'Lowercase (a-z)' },\n { key: 'numbers' as const, label: 'Numbers (0-9)' },\n { key: 'symbols' as const, label: 'Symbols (!@#...)' },\n ].map(({ key, label }) => (\n <label key={key} className=\"flex items-center gap-2 text-sm cursor-pointer\">\n <input\n type=\"checkbox\"\n checked={options[key]}\n onChange={(e) => handleOptionChange(key, e.target.checked)}\n className=\"rounded accent-primary\"\n aria-label={label}\n />\n {label}\n </label>\n ))}\n <label className=\"flex items-center gap-2 text-sm cursor-pointer col-span-2\">\n <input\n type=\"checkbox\"\n checked={options.excludeAmbiguous}\n onChange={(e) => handleOptionChange('excludeAmbiguous', e.target.checked)}\n className=\"rounded accent-primary\"\n aria-label=\"Exclude ambiguous characters\"\n />\n Exclude ambiguous (0, O, l, 1, I)\n </label>\n </div>\n\n {/* Accept button */}\n <Button onClick={() => onAccept(password)} className=\"w-full\">\n Use This Password\n </Button>\n </div>\n );\n};\n"],"mappings":";;;;;;;;AAyBA,IAAa,KAAiD,EAC5D,aACA,0BAAuB,KACvB,mBACI;CACJ,IAAM,CAAC,GAAS,KAAc,EAA0B,EAAyB,EAC3E,CAAC,GAAU,KAAe,QAAe,EAAiB,EAAyB,CAAC,EAEpF,IAAa,QAAkB;AACnC,IAAY,EAAiB,EAAQ,CAAC;IACrC,CAAC,EAAQ,CAAC,EAEP,IAAqB,GACxB,GAA4B,MAA4B;EACvD,IAAM,IAAa;GAAE,GAAG;IAAU,IAAM;GAAO;AAE/C,EADA,EAAW,EAAW,EACtB,EAAY,EAAiB,EAAW,CAAC;IAE3C,CAAC,EAAQ,CACV,EAEK,IAAW,EAA0B,EAAS;AAEpD,QACE,kBAAC,OAAD;EAAK,WAAW,EAAG,iDAAiD,EAAU;YAA9E;GAEE,kBAAC,OAAD;IAAK,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BAAC,SAAD;MACE,MAAK;MACL,SAAS,EAAQ;MACjB,WAAW,MAAM,EAAmB,GAAK,EAAE,OAAO,QAAQ;MAC1D,WAAU;MACV,cAAY;MACZ,CAAA,EACD,EACK;OATI,EASJ,CACR,EACF,kBAAC,SAAD;KAAO,WAAU;eAAjB,CACE,kBAAC,SAAD;MACE,MAAK;MACL,SAAS,EAAQ;MACjB,WAAW,MAAM,EAAmB,oBAAoB,EAAE,OAAO,QAAQ;MACzE,WAAU;MACV,cAAW;MACX,CAAA,EAAA,oCAEI;OACJ;;GAGN,kBAAC,GAAD;IAAQ,eAAe,EAAS,EAAS;IAAE,WAAU;cAAS;IAErD,CAAA;GACL"}
|
|
@@ -23,7 +23,7 @@ var o = ({ status: o, className: s }) => {
|
|
|
23
23
|
return /* @__PURE__ */ n(e, {
|
|
24
24
|
variant: l,
|
|
25
25
|
className: s,
|
|
26
|
-
children: [/* @__PURE__ */ t(u, { className: "
|
|
26
|
+
children: [/* @__PURE__ */ t(u, { className: "size-3" }), c]
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
29
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RotationStatusBadge.js","names":[],"sources":["../../../src/security/components/RotationStatusBadge.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { CheckCircle, AlertCircle, AlertTriangle } from 'lucide-react';\nimport type { RotationStatus } from '../types';\nimport { Badge } from './ui';\n\ninterface RotationStatusBadgeProps {\n status: RotationStatus;\n className?: string;\n}\n\n/**\n * Badge showing rotation status: healthy, due, or overdue.\n */\nexport const RotationStatusBadge: FC<RotationStatusBadgeProps> = ({ status, className }) => {\n const config = {\n healthy: {\n label: 'Healthy',\n variant: 'success' as const,\n Icon: CheckCircle,\n },\n due: {\n label: 'Due',\n variant: 'warning' as const,\n Icon: AlertCircle,\n },\n overdue: {\n label: 'Overdue',\n variant: 'destructive' as const,\n Icon: AlertTriangle,\n },\n };\n\n const { label, variant, Icon } = config[status];\n\n return (\n <Badge variant={variant} className={className}>\n <Icon className=\"
|
|
1
|
+
{"version":3,"file":"RotationStatusBadge.js","names":[],"sources":["../../../src/security/components/RotationStatusBadge.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { CheckCircle, AlertCircle, AlertTriangle } from 'lucide-react';\nimport type { RotationStatus } from '../types';\nimport { Badge } from './ui';\n\ninterface RotationStatusBadgeProps {\n status: RotationStatus;\n className?: string;\n}\n\n/**\n * Badge showing rotation status: healthy, due, or overdue.\n */\nexport const RotationStatusBadge: FC<RotationStatusBadgeProps> = ({ status, className }) => {\n const config = {\n healthy: {\n label: 'Healthy',\n variant: 'success' as const,\n Icon: CheckCircle,\n },\n due: {\n label: 'Due',\n variant: 'warning' as const,\n Icon: AlertCircle,\n },\n overdue: {\n label: 'Overdue',\n variant: 'destructive' as const,\n Icon: AlertTriangle,\n },\n };\n\n const { label, variant, Icon } = config[status];\n\n return (\n <Badge variant={variant} className={className}>\n <Icon className=\"size-3\" />\n {label}\n </Badge>\n );\n};\n"],"mappings":";;;;AAaA,IAAa,KAAqD,EAAE,WAAQ,mBAAgB;CAmB1F,IAAM,EAAE,UAAO,YAAS,YAlBT;EACb,SAAS;GACP,OAAO;GACP,SAAS;GACT,MAAM;GACP;EACD,KAAK;GACH,OAAO;GACP,SAAS;GACT,MAAM;GACP;EACD,SAAS;GACP,OAAO;GACP,SAAS;GACT,MAAM;GACP;EACF,CAEuC;AAExC,QACE,kBAAC,GAAD;EAAgB;EAAoB;YAApC,CACE,kBAAC,GAAD,EAAM,WAAU,UAAW,CAAA,EAC1B,EACK"}
|
|
@@ -6,7 +6,80 @@ import { useState as o } from "react";
|
|
|
6
6
|
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
7
|
import { Minus as l, Plus as u } from "lucide-react";
|
|
8
8
|
//#region src/security/components/SecretFormFields.tsx
|
|
9
|
-
var d = ({ type:
|
|
9
|
+
var d = ({ type: n, value: r, onValueChange: i, showPasswordGen: o, setShowPasswordGen: l }) => n === "CREDENTIAL" ? /* @__PURE__ */ c("div", {
|
|
10
|
+
className: "space-y-2",
|
|
11
|
+
children: [
|
|
12
|
+
/* @__PURE__ */ s("label", {
|
|
13
|
+
htmlFor: "secret-value-password",
|
|
14
|
+
className: "text-sm font-medium text-foreground",
|
|
15
|
+
children: "Password"
|
|
16
|
+
}),
|
|
17
|
+
/* @__PURE__ */ s("input", {
|
|
18
|
+
id: "secret-value-password",
|
|
19
|
+
"aria-label": "Password",
|
|
20
|
+
type: "password",
|
|
21
|
+
value: r,
|
|
22
|
+
onChange: (e) => i(e.target.value),
|
|
23
|
+
placeholder: "Enter password",
|
|
24
|
+
className: e("flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm font-mono", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")
|
|
25
|
+
}),
|
|
26
|
+
/* @__PURE__ */ s(t, {
|
|
27
|
+
variant: "outline",
|
|
28
|
+
size: "sm",
|
|
29
|
+
type: "button",
|
|
30
|
+
onClick: () => l(!o),
|
|
31
|
+
children: o ? "Hide Generator" : "Generate Password"
|
|
32
|
+
}),
|
|
33
|
+
o && /* @__PURE__ */ s(a, { onAccept: (e) => {
|
|
34
|
+
i(e), l(!1);
|
|
35
|
+
} })
|
|
36
|
+
]
|
|
37
|
+
}) : n === "CERTIFICATE" || n === "PRIVATE_KEY" ? /* @__PURE__ */ c("div", {
|
|
38
|
+
className: "space-y-1.5",
|
|
39
|
+
children: [/* @__PURE__ */ s("label", {
|
|
40
|
+
htmlFor: "secret-value-pem",
|
|
41
|
+
className: "text-sm font-medium text-foreground",
|
|
42
|
+
children: n === "CERTIFICATE" ? "Certificate (PEM)" : "Private Key"
|
|
43
|
+
}), /* @__PURE__ */ s("textarea", {
|
|
44
|
+
id: "secret-value-pem",
|
|
45
|
+
"aria-label": n === "CERTIFICATE" ? "Certificate (PEM)" : "Private Key",
|
|
46
|
+
value: r,
|
|
47
|
+
onChange: (e) => i(e.target.value),
|
|
48
|
+
placeholder: n === "CERTIFICATE" ? "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----" : "-----BEGIN OPENSSH PRIVATE KEY-----\n...\n-----END OPENSSH PRIVATE KEY-----",
|
|
49
|
+
rows: 8,
|
|
50
|
+
className: e("flex w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", "resize-y min-h-[120px]")
|
|
51
|
+
})]
|
|
52
|
+
}) : n === "STRUCTURED_DATA" ? /* @__PURE__ */ c("div", {
|
|
53
|
+
className: "space-y-3",
|
|
54
|
+
children: [/* @__PURE__ */ s("label", {
|
|
55
|
+
htmlFor: "secret-value-json",
|
|
56
|
+
className: "text-sm font-medium text-foreground",
|
|
57
|
+
children: "Structured Data (JSON format)"
|
|
58
|
+
}), /* @__PURE__ */ s("textarea", {
|
|
59
|
+
id: "secret-value-json",
|
|
60
|
+
"aria-label": "Structured Data JSON",
|
|
61
|
+
value: r,
|
|
62
|
+
onChange: (e) => i(e.target.value),
|
|
63
|
+
placeholder: "{\n \"key\": \"value\",\n \"connection\": \"...\"\n}",
|
|
64
|
+
rows: 5,
|
|
65
|
+
className: e("flex w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", "resize-y")
|
|
66
|
+
})]
|
|
67
|
+
}) : /* @__PURE__ */ c("div", {
|
|
68
|
+
className: "space-y-1.5",
|
|
69
|
+
children: [/* @__PURE__ */ s("label", {
|
|
70
|
+
htmlFor: "secret-value-text",
|
|
71
|
+
className: "text-sm font-medium text-foreground",
|
|
72
|
+
children: "Value"
|
|
73
|
+
}), /* @__PURE__ */ s("textarea", {
|
|
74
|
+
id: "secret-value-text",
|
|
75
|
+
"aria-label": "Value",
|
|
76
|
+
value: r,
|
|
77
|
+
onChange: (e) => i(e.target.value),
|
|
78
|
+
placeholder: "Enter secret value",
|
|
79
|
+
rows: 3,
|
|
80
|
+
className: e("flex w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", "resize-y")
|
|
81
|
+
})]
|
|
82
|
+
}), f = ({ type: a, onTypeChange: f, name: p, onNameChange: m, value: h, onValueChange: g, description: _, onDescriptionChange: v, labels: y, onLabelsChange: b, className: x }) => {
|
|
10
83
|
let [S, C] = o(""), [w, T] = o(!1), E = i.map((e) => ({
|
|
11
84
|
value: e.value,
|
|
12
85
|
label: e.label
|
|
@@ -21,7 +94,7 @@ var d = ({ type: d, onTypeChange: f, name: p, onNameChange: m, value: h, onValue
|
|
|
21
94
|
children: [
|
|
22
95
|
/* @__PURE__ */ s(r, {
|
|
23
96
|
label: "Secret Type",
|
|
24
|
-
value:
|
|
97
|
+
value: a,
|
|
25
98
|
onChange: (e) => f(e),
|
|
26
99
|
options: E
|
|
27
100
|
}),
|
|
@@ -40,86 +113,26 @@ var d = ({ type: d, onTypeChange: f, name: p, onNameChange: m, value: h, onValue
|
|
|
40
113
|
onChange: (e) => v(e.target.value),
|
|
41
114
|
placeholder: "Brief description of this secret"
|
|
42
115
|
}),
|
|
43
|
-
(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
children: "Password"
|
|
51
|
-
}),
|
|
52
|
-
/* @__PURE__ */ s("input", {
|
|
53
|
-
type: "password",
|
|
54
|
-
value: h,
|
|
55
|
-
onChange: (e) => g(e.target.value),
|
|
56
|
-
placeholder: "Enter password",
|
|
57
|
-
className: e("flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm font-mono", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")
|
|
58
|
-
}),
|
|
59
|
-
/* @__PURE__ */ s(t, {
|
|
60
|
-
variant: "outline",
|
|
61
|
-
size: "sm",
|
|
62
|
-
type: "button",
|
|
63
|
-
onClick: () => T(!w),
|
|
64
|
-
children: w ? "Hide Generator" : "Generate Password"
|
|
65
|
-
}),
|
|
66
|
-
w && /* @__PURE__ */ s(a, { onAccept: (e) => {
|
|
67
|
-
g(e), T(!1);
|
|
68
|
-
} })
|
|
69
|
-
]
|
|
70
|
-
});
|
|
71
|
-
case "CERTIFICATE":
|
|
72
|
-
case "PRIVATE_KEY": return /* @__PURE__ */ c("div", {
|
|
73
|
-
className: "space-y-1.5",
|
|
74
|
-
children: [/* @__PURE__ */ s("label", {
|
|
75
|
-
className: "text-sm font-medium text-foreground",
|
|
76
|
-
children: d === "CERTIFICATE" ? "Certificate (PEM)" : "Private Key"
|
|
77
|
-
}), /* @__PURE__ */ s("textarea", {
|
|
78
|
-
value: h,
|
|
79
|
-
onChange: (e) => g(e.target.value),
|
|
80
|
-
placeholder: d === "CERTIFICATE" ? "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----" : "-----BEGIN OPENSSH PRIVATE KEY-----\n...\n-----END OPENSSH PRIVATE KEY-----",
|
|
81
|
-
rows: 8,
|
|
82
|
-
className: e("flex w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", "resize-y min-h-[120px]")
|
|
83
|
-
})]
|
|
84
|
-
});
|
|
85
|
-
case "STRUCTURED_DATA": return /* @__PURE__ */ c("div", {
|
|
86
|
-
className: "space-y-3",
|
|
87
|
-
children: [/* @__PURE__ */ s("label", {
|
|
88
|
-
className: "text-sm font-medium text-foreground",
|
|
89
|
-
children: "Structured Data (JSON format)"
|
|
90
|
-
}), /* @__PURE__ */ s("textarea", {
|
|
91
|
-
value: h,
|
|
92
|
-
onChange: (e) => g(e.target.value),
|
|
93
|
-
placeholder: "{\n \"key\": \"value\",\n \"connection\": \"...\"\n}",
|
|
94
|
-
rows: 5,
|
|
95
|
-
className: e("flex w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", "resize-y")
|
|
96
|
-
})]
|
|
97
|
-
});
|
|
98
|
-
default: return /* @__PURE__ */ c("div", {
|
|
99
|
-
className: "space-y-1.5",
|
|
100
|
-
children: [/* @__PURE__ */ s("label", {
|
|
101
|
-
className: "text-sm font-medium text-foreground",
|
|
102
|
-
children: "Value"
|
|
103
|
-
}), /* @__PURE__ */ s("textarea", {
|
|
104
|
-
value: h,
|
|
105
|
-
onChange: (e) => g(e.target.value),
|
|
106
|
-
placeholder: "Enter secret value",
|
|
107
|
-
rows: 3,
|
|
108
|
-
className: e("flex w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", "resize-y")
|
|
109
|
-
})]
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
})(),
|
|
116
|
+
/* @__PURE__ */ s(d, {
|
|
117
|
+
type: a,
|
|
118
|
+
value: h,
|
|
119
|
+
onValueChange: g,
|
|
120
|
+
showPasswordGen: w,
|
|
121
|
+
setShowPasswordGen: T
|
|
122
|
+
}),
|
|
113
123
|
/* @__PURE__ */ c("div", {
|
|
114
124
|
className: "space-y-2",
|
|
115
125
|
children: [
|
|
116
126
|
/* @__PURE__ */ s("label", {
|
|
127
|
+
htmlFor: "secret-new-label",
|
|
117
128
|
className: "text-sm font-medium text-foreground",
|
|
118
129
|
children: "Labels"
|
|
119
130
|
}),
|
|
120
131
|
/* @__PURE__ */ c("div", {
|
|
121
132
|
className: "flex items-center gap-2",
|
|
122
133
|
children: [/* @__PURE__ */ s("input", {
|
|
134
|
+
id: "secret-new-label",
|
|
135
|
+
"aria-label": "Add label",
|
|
123
136
|
value: S,
|
|
124
137
|
onChange: (e) => C(e.target.value),
|
|
125
138
|
onKeyDown: (e) => e.key === "Enter" && (e.preventDefault(), D()),
|
|
@@ -130,7 +143,7 @@ var d = ({ type: d, onTypeChange: f, name: p, onNameChange: m, value: h, onValue
|
|
|
130
143
|
size: "sm",
|
|
131
144
|
type: "button",
|
|
132
145
|
onClick: D,
|
|
133
|
-
children: /* @__PURE__ */ s(u, { className: "
|
|
146
|
+
children: /* @__PURE__ */ s(u, { className: "size-3" })
|
|
134
147
|
})]
|
|
135
148
|
}),
|
|
136
149
|
y.length > 0 && /* @__PURE__ */ s("div", {
|
|
@@ -141,7 +154,7 @@ var d = ({ type: d, onTypeChange: f, name: p, onNameChange: m, value: h, onValue
|
|
|
141
154
|
type: "button",
|
|
142
155
|
onClick: () => O(e),
|
|
143
156
|
className: "p-0.5 rounded-full hover:bg-destructive/10 hover:text-destructive",
|
|
144
|
-
children: /* @__PURE__ */ s(l, { className: "
|
|
157
|
+
children: /* @__PURE__ */ s(l, { className: "size-2.5" })
|
|
145
158
|
})]
|
|
146
159
|
}, e))
|
|
147
160
|
})
|
|
@@ -151,6 +164,6 @@ var d = ({ type: d, onTypeChange: f, name: p, onNameChange: m, value: h, onValue
|
|
|
151
164
|
});
|
|
152
165
|
};
|
|
153
166
|
//#endregion
|
|
154
|
-
export {
|
|
167
|
+
export { f as SecretFormFields };
|
|
155
168
|
|
|
156
169
|
//# sourceMappingURL=SecretFormFields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecretFormFields.js","names":[],"sources":["../../../src/security/components/SecretFormFields.tsx"],"sourcesContent":["import { type FC, useState } from 'react';\nimport { Plus, Minus } from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { Input, Select, Button } from './ui';\nimport { SECRET_TYPES } from '../constants/secretTypes';\nimport { PasswordGenerator } from './PasswordGenerator';\nimport type { SecretType } from '../types';\n\ninterface SecretFormFieldsProps {\n type: SecretType;\n onTypeChange: (type: SecretType) => void;\n name: string;\n onNameChange: (name: string) => void;\n value: string;\n onValueChange: (value: string) => void;\n description: string;\n onDescriptionChange: (description: string) => void;\n labels: string[];\n onLabelsChange: (labels: string[]) => void;\n className?: string;\n}\n\n/**\n * Type-specific form fields for creating or editing secrets.\n * Renders appropriate input fields based on the selected secret type.\n */\nexport const SecretFormFields: FC<SecretFormFieldsProps> = ({\n type,\n onTypeChange,\n name,\n onNameChange,\n value,\n onValueChange,\n description,\n onDescriptionChange,\n labels,\n onLabelsChange,\n className,\n}) => {\n const [newLabel, setNewLabel] = useState('');\n const [showPasswordGen, setShowPasswordGen] = useState(false);\n\n const typeOptions = SECRET_TYPES.map((t) => ({ value: t.value, label: t.label }));\n\n const addLabel = () => {\n const trimmed = newLabel.trim();\n if (trimmed && !labels.includes(trimmed)) {\n onLabelsChange([...labels, trimmed]);\n setNewLabel('');\n }\n };\n\n const removeLabel = (label: string) => {\n onLabelsChange(labels.filter((l) => l !== label));\n };\n\n const renderValueField = () => {\n switch (type) {\n case 'CREDENTIAL':\n return (\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium text-foreground\">Password</label>\n <input\n type=\"password\"\n value={value}\n onChange={(e) => onValueChange(e.target.value)}\n placeholder=\"Enter password\"\n className={cn(\n 'flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm font-mono',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring'\n )}\n />\n <Button\n variant=\"outline\"\n size=\"sm\"\n type=\"button\"\n onClick={() => setShowPasswordGen(!showPasswordGen)}\n >\n {showPasswordGen ? 'Hide Generator' : 'Generate Password'}\n </Button>\n {showPasswordGen && (\n <PasswordGenerator\n onAccept={(pw) => {\n onValueChange(pw);\n setShowPasswordGen(false);\n }}\n />\n )}\n </div>\n );\n\n case 'CERTIFICATE':\n case 'PRIVATE_KEY':\n return (\n <div className=\"space-y-1.5\">\n <label className=\"text-sm font-medium text-foreground\">\n {type === 'CERTIFICATE' ? 'Certificate (PEM)' : 'Private Key'}\n </label>\n <textarea\n value={value}\n onChange={(e) => onValueChange(e.target.value)}\n placeholder={\n type === 'CERTIFICATE'\n ? '-----BEGIN CERTIFICATE-----\\n...\\n-----END CERTIFICATE-----'\n : '-----BEGIN OPENSSH PRIVATE KEY-----\\n...\\n-----END OPENSSH PRIVATE KEY-----'\n }\n rows={8}\n className={cn(\n 'flex w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n 'resize-y min-h-[120px]'\n )}\n />\n </div>\n );\n\n case 'STRUCTURED_DATA':\n return (\n <div className=\"space-y-3\">\n <label className=\"text-sm font-medium text-foreground\">\n Structured Data (JSON format)\n </label>\n <textarea\n value={value}\n onChange={(e) => onValueChange(e.target.value)}\n placeholder={'{\\n \"key\": \"value\",\\n \"connection\": \"...\"\\n}'}\n rows={5}\n className={cn(\n 'flex w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n 'resize-y'\n )}\n />\n </div>\n );\n\n default:\n return (\n <div className=\"space-y-1.5\">\n <label className=\"text-sm font-medium text-foreground\">Value</label>\n <textarea\n value={value}\n onChange={(e) => onValueChange(e.target.value)}\n placeholder=\"Enter secret value\"\n rows={3}\n className={cn(\n 'flex w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n 'resize-y'\n )}\n />\n </div>\n );\n }\n };\n\n return (\n <div className={cn('space-y-4', className)}>\n {/* Secret type */}\n <Select\n label=\"Secret Type\"\n value={type}\n onChange={(v) => onTypeChange(v as SecretType)}\n options={typeOptions}\n />\n\n {/* Name */}\n <Input\n id=\"secret-name\"\n label=\"Name\"\n value={name}\n onChange={(e) => onNameChange(e.target.value)}\n placeholder=\"e.g., production-database-password\"\n required\n />\n\n {/* Description */}\n <Input\n id=\"secret-description\"\n label=\"Description (optional)\"\n value={description}\n onChange={(e) => onDescriptionChange(e.target.value)}\n placeholder=\"Brief description of this secret\"\n />\n\n {/* Type-specific value field */}\n {renderValueField()}\n\n {/* Labels */}\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium text-foreground\">Labels</label>\n <div className=\"flex items-center gap-2\">\n <input\n value={newLabel}\n onChange={(e) => setNewLabel(e.target.value)}\n onKeyDown={(e) => e.key === 'Enter' && (e.preventDefault(), addLabel())}\n placeholder=\"Add label\"\n className={cn(\n 'flex h-8 flex-1 rounded-md border border-border bg-background px-3 py-1 text-sm',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring'\n )}\n />\n <Button variant=\"outline\" size=\"sm\" type=\"button\" onClick={addLabel}>\n <Plus className=\"h-3 w-3\" />\n </Button>\n </div>\n {labels.length > 0 && (\n <div className=\"flex flex-wrap gap-1.5\">\n {labels.map((label) => (\n <span\n key={label}\n className=\"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs bg-muted border border-border\"\n >\n {label}\n <button\n type=\"button\"\n onClick={() => removeLabel(label)}\n className=\"p-0.5 rounded-full hover:bg-destructive/10 hover:text-destructive\"\n >\n <Minus className=\"h-2.5 w-2.5\" />\n </button>\n </span>\n ))}\n </div>\n )}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;AA0BA,IAAa,KAA+C,EAC1D,SACA,iBACA,SACA,iBACA,UACA,kBACA,gBACA,wBACA,WACA,mBACA,mBACI;CACJ,IAAM,CAAC,GAAU,KAAe,EAAS,GAAG,EACtC,CAAC,GAAiB,KAAsB,EAAS,GAAM,EAEvD,IAAc,EAAa,KAAK,OAAO;EAAE,OAAO,EAAE;EAAO,OAAO,EAAE;EAAO,EAAE,EAE3E,UAAiB;EACrB,IAAM,IAAU,EAAS,MAAM;AAC/B,EAAI,KAAW,CAAC,EAAO,SAAS,EAAQ,KACtC,EAAe,CAAC,GAAG,GAAQ,EAAQ,CAAC,EACpC,EAAY,GAAG;IAIb,KAAe,MAAkB;AACrC,IAAe,EAAO,QAAQ,MAAM,MAAM,EAAM,CAAC;;AAuGnD,QACE,kBAAC,OAAD;EAAK,WAAW,EAAG,aAAa,EAAU;YAA1C;GAEE,kBAAC,GAAD;IACE,OAAM;IACN,OAAO;IACP,WAAW,MAAM,EAAa,EAAgB;IAC9C,SAAS;IACT,CAAA;GAGF,kBAAC,GAAD;IACE,IAAG;IAC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ACE;;KAGV,QACE,QACE,kBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,kBAAC,SAAD;OAAO,WAAU;iBAAsC;OAAa,CAAA,EACpE,kBAAC,YAAD;OACS;OACP,WAAW,MAAM,EAAc,EAAE,OAAO,MAAM;OAC9C,aAAY;OACZ,MAAM;OACN,WAAW,EACT,yFACA,2EACA,WACD;OACD,CAAA,CACE;;;OAmCS;GAGnB,kBAAC,OAAD;IAAK,WAAU;cAAf;KACE,kBAAC,SAAD;MAAO,WAAU;gBAAsC;MAAc,CAAA;KACrE,kBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,kBAAC,SAAD;OACE,OAAO;OACP,WAAW,MAAM,EAAY,EAAE,OAAO,MAAM;OAC5C,YAAY,MAAM,EAAE,QAAQ,YAAY,EAAE,gBAAgB,EAAE,GAAU;OACtE,aAAY;OACZ,WAAW,EACT,mFACA,0EACD;OACD,CAAA,EACF,kBAAC,GAAD;OAAQ,SAAQ;OAAU,MAAK;OAAK,MAAK;OAAS,SAAS;iBACzD,kBAAC,GAAD,EAAM,WAAU,WAAY,CAAA;OACrB,CAAA,CACL;;KACL,EAAO,SAAS,KACf,kBAAC,OAAD;MAAK,WAAU;gBACZ,EAAO,KAAK,MACX,kBAAC,QAAD;OAEE,WAAU;iBAFZ,CAIG,GACD,kBAAC,UAAD;QACE,MAAK;QACL,eAAe,EAAY,EAAM;QACjC,WAAU;kBAEV,kBAAC,GAAD,EAAO,WAAU,eAAgB,CAAA;QAC1B,CAAA,CACJ;SAXA,EAWA,CACP;MACE,CAAA;KAEJ;;GACF"}
|
|
1
|
+
{"version":3,"file":"SecretFormFields.js","names":[],"sources":["../../../src/security/components/SecretFormFields.tsx"],"sourcesContent":["import { type FC, useState } from 'react';\nimport { Plus, Minus } from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { Input, Select, Button } from './ui';\nimport { SECRET_TYPES } from '../constants/secretTypes';\nimport { PasswordGenerator } from './PasswordGenerator';\nimport type { SecretType } from '../types';\n\ninterface SecretValueFieldProps {\n type: SecretType;\n value: string;\n onValueChange: (value: string) => void;\n showPasswordGen: boolean;\n setShowPasswordGen: (show: boolean) => void;\n}\n\nconst SecretValueField: FC<SecretValueFieldProps> = ({\n type,\n value,\n onValueChange,\n showPasswordGen,\n setShowPasswordGen,\n}) => {\n if (type === 'CREDENTIAL') {\n return (\n <div className=\"space-y-2\">\n <label htmlFor=\"secret-value-password\" className=\"text-sm font-medium text-foreground\">\n Password\n </label>\n <input\n id=\"secret-value-password\"\n aria-label=\"Password\"\n type=\"password\"\n value={value}\n onChange={(e) => onValueChange(e.target.value)}\n placeholder=\"Enter password\"\n className={cn(\n 'flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm font-mono',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring'\n )}\n />\n <Button\n variant=\"outline\"\n size=\"sm\"\n type=\"button\"\n onClick={() => setShowPasswordGen(!showPasswordGen)}\n >\n {showPasswordGen ? 'Hide Generator' : 'Generate Password'}\n </Button>\n {showPasswordGen && (\n <PasswordGenerator\n onAccept={(pw) => {\n onValueChange(pw);\n setShowPasswordGen(false);\n }}\n />\n )}\n </div>\n );\n }\n\n if (type === 'CERTIFICATE' || type === 'PRIVATE_KEY') {\n return (\n <div className=\"space-y-1.5\">\n <label htmlFor=\"secret-value-pem\" className=\"text-sm font-medium text-foreground\">\n {type === 'CERTIFICATE' ? 'Certificate (PEM)' : 'Private Key'}\n </label>\n <textarea\n id=\"secret-value-pem\"\n aria-label={type === 'CERTIFICATE' ? 'Certificate (PEM)' : 'Private Key'}\n value={value}\n onChange={(e) => onValueChange(e.target.value)}\n placeholder={\n type === 'CERTIFICATE'\n ? '-----BEGIN CERTIFICATE-----\\n...\\n-----END CERTIFICATE-----'\n : '-----BEGIN OPENSSH PRIVATE KEY-----\\n...\\n-----END OPENSSH PRIVATE KEY-----'\n }\n rows={8}\n className={cn(\n 'flex w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n 'resize-y min-h-[120px]'\n )}\n />\n </div>\n );\n }\n\n if (type === 'STRUCTURED_DATA') {\n return (\n <div className=\"space-y-3\">\n <label htmlFor=\"secret-value-json\" className=\"text-sm font-medium text-foreground\">\n Structured Data (JSON format)\n </label>\n <textarea\n id=\"secret-value-json\"\n aria-label=\"Structured Data JSON\"\n value={value}\n onChange={(e) => onValueChange(e.target.value)}\n placeholder={'{\\n \"key\": \"value\",\\n \"connection\": \"...\"\\n}'}\n rows={5}\n className={cn(\n 'flex w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n 'resize-y'\n )}\n />\n </div>\n );\n }\n\n return (\n <div className=\"space-y-1.5\">\n <label htmlFor=\"secret-value-text\" className=\"text-sm font-medium text-foreground\">Value</label>\n <textarea\n id=\"secret-value-text\"\n aria-label=\"Value\"\n value={value}\n onChange={(e) => onValueChange(e.target.value)}\n placeholder=\"Enter secret value\"\n rows={3}\n className={cn(\n 'flex w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n 'resize-y'\n )}\n />\n </div>\n );\n};\n\ninterface SecretFormFieldsProps {\n type: SecretType;\n onTypeChange: (type: SecretType) => void;\n name: string;\n onNameChange: (name: string) => void;\n value: string;\n onValueChange: (value: string) => void;\n description: string;\n onDescriptionChange: (description: string) => void;\n labels: string[];\n onLabelsChange: (labels: string[]) => void;\n className?: string;\n}\n\n/**\n * Type-specific form fields for creating or editing secrets.\n * Renders appropriate input fields based on the selected secret type.\n */\nexport const SecretFormFields: FC<SecretFormFieldsProps> = ({\n type,\n onTypeChange,\n name,\n onNameChange,\n value,\n onValueChange,\n description,\n onDescriptionChange,\n labels,\n onLabelsChange,\n className,\n}) => {\n const [newLabel, setNewLabel] = useState('');\n const [showPasswordGen, setShowPasswordGen] = useState(false);\n\n const typeOptions = SECRET_TYPES.map((t) => ({ value: t.value, label: t.label }));\n\n const addLabel = () => {\n const trimmed = newLabel.trim();\n if (trimmed && !labels.includes(trimmed)) {\n onLabelsChange([...labels, trimmed]);\n setNewLabel('');\n }\n };\n\n const removeLabel = (label: string) => {\n onLabelsChange(labels.filter((l) => l !== label));\n };\n\n return (\n <div className={cn('space-y-4', className)}>\n {/* Secret type */}\n <Select\n label=\"Secret Type\"\n value={type}\n onChange={(v) => onTypeChange(v as SecretType)}\n options={typeOptions}\n />\n\n {/* Name */}\n <Input\n id=\"secret-name\"\n label=\"Name\"\n value={name}\n onChange={(e) => onNameChange(e.target.value)}\n placeholder=\"e.g., production-database-password\"\n required\n />\n\n {/* Description */}\n <Input\n id=\"secret-description\"\n label=\"Description (optional)\"\n value={description}\n onChange={(e) => onDescriptionChange(e.target.value)}\n placeholder=\"Brief description of this secret\"\n />\n\n {/* Type-specific value field */}\n <SecretValueField\n type={type}\n value={value}\n onValueChange={onValueChange}\n showPasswordGen={showPasswordGen}\n setShowPasswordGen={setShowPasswordGen}\n />\n\n {/* Labels */}\n <div className=\"space-y-2\">\n <label htmlFor=\"secret-new-label\" className=\"text-sm font-medium text-foreground\">Labels</label>\n <div className=\"flex items-center gap-2\">\n <input\n id=\"secret-new-label\"\n aria-label=\"Add label\"\n value={newLabel}\n onChange={(e) => setNewLabel(e.target.value)}\n onKeyDown={(e) => e.key === 'Enter' && (e.preventDefault(), addLabel())}\n placeholder=\"Add label\"\n className={cn(\n 'flex h-8 flex-1 rounded-md border border-border bg-background px-3 py-1 text-sm',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring'\n )}\n />\n <Button variant=\"outline\" size=\"sm\" type=\"button\" onClick={addLabel}>\n <Plus className=\"size-3\" />\n </Button>\n </div>\n {labels.length > 0 && (\n <div className=\"flex flex-wrap gap-1.5\">\n {labels.map((label) => (\n <span\n key={label}\n className=\"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs bg-muted border border-border\"\n >\n {label}\n <button\n type=\"button\"\n onClick={() => removeLabel(label)}\n className=\"p-0.5 rounded-full hover:bg-destructive/10 hover:text-destructive\"\n >\n <Minus className=\"size-2.5\" />\n </button>\n </span>\n ))}\n </div>\n )}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;AAgBA,IAAM,KAA+C,EACnD,SACA,UACA,kBACA,oBACA,4BAEI,MAAS,eAET,kBAAC,OAAD;CAAK,WAAU;WAAf;EACE,kBAAC,SAAD;GAAO,SAAQ;GAAwB,WAAU;aAAsC;GAE/E,CAAA;EACR,kBAAC,SAAD;GACE,IAAG;GACH,cAAW;GACX,MAAK;GACE;GACP,WAAW,MAAM,EAAc,EAAE,OAAO,MAAM;GAC9C,aAAY;GACZ,WAAW,EACT,6FACA,0EACD;GACD,CAAA;EACF,kBAAC,GAAD;GACE,SAAQ;GACR,MAAK;GACL,MAAK;GACL,eAAe,EAAmB,CAAC,EAAgB;aAElD,IAAkB,mBAAmB;GAC/B,CAAA;EACR,KACC,kBAAC,GAAD,EACE,WAAW,MAAO;AAEhB,GADA,EAAc,EAAG,EACjB,EAAmB,GAAM;KAE3B,CAAA;EAEA;KAIN,MAAS,iBAAiB,MAAS,gBAEnC,kBAAC,OAAD;CAAK,WAAU;WAAf,CACE,kBAAC,SAAD;EAAO,SAAQ;EAAmB,WAAU;YACzC,MAAS,gBAAgB,sBAAsB;EAC1C,CAAA,EACR,kBAAC,YAAD;EACE,IAAG;EACH,cAAY,MAAS,gBAAgB,sBAAsB;EACpD;EACP,WAAW,MAAM,EAAc,EAAE,OAAO,MAAM;EAC9C,aACE,MAAS,gBACL,gEACA;EAEN,MAAM;EACN,WAAW,EACT,yFACA,2EACA,yBACD;EACD,CAAA,CACE;KAIN,MAAS,oBAET,kBAAC,OAAD;CAAK,WAAU;WAAf,CACE,kBAAC,SAAD;EAAO,SAAQ;EAAoB,WAAU;YAAsC;EAE3E,CAAA,EACR,kBAAC,YAAD;EACE,IAAG;EACH,cA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pD,aAAY;IACZ,CAAA;GAGF,kBAAC,GAAD;IACQ;IACC;IACQ;IACE;IACG;IACpB,CAAA;GAGF,kBAAC,OAAD;IAAK,WAAU;cAAf;KACE,kBAAC,SAAD;MAAO,SAAQ;MAAmB,WAAU;gBAAsC;MAAc,CAAA;KAChG,kBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,kBAAC,SAAD;OACE,IAAG;OACH,cAAW;OACX,OAAO;OACP,WAAW,MAAM,EAAY,EAAE,OAAO,MAAM;OAC5C,YAAY,MAAM,EAAE,QAAQ,YAAY,EAAE,gBAAgB,EAAE,GAAU;OACtE,aAAY;OACZ,WAAW,EACT,mFACA,0EACD;OACD,CAAA,EACF,kBAAC,GAAD;OAAQ,SAAQ;OAAU,MAAK;OAAK,MAAK;OAAS,SAAS;iBACzD,kBAAC,GAAD,EAAM,WAAU,UAAW,CAAA;OACpB,CAAA,CACL;;KACL,EAAO,SAAS,KACf,kBAAC,OAAD;MAAK,WAAU;gBACZ,EAAO,KAAK,MACX,kBAAC,QAAD;OAEE,WAAU;iBAFZ,CAIG,GACD,kBAAC,UAAD;QACE,MAAK;QACL,eAAe,EAAY,EAAM;QACjC,WAAU;kBAEV,kBAAC,GAAD,EAAO,WAAU,YAAa,CAAA;QACvB,CAAA,CACJ;SAXA,EAWA,CACP;MACE,CAAA;KAEJ;;GACF"}
|
|
@@ -9,16 +9,18 @@ import { Clock as c } from "lucide-react";
|
|
|
9
9
|
import { useI18n as l } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
10
10
|
//#region src/security/components/SecretRow.tsx
|
|
11
11
|
var u = ({ secret: u, isSelected: d = !1, onSelect: f, onClick: p, className: m }) => {
|
|
12
|
-
let { t: h } = l(), g = (e, t, r) => n(h, e, t, r)
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
let { t: h } = l(), g = (e, t, r) => n(h, e, t, r), _ = (e) => {
|
|
13
|
+
p && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), p());
|
|
14
|
+
}, v = !!p, y = v ? {
|
|
15
15
|
onClick: p,
|
|
16
|
-
onKeyDown:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
onKeyDown: _,
|
|
17
|
+
role: "button",
|
|
18
|
+
tabIndex: 0
|
|
19
|
+
} : { role: "listitem" };
|
|
20
|
+
return /* @__PURE__ */ s("div", {
|
|
21
|
+
className: e("flex items-center gap-3 px-4 py-3 border-b border-border last:border-b-0", "hover:bg-muted/50 transition-colors", "focus-visible:bg-accent focus-visible:outline-none", d && "bg-primary/5", v && "cursor-pointer", m),
|
|
21
22
|
"aria-selected": d,
|
|
23
|
+
...y,
|
|
22
24
|
children: [
|
|
23
25
|
f && /* @__PURE__ */ o("input", {
|
|
24
26
|
type: "checkbox",
|
|
@@ -68,7 +70,7 @@ var u = ({ secret: u, isSelected: d = !1, onSelect: f, onClick: p, className: m
|
|
|
68
70
|
className: "flex items-center gap-1 text-xs text-muted-foreground shrink-0",
|
|
69
71
|
"aria-label": g("security.secretRow.lastUpdated.aria", "Last updated {date}", { date: new Date(u.updatedAt).toLocaleDateString() }),
|
|
70
72
|
children: [
|
|
71
|
-
/* @__PURE__ */ o(c, { className: "
|
|
73
|
+
/* @__PURE__ */ o(c, { className: "size-3" }),
|
|
72
74
|
/* @__PURE__ */ o("span", {
|
|
73
75
|
className: "sr-only",
|
|
74
76
|
children: g("security.secretRow.lastUpdated.srOnly", "Last updated {date}", { date: new Date(u.updatedAt).toLocaleDateString() })
|