Skip to content

opendefender/ui-kit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛡️ OpenDefender UI Kit

Professional component library for OpenRisk Risk Management Platform.

Built with: React 19 | TypeScript | Tailwind CSS | Storybook 8
Design: Modern, Accessible, Performance-optimized
Status: ✅ Production Ready


🎯 Mission

Provide a cohesive, modern, and intuitive component library for OpenDefender suite (OpenRisk, OpenAsset, OpenSec, OpenWatch, OpenAudit, OpenConfig, OpenAccess, OpenShield, OpenGuard, etc.).

Consistent interfaces across all platforms. Enterprise-grade quality.


✨ Features

  • Production-Ready Components → 3+ atoms, 15+ hooks, extensible architecture
  • Storybook Integration → Live component preview with controls and documentation
  • Full TypeScript Support → 100% type-safe with exported definitions
  • Accessible (WCAG AA) → Color contrast, keyboard navigation, screen reader support
  • Dark & Light Modes → CSS variables for complete theme control
  • Animation System → 12+ pre-built Framer Motion variants
  • Responsive Design → Mobile-first, all devices supported
  • Performance Optimized → GPU-accelerated transforms, lazy loading ready
  • Modern Stack → React 19, TypeScript 5, Tailwind CSS 3, Vite
  • Enterprise Ready → Comprehensive documentation, CI/CD ready

📁 Project Structure

opendefender-ui/
├── frontend/ui-kit/                   # Component Library
│   ├── atoms/                         # Basic Components
│   │   ├── Badge.tsx                  # Risk severity indicators
│   │   ├── StatusDot.tsx              # Animated status indicators
│   │   ├── SecurityScore.tsx          # Circular progress meter
│   │   └── *.stories.tsx              # Storybook stories
│   │
│   ├── molecules/                     # Component Combinations (ready for expansion)
│   ├── organisms/                     # Complex Layouts (ready for expansion)
│   ├── templates/                     # Page Templates (ready for expansion)
│   │
│   ├── hooks/                         # Custom React Hooks (15+)
│   │   └── useInteraction.ts          # useModal, useForm, useAsync, etc.
│   │
│   ├── utils/                         # Utility Functions
│   │   ├── cn.ts                      # Class name utilities
│   │   ├── animations.ts              # Animation variants
│   │   └── types.ts                   # TypeScript definitions
│   │
│   ├── styles/                        # Global CSS
│   │   ├── globals.css                # Base styles (380 lines)
│   │   └── storybook.css              # Storybook theming
│   │
│   ├── index.ts                       # Main export file
│   └── README.md                      # Component library docs
│
├── .storybook/                        # Storybook Configuration
│   ├── main.ts                        # Main configuration
│   ├── preview.ts                     # Preview setup
│   └── tailwind.config.js             # Extended Tailwind theme
│
├── docs/                              # Documentation & Examples
│   ├── getting-started.md             # Quick start guide
│   ├── components.md                  # Component documentation
│   ├── utilities.md                   # Utility functions
│   └── examples/                      # HTML/React examples
│
├── UI_KIT_SETUP.md                    # Development setup guide
├── STORYBOOK_CONFIG.md                # Storybook configuration guide
├── UI_KIT_INTEGRATION.md              # OpenRisk integration guide
├── UI_KIT_QUICK_REFERENCE.md          # Quick lookup reference
├── UI_KIT_COMPLETION_REPORT.md        # Project completion summary
└── README.md                          # This file

🚀 Quick Start

View Components in Storybook

# Install dependencies
npm install

# Start Storybook dev server
npm run storybook
# Opens at http://localhost:6006

Using Components

import { Badge, StatusDot, SecurityScore, useModal } from '@openrisk/ui-kit';
import '@openrisk/ui-kit/styles/globals.css';

export function RiskCard() {
  const { isOpen, open, close } = useModal();
  
  return (
    <div>
      <Badge variant="critical">Critical Risk</Badge>
      <StatusDot severity="critical" label="Active" />
      <SecurityScore score={45} size="md" />
    </div>
  );
}

Installation via NPM

npm install @openrisk/ui-kit
import { Badge, useForm, useLoading } from '@openrisk/ui-kit';
import '@openrisk/ui-kit/styles/globals.css';

🎨 Design System

Colors

  • Risk Severity: Critical (red #ef4444), High (orange #f97316), Medium (amber #f59e0b), Low (green #22c55e)
  • Brand: Primary (blue #3b82f6), Secondary (violet #8b5cf6), Accent (pink #ec4899)
  • Status: Success, Warning, Error, Info
  • Theme: Dark (#0f1419) and Light modes supported

CSS Variables (40+)

All available in frontend/ui-kit/styles/globals.css

:root {
  /* Risk Colors */
  --risk-critical: #ef4444;
  --risk-high: #f97316;
  --risk-medium: #f59e0b;
  --risk-low: #22c55e;
  
  /* Brand Colors */
  --brand-primary: #3b82f6;
  --brand-secondary: #8b5cf6;
  --brand-accent: #ec4899;
  
  /* Dark Theme */
  --dark-bg: #0f1419;
  --dark-card: #1a1f2e;
  --dark-border: #2d3748;
}

Typography

  • Headings: H1 → H4 with semantic sizing
  • Body: Primary, Secondary, Tertiary, Muted text colors
  • Monospace: Fira Code for code blocks

Spacing & Layout

  • Scale: XS → SM → MD → LG → XL → 2XL
  • Responsive breakpoints: 320px → 2560px
  • Flexbox and grid utilities

📚 Documentation

Getting Started

Configuration & Integration

Project Info

Live Documentation

  • View components in Storybook: npm run storybookhttp://localhost:6006
  • Auto-generated docs from TypeScript props
  • Interactive prop controls for testing

🧩 Components & Hooks

Available Components (3 Atoms)

  • Badge — Risk severity and status indicators (8 variants)
  • StatusDot — Animated status indicators with pulse effect
  • SecurityScore — Circular progress meter with color gradients

Custom Hooks (15+)

State Management: useActive, useToggle, useCounter, useInput, useForm
UI Interactions: useHover, useFocus, useModal, useDropdown, useAnimation
Async & Utilities: useLoading, useError, useDebounce, usePrevious, useLocalStorage, useAsync

Utilities

  • cn() — Class name combining with Tailwind support
  • getRiskSeverityColor() — Map risk levels to color classes
  • Animation variants for Framer Motion
  • 20+ TypeScript type definitions

🎬 Animations

Pre-built animation variants with Framer Motion:

  • Entrances: Fade In, Slide In (left/right/top), Scale In
  • Emphasis: Pulse, Shimmer, Glow, Data Flow
  • Interactions: Hover Scale, Click Tap, Bounce
  • Staggered: Container and item animations for lists

All animations:

  • ✅ < 300ms for snappy feel
  • ✅ GPU-accelerated (transforms only)
  • ✅ Respect prefers-reduced-motion
  • ✅ Natural easing curves

♿ Accessibility

OpenRisk UI Kit is built with accessibility as a first-class citizen:

  • WCAG AA Compliant: All components meet WCAG 2.1 level AA standards
  • Semantic HTML: Proper heading hierarchy, landmarks, and ARIA labels
  • Keyboard Navigation: Full support for Tab, Enter, Escape, and arrow keys
  • Screen Reader Support: Tested with NVDA, JAWS, and VoiceOver
  • Color Contrast: 7:1 ratios exceed WCAG AAA for critical components
  • Motion: Respects prefers-reduced-motion media query
  • Focus Indicators: Clear, visible focus rings (minimum 2px, 3:1 contrast)
// Built-in a11y with React
<Badge 
  variant="risk"
  aria-label="Critical Risk: SQL Injection detected"
/>

Use Storybook's A11y addon to audit components: npm run storybook


🌙 Dark Mode

Dark mode is automatically supported via CSS variables and Tailwind's dark: utilities:

// Automatically adapts to system preference
<div className="bg-white dark:bg-gray-950">
  <p className="text-gray-900 dark:text-white">
    Adaptive content
  </p>
</div>
  • Detects prefers-color-scheme automatically
  • All 40+ CSS variables have dark counterparts
  • Storybook includes dark mode switcher in toolbar
  • No manual toggle needed (respects OS preference)

📊 Examples

Explore example implementations in the docs/examples/ directory:

View live components in Storybook: npm run storybook


🤝 Contributing

The OpenRisk UI Kit welcomes contributions!

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature
  3. Make changes and add tests
  4. Commit with clear messages: git commit -am 'feat: Add new component'
  5. Push and create a Pull Request

See CONTRIBUTING.md for detailed guidelines.


📄 License

MIT License — Free to use, modify, and distribute. See LICENSE for details.


🌟 Credits

This UI Kit was designed and built with inspiration from modern design systems and best practices in cybersecurity interfaces. See CREDITS.md for detailed attribution.

  • Vercel — Finesse moderne
  • Stripe Dashboard — Confiance et rigueur
  • GitHub — Sobriété fonctionnelle

📧 Support


Construit avec ❤️ pour rendre la cybersécurité accessible à tous.