@burdenoff/microfe-security 2026.527.1 → 2026.530.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.
@@ -1 +1 @@
1
- {"version":3,"file":"SecurityAdminRoot.js","names":[],"sources":["../../src/security/SecurityAdminRoot.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport type { SecurityAdminRootProps } from './types';\nimport { SecurityRootBase } from './SecurityRootBase';\nimport { SecurityAdminRoutes } from './routes/SecurityAdminRoutes';\n\nconst routesElement = <SecurityAdminRoutes />;\n\n/**\n * Admin-facing root component for the Security microfrontend.\n *\n * Renders governance/oversight pages (audit, dashboard, access review,\n * providers, import/export) plus vault management for administrative inspection.\n * Used by admin-app.\n *\n * @example\n * ```tsx\n * import { SecurityAdminRoot } from '@burdenoff/micro-fe/security';\n *\n * <SecurityAdminRoot basePath=\"/security\" {...contentMfeProps} />\n * ```\n */\nexport const SecurityAdminRoot: FC<SecurityAdminRootProps> = (props) => (\n <SecurityRootBase\n mode=\"admin\"\n routes={routesElement}\n footerLabel=\"Security Admin\"\n {...props}\n />\n);\n"],"mappings":";;;;AAKA,IAAM,IAAgB,kBAAC,GAAD,EAAuB,CAAA,EAgBhC,KAAiD,MAC5D,kBAAC,GAAD;CACE,MAAK;CACL,QAAQ;CACR,aAAY;CACZ,GAAI;CACJ,CAAA"}
1
+ {"version":3,"file":"SecurityAdminRoot.js","names":[],"sources":["../../src/security/SecurityAdminRoot.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport type { SecurityAdminRootProps } from './types';\nimport { SecurityRootBase } from './SecurityRootBase';\nimport { SecurityAdminRoutes } from './routes/SecurityAdminRoutes';\n\nconst routesElement = <SecurityAdminRoutes />;\n\n/**\n * Admin-facing root component for the Security microfrontend.\n *\n * Renders governance/oversight pages (audit, dashboard, access review,\n * providers, import/export) plus vault management for administrative inspection.\n * Used by admin-app.\n *\n * @example\n * ```tsx\n * import { SecurityAdminRoot } from '@burdenoff/micro-fe/security';\n *\n * <SecurityAdminRoot basePath=\"/security\" {...contentMfeProps} />\n * ```\n */\nexport const SecurityAdminRoot: FC<SecurityAdminRootProps> = (props) => (\n <SecurityRootBase mode=\"admin\" routes={routesElement} footerLabel=\"Security Admin\" {...props} />\n);\n"],"mappings":";;;;AAKA,IAAM,IAAgB,kBAAC,GAAD,EAAuB,CAAA,EAgBhC,KAAiD,MAC5D,kBAAC,GAAD;CAAkB,MAAK;CAAQ,QAAQ;CAAe,aAAY;CAAiB,GAAI;CAAS,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"SecurityRoot.js","names":[],"sources":["../../src/security/SecurityRoot.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport type { SecurityRootProps } from './types';\nimport { SecurityRootBase } from './SecurityRootBase';\nimport { SecurityRoutes } from './routes/SecurityRoutes';\n\nconst routesElement = <SecurityRoutes />;\n\n/**\n * Root component for the Security microfrontend (backward-compatible, all routes).\n *\n * Renders all pages (user operational + admin governance).\n * Kept for backward compatibility with existing consumers.\n *\n * @example\n * ```tsx\n * import { SecurityRoot } from '@burdenoff/micro-fe/security';\n *\n * <SecurityRoot basePath=\"/security\" {...props} />\n * ```\n */\nexport const SecurityRoot: FC<SecurityRootProps> = (props) => (\n <SecurityRootBase\n mode=\"all\"\n routes={routesElement}\n footerLabel=\"Security Ready\"\n {...props}\n />\n);\n"],"mappings":";;;;AAKA,IAAM,IAAgB,kBAAC,GAAD,EAAkB,CAAA,EAe3B,KAAuC,MAClD,kBAAC,GAAD;CACE,MAAK;CACL,QAAQ;CACR,aAAY;CACZ,GAAI;CACJ,CAAA"}
1
+ {"version":3,"file":"SecurityRoot.js","names":[],"sources":["../../src/security/SecurityRoot.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport type { SecurityRootProps } from './types';\nimport { SecurityRootBase } from './SecurityRootBase';\nimport { SecurityRoutes } from './routes/SecurityRoutes';\n\nconst routesElement = <SecurityRoutes />;\n\n/**\n * Root component for the Security microfrontend (backward-compatible, all routes).\n *\n * Renders all pages (user operational + admin governance).\n * Kept for backward compatibility with existing consumers.\n *\n * @example\n * ```tsx\n * import { SecurityRoot } from '@burdenoff/micro-fe/security';\n *\n * <SecurityRoot basePath=\"/security\" {...props} />\n * ```\n */\nexport const SecurityRoot: FC<SecurityRootProps> = (props) => (\n <SecurityRootBase mode=\"all\" routes={routesElement} footerLabel=\"Security Ready\" {...props} />\n);\n"],"mappings":";;;;AAKA,IAAM,IAAgB,kBAAC,GAAD,EAAkB,CAAA,EAe3B,KAAuC,MAClD,kBAAC,GAAD;CAAkB,MAAK;CAAM,QAAQ;CAAe,aAAY;CAAiB,GAAI;CAAS,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"SecurityUserRoot.js","names":[],"sources":["../../src/security/SecurityUserRoot.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport type { SecurityUserRootProps } from './types';\nimport { SecurityRootBase } from './SecurityRootBase';\nimport { SecurityUserRoutes } from './routes/SecurityUserRoutes';\n\nconst routesElement = <SecurityUserRoutes />;\n\n/**\n * User-facing root component for the Security microfrontend.\n *\n * Renders only vault/secret operational pages (CRUD).\n * Used by product app shells (vibecontrols-app, bigconsole, etc.).\n *\n * @example\n * ```tsx\n * import { SecurityUserRoot } from '@burdenoff/micro-fe/security';\n *\n * <SecurityUserRoot basePath=\"/security\" {...workspaceBaseProps} />\n * ```\n */\nexport const SecurityUserRoot: FC<SecurityUserRootProps> = (props) => (\n <SecurityRootBase\n mode=\"user\"\n routes={routesElement}\n footerLabel=\"Security Ready\"\n {...props}\n />\n);\n"],"mappings":";;;;AAKA,IAAM,IAAgB,kBAAC,GAAD,EAAsB,CAAA,EAe/B,KAA+C,MAC1D,kBAAC,GAAD;CACE,MAAK;CACL,QAAQ;CACR,aAAY;CACZ,GAAI;CACJ,CAAA"}
1
+ {"version":3,"file":"SecurityUserRoot.js","names":[],"sources":["../../src/security/SecurityUserRoot.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport type { SecurityUserRootProps } from './types';\nimport { SecurityRootBase } from './SecurityRootBase';\nimport { SecurityUserRoutes } from './routes/SecurityUserRoutes';\n\nconst routesElement = <SecurityUserRoutes />;\n\n/**\n * User-facing root component for the Security microfrontend.\n *\n * Renders only vault/secret operational pages (CRUD).\n * Used by product app shells (vibecontrols-app, bigconsole, etc.).\n *\n * @example\n * ```tsx\n * import { SecurityUserRoot } from '@burdenoff/micro-fe/security';\n *\n * <SecurityUserRoot basePath=\"/security\" {...workspaceBaseProps} />\n * ```\n */\nexport const SecurityUserRoot: FC<SecurityUserRootProps> = (props) => (\n <SecurityRootBase mode=\"user\" routes={routesElement} footerLabel=\"Security Ready\" {...props} />\n);\n"],"mappings":";;;;AAKA,IAAM,IAAgB,kBAAC,GAAD,EAAsB,CAAA,EAe/B,KAA+C,MAC1D,kBAAC,GAAD;CAAkB,MAAK;CAAO,QAAQ;CAAe,aAAY;CAAiB,GAAI;CAAS,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"BulkActionBar.js","names":[],"sources":["../../../src/security/components/BulkActionBar.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useState } from 'react';\nimport { Trash2, FolderInput, Tag, X, Loader2 } from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { Button, Badge } from './ui';\nimport { useBulkSecretOperations } from '../hooks/useBulkSecretOperations';\nimport { useSecurityEventEmitter } from '../hooks/useSecurityEventEmitter';\nimport { useSecurityStore } from '../store/securityStore';\nimport { ConfirmDialog } from './ConfirmDialog';\nimport { usePermission } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { translateWithFallback } from '../utils/i18n';\n\ninterface BulkActionBarProps {\n vaultId: string;\n className?: string;\n}\n\nexport const BulkActionBar: FC<BulkActionBarProps> = ({ vaultId, className }) => {\n const { t } = useI18n();\n const tx = (key: string, fallback: string, params?: Record<string, string | number>) =>\n translateWithFallback(t, key, fallback, params);\n\n const selectedCount = useSecurityStore((s) => s.selectedSecretIds.length);\n const clearSelection = useSecurityStore((s) => s.clearSecretSelection);\n const { bulkDeleteSecrets, bulkMoveSecrets, bulkLabelSecrets, loading } =\n useBulkSecretOperations();\n const { emit } = useSecurityEventEmitter();\n\n const canDeleteSecret = usePermission('secret:delete');\n const canUpdateSecret = usePermission('secret:update');\n\n const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);\n\n if (selectedCount === 0) return null;\n\n return (\n <>\n <div\n className={cn(\n 'flex items-center justify-between gap-3 px-4 py-3 rounded-lg',\n 'bg-primary/5 border border-primary/20',\n 'animate-in slide-in-from-bottom-2 duration-200',\n className\n )}\n >\n <div className=\"flex items-center gap-2\">\n <Badge variant=\"default\">\n {tx('security.bulkActionBar.selected', '{count} selected', { count: selectedCount })}\n </Badge>\n <button type=\"button\"\n onClick={clearSelection}\n className=\"p-1 rounded hover:bg-accent text-muted-foreground\"\n title={tx('security.bulkActionBar.clearSelection', 'Clear selection')}\n aria-label={tx('security.bulkActionBar.clearSelection', 'Clear selection')}\n >\n <X className=\"size-4\" />\n </button>\n </div>\n\n <div className=\"flex items-center gap-2\">\n {loading && <Loader2 className=\"size-4 animate-spin text-muted-foreground\" />}\n\n {canUpdateSecret && (\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled={loading}\n onClick={() => {\n const label = prompt(\n tx('security.bulkActionBar.labelPrompt', 'Enter label to apply:')\n );\n if (label) {\n const selectedIds = useSecurityStore.getState().selectedSecretIds;\n bulkLabelSecrets(selectedIds, label);\n clearSelection();\n }\n }}\n >\n <Tag className=\"size-3.5\" />\n {tx('security.bulkActionBar.label', 'Label')}\n </Button>\n )}\n\n {canUpdateSecret && (\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled={loading}\n onClick={() => {\n const targetId = prompt(\n tx('security.bulkActionBar.movePrompt', 'Enter target vault ID:')\n );\n if (targetId) {\n const selectedIds = useSecurityStore.getState().selectedSecretIds;\n bulkMoveSecrets(selectedIds, targetId);\n selectedIds.forEach((id) => emit('secret.updated', { secretId: id, vaultId }));\n clearSelection();\n }\n }}\n >\n <FolderInput className=\"size-3.5\" />\n {tx('security.bulkActionBar.move', 'Move')}\n </Button>\n )}\n\n {canDeleteSecret && (\n <Button\n variant=\"destructive\"\n size=\"sm\"\n disabled={loading}\n onClick={() => setShowDeleteConfirm(true)}\n >\n <Trash2 className=\"size-3.5\" />\n {tx('security.bulkActionBar.delete', 'Delete')}\n </Button>\n )}\n </div>\n </div>\n\n <ConfirmDialog\n isOpen={showDeleteConfirm}\n onClose={() => setShowDeleteConfirm(false)}\n onConfirm={async () => {\n const selectedIds = useSecurityStore.getState().selectedSecretIds;\n await bulkDeleteSecrets(selectedIds);\n selectedIds.forEach((id) => emit('secret.deleted', { secretId: id, vaultId }));\n setShowDeleteConfirm(false);\n clearSelection();\n }}\n title={tx('security.bulkActionBar.deleteConfirm.title', 'Delete Selected Secrets')}\n description={tx(\n 'security.bulkActionBar.deleteConfirm.description',\n 'Are you sure you want to delete {count} selected secret{suffix}? This action cannot be undone.',\n { count: selectedCount, suffix: selectedCount !== 1 ? 's' : '' }\n )}\n confirmLabel={tx('security.bulkActionBar.deleteConfirm.confirm', 'Delete All')}\n variant=\"destructive\"\n />\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAkBA,IAAa,KAAyC,EAAE,YAAS,mBAAgB;CAC/E,IAAM,EAAE,SAAM,GAAS,EACjB,KAAM,GAAa,GAAkB,MACzC,EAAsB,GAAG,GAAK,GAAU,EAAO,EAE3C,IAAgB,GAAkB,MAAM,EAAE,kBAAkB,OAAO,EACnE,IAAiB,GAAkB,MAAM,EAAE,qBAAqB,EAChE,EAAE,sBAAmB,oBAAiB,qBAAkB,eAC5D,GAAyB,EACrB,EAAE,YAAS,GAAyB,EAEpC,IAAkB,EAAc,gBAAgB,EAChD,IAAkB,EAAc,gBAAgB,EAEhD,CAAC,GAAmB,KAAwB,EAAS,GAAM;AAIjE,QAFI,MAAkB,IAAU,OAG9B,kB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,UAAU;KACV,eAAe,EAAqB,GAAK;eAJ3C,CAME,kBAAC,GAAD,EAAQ,WAAU,YAAa,CAAA,EAC9B,EAAG,iCAAiC,SAAS,CACvC;;IAEP;KACF;KAEN,kBAAC,GAAD;EACE,QAAQ;EACR,eAAe,EAAqB,GAAM;EAC1C,WAAW,YAAY;GACrB,IAAM,IAAc,EAAiB,UAAU,CAAC;AAIhD,GAHA,MAAM,EAAkB,EAAY,EACpC,EAAY,SAAS,MAAO,EAAK,kBAAkB;IAAE,UAAU;IAAI;IAAS,CAAC,CAAC,EAC9E,EAAqB,GAAM,EAC3B,GAAgB;;EAElB,OAAO,EAAG,8CAA8C,0BAA0B;EAClF,aAAa,EACX,oDACA,kGACA;GAAE,OAAO;GAAe,QAAQ,MAAkB,IAAU,KAAN;GAAU,CACjE;EACD,cAAc,EAAG,gDAAgD,aAAa;EAC9E,SAAQ;EACR,CAAA,CACD,EAAA,CAAA"}
1
+ {"version":3,"file":"BulkActionBar.js","names":[],"sources":["../../../src/security/components/BulkActionBar.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useState } from 'react';\nimport { Trash2, FolderInput, Tag, X, Loader2 } from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { Button, Badge } from './ui';\nimport { useBulkSecretOperations } from '../hooks/useBulkSecretOperations';\nimport { useSecurityEventEmitter } from '../hooks/useSecurityEventEmitter';\nimport { useSecurityStore } from '../store/securityStore';\nimport { ConfirmDialog } from './ConfirmDialog';\nimport { usePermission } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { translateWithFallback } from '../utils/i18n';\n\ninterface BulkActionBarProps {\n vaultId: string;\n className?: string;\n}\n\nexport const BulkActionBar: FC<BulkActionBarProps> = ({ vaultId, className }) => {\n const { t } = useI18n();\n const tx = (key: string, fallback: string, params?: Record<string, string | number>) =>\n translateWithFallback(t, key, fallback, params);\n\n const selectedCount = useSecurityStore((s) => s.selectedSecretIds.length);\n const clearSelection = useSecurityStore((s) => s.clearSecretSelection);\n const { bulkDeleteSecrets, bulkMoveSecrets, bulkLabelSecrets, loading } =\n useBulkSecretOperations();\n const { emit } = useSecurityEventEmitter();\n\n const canDeleteSecret = usePermission('secret:delete');\n const canUpdateSecret = usePermission('secret:update');\n\n const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);\n\n if (selectedCount === 0) return null;\n\n return (\n <>\n <div\n className={cn(\n 'flex items-center justify-between gap-3 px-4 py-3 rounded-lg',\n 'bg-primary/5 border border-primary/20',\n 'animate-in slide-in-from-bottom-2 duration-200',\n className\n )}\n >\n <div className=\"flex items-center gap-2\">\n <Badge variant=\"default\">\n {tx('security.bulkActionBar.selected', '{count} selected', { count: selectedCount })}\n </Badge>\n <button\n type=\"button\"\n onClick={clearSelection}\n className=\"p-1 rounded hover:bg-accent text-muted-foreground\"\n title={tx('security.bulkActionBar.clearSelection', 'Clear selection')}\n aria-label={tx('security.bulkActionBar.clearSelection', 'Clear selection')}\n >\n <X className=\"size-4\" />\n </button>\n </div>\n\n <div className=\"flex items-center gap-2\">\n {loading && <Loader2 className=\"size-4 animate-spin text-muted-foreground\" />}\n\n {canUpdateSecret && (\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled={loading}\n onClick={() => {\n const label = prompt(\n tx('security.bulkActionBar.labelPrompt', 'Enter label to apply:')\n );\n if (label) {\n const selectedIds = useSecurityStore.getState().selectedSecretIds;\n bulkLabelSecrets(selectedIds, label);\n clearSelection();\n }\n }}\n >\n <Tag className=\"size-3.5\" />\n {tx('security.bulkActionBar.label', 'Label')}\n </Button>\n )}\n\n {canUpdateSecret && (\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled={loading}\n onClick={() => {\n const targetId = prompt(\n tx('security.bulkActionBar.movePrompt', 'Enter target vault ID:')\n );\n if (targetId) {\n const selectedIds = useSecurityStore.getState().selectedSecretIds;\n bulkMoveSecrets(selectedIds, targetId);\n selectedIds.forEach((id) => emit('secret.updated', { secretId: id, vaultId }));\n clearSelection();\n }\n }}\n >\n <FolderInput className=\"size-3.5\" />\n {tx('security.bulkActionBar.move', 'Move')}\n </Button>\n )}\n\n {canDeleteSecret && (\n <Button\n variant=\"destructive\"\n size=\"sm\"\n disabled={loading}\n onClick={() => setShowDeleteConfirm(true)}\n >\n <Trash2 className=\"size-3.5\" />\n {tx('security.bulkActionBar.delete', 'Delete')}\n </Button>\n )}\n </div>\n </div>\n\n <ConfirmDialog\n isOpen={showDeleteConfirm}\n onClose={() => setShowDeleteConfirm(false)}\n onConfirm={async () => {\n const selectedIds = useSecurityStore.getState().selectedSecretIds;\n await bulkDeleteSecrets(selectedIds);\n selectedIds.forEach((id) => emit('secret.deleted', { secretId: id, vaultId }));\n setShowDeleteConfirm(false);\n clearSelection();\n }}\n title={tx('security.bulkActionBar.deleteConfirm.title', 'Delete Selected Secrets')}\n description={tx(\n 'security.bulkActionBar.deleteConfirm.description',\n 'Are you sure you want to delete {count} selected secret{suffix}? This action cannot be undone.',\n { count: selectedCount, suffix: selectedCount !== 1 ? 's' : '' }\n )}\n confirmLabel={tx('security.bulkActionBar.deleteConfirm.confirm', 'Delete All')}\n variant=\"destructive\"\n />\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAkBA,IAAa,KAAyC,EAAE,YAAS,mBAAgB;CAC/E,IAAM,EAAE,SAAM,GAAS,EACjB,KAAM,GAAa,GAAkB,MACzC,EAAsB,GAAG,GAAK,GAAU,EAAO,EAE3C,IAAgB,GAAkB,MAAM,EAAE,kBAAkB,OAAO,EACnE,IAAiB,GAAkB,MAAM,EAAE,qBAAqB,EAChE,EAAE,sBAAmB,oBAAiB,qBAAkB,eAC5D,GAAyB,EACrB,EAAE,YAAS,GAAyB,EAEpC,IAAkB,EAAc,gBAAgB,EAChD,IAAkB,EAAc,gBAAgB,EAEhD,CAAC,GAAmB,KAAwB,EAAS,GAAM;AAIjE,QAFI,MAAkB,IAAU,OAG9B,kBAAA,GAAA,EAA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,EAAqB,GAAK;eAJ3C,CAME,kBAAC,GAAD,EAAQ,WAAU,YAAa,CAAA,EAC9B,EAAG,iCAAiC,SAAS,CACvC;;IAEP;KACF;KAEN,kBAAC,GAAD;EACE,QAAQ;EACR,eAAe,EAAqB,GAAM;EAC1C,WAAW,YAAY;GACrB,IAAM,IAAc,EAAiB,UAAU,CAAC;AAIhD,GAHA,MAAM,EAAkB,EAAY,EACpC,EAAY,SAAS,MAAO,EAAK,kBAAkB;IAAE,UAAU;IAAI;IAAS,CAAC,CAAC,EAC9E,EAAqB,GAAM,EAC3B,GAAgB;;EAElB,OAAO,EAAG,8CAA8C,0BAA0B;EAClF,aAAa,EACX,oDACA,kGACA;GAAE,OAAO;GAAe,QAAQ,MAAkB,IAAU,KAAN;GAAU,CACjE;EACD,cAAc,EAAG,gDAAgD,aAAa;EAC9E,SAAQ;EACR,CAAA,CACD,EAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"CopyButton.js","names":[],"sources":["../../../src/security/components/CopyButton.tsx"],"sourcesContent":["import { type FC, useState, useCallback, useEffect, useRef } from 'react';\nimport { Copy, Check, Timer } from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { copyToClipboard } from '../utils/clipboard';\n\ninterface CopyButtonProps {\n /** The value to copy to clipboard */\n value: string;\n /** Auto-clear clipboard after this many milliseconds (0 = no auto-clear) */\n autoClearMs?: number;\n /** Whether the button is disabled */\n disabled?: boolean;\n /** Additional CSS classes */\n className?: string;\n}\n\n/**\n * Copy-to-clipboard button with auto-clear countdown.\n * After copying, shows a checkmark and starts a countdown timer.\n * When the timer expires, the clipboard is cleared automatically.\n */\nexport const CopyButton: FC<CopyButtonProps> = ({\n value,\n autoClearMs = 30000,\n disabled = false,\n className,\n}) => {\n const [state, setState] = useState<'idle' | 'copied' | 'clearing'>('idle');\n const [countdown, setCountdown] = useState(0);\n const cancelRef = useRef<(() => void) | null>(null);\n const intervalRef = useRef<ReturnType<typeof setInterval> | null>(null);\n\n const cleanup = useCallback(() => {\n if (cancelRef.current) {\n cancelRef.current();\n cancelRef.current = null;\n }\n if (intervalRef.current) {\n clearInterval(intervalRef.current);\n intervalRef.current = null;\n }\n }, []);\n\n useEffect(() => {\n return cleanup;\n }, [cleanup]);\n\n const handleCopy = useCallback(async () => {\n if (disabled || !value) return;\n\n cleanup();\n\n const { promise, cancel } = copyToClipboard(value, autoClearMs);\n cancelRef.current = cancel;\n\n try {\n await promise;\n setState('copied');\n\n if (autoClearMs > 0) {\n setCountdown(autoClearMs);\n\n intervalRef.current = setInterval(() => {\n setCountdown((prev) => {\n const next = prev - 1000;\n if (next <= 0) {\n setState('idle');\n if (intervalRef.current) {\n clearInterval(intervalRef.current);\n intervalRef.current = null;\n }\n return 0;\n }\n return next;\n });\n }, 1000);\n } else {\n // No auto-clear, just show checkmark briefly\n setTimeout(() => setState('idle'), 2000);\n }\n } catch {\n setState('idle');\n }\n }, [value, autoClearMs, disabled, cleanup]);\n\n return (\n <button type=\"button\"\n onClick={handleCopy}\n disabled={disabled}\n className={cn(\n 'p-2 rounded-md text-muted-foreground hover:text-foreground',\n 'hover:bg-accent transition-colors relative',\n 'disabled:opacity-50 disabled:cursor-not-allowed',\n state === 'copied' && 'text-status-success-text hover:text-status-success-text',\n className\n )}\n title={\n state === 'idle'\n ? 'Copy to clipboard'\n : `Copied! Clipboard clears in ${Math.ceil(countdown / 1000)}s`\n }\n >\n {state === 'idle' ? (\n <Copy className=\"size-4\" />\n ) : (\n <div className=\"relative\">\n <Check className=\"size-4\" />\n {autoClearMs > 0 && countdown > 0 && (\n <span className=\"absolute -top-1 -right-1 flex items-center\">\n <Timer className=\"size-2.5 text-muted-foreground\" />\n </span>\n )}\n </div>\n )}\n </button>\n );\n};\n"],"mappings":";;;;;;AAqBA,IAAa,KAAmC,EAC9C,UACA,iBAAc,KACd,cAAW,IACX,mBACI;CACJ,IAAM,CAAC,GAAO,KAAY,EAAyC,OAAO,EACpE,CAAC,GAAW,KAAgB,EAAS,EAAE,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"sourcesContent":["import { type FC, useState, useCallback, useEffect, useRef } from 'react';\nimport { Copy, Check, Timer } from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { copyToClipboard } from '../utils/clipboard';\n\ninterface CopyButtonProps {\n /** The value to copy to clipboard */\n value: string;\n /** Auto-clear clipboard after this many milliseconds (0 = no auto-clear) */\n autoClearMs?: number;\n /** Whether the button is disabled */\n disabled?: boolean;\n /** Additional CSS classes */\n className?: string;\n}\n\n/**\n * Copy-to-clipboard button with auto-clear countdown.\n * After copying, shows a checkmark and starts a countdown timer.\n * When the timer expires, the clipboard is cleared automatically.\n */\nexport const CopyButton: FC<CopyButtonProps> = ({\n value,\n autoClearMs = 30000,\n disabled = false,\n className,\n}) => {\n const [state, setState] = useState<'idle' | 'copied' | 'clearing'>('idle');\n const [countdown, setCountdown] = useState(0);\n const cancelRef = useRef<(() => void) | null>(null);\n const intervalRef = useRef<ReturnType<typeof setInterval> | null>(null);\n\n const cleanup = useCallback(() => {\n if (cancelRef.current) {\n cancelRef.current();\n cancelRef.current = null;\n }\n if (intervalRef.current) {\n clearInterval(intervalRef.current);\n intervalRef.current = null;\n }\n }, []);\n\n useEffect(() => {\n return cleanup;\n }, [cleanup]);\n\n const handleCopy = useCallback(async () => {\n if (disabled || !value) return;\n\n cleanup();\n\n const { promise, cancel } = copyToClipboard(value, autoClearMs);\n cancelRef.current = cancel;\n\n try {\n await promise;\n setState('copied');\n\n if (autoClearMs > 0) {\n setCountdown(autoClearMs);\n\n intervalRef.current = setInterval(() => {\n setCountdown((prev) => {\n const next = prev - 1000;\n if (next <= 0) {\n setState('idle');\n if (intervalRef.current) {\n clearInterval(intervalRef.current);\n intervalRef.current = null;\n }\n return 0;\n }\n return next;\n });\n }, 1000);\n } else {\n // No auto-clear, just show checkmark briefly\n setTimeout(() => setState('idle'), 2000);\n }\n } catch {\n setState('idle');\n }\n }, [value, autoClearMs, disabled, cleanup]);\n\n return (\n <button\n type=\"button\"\n onClick={handleCopy}\n disabled={disabled}\n className={cn(\n 'p-2 rounded-md text-muted-foreground hover:text-foreground',\n 'hover:bg-accent transition-colors relative',\n 'disabled:opacity-50 disabled:cursor-not-allowed',\n state === 'copied' && 'text-status-success-text hover:text-status-success-text',\n className\n )}\n title={\n state === 'idle'\n ? 'Copy to clipboard'\n : `Copied! Clipboard clears in ${Math.ceil(countdown / 1000)}s`\n }\n >\n {state === 'idle' ? (\n <Copy className=\"size-4\" />\n ) : (\n <div className=\"relative\">\n <Check className=\"size-4\" />\n {autoClearMs > 0 && countdown > 0 && (\n <span className=\"absolute -top-1 -right-1 flex items-center\">\n <Timer className=\"size-2.5 text-muted-foreground\" />\n </span>\n )}\n </div>\n )}\n </button>\n );\n};\n"],"mappings":";;;;;;AAqBA,IAAa,KAAmC,EAC9C,UACA,iBAAc,KACd,cAAW,IACX,mBACI;CACJ,IAAM,CAAC,GAAO,KAAY,EAAyC,OAAO,EACpE,CAAC,GAAW,KAAgB,EAAS,EAAE,EACvC,IAAY,EAA4B,KAAK,EAC7C,IAAc,EAA8C,KAAK,EAEjE,IAAU,QAAkB;AAKhC,EAJA,AAEE,EAAU,aADV,EAAU,SAAS,EACC,OAEtB,AAEE,EAAY,aADZ,cAAc,EAAY,QAAQ,EACZ;IAEvB,EAAE,CAAC;AA4CN,QA1CA,QACS,GACN,CAAC,EAAQ,CAAC,EAyCX,kBAAC,UAAD;EACE,MAAK;EACL,SAzCe,EAAY,YAAY;AACzC,OAAI,KAAY,CAAC,EAAO;AAExB,MAAS;GAET,IAAM,EAAE,YAAS,cAAW,EAAgB,GAAO,EAAY;AAC/D,KAAU,UAAU;AAEpB,OAAI;AAIF,IAHA,MAAM,GACN,EAAS,SAAS,EAEd,IAAc,KAChB,EAAa,EAAY,EAEzB,EAAY,UAAU,kBAAkB;AACtC,QAAc,MAAS;MACrB,IAAM,IAAO,IAAO;AASpB,aARI,KAAQ,KACV,EAAS,OAAO,EAChB,AAEE,EAAY,aADZ,cAAc,EAAY,QAAQ,EACZ,OAEjB,KAEF;OACP;OACD,IAAK,IAGR,iBAAiB,EAAS,OAAO,EAAE,IAAK;WAEpC;AACN,MAAS,OAAO;;KAEjB;GAAC;GAAO;GAAa;GAAU;GAAQ,CAAC;EAM7B;EACV,WAAW,EACT,8DACA,8CACA,mDACA,MAAU,YAAY,2DACtB,EACD;EACD,OACE,MAAU,SACN,sBACA,+BAA+B,KAAK,KAAK,IAAY,IAAK,CAAC;YAGhE,MAAU,SACT,kBAAC,GAAD,EAAM,WAAU,UAAW,CAAA,GAE3B,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,GAAD,EAAO,WAAU,UAAW,CAAA,EAC3B,IAAc,KAAK,IAAY,KAC9B,kBAAC,QAAD;IAAM,WAAU;cACd,kBAAC,GAAD,EAAO,WAAU,kCAAmC,CAAA;IAC/C,CAAA,CAEL;;EAED,CAAA"}
@@ -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 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,WAAU;cAAf;KACE,kBAAC,OAAD;MAAK,WAAU;gBACZ;MACG,CAAA;KACN,kBAAC,UAAD;MAAQ,MAAK;MACX,SAAS;MACT,WAAU;MACV,OAAM;gBAEN,kBAAC,GAAD,EAAW,WAAU,UAAW,CAAA;MACzB,CAAA;KACT,kBAAC,GAAD;MAAY,OAAO;MAAU,aAAa;MAAwB,CAAA;KAC9D;;GAGN,kBAA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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"}
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 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,WAAU;cAAf;KACE,kBAAC,OAAD;MAAK,WAAU;gBACZ;MACG,CAAA;KACN,kBAAC,UAAD;MACE,MAAK;MACL,SAAS;MACT,WAAU;MACV,OAAM;gBAEN,kBAAC,GAAD,EAAW,WAAU,UAAW,CAAA;MACzB,CAAA;KACT,kBAAC,GAAD;MAAY,OAAO;MAAU,aAAa;MAAwB,CAAA;KAC9D;;GAGN,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,QAAD;MAAM,WAAU;gBAAwB;MAAe,CAAA,EACvD,kBAAC,QAAD;MAAM,WAAU;gBAA0B,EAAS;MAAa,CAAA,CAC5D;QACN,kBAAC,OAAD;KAAK,WAAU;eACb,kBAAC,OAAD;MACE,WAAW,EAAG,mDAAmD,EAAS,MAAM;MAChF,OAAO,EAAE,OAAO,GAAG,EAAS,MAAM,IAAI;MACtC,CAAA;KACE,CAAA,CACF;;GAGN,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,QAAD;MAAM,WAAU;gBAAwB;MAAa,CAAA,EACrD,kBAAC,QAAD;MAAM,WAAU;gBAA4B,EAAQ;MAAc,CAAA,CAC9D;QACN,kBAAC,SAAD;KACE,MAAK;KACL,KAAK;KACL,KAAK;KACL,OAAO,EAAQ;KACf,WAAW,MAAM,EAAmB,UAAU,SAAS,EAAE,OAAO,OAAO,GAAG,CAAC;KAC3E,WAAU;KACV,cAAW;KACX,CAAA,CACE;;GAGN,kBAAC,OAAD;IAAK,WAAU;cAAf,CACG;KACC;MAAE,KAAK;MAAsB,OAAO;MAAmB;KACvD;MAAE,KAAK;MAAsB,OAAO;MAAmB;KACvD;MAAE,KAAK;MAAoB,OAAO;MAAiB;KACnD;MAAE,KAAK;MAAoB,OAAO;MAAoB;KACvD,CAAC,KAAK,EAAE,QAAK,eACZ,kBAAC,SAAD;KAAiB,WAAU;eAA3B,CACE,kBAAC,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"}
@@ -5,8 +5,9 @@ import { PasswordGenerator as a } from "./PasswordGenerator.js";
5
5
  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
+ import { OptionalFields as d } from "@burdenoff/fe-libs/ui";
8
9
  //#region src/security/components/SecretFormFields.tsx
9
- var d = ({ type: n, value: r, onValueChange: i, showPasswordGen: o, setShowPasswordGen: l }) => n === "CREDENTIAL" ? /* @__PURE__ */ c("div", {
10
+ var f = ({ type: n, value: r, onValueChange: i, showPasswordGen: o, setShowPasswordGen: l }) => n === "CREDENTIAL" ? /* @__PURE__ */ c("div", {
10
11
  className: "space-y-2",
11
12
  children: [
12
13
  /* @__PURE__ */ s("label", {
@@ -79,91 +80,95 @@ var d = ({ type: n, value: r, onValueChange: i, showPasswordGen: o, setShowPassw
79
80
  rows: 3,
80
81
  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
  })]
82
- }), f = ({ type: a, onTypeChange: f, name: p, onNameChange: m, value: h, onValueChange: g, description: _, onDescriptionChange: v, labels: y, onLabelsChange: b, className: x }) => {
83
- let [S, C] = o(""), [w, T] = o(!1), E = i.map((e) => ({
83
+ }), p = ({ type: a, onTypeChange: p, name: m, onNameChange: h, value: g, onValueChange: _, description: v, onDescriptionChange: y, labels: b, onLabelsChange: x, className: S }) => {
84
+ let [C, w] = o(""), [T, E] = o(!1), D = i.map((e) => ({
84
85
  value: e.value,
85
86
  label: e.label
86
- })), D = () => {
87
- let e = S.trim();
88
- e && !y.includes(e) && (b([...y, e]), C(""));
89
- }, O = (e) => {
90
- b(y.filter((t) => t !== e));
87
+ })), O = () => {
88
+ let e = C.trim();
89
+ e && !b.includes(e) && (x([...b, e]), w(""));
90
+ }, k = (e) => {
91
+ x(b.filter((t) => t !== e));
91
92
  };
92
93
  return /* @__PURE__ */ c("div", {
93
- className: e("space-y-4", x),
94
+ className: e("space-y-4", S),
94
95
  children: [
95
96
  /* @__PURE__ */ s(r, {
96
97
  label: "Secret Type",
97
98
  value: a,
98
- onChange: (e) => f(e),
99
- options: E
99
+ onChange: (e) => p(e),
100
+ options: D
100
101
  }),
101
102
  /* @__PURE__ */ s(n, {
102
103
  id: "secret-name",
103
104
  label: "Name",
104
- value: p,
105
- onChange: (e) => m(e.target.value),
105
+ value: m,
106
+ onChange: (e) => h(e.target.value),
106
107
  placeholder: "e.g., production-database-password",
107
108
  required: !0
108
109
  }),
109
110
  /* @__PURE__ */ s(n, {
110
111
  id: "secret-description",
111
112
  label: "Description (optional)",
112
- value: _,
113
- onChange: (e) => v(e.target.value),
113
+ value: v,
114
+ onChange: (e) => y(e.target.value),
114
115
  placeholder: "Brief description of this secret"
115
116
  }),
116
- /* @__PURE__ */ s(d, {
117
+ /* @__PURE__ */ s(f, {
117
118
  type: a,
118
- value: h,
119
- onValueChange: g,
120
- showPasswordGen: w,
121
- setShowPasswordGen: T
119
+ value: g,
120
+ onValueChange: _,
121
+ showPasswordGen: T,
122
+ setShowPasswordGen: E
122
123
  }),
123
- /* @__PURE__ */ c("div", {
124
- className: "space-y-2",
125
- children: [
126
- /* @__PURE__ */ s("label", {
127
- htmlFor: "secret-new-label",
128
- className: "text-sm font-medium text-foreground",
129
- children: "Labels"
130
- }),
131
- /* @__PURE__ */ c("div", {
132
- className: "flex items-center gap-2",
133
- children: [/* @__PURE__ */ s("input", {
134
- id: "secret-new-label",
135
- "aria-label": "Add label",
136
- value: S,
137
- onChange: (e) => C(e.target.value),
138
- onKeyDown: (e) => e.key === "Enter" && (e.preventDefault(), D()),
139
- placeholder: "Add label",
140
- className: e("flex h-8 flex-1 rounded-md border border-border bg-background px-3 py-1 text-sm", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")
141
- }), /* @__PURE__ */ s(t, {
142
- variant: "outline",
143
- size: "sm",
144
- type: "button",
145
- onClick: D,
146
- children: /* @__PURE__ */ s(u, { className: "size-3" })
147
- })]
148
- }),
149
- y.length > 0 && /* @__PURE__ */ s("div", {
150
- className: "flex flex-wrap gap-1.5",
151
- children: y.map((e) => /* @__PURE__ */ c("span", {
152
- className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs bg-muted border border-border",
153
- children: [e, /* @__PURE__ */ s("button", {
124
+ /* @__PURE__ */ s(d, {
125
+ title: "Advanced metadata",
126
+ description: "Custom labels for filtering and grouping secrets.",
127
+ children: /* @__PURE__ */ c("div", {
128
+ className: "space-y-2",
129
+ children: [
130
+ /* @__PURE__ */ s("label", {
131
+ htmlFor: "secret-new-label",
132
+ className: "text-sm font-medium text-foreground",
133
+ children: "Labels"
134
+ }),
135
+ /* @__PURE__ */ c("div", {
136
+ className: "flex items-center gap-2",
137
+ children: [/* @__PURE__ */ s("input", {
138
+ id: "secret-new-label",
139
+ "aria-label": "Add label",
140
+ value: C,
141
+ onChange: (e) => w(e.target.value),
142
+ onKeyDown: (e) => e.key === "Enter" && (e.preventDefault(), O()),
143
+ placeholder: "Add label",
144
+ className: e("flex h-8 flex-1 rounded-md border border-border bg-background px-3 py-1 text-sm", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")
145
+ }), /* @__PURE__ */ s(t, {
146
+ variant: "outline",
147
+ size: "sm",
154
148
  type: "button",
155
- onClick: () => O(e),
156
- className: "p-0.5 rounded-full hover:bg-destructive/10 hover:text-destructive",
157
- children: /* @__PURE__ */ s(l, { className: "size-2.5" })
149
+ onClick: O,
150
+ children: /* @__PURE__ */ s(u, { className: "size-3" })
158
151
  })]
159
- }, e))
160
- })
161
- ]
152
+ }),
153
+ b.length > 0 && /* @__PURE__ */ s("div", {
154
+ className: "flex flex-wrap gap-1.5",
155
+ children: b.map((e) => /* @__PURE__ */ c("span", {
156
+ className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs bg-muted border border-border",
157
+ children: [e, /* @__PURE__ */ s("button", {
158
+ type: "button",
159
+ onClick: () => k(e),
160
+ className: "p-0.5 rounded-full hover:bg-destructive/10 hover:text-destructive",
161
+ children: /* @__PURE__ */ s(l, { className: "size-2.5" })
162
+ })]
163
+ }, e))
164
+ })
165
+ ]
166
+ })
162
167
  })
163
168
  ]
164
169
  });
165
170
  };
166
171
  //#endregion
167
- export { f as SecretFormFields };
172
+ export { p as SecretFormFields };
168
173
 
169
174
  //# 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 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;E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;GAEE,kBAAC,GAAD;IACE,OAAM;IACN,OAAO;IACP,WAAW,MAAM,EAAa,EAAgB;IAC9C,SAAS;IACT,CAAA;GAGF,kBAAC,GAAD;IACE,IAAG;IACH,OAAM;IACN,OAAO;IACP,WAAW,MAAM,EAAa,EAAE,OAAO,MAAM;IAC7C,aAAY;IACZ,UAAA;IACA,CAAA;GAGF,kBAAC,GAAD;IACE,IAAG;IACH,OAAM;IACN,OAAO;IACP,WAAW,MAAM,EAAoB,EAAE,OAAO,MAAM;IACpD,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"}
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 { OptionalFields } from '@burdenoff/fe-libs/ui';\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\">\n Value\n </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 — advanced classification, hidden by default */}\n <OptionalFields\n title=\"Advanced metadata\"\n description=\"Custom labels for filtering and grouping secrets.\"\n >\n <div className=\"space-y-2\">\n <label htmlFor=\"secret-new-label\" className=\"text-sm font-medium text-foreground\">\n Labels\n </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 </OptionalFields>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;AAiBA,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,M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"SecretValueDisplay.js","names":[],"sources":["../../../src/security/components/SecretValueDisplay.tsx"],"sourcesContent":["import { type FC, useEffect, useRef, useState } from 'react';\nimport { Eye, EyeOff } from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { CopyButton } from './CopyButton';\n\ninterface SecretValueDisplayProps {\n /** The actual secret value */\n value: string;\n /** Whether the value is currently revealed */\n isRevealed: boolean;\n /** Callback to toggle reveal state; if undefined the reveal button is disabled */\n onToggleReveal?: () => void;\n /** Auto-hide timer in milliseconds (0 = no auto-hide, default 30000) */\n autoHideMs?: number;\n /** Clipboard auto-clear time in ms */\n clipboardAutoClearMs?: number;\n /** Whether loading the decrypted value */\n isLoading?: boolean;\n /** Additional CSS classes */\n className?: string;\n}\n\n/**\n * Displays a secret value with masking, reveal toggle, and auto-hide.\n * When hidden, shows masked dots. When revealed, shows the actual value\n * with a monospaced font and auto-hides after the configured timeout.\n */\nexport const SecretValueDisplay: FC<SecretValueDisplayProps> = ({\n value,\n isRevealed,\n onToggleReveal,\n autoHideMs = 30000,\n clipboardAutoClearMs = 30000,\n isLoading = false,\n className,\n}) => {\n // When the current reveal window started (ms epoch). Held in a ref so prop\n // sync doesn't trigger a render; ticks come from a single state update below.\n const revealedAtRef = useRef<number | null>(null);\n // Bump on each tick to re-render the countdown. Single setState in effect.\n const [, setTick] = useState(0);\n\n // Latest onToggleReveal — accessed inside timeout without becoming a dep.\n const onToggleRevealRef = useRef(onToggleReveal);\n useEffect(() => {\n onToggleRevealRef.current = onToggleReveal;\n });\n\n // Reset the reveal window timestamp directly during render when isRevealed\n // changes — avoids adjusting state in an effect on prop change.\n const prevRevealedRef = useRef<boolean | null>(null);\n if (prevRevealedRef.current !== isRevealed) {\n prevRevealedRef.current = isRevealed;\n revealedAtRef.current = isRevealed && autoHideMs > 0 ? Date.now() : null;\n }\n\n // Tick every second while revealed so the countdown re-renders.\n useEffect(() => {\n if (!isRevealed || autoHideMs <= 0) return;\n const interval = setInterval(() => setTick((t) => t + 1), 1000);\n return () => clearInterval(interval);\n }, [isRevealed, autoHideMs]);\n\n // Auto-hide after the configured timeout.\n useEffect(() => {\n if (!isRevealed || autoHideMs <= 0) return;\n const hideTimeout = setTimeout(() => {\n onToggleRevealRef.current?.();\n }, autoHideMs);\n return () => clearTimeout(hideTimeout);\n }, [isRevealed, autoHideMs]);\n\n const revealedAt = revealedAtRef.current;\n const autoHideCountdown =\n isRevealed && autoHideMs > 0 && revealedAt !== null\n ? Math.max(0, autoHideMs - (Date.now() - revealedAt))\n : 0;\n\n const maskedValue = '\\u2022'.repeat(Math.min(24, value.length || 16));\n\n return (\n <div className={cn('flex items-center gap-2', className)}>\n <div\n className={cn(\n 'flex-1 px-3 py-2 rounded-md border border-border bg-muted/50',\n 'font-mono text-sm select-all',\n !isRevealed && 'tracking-wider'\n )}\n >\n {isLoading ? (\n <span className=\"text-muted-foreground animate-pulse\">Decrypting…</span>\n ) : isRevealed ? (\n <span className=\"break-all\">{value}</span>\n ) : (\n <span className=\"text-muted-foreground\">{maskedValue}</span>\n )}\n </div>\n\n <div className=\"flex items-center gap-1 shrink-0\">\n {/* Reveal/Hide toggle */}\n <button type=\"button\"\n onClick={onToggleReveal}\n disabled={isLoading || !onToggleReveal}\n className={cn(\n 'p-2 rounded-md text-muted-foreground hover:text-foreground',\n 'hover:bg-accent transition-colors',\n 'disabled:opacity-50 disabled:cursor-not-allowed'\n )}\n aria-label={isRevealed ? 'Hide value' : 'Reveal value'}\n title={isRevealed ? 'Hide value' : 'Reveal value'}\n >\n {isRevealed ? <EyeOff className=\"size-4\" /> : <Eye className=\"size-4\" />}\n </button>\n\n {/* Copy button */}\n <CopyButton\n value={value}\n autoClearMs={clipboardAutoClearMs}\n disabled={isLoading || !value}\n />\n </div>\n\n {/* Auto-hide countdown */}\n {isRevealed && autoHideMs > 0 && autoHideCountdown > 0 && (\n <span className=\"text-xs text-muted-foreground tabular-nums shrink-0\">\n {Math.ceil(autoHideCountdown / 1000)}s\n </span>\n )}\n </div>\n );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f,CAEE,kBAAC,UAAD;KAAQ,MAAK;KACX,SAAS;KACT,UAAU,KAAa,CAAC;KACxB,WAAW,EACT,8DACA,qCACA,kDACD;KACD,cAAY,IAAa,eAAe;KACxC,OAAO,IAAa,eAAe;eAErB,EAAb,IAAc,IAAgC,GAAjC,EAAQ,WAAU,UAAW,CAA6B;KACjE,CAAA,EAGT,kBAAC,GAAD;KACS;KACP,aAAa;KACb,UAAU,KAAa,CAAC;KACxB,CAAA,CACE;;GAGL,KAAc,IAAa,KAAK,IAAoB,KACnD,kBAAC,QAAD;IAAM,WAAU;cAAhB,CACG,KAAK,KAAK,IAAoB,IAAK,EAAC,IAChC;;GAEL"}
1
+ {"version":3,"file":"SecretValueDisplay.js","names":[],"sources":["../../../src/security/components/SecretValueDisplay.tsx"],"sourcesContent":["import { type FC, useEffect, useRef, useState } from 'react';\nimport { Eye, EyeOff } from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { CopyButton } from './CopyButton';\n\ninterface SecretValueDisplayProps {\n /** The actual secret value */\n value: string;\n /** Whether the value is currently revealed */\n isRevealed: boolean;\n /** Callback to toggle reveal state; if undefined the reveal button is disabled */\n onToggleReveal?: () => void;\n /** Auto-hide timer in milliseconds (0 = no auto-hide, default 30000) */\n autoHideMs?: number;\n /** Clipboard auto-clear time in ms */\n clipboardAutoClearMs?: number;\n /** Whether loading the decrypted value */\n isLoading?: boolean;\n /** Additional CSS classes */\n className?: string;\n}\n\n/**\n * Displays a secret value with masking, reveal toggle, and auto-hide.\n * When hidden, shows masked dots. When revealed, shows the actual value\n * with a monospaced font and auto-hides after the configured timeout.\n */\nexport const SecretValueDisplay: FC<SecretValueDisplayProps> = ({\n value,\n isRevealed,\n onToggleReveal,\n autoHideMs = 30000,\n clipboardAutoClearMs = 30000,\n isLoading = false,\n className,\n}) => {\n // When the current reveal window started (ms epoch). Held in a ref so prop\n // sync doesn't trigger a render; ticks come from a single state update below.\n const revealedAtRef = useRef<number | null>(null);\n // Bump on each tick to re-render the countdown. Single setState in effect.\n const [, setTick] = useState(0);\n\n // Latest onToggleReveal — accessed inside timeout without becoming a dep.\n const onToggleRevealRef = useRef(onToggleReveal);\n useEffect(() => {\n onToggleRevealRef.current = onToggleReveal;\n });\n\n // Reset the reveal window timestamp directly during render when isRevealed\n // changes — avoids adjusting state in an effect on prop change.\n const prevRevealedRef = useRef<boolean | null>(null);\n if (prevRevealedRef.current !== isRevealed) {\n prevRevealedRef.current = isRevealed;\n revealedAtRef.current = isRevealed && autoHideMs > 0 ? Date.now() : null;\n }\n\n // Tick every second while revealed so the countdown re-renders.\n useEffect(() => {\n if (!isRevealed || autoHideMs <= 0) return;\n const interval = setInterval(() => setTick((t) => t + 1), 1000);\n return () => clearInterval(interval);\n }, [isRevealed, autoHideMs]);\n\n // Auto-hide after the configured timeout.\n useEffect(() => {\n if (!isRevealed || autoHideMs <= 0) return;\n const hideTimeout = setTimeout(() => {\n onToggleRevealRef.current?.();\n }, autoHideMs);\n return () => clearTimeout(hideTimeout);\n }, [isRevealed, autoHideMs]);\n\n const revealedAt = revealedAtRef.current;\n const autoHideCountdown =\n isRevealed && autoHideMs > 0 && revealedAt !== null\n ? Math.max(0, autoHideMs - (Date.now() - revealedAt))\n : 0;\n\n const maskedValue = '\\u2022'.repeat(Math.min(24, value.length || 16));\n\n return (\n <div className={cn('flex items-center gap-2', className)}>\n <div\n className={cn(\n 'flex-1 px-3 py-2 rounded-md border border-border bg-muted/50',\n 'font-mono text-sm select-all',\n !isRevealed && 'tracking-wider'\n )}\n >\n {isLoading ? (\n <span className=\"text-muted-foreground animate-pulse\">Decrypting…</span>\n ) : isRevealed ? (\n <span className=\"break-all\">{value}</span>\n ) : (\n <span className=\"text-muted-foreground\">{maskedValue}</span>\n )}\n </div>\n\n <div className=\"flex items-center gap-1 shrink-0\">\n {/* Reveal/Hide toggle */}\n <button\n type=\"button\"\n onClick={onToggleReveal}\n disabled={isLoading || !onToggleReveal}\n className={cn(\n 'p-2 rounded-md text-muted-foreground hover:text-foreground',\n 'hover:bg-accent transition-colors',\n 'disabled:opacity-50 disabled:cursor-not-allowed'\n )}\n aria-label={isRevealed ? 'Hide value' : 'Reveal value'}\n title={isRevealed ? 'Hide value' : 'Reveal value'}\n >\n {isRevealed ? <EyeOff className=\"size-4\" /> : <Eye className=\"size-4\" />}\n </button>\n\n {/* Copy button */}\n <CopyButton\n value={value}\n autoClearMs={clipboardAutoClearMs}\n disabled={isLoading || !value}\n />\n </div>\n\n {/* Auto-hide countdown */}\n {isRevealed && autoHideMs > 0 && autoHideCountdown > 0 && (\n <span className=\"text-xs text-muted-foreground tabular-nums shrink-0\">\n {Math.ceil(autoHideCountdown / 1000)}s\n </span>\n )}\n </div>\n );\n};\n"],"mappings":";;;;;;AA2BA,IAAa,KAAmD,EAC9D,UACA,eACA,mBACA,gBAAa,KACb,0BAAuB,KACvB,eAAY,IACZ,mBACI;CAGJ,IAAM,IAAgB,EAAsB,KAAK,EAE3C,GAAG,KAAW,EAAS,EAAE,EAGzB,IAAoB,EAAO,EAAe;AAChD,SAAgB;AACd,IAAkB,UAAU;GAC5B;CAIF,IAAM,IAAkB,EAAuB,KAAK;AAcpD,CAbI,EAAgB,YAAY,MAC9B,EAAgB,UAAU,GAC1B,EAAc,UAAU,KAAc,IAAa,IAAI,KAAK,KAAK,GAAG,OAItE,QAAgB;AACd,MAAI,CAAC,KAAc,KAAc,EAAG;EACpC,IAAM,IAAW,kBAAkB,GAAS,MAAM,IAAI,EAAE,EAAE,IAAK;AAC/D,eAAa,cAAc,EAAS;IACnC,CAAC,GAAY,EAAW,CAAC,EAG5B,QAAgB;AACd,MAAI,CAAC,KAAc,KAAc,EAAG;EACpC,IAAM,IAAc,iBAAiB;AACnC,KAAkB,WAAW;KAC5B,EAAW;AACd,eAAa,aAAa,EAAY;IACrC,CAAC,GAAY,EAAW,CAAC;CAE5B,IAAM,IAAa,EAAc,SAC3B,IACJ,KAAc,IAAa,KAAK,MAAe,OAC3C,KAAK,IAAI,GAAG,KAAc,KAAK,KAAK,GAAG,GAAY,GACnD,GAEA,IAAc,IAAS,OAAO,KAAK,IAAI,IAAI,EAAM,UAAU,GAAG,CAAC;AAErE,QACE,kBAAC,OAAD;EAAK,WAAW,EAAG,2BAA2B,EAAU;YAAxD;GACE,kBAAC,OAAD;IACE,WAAW,EACT,gEACA,gCACA,CAAC,KAAc,iBAChB;cAEA,IACC,kBAAC,QAAD;KAAM,WAAU;eAAsC;KAAkB,CAAA,GACtE,IACF,kBAAC,QAAD;KAAM,WAAU;eAAa;KAAa,CAAA,GAE1C,kBAAC,QAAD;KAAM,WAAU;eAAyB;KAAmB,CAAA;IAE1D,CAAA;GAEN,kBAAC,OAAD;IAAK,WAAU;cAAf,CAEE,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,UAAU,KAAa,CAAC;KACxB,WAAW,EACT,8DACA,qCACA,kDACD;KACD,cAAY,IAAa,eAAe;KACxC,OAAO,IAAa,eAAe;eAErB,EAAb,IAAc,IAAgC,GAAjC,EAAQ,WAAU,UAAW,CAA6B;KACjE,CAAA,EAGT,kBAAC,GAAD;KACS;KACP,aAAa;KACb,UAAU,KAAa,CAAC;KACxB,CAAA,CACE;;GAGL,KAAc,IAAa,KAAK,IAAoB,KACnD,kBAAC,QAAD;IAAM,WAAU;cAAhB,CACG,KAAK,KAAK,IAAoB,IAAK,EAAC,IAChC;;GAEL"}
@@ -37,6 +37,7 @@ var d = ({ vault: d, onClick: f, isSelected: p, onSelect: m, className: h }) =>
37
37
  onClick: f,
38
38
  className: e("p-5", "focus-visible:ring-2 focus-visible:ring-primary focus-visible:outline-none", p && "ring-2 ring-primary/50", h),
39
39
  "aria-selected": p,
40
+ "data-tour": "vaults-card-item",
40
41
  children: [/* @__PURE__ */ a("div", {
41
42
  className: "flex items-start justify-between mb-3",
42
43
  children: [/* @__PURE__ */ a("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"VaultCard.js","names":[],"sources":["../../../src/security/components/VaultCard.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { KeyRound, Users, Lock, Archive } from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { Card, Badge } from './ui';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { translateWithFallback } from '../utils/i18n';\nimport type { Vault } from '../types';\n\ninterface VaultCardProps {\n vault: Vault;\n onClick?: () => void;\n isSelected?: boolean;\n onSelect?: (vaultId: string) => void;\n className?: string;\n}\n\nexport const VaultCard: FC<VaultCardProps> = ({\n vault,\n onClick,\n isSelected,\n onSelect,\n className,\n}) => {\n const { t } = useI18n();\n const tx = (key: string, fallback: string, params?: Record<string, string | number>) =>\n translateWithFallback(t, key, fallback, params);\n\n const statusConfig: Record<\n string,\n { label: string; variant: 'success' | 'warning' | 'outline'; icon: typeof Lock | null }\n > = {\n ACTIVE: {\n label: tx('security.vaultCard.status.active', 'Active'),\n variant: 'success',\n icon: null,\n },\n LOCKED: {\n label: tx('security.vaultCard.status.locked', 'Locked'),\n variant: 'warning',\n icon: Lock,\n },\n ARCHIVED: {\n label: tx('security.vaultCard.status.archived', 'Archived'),\n variant: 'outline',\n icon: Archive,\n },\n SUSPENDED: {\n label: tx('security.vaultCard.status.suspended', 'Suspended'),\n variant: 'outline',\n icon: Archive,\n },\n DELETED: {\n label: tx('security.vaultCard.status.deleted', 'Deleted'),\n variant: 'outline',\n icon: Archive,\n },\n };\n\n const status = statusConfig[vault.status] ?? statusConfig.ACTIVE;\n const StatusIcon = status.icon;\n\n const secretLabel =\n vault.secretCount === 1\n ? tx('security.vaultCard.secretCount.singular', '{count} secret', {\n count: vault.secretCount,\n })\n : tx('security.vaultCard.secretCount.plural', '{count} secrets', {\n count: vault.secretCount,\n });\n\n const memberLabel =\n vault.memberCount === 1\n ? tx('security.vaultCard.memberCount.singular', '{count} member', {\n count: vault.memberCount,\n })\n : tx('security.vaultCard.memberCount.plural', '{count} members', {\n count: vault.memberCount,\n });\n\n return (\n <Card\n onClick={onClick}\n className={cn(\n 'p-5',\n 'focus-visible:ring-2 focus-visible:ring-primary focus-visible:outline-none',\n isSelected && 'ring-2 ring-primary/50',\n className\n )}\n aria-selected={isSelected}\n >\n <div className=\"flex items-start justify-between mb-3\">\n <div className=\"flex items-center gap-2.5\">\n {onSelect && (\n <input\n type=\"checkbox\"\n checked={isSelected ?? false}\n onChange={(e) => {\n e.stopPropagation();\n onSelect(vault.id);\n }}\n onClick={(e) => e.stopPropagation()}\n className=\"size-4 rounded border-border text-primary focus:ring-primary shrink-0\"\n aria-label={tx('security.vaultCard.checkbox.aria', 'Select vault {name}', {\n name: vault.name,\n })}\n />\n )}\n <div className=\"p-2 rounded-lg bg-primary/10 text-primary\">\n <KeyRound className=\"size-5\" />\n </div>\n <div>\n <h3 className=\"font-semibold text-foreground leading-tight\">{vault.name}</h3>\n {vault.description && (\n <p className=\"text-xs text-muted-foreground mt-0.5 line-clamp-1\">\n {vault.description}\n </p>\n )}\n </div>\n </div>\n <Badge variant={status.variant}>\n {StatusIcon && <StatusIcon className=\"size-3\" />}\n {status.label}\n </Badge>\n </div>\n\n <div className=\"flex items-center gap-4 text-sm text-muted-foreground\">\n <div className=\"flex items-center gap-1.5\" aria-label={secretLabel}>\n <KeyRound className=\"size-3.5\" />\n <span aria-hidden=\"true\">{secretLabel}</span>\n </div>\n <div className=\"flex items-center gap-1.5\" aria-label={memberLabel}>\n <Users className=\"size-3.5\" />\n <span aria-hidden=\"true\">{memberLabel}</span>\n </div>\n </div>\n </Card>\n );\n};\n"],"mappings":";;;;;;;AAgBA,IAAa,KAAiC,EAC5C,UACA,YACA,eACA,aACA,mBACI;CACJ,IAAM,EAAE,SAAM,GAAS,EACjB,KAAM,GAAa,GAAkB,MACzC,EAAsB,GAAG,GAAK,GAAU,EAAO,EAE3C,IAGF;EACF,QAAQ;GACN,OAAO,EAAG,oCAAoC,SAAS;GACvD,SAAS;GACT,MAAM;GACP;EACD,QAAQ;GACN,OAAO,EAAG,oCAAoC,SAAS;GACvD,SAAS;GACT,MAAM;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,kBAAC,GAAD;IAAO,SAAS,EAAO;cAAvB,CACG,KAAc,kBAAC,GAAD,EAAY,WAAU,UAAW,CAAA,EAC/C,EAAO,MACF;MACJ;MAEN,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,OAAD;IAAK,WAAU;IAA4B,cAAY;cAAvD,CACE,kBAAC,GAAD,EAAU,WAAU,YAAa,CAAA,EACjC,kBAAC,QAAD;KAAM,eAAY;eAAQ;KAAmB,CAAA,CACzC;OACN,kBAAC,OAAD;IAAK,WAAU;IAA4B,cAAY;cAAvD,CACE,kBAAC,GAAD,EAAO,WAAU,YAAa,CAAA,EAC9B,kBAAC,QAAD;KAAM,eAAY;eAAQ;KAAmB,CAAA,CACzC;MACF;KACD"}
1
+ {"version":3,"file":"VaultCard.js","names":[],"sources":["../../../src/security/components/VaultCard.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { KeyRound, Users, Lock, Archive } from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { Card, Badge } from './ui';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { translateWithFallback } from '../utils/i18n';\nimport type { Vault } from '../types';\n\ninterface VaultCardProps {\n vault: Vault;\n onClick?: () => void;\n isSelected?: boolean;\n onSelect?: (vaultId: string) => void;\n className?: string;\n}\n\nexport const VaultCard: FC<VaultCardProps> = ({\n vault,\n onClick,\n isSelected,\n onSelect,\n className,\n}) => {\n const { t } = useI18n();\n const tx = (key: string, fallback: string, params?: Record<string, string | number>) =>\n translateWithFallback(t, key, fallback, params);\n\n const statusConfig: Record<\n string,\n { label: string; variant: 'success' | 'warning' | 'outline'; icon: typeof Lock | null }\n > = {\n ACTIVE: {\n label: tx('security.vaultCard.status.active', 'Active'),\n variant: 'success',\n icon: null,\n },\n LOCKED: {\n label: tx('security.vaultCard.status.locked', 'Locked'),\n variant: 'warning',\n icon: Lock,\n },\n ARCHIVED: {\n label: tx('security.vaultCard.status.archived', 'Archived'),\n variant: 'outline',\n icon: Archive,\n },\n SUSPENDED: {\n label: tx('security.vaultCard.status.suspended', 'Suspended'),\n variant: 'outline',\n icon: Archive,\n },\n DELETED: {\n label: tx('security.vaultCard.status.deleted', 'Deleted'),\n variant: 'outline',\n icon: Archive,\n },\n };\n\n const status = statusConfig[vault.status] ?? statusConfig.ACTIVE;\n const StatusIcon = status.icon;\n\n const secretLabel =\n vault.secretCount === 1\n ? tx('security.vaultCard.secretCount.singular', '{count} secret', {\n count: vault.secretCount,\n })\n : tx('security.vaultCard.secretCount.plural', '{count} secrets', {\n count: vault.secretCount,\n });\n\n const memberLabel =\n vault.memberCount === 1\n ? tx('security.vaultCard.memberCount.singular', '{count} member', {\n count: vault.memberCount,\n })\n : tx('security.vaultCard.memberCount.plural', '{count} members', {\n count: vault.memberCount,\n });\n\n return (\n <Card\n onClick={onClick}\n className={cn(\n 'p-5',\n 'focus-visible:ring-2 focus-visible:ring-primary focus-visible:outline-none',\n isSelected && 'ring-2 ring-primary/50',\n className\n )}\n aria-selected={isSelected}\n data-tour=\"vaults-card-item\"\n >\n <div className=\"flex items-start justify-between mb-3\">\n <div className=\"flex items-center gap-2.5\">\n {onSelect && (\n <input\n type=\"checkbox\"\n checked={isSelected ?? false}\n onChange={(e) => {\n e.stopPropagation();\n onSelect(vault.id);\n }}\n onClick={(e) => e.stopPropagation()}\n className=\"size-4 rounded border-border text-primary focus:ring-primary shrink-0\"\n aria-label={tx('security.vaultCard.checkbox.aria', 'Select vault {name}', {\n name: vault.name,\n })}\n />\n )}\n <div className=\"p-2 rounded-lg bg-primary/10 text-primary\">\n <KeyRound className=\"size-5\" />\n </div>\n <div>\n <h3 className=\"font-semibold text-foreground leading-tight\">{vault.name}</h3>\n {vault.description && (\n <p className=\"text-xs text-muted-foreground mt-0.5 line-clamp-1\">\n {vault.description}\n </p>\n )}\n </div>\n </div>\n <Badge variant={status.variant}>\n {StatusIcon && <StatusIcon className=\"size-3\" />}\n {status.label}\n </Badge>\n </div>\n\n <div className=\"flex items-center gap-4 text-sm text-muted-foreground\">\n <div className=\"flex items-center gap-1.5\" aria-label={secretLabel}>\n <KeyRound className=\"size-3.5\" />\n <span aria-hidden=\"true\">{secretLabel}</span>\n </div>\n <div className=\"flex items-center gap-1.5\" aria-label={memberLabel}>\n <Users className=\"size-3.5\" />\n <span aria-hidden=\"true\">{memberLabel}</span>\n </div>\n </div>\n </Card>\n );\n};\n"],"mappings":";;;;;;;AAgBA,IAAa,KAAiC,EAC5C,UACA,YACA,eACA,aACA,mBACI;CACJ,IAAM,EAAE,SAAM,GAAS,EACjB,KAAM,GAAa,GAAkB,MACzC,EAAsB,GAAG,GAAK,GAAU,EAAO,EAE3C,IAGF;EACF,QAAQ;GACN,OAAO,EAAG,oCAAoC,SAAS;GACvD,SAAS;GACT,MAAM;GACP;EACD,QAAQ;GACN,OAAO,EAAG,oCAAoC,SAAS;GACvD,SAAS;GACT,MAAM;GACP;EACD,UAAU;GACR,OAAO,EAAG,sCAAsC,WAAW;GAC3D,SAAS;GACT,MAAM;GACP;EACD,WAAW;GACT,OAAO,EAAG,uCAAuC,YAAY;GAC7D,SAAS;GACT,MAAM;GACP;EACD,SAAS;GACP,OAAO,EAAG,qCAAqC,UAAU;GACzD,SAAS;GACT,MAAM;GACP;EACF,EAEK,IAAS,EAAa,EAAM,WAAW,EAAa,QACpD,IAAa,EAAO,MAEpB,IACJ,EAAM,gBAAgB,IAClB,EAAG,2CAA2C,kBAAkB,EAC9D,OAAO,EAAM,aACd,CAAC,GACF,EAAG,yCAAyC,mBAAmB,EAC7D,OAAO,EAAM,aACd,CAAC,EAEF,IACJ,EAAM,gBAAgB,IAClB,EAAG,2CAA2C,kBAAkB,EAC9D,OAAO,EAAM,aACd,CAAC,GACF,EAAG,yCAAyC,mBAAmB,EAC7D,OAAO,EAAM,aACd,CAAC;AAER,QACE,kBAAC,GAAD;EACW;EACT,WAAW,EACT,OACA,8EACA,KAAc,0BACd,EACD;EACD,iBAAe;EACf,aAAU;YATZ,CAWE,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,OAAD;IAAK,WAAU;cAAf;KACG,KACC,kBAAC,SAAD;MACE,MAAK;MACL,SAAS,KAAc;MACvB,WAAW,MAAM;AAEf,OADA,EAAE,iBAAiB,EACnB,EAAS,EAAM,GAAG;;MAEpB,UAAU,MAAM,EAAE,iBAAiB;MACnC,WAAU;MACV,cAAY,EAAG,oCAAoC,uBAAuB,EACxE,MAAM,EAAM,MACb,CAAC;MACF,CAAA;KAEJ,kBAAC,OAAD;MAAK,WAAU;gBACb,kBAAC,GAAD,EAAU,WAAU,UAAW,CAAA;MAC3B,CAAA;KACN,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,MAAD;MAAI,WAAU;gBAA+C,EAAM;MAAU,CAAA,EAC5E,EAAM,eACL,kBAAC,KAAD;MAAG,WAAU;gBACV,EAAM;MACL,CAAA,CAEF,EAAA,CAAA;KACF;OACN,kBAAC,GAAD;IAAO,SAAS,EAAO;cAAvB,CACG,KAAc,kBAAC,GAAD,EAAY,WAAU,UAAW,CAAA,EAC/C,EAAO,MACF;MACJ;MAEN,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,OAAD;IAAK,WAAU;IAA4B,cAAY;cAAvD,CACE,kBAAC,GAAD,EAAU,WAAU,YAAa,CAAA,EACjC,kBAAC,QAAD;KAAM,eAAY;eAAQ;KAAmB,CAAA,CACzC;OACN,kBAAC,OAAD;IAAK,WAAU;IAA4B,cAAY;cAAvD,CACE,kBAAC,GAAD,EAAO,WAAU,YAAa,CAAA,EAC9B,kBAAC,QAAD;KAAM,eAAY;eAAQ;KAAmB,CAAA,CACzC;MACF;KACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"VaultShareDialog.js","names":[],"sources":["../../../src/security/components/VaultShareDialog.tsx"],"sourcesContent":["import { type FC, useState } from 'react';\nimport { X, UserPlus } from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { Button, Input, Select } from './ui';\nimport { VAULT_ROLES } from '../constants/permissions';\nimport type { VaultRole } from '../types';\n\ninterface VaultShareDialogProps {\n isOpen: boolean;\n onClose: () => void;\n onInvite: (email: string, role: VaultRole) => void;\n vaultName: string;\n className?: string;\n}\n\n/**\n * Dialog for inviting members to a vault with a role dropdown.\n */\nexport const VaultShareDialog: FC<VaultShareDialogProps> = ({\n isOpen,\n onClose,\n onInvite,\n vaultName,\n className,\n}) => {\n const [email, setEmail] = useState('');\n const [role, setRole] = useState<VaultRole>('viewer');\n\n if (!isOpen) return null;\n\n const handleSubmit = (e: React.FormEvent) => {\n e.preventDefault();\n if (!email.trim()) return;\n onInvite(email.trim(), role);\n setEmail('');\n setRole('viewer');\n };\n\n const roleOptions = VAULT_ROLES.flatMap((r) =>\n r.value === 'owner'\n ? []\n : [{ value: r.value, label: `${r.label} - ${r.description}` }]\n );\n\n return (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center\">\n {/* Backdrop */}\n <button\n type=\"button\"\n aria-label=\"Close dialog\"\n className=\"absolute inset-0 bg-black/50 cursor-default\"\n onClick={onClose}\n />\n\n {/* Dialog */}\n <div\n className={cn(\n 'relative z-10 w-full max-w-md rounded-lg bg-card border border-border shadow-lg p-6',\n className\n )}\n >\n <div className=\"flex items-center justify-between mb-4\">\n <h2 className=\"text-lg font-semibold text-foreground\">Share Vault</h2>\n <button type=\"button\" onClick={onClose} className=\"p-1 rounded hover:bg-accent text-muted-foreground\">\n <X className=\"size-4\" />\n </button>\n </div>\n\n <p className=\"text-sm text-muted-foreground mb-4\">\n Invite a member to <span className=\"font-medium text-foreground\">{vaultName}</span>\n </p>\n\n <form onSubmit={handleSubmit} className=\"space-y-4\">\n <Input\n id=\"invite-email\"\n label=\"User email or actor ID\"\n type=\"text\"\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n placeholder=\"colleague@example.com\"\n required\n />\n\n <Select\n label=\"Role\"\n value={role}\n onChange={(v) => setRole(v as VaultRole)}\n options={roleOptions}\n />\n\n <div className=\"flex justify-end gap-2 pt-2\">\n <Button variant=\"outline\" onClick={onClose} type=\"button\">\n Cancel\n </Button>\n <Button type=\"submit\" disabled={!email.trim()}>\n <UserPlus className=\"size-4\" />\n Invite\n </Button>\n </div>\n </form>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;AAkBA,IAAa,KAA+C,EAC1D,WACA,YACA,aACA,cACA,mBACI;CACJ,IAAM,CAAC,GAAO,KAAY,EAAS,GAAG,EAChC,CAAC,GAAM,KAAW,EAAoB,SAAS;AAErD,KAAI,CAAC,EAAQ,QAAO;CAEpB,IAAM,KAAgB,MAAuB;AAC3C,IAAE,gBAAgB,EACb,EAAM,MAAM,KACjB,EAAS,EAAM,MAAM,EAAE,EAAK,EAC5B,EAAS,GAAG,EACZ,EAAQ,SAAS;IAGb,IAAc,EAAY,SAAS,MACvC,EAAE,UAAU,UACR,EAAE,GACF,CAAC;EAAE,OAAO,EAAE;EAAO,OAAO,GAAG,EAAE,MAAM,KAAK,EAAE;EAAe,CAAC,CACjE;AAED,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CAEE,kBAAC,UAAD;GACE,MAAK;GACL,cAAW;GACX,WAAU;GACV,SAAS;GACT,CAAA,EAGF,kBAAC,OAAD;GACE,WAAW,EACT,uFACA,EACD;aAJH;IAME,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,MAAD;MAAI,WAAU;gBAAwC;MAAgB,CAAA,EACtE,kBAAC,UAAD;MAAQ,MAAK;MAAS,SAAS;MAAS,WAAU;gBAChD,kBAAC,GAAD,EAAG,WAAU,UAAW,CAAA;MACjB,CAAA,CACL;;IAEN,kBAAC,KAAD;KAAG,WAAU;eAAb,CAAkD,uBAC7B,kBAAC,QAAD;MAAM,WAAU;gBAA+B;MAAiB,CAAA,CACjF;;IAEJ,kBAAC,QAAD;KAAM,UAAU;KAAc,WAAU;eAAxC;MACE,kBAAC,GAAD;OACE,IAAG;OACH,OAAM;OACN,MAAK;OACL,OAAO;OACP,WAAW,MAAM,EAAS,EAAE,OAAO,MAAM;OACzC,aAAY;OACZ,UAAA;OACA,CAAA;MAEF,kBAAC,GAAD;OACE,OAAM;OACN,OAAO;OACP,WAAW,MAAM,EAAQ,EAAe;OACxC,SAAS;OACT,CAAA;MAEF,kBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,kBAAC,GAAD;QAAQ,SAAQ;QAAU,SAAS;QAAS,MAAK;kBAAS;QAEjD,CAAA,EACT,kBAAC,GAAD;QAAQ,MAAK;QAAS,UAAU,CAAC,EAAM,MAAM;kBAA7C,CACE,kBAAC,GAAD,EAAU,WAAU,UAAW,CAAA,EAAA,SAExB;UACL;;MACD;;IACH;KACF"}
1
+ {"version":3,"file":"VaultShareDialog.js","names":[],"sources":["../../../src/security/components/VaultShareDialog.tsx"],"sourcesContent":["import { type FC, useState } from 'react';\nimport { X, UserPlus } from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { Button, Input, Select } from './ui';\nimport { VAULT_ROLES } from '../constants/permissions';\nimport type { VaultRole } from '../types';\n\ninterface VaultShareDialogProps {\n isOpen: boolean;\n onClose: () => void;\n onInvite: (email: string, role: VaultRole) => void;\n vaultName: string;\n className?: string;\n}\n\n/**\n * Dialog for inviting members to a vault with a role dropdown.\n */\nexport const VaultShareDialog: FC<VaultShareDialogProps> = ({\n isOpen,\n onClose,\n onInvite,\n vaultName,\n className,\n}) => {\n const [email, setEmail] = useState('');\n const [role, setRole] = useState<VaultRole>('viewer');\n\n if (!isOpen) return null;\n\n const handleSubmit = (e: React.FormEvent) => {\n e.preventDefault();\n if (!email.trim()) return;\n onInvite(email.trim(), role);\n setEmail('');\n setRole('viewer');\n };\n\n const roleOptions = VAULT_ROLES.flatMap((r) =>\n r.value === 'owner' ? [] : [{ value: r.value, label: `${r.label} - ${r.description}` }]\n );\n\n return (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center\">\n {/* Backdrop */}\n <button\n type=\"button\"\n aria-label=\"Close dialog\"\n className=\"absolute inset-0 bg-black/50 cursor-default\"\n onClick={onClose}\n />\n\n {/* Dialog */}\n <div\n className={cn(\n 'relative z-10 w-full max-w-md rounded-lg bg-card border border-border shadow-lg p-6',\n className\n )}\n >\n <div className=\"flex items-center justify-between mb-4\">\n <h2 className=\"text-lg font-semibold text-foreground\">Share Vault</h2>\n <button\n type=\"button\"\n onClick={onClose}\n className=\"p-1 rounded hover:bg-accent text-muted-foreground\"\n >\n <X className=\"size-4\" />\n </button>\n </div>\n\n <p className=\"text-sm text-muted-foreground mb-4\">\n Invite a member to <span className=\"font-medium text-foreground\">{vaultName}</span>\n </p>\n\n <form onSubmit={handleSubmit} className=\"space-y-4\">\n <Input\n id=\"invite-email\"\n label=\"User email or actor ID\"\n type=\"text\"\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n placeholder=\"colleague@example.com\"\n required\n />\n\n <Select\n label=\"Role\"\n value={role}\n onChange={(v) => setRole(v as VaultRole)}\n options={roleOptions}\n />\n\n <div className=\"flex justify-end gap-2 pt-2\">\n <Button variant=\"outline\" onClick={onClose} type=\"button\">\n Cancel\n </Button>\n <Button type=\"submit\" disabled={!email.trim()}>\n <UserPlus className=\"size-4\" />\n Invite\n </Button>\n </div>\n </form>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;AAkBA,IAAa,KAA+C,EAC1D,WACA,YACA,aACA,cACA,mBACI;CACJ,IAAM,CAAC,GAAO,KAAY,EAAS,GAAG,EAChC,CAAC,GAAM,KAAW,EAAoB,SAAS;AAErD,KAAI,CAAC,EAAQ,QAAO;CAEpB,IAAM,KAAgB,MAAuB;AAC3C,IAAE,gBAAgB,EACb,EAAM,MAAM,KACjB,EAAS,EAAM,MAAM,EAAE,EAAK,EAC5B,EAAS,GAAG,EACZ,EAAQ,SAAS;IAGb,IAAc,EAAY,SAAS,MACvC,EAAE,UAAU,UAAU,EAAE,GAAG,CAAC;EAAE,OAAO,EAAE;EAAO,OAAO,GAAG,EAAE,MAAM,KAAK,EAAE;EAAe,CAAC,CACxF;AAED,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CAEE,kBAAC,UAAD;GACE,MAAK;GACL,cAAW;GACX,WAAU;GACV,SAAS;GACT,CAAA,EAGF,kBAAC,OAAD;GACE,WAAW,EACT,uFACA,EACD;aAJH;IAME,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,MAAD;MAAI,WAAU;gBAAwC;MAAgB,CAAA,EACtE,kBAAC,UAAD;MACE,MAAK;MACL,SAAS;MACT,WAAU;gBAEV,kBAAC,GAAD,EAAG,WAAU,UAAW,CAAA;MACjB,CAAA,CACL;;IAEN,kBAAC,KAAD;KAAG,WAAU;eAAb,CAAkD,uBAC7B,kBAAC,QAAD;MAAM,WAAU;gBAA+B;MAAiB,CAAA,CACjF;;IAEJ,kBAAC,QAAD;KAAM,UAAU;KAAc,WAAU;eAAxC;MACE,kBAAC,GAAD;OACE,IAAG;OACH,OAAM;OACN,MAAK;OACL,OAAO;OACP,WAAW,MAAM,EAAS,EAAE,OAAO,MAAM;OACzC,aAAY;OACZ,UAAA;OACA,CAAA;MAEF,kBAAC,GAAD;OACE,OAAM;OACN,OAAO;OACP,WAAW,MAAM,EAAQ,EAAe;OACxC,SAAS;OACT,CAAA;MAEF,kBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,kBAAC,GAAD;QAAQ,SAAQ;QAAU,SAAS;QAAS,MAAK;kBAAS;QAEjD,CAAA,EACT,kBAAC,GAAD;QAAQ,MAAK;QAAS,UAAU,CAAC,EAAM,MAAM;kBAA7C,CACE,kBAAC,GAAD,EAAU,WAAU,UAAW,CAAA,EAAA,SAExB;UACL;;MACD;;IACH;KACF"}
@@ -1,7 +1,8 @@
1
1
  import { cn as e } from "../utils/cn.js";
2
2
  import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
+ import { EmptyState as r } from "@burdenoff/fe-libs/ui";
3
4
  //#region src/security/components/ui.tsx
4
- var r = ({ children: n, variant: r = "default", className: i }) => /* @__PURE__ */ t("span", {
5
+ var i = ({ children: n, variant: r = "default", className: i }) => /* @__PURE__ */ t("span", {
5
6
  className: e("inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs font-medium", {
6
7
  default: "bg-primary/10 text-primary",
7
8
  success: "bg-status-success-bg-subtle text-status-success-text",
@@ -10,7 +11,7 @@ var r = ({ children: n, variant: r = "default", className: i }) => /* @__PURE__
10
11
  outline: "border border-border text-muted-foreground"
11
12
  }[r], i),
12
13
  children: n
13
- }), i = ({ children: n, variant: r = "primary", size: i = "md", className: a, ...o }) => /* @__PURE__ */ t("button", {
14
+ }), a = ({ children: n, variant: r = "primary", size: i = "md", className: a, ...o }) => /* @__PURE__ */ t("button", {
14
15
  type: "button",
15
16
  className: e("inline-flex items-center justify-center gap-2 rounded-md font-medium transition-colors", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", "disabled:pointer-events-none disabled:opacity-50", {
16
17
  primary: "bg-primary text-primary-foreground hover:bg-primary/90",
@@ -26,7 +27,7 @@ var r = ({ children: n, variant: r = "default", className: i }) => /* @__PURE__
26
27
  }[i], a),
27
28
  ...o,
28
29
  children: n
29
- }), a = ({ label: r, className: i, id: a, ...o }) => /* @__PURE__ */ n("div", {
30
+ }), o = ({ label: r, className: i, id: a, ...o }) => /* @__PURE__ */ n("div", {
30
31
  className: "space-y-1.5",
31
32
  children: [r && /* @__PURE__ */ t("label", {
32
33
  htmlFor: a,
@@ -37,7 +38,7 @@ var r = ({ children: n, variant: r = "default", className: i }) => /* @__PURE__
37
38
  className: e("flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm", "placeholder:text-muted-foreground", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", "disabled:cursor-not-allowed disabled:opacity-50", i),
38
39
  ...o
39
40
  })]
40
- }), o = ({ children: n, className: r, onClick: i, ...a }) => i ? /* @__PURE__ */ t("button", {
41
+ }), s = ({ children: n, className: r, onClick: i, ...a }) => i ? /* @__PURE__ */ t("button", {
41
42
  type: "button",
42
43
  className: e("block w-full text-left rounded-lg border border-border bg-card text-card-foreground shadow-sm", "cursor-pointer hover:shadow-md hover:border-primary/30 transition-all", r),
43
44
  onClick: i,
@@ -47,24 +48,15 @@ var r = ({ children: n, variant: r = "default", className: i }) => /* @__PURE__
47
48
  className: e("rounded-lg border border-border bg-card text-card-foreground shadow-sm", r),
48
49
  ...a,
49
50
  children: n
50
- }), s = ({ icon: r, title: i, description: a, action: o, className: s }) => /* @__PURE__ */ n("div", {
51
- className: e("flex flex-col items-center justify-center py-16 px-6 text-center", s),
52
- children: [
53
- r && /* @__PURE__ */ t("div", {
54
- className: "mb-4 text-muted-foreground",
55
- children: r
56
- }),
57
- /* @__PURE__ */ t("h3", {
58
- className: "text-lg font-semibold text-foreground mb-1",
59
- children: i
60
- }),
61
- a && /* @__PURE__ */ t("p", {
62
- className: "text-sm text-muted-foreground max-w-md mb-4",
63
- children: a
64
- }),
65
- o
66
- ]
67
- }), c = ({ label: r, value: i, onChange: a, options: o, className: s, disabled: c, id: l }) => /* @__PURE__ */ n("div", {
51
+ }), c = ({ icon: e, title: n, description: i, action: a, className: o }) => /* @__PURE__ */ t("div", {
52
+ className: o,
53
+ children: /* @__PURE__ */ t(r, {
54
+ icon: e,
55
+ title: n,
56
+ description: i,
57
+ action: a
58
+ })
59
+ }), l = ({ label: r, value: i, onChange: a, options: o, className: s, disabled: c, id: l }) => /* @__PURE__ */ n("div", {
68
60
  className: "space-y-1.5",
69
61
  children: [r && /* @__PURE__ */ t("label", {
70
62
  htmlFor: l,
@@ -83,6 +75,6 @@ var r = ({ children: n, variant: r = "default", className: i }) => /* @__PURE__
83
75
  })]
84
76
  });
85
77
  //#endregion
86
- export { r as Badge, i as Button, o as Card, s as EmptyState, a as Input, c as Select };
78
+ export { i as Badge, a as Button, s as Card, c as EmptyState, o as Input, l as Select };
87
79
 
88
80
  //# sourceMappingURL=ui.js.map