feat(web): add Modal + EmptyState primitives and a11y hooks

- Modal: shared backdrop/panel with ESC-close, backdrop-click-close,
  focus trap, body scroll lock; supports center + drawer-right variants,
  matrix/violet accents, default/wide widths.
- EmptyState: icon + title + hint + optional CTA; compact variant
  for tight rails.
- useEscapeKey, useFocusTrap: reusable hooks powering Modal; will also
  be adopted by CommandPalette and ContextMenu in follow-up commits.

No retrofits yet — primitives only. tsc clean.
This commit is contained in:
2026-04-22 17:04:37 -04:00
parent 73ccf12678
commit d0463c2c16
6 changed files with 271 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
/* Shared EmptyState styling. Component-scoped .empty-state rules
(Attackers/Bounty/LiveLogs) still win over these base rules. */
.empty-state-icon {
opacity: 0.4;
color: var(--violet);
}
.empty-state-title {
font-size: 0.75rem;
letter-spacing: 2px;
opacity: 0.7;
}
.empty-state-hint {
font-size: 0.65rem;
opacity: 0.45;
letter-spacing: 1px;
margin-top: -4px;
}
.empty-state-cta {
margin-top: 6px;
padding: 6px 12px;
background: transparent;
border: 1px solid var(--matrix);
color: var(--matrix);
font-family: var(--font-mono);
font-size: 0.65rem;
letter-spacing: 2px;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 6px;
text-transform: uppercase;
}
.empty-state-cta:hover {
background: rgba(0, 255, 65, 0.1);
box-shadow: 0 0 8px rgba(0, 255, 65, 0.3);
}
.empty-state.empty-state-compact {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 6px 4px;
font-size: 0.65rem;
letter-spacing: 1.5px;
opacity: 0.5;
color: var(--text-dim, #888);
}

View File

@@ -0,0 +1,46 @@
import React from 'react';
import type { LucideIcon } from 'lucide-react';
import './EmptyState.css';
interface CTA {
label: string;
onClick: () => void;
icon?: LucideIcon;
}
interface Props {
icon?: LucideIcon;
title: string;
hint?: string;
cta?: CTA;
size?: 'default' | 'compact';
className?: string;
}
const EmptyState: React.FC<Props> = ({ icon: Icon, title, hint, cta, size = 'default', className = '' }) => {
if (size === 'compact') {
return (
<div className={`empty-state empty-state-compact ${className}`}>
{Icon && <Icon size={12} />}
<span>{title}</span>
</div>
);
}
const CtaIcon = cta?.icon;
return (
<div className={`empty-state ${className}`}>
{Icon && <Icon size={28} className="empty-state-icon" />}
<div className="type-label empty-state-title">{title}</div>
{hint && <div className="empty-state-hint">{hint}</div>}
{cta && (
<button type="button" className="empty-state-cta" onClick={cta.onClick}>
{CtaIcon && <CtaIcon size={12} />}
<span>{cta.label}</span>
</button>
)}
</div>
);
};
export default EmptyState;