// Copyright 2019-2025 @pezkuwi/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 import type { PasswordStrength } from '../util/passwordValidation.js'; import React from 'react'; import { styled } from '../styled.js'; interface Props { className?: string; passwordStrength: PasswordStrength; } function PasswordStrengthIndicator ({ className, passwordStrength }: Props): React.ReactElement { const { feedback, score } = passwordStrength; const strengthColors = [ '#ff4444', // Very Weak - Red '#ffa700', // Weak - Orange '#ffeb3b', // Medium - Yellow '#00C853', // Strong - Light Green '#00695C' // Very Strong - Dark Green ]; return (
{[0, 1, 2, 3, 4].map((index) => (
))}
{feedback.suggestions.length > 0 && (
    {feedback.suggestions.map((suggestion, index) => (
  • {suggestion}
  • ))}
)}
); } export default styled(PasswordStrengthIndicator)` .strength-meter { margin-top: 0.5rem; display: flex; margin-bottom: 0.5rem; } .strength-segment { flex: 1; height: 4px; margin: 0 2px; } .strength-label { font-size: 0.85rem; margin-bottom: 0.5rem; } .suggestions { margin: 0.5rem 0; padding-left: 1.5rem; font-size: 0.85rem; color: var(--warning-color); } `;