import { ReactNode } from "react"; import { CIAComponent, SecurityLevel } from "./cia"; /** * Standard interface for components that use security levels * * This interface should be used by any component that needs to display * or modify security levels for the CIA triad components. It provides * a consistent pattern for props across the application. * * @example * ```typescript * interface MyWidgetProps extends WithSecurityLevelProps { * customProp: string; * } * * const MyWidget: React.FC = ({ * availabilityLevel, * integrityLevel, * confidentialityLevel, * onAvailabilityChange * }) => { * // Component implementation * }; * ``` */ export interface WithSecurityLevelProps { /** * The selected availability level * * Controls system uptime and accessibility requirements. * * @example 'High' */ availabilityLevel: SecurityLevel; /** * The selected integrity level * * Controls data accuracy and consistency requirements. * * @example 'Very High' */ integrityLevel: SecurityLevel; /** * The selected confidentiality level * * Controls data privacy and access control requirements. * * @example 'Moderate' */ confidentialityLevel: SecurityLevel; /** * Optional callback fired when availability level changes * * @param level - New security level selected by user * * @example * ```typescript * onAvailabilityChange={(level) => { * console.log('New availability level:', level); * updateConfiguration('availability', level); * }} * ``` */ onAvailabilityChange?: (level: SecurityLevel) => void; /** * Optional callback fired when integrity level changes * * @param level - New security level selected by user * * @example * ```typescript * onIntegrityChange={(level) => { * console.log('New integrity level:', level); * updateConfiguration('integrity', level); * }} * ``` */ onIntegrityChange?: (level: SecurityLevel) => void; /** * Optional callback fired when confidentiality level changes * * @param level - New security level selected by user * * @example * ```typescript * onConfidentialityChange={(level) => { * console.log('New confidentiality level:', level); * updateConfiguration('confidentiality', level); * }} * ``` */ onConfidentialityChange?: (level: SecurityLevel) => void; } /** * Common props shared by all widgets * * Provides standard customization options that all widgets should support * for consistent styling and testing across the application. * * @example * ```typescript * * ``` */ export interface CommonWidgetProps { /** * Optional CSS class name for custom styling * * Allows consumers to apply custom styles via CSS classes. * Use Tailwind CSS classes or custom CSS classes. * * @example "mt-4 border-2 rounded-lg" */ className?: string; /** * Optional test ID for automated testing * * Used by testing frameworks (Cypress, Vitest) to locate * and interact with the component. Should follow the pattern * defined in testIds constants. * * @example "security-widget-availability" */ testId?: string; } /** * Combined interface for widgets that use security levels * * Merges security level props with common widget props, providing * a complete set of props for security-aware widgets. * * @example * ```typescript * const SecurityWidget: React.FC = ({ * availabilityLevel, * integrityLevel, * confidentialityLevel, * onAvailabilityChange, * className, * testId * }) => { * return ( *
* Widget content here *
* ); * }; * ``` */ export type SecurityWidgetProps = WithSecurityLevelProps & CommonWidgetProps; /** * Base interface for components that impact security levels * * Provides a foundation for components that need to display or * interact with security levels across all CIA components. * * Components should use specific level properties. * * @example * ```typescript * interface MyComponentProps extends ComponentImpactBaseProps { * additionalProp: string; * } * ``` */ export interface ComponentImpactBaseProps { /** * Current availability security level * * Represents the selected security level for system availability * and uptime requirements. */ availabilityLevel: SecurityLevel; /** * Current integrity security level * * Represents the selected security level for data integrity * and accuracy requirements. */ integrityLevel: SecurityLevel; /** * Current confidentiality security level * * Represents the selected security level for data privacy * and access control requirements. */ confidentialityLevel: SecurityLevel; /** * Optional CSS class name for custom styling */ className?: string; /** * Optional test ID for automated testing */ testId?: string; /** * Optional callback when security level changes */ onLevelChange?: (level: SecurityLevel) => void; } /** * Base props common to all widgets * * Provides the foundation for all widget components with standard * styling, testing capabilities, error handling, and child content. * * Extends CommonWidgetProps to maintain consistency with existing patterns. * * @example * ```typescript * interface MyWidgetProps extends BaseWidgetProps { * customProp: string; * } * ``` */ export interface BaseWidgetProps extends CommonWidgetProps { /** * Optional children elements */ children?: ReactNode; /** * Optional callback when widget encounters an error * @param error - Error that occurred */ onError?: (error: Error) => void; } /** * Base props for widgets that display CIA component data * * Used by widgets that need to show information for a single CIA component. * * @example * ```typescript * * ``` */ export interface CIAComponentWidgetProps extends BaseWidgetProps { /** * CIA triad component (availability, integrity, or confidentiality) */ component: CIAComponent; /** * Current security level for the component */ level: SecurityLevel; } /** * Base props for widgets that allow security level changes * * Extends CIAComponentWidgetProps with interactive change capability. * * @example * ```typescript * console.log('New level:', level)} * /> * ``` */ export interface SecurityLevelChangeWidgetProps extends CIAComponentWidgetProps { /** * Callback fired when security level changes * @param level - New security level selected by user */ onLevelChange: (level: SecurityLevel) => void; /** * If true, the widget is disabled and cannot be interacted with * @default false */ disabled?: boolean; } /** * Base props for widgets that display all three CIA components * * Used by widgets that need to show a complete security profile across * all CIA triad components. * * @example * ```typescript * * ``` */ export interface AllCIAComponentsProps extends BaseWidgetProps { /** * Security level for availability component */ availabilityLevel: SecurityLevel; /** * Security level for integrity component */ integrityLevel: SecurityLevel; /** * Security level for confidentiality component */ confidentialityLevel: SecurityLevel; } /** * Extract only the CIA level props from AllCIAComponentsProps * * Useful when you need just the security levels without other widget props. * * @example * ```typescript * const levels: CIALevelsOnly = { * availabilityLevel: 'High', * integrityLevel: 'Very High', * confidentialityLevel: 'Moderate' * }; * ``` */ export type CIALevelsOnly = Pick; /** * Make all CIA levels optional * * Useful for partial updates or default values. * * @example * ```typescript * const partialLevels: PartialCIALevels = { * availabilityLevel: 'High' * // other levels are optional * }; * ``` */ export type PartialCIALevels = Partial; /** * Widget props with loading state * * Generic interface for widgets that load and display data asynchronously. * * @template T - Type of data being loaded * * @example * ```typescript * interface MyData { * value: number; * } * * const props: WidgetPropsWithLoading = { * data: { value: 42 }, * loading: false, * error: undefined * }; * ``` */ export interface WidgetPropsWithLoading extends BaseWidgetProps { /** * Data to display in widget */ data: T | null; /** * If true, widget is loading data */ loading: boolean; /** * Error encountered while loading */ error?: Error; } /** * Props for SecurityLevelWidget component * * Allows users to select and view security level for CIA components. * * @example * ```typescript * setLevel('availability', level)} * /> * ``` */ export interface SecurityLevelWidgetProps extends AllCIAComponentsProps { /** * Callback fired when availability level changes * @param level - New availability security level */ onAvailabilityChange?: (level: SecurityLevel) => void; /** * Callback fired when integrity level changes * @param level - New integrity security level */ onIntegrityChange?: (level: SecurityLevel) => void; /** * Callback fired when confidentiality level changes * @param level - New confidentiality security level */ onConfidentialityChange?: (level: SecurityLevel) => void; } /** * Props for SecuritySummaryWidget component * * Displays comprehensive security assessment summary across all CIA components. * * @example * ```typescript * * ``` */ export type SecuritySummaryWidgetProps = AllCIAComponentsProps; /** * Props for BusinessImpactAnalysisWidget component * * Analyzes and displays business impact of security levels across * financial, operational, reputational, and regulatory dimensions. * * @example * ```typescript * * ``` */ export type BusinessImpactAnalysisWidgetProps = AllCIAComponentsProps; /** * Props for CostEstimationWidget component * * Estimates implementation costs for security controls based on * selected security levels across CIA components. * * @example * ```typescript * * ``` */ export type CostEstimationWidgetProps = AllCIAComponentsProps; /** * Props for ComplianceStatusWidget component * * Shows compliance status across multiple regulatory frameworks * based on current security levels. * * @example * ```typescript * * ``` */ export interface ComplianceStatusWidgetProps extends AllCIAComponentsProps { /** * Optional industry context for compliance */ industry?: string; /** * Optional region context for compliance */ region?: string; } /** * Props for ValueCreationWidget component * * Displays business value created by security investments * including ROI and value metrics. * * @example * ```typescript * * ``` */ export type ValueCreationWidgetProps = AllCIAComponentsProps; /** * Props for AvailabilityImpactWidget component * * Displays availability-specific business impact including uptime, * recovery objectives, and resilience requirements. * * @example * ```typescript * * ``` */ export interface AvailabilityImpactWidgetProps extends BaseWidgetProps { /** * Availability security level */ availabilityLevel: SecurityLevel; /** * Integrity security level (optional, for context) */ integrityLevel?: SecurityLevel; /** * Confidentiality security level (optional, for context) */ confidentialityLevel?: SecurityLevel; /** * If true, displays extended details * @default false */ showExtendedDetails?: boolean; } /** * Props for IntegrityImpactWidget component * * Displays integrity-specific business impact including data accuracy, * validation requirements, and audit controls. * * @example * ```typescript * * ``` */ export interface IntegrityImpactWidgetProps extends BaseWidgetProps { /** * Availability security level (optional, for context) */ availabilityLevel?: SecurityLevel; /** * Integrity security level */ integrityLevel: SecurityLevel; /** * Confidentiality security level (optional, for context) */ confidentialityLevel?: SecurityLevel; /** * If true, displays extended details * @default false */ showExtendedDetails?: boolean; } /** * Props for ConfidentialityImpactWidget component * * Displays confidentiality-specific business impact including data * classification, access controls, and privacy safeguards. * * @example * ```typescript * * ``` */ export interface ConfidentialityImpactWidgetProps extends BaseWidgetProps { /** * Availability security level (optional, for context) */ availabilityLevel?: SecurityLevel; /** * Integrity security level (optional, for context) */ integrityLevel?: SecurityLevel; /** * Confidentiality security level */ confidentialityLevel: SecurityLevel; /** * If true, displays extended details * @default false */ showExtendedDetails?: boolean; } /** * Props for the shared ImpactWidget component * * This is the base component used by all three impact widgets (Availability, * Integrity, Confidentiality). It provides a unified interface for displaying * CIA component-specific business impact analysis. * * @example * ```typescript * * ``` */ export interface ImpactWidgetProps extends CIAComponentWidgetProps { /** * If true, displays extended details (e.g., recommendations for integrity) * @default false */ showExtendedDetails?: boolean; } /** * Props for TechnicalDetailsWidget component * * Shows technical implementation details and guidance for * achieving security requirements. * * @example * ```typescript * * ``` */ export type TechnicalDetailsWidgetProps = AllCIAComponentsProps; /** * Props for SecurityResourcesWidget component * * Displays relevant security resources and documentation based * on current security configuration. * * @example * ```typescript * * ``` */ export interface SecurityResourcesWidgetProps extends AllCIAComponentsProps { /** * Maximum number of items to display * @default 8 */ maxItems?: number; /** * Optional flag to show only top/priority resources * @default false */ showTopResourcesOnly?: boolean; } /** * Props for SecurityVisualizationWidget component * * Visualizes security posture with interactive charts based on * CIA component security levels. * * @example * ```typescript * * ``` */ export type SecurityVisualizationWidgetProps = AllCIAComponentsProps; //# sourceMappingURL=widget-props.d.ts.map