Files
catalog/ts_web/styles/shared.styles.ts

531 lines
14 KiB
TypeScript
Raw Permalink Normal View History

2025-06-29 19:55:58 +00:00
import { css, cssManager, unsafeCSS } from '@design.estate/dees-element';
export const fonts = {
base: `'Geist Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif`,
mono: `'Geist Mono', ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace`
};
export const colors = {
// Background colors
background: {
primary: cssManager.bdTheme('#ffffff', '#09090b'),
secondary: cssManager.bdTheme('#fafafa', '#18181b'),
muted: cssManager.bdTheme('#f4f4f5', '#27272a'),
card: cssManager.bdTheme('#ffffff', '#0f0f12'),
elevated: cssManager.bdTheme('#ffffff', '#1a1a1e')
2025-06-29 19:55:58 +00:00
},
2025-06-29 19:55:58 +00:00
// Border colors
border: {
default: cssManager.bdTheme('#e4e4e7', '#27272a'),
muted: cssManager.bdTheme('#f4f4f5', '#3f3f46'),
subtle: cssManager.bdTheme('#f0f0f2', '#1f1f23')
2025-06-29 19:55:58 +00:00
},
2025-06-29 19:55:58 +00:00
// Text colors
text: {
primary: cssManager.bdTheme('#09090b', '#fafafa'),
secondary: cssManager.bdTheme('#71717a', '#a1a1aa'),
muted: cssManager.bdTheme('#a1a1aa', '#71717a')
2025-06-29 19:55:58 +00:00
},
// Status colors - vibrant and accessible
2025-06-29 19:55:58 +00:00
status: {
operational: cssManager.bdTheme('#16a34a', '#22c55e'),
degraded: cssManager.bdTheme('#d97706', '#fbbf24'),
partial: cssManager.bdTheme('#dc2626', '#f87171'),
major: cssManager.bdTheme('#b91c1c', '#ef4444'),
maintenance: cssManager.bdTheme('#2563eb', '#60a5fa')
},
// Accent colors for interactive elements
accent: {
primary: cssManager.bdTheme('#09090b', '#fafafa'),
hover: cssManager.bdTheme('#18181b', '#e4e4e7'),
focus: cssManager.bdTheme('#3b82f6', '#60a5fa')
2025-06-29 19:55:58 +00:00
}
};
export const shadows = {
xs: '0 1px 2px 0 rgba(0, 0, 0, 0.03)',
sm: '0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.06)',
base: '0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05)',
md: '0 6px 12px -2px rgba(0, 0, 0, 0.08), 0 3px 7px -3px rgba(0, 0, 0, 0.05)',
lg: '0 12px 24px -4px rgba(0, 0, 0, 0.1), 0 6px 12px -6px rgba(0, 0, 0, 0.05)',
xl: '0 24px 48px -12px rgba(0, 0, 0, 0.12), 0 12px 24px -12px rgba(0, 0, 0, 0.05)',
inner: 'inset 0 2px 4px 0 rgba(0, 0, 0, 0.04)',
glow: '0 0 20px -5px rgba(34, 197, 94, 0.3)'
2025-06-29 19:55:58 +00:00
};
export const borderRadius = {
xs: '3px',
2025-06-29 19:55:58 +00:00
sm: '4px',
base: '6px',
md: '8px',
lg: '12px',
xl: '16px',
'2xl': '24px',
2025-06-29 19:55:58 +00:00
full: '9999px'
};
export const spacing = {
xs: '4px',
sm: '8px',
md: '16px',
lg: '24px',
xl: '32px',
'2xl': '48px',
'3xl': '64px',
'4xl': '96px'
};
// Animation easings
export const easings = {
default: 'cubic-bezier(0.4, 0, 0.2, 1)',
smooth: 'cubic-bezier(0.4, 0, 0.6, 1)',
bounce: 'cubic-bezier(0.68, -0.55, 0.265, 1.55)',
snappy: 'cubic-bezier(0.2, 0, 0, 1)',
spring: 'cubic-bezier(0.175, 0.885, 0.32, 1.275)'
};
// Durations
export const durations = {
instant: '50ms',
fast: '100ms',
normal: '200ms',
slow: '300ms',
slower: '500ms',
slowest: '800ms'
};
// Status gradients for backgrounds
export const statusGradients = {
operational: cssManager.bdTheme(
'linear-gradient(135deg, rgba(22, 163, 74, 0.08) 0%, rgba(22, 163, 74, 0.02) 100%)',
'linear-gradient(135deg, rgba(34, 197, 94, 0.12) 0%, rgba(34, 197, 94, 0.03) 100%)'
),
degraded: cssManager.bdTheme(
'linear-gradient(135deg, rgba(217, 119, 6, 0.08) 0%, rgba(217, 119, 6, 0.02) 100%)',
'linear-gradient(135deg, rgba(251, 191, 36, 0.12) 0%, rgba(251, 191, 36, 0.03) 100%)'
),
partial: cssManager.bdTheme(
'linear-gradient(135deg, rgba(220, 38, 38, 0.08) 0%, rgba(220, 38, 38, 0.02) 100%)',
'linear-gradient(135deg, rgba(248, 113, 113, 0.12) 0%, rgba(248, 113, 113, 0.03) 100%)'
),
major: cssManager.bdTheme(
'linear-gradient(135deg, rgba(185, 28, 28, 0.10) 0%, rgba(185, 28, 28, 0.03) 100%)',
'linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.04) 100%)'
),
maintenance: cssManager.bdTheme(
'linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(37, 99, 235, 0.02) 100%)',
'linear-gradient(135deg, rgba(96, 165, 250, 0.12) 0%, rgba(96, 165, 250, 0.03) 100%)'
)
};
// Glassmorphism styles
export const glass = {
light: 'background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);',
dark: 'background: rgba(9, 9, 11, 0.8); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);',
subtle: cssManager.bdTheme(
'background: rgba(255, 255, 255, 0.5); backdrop-filter: blur(8px);',
'background: rgba(9, 9, 11, 0.6); backdrop-filter: blur(8px);'
)
};
// Status glow shadows
export const statusGlows = {
operational: '0 0 20px -5px rgba(34, 197, 94, 0.4)',
degraded: '0 0 20px -5px rgba(251, 191, 36, 0.4)',
partial: '0 0 20px -5px rgba(248, 113, 113, 0.4)',
major: '0 0 20px -5px rgba(239, 68, 68, 0.5)',
maintenance: '0 0 20px -5px rgba(96, 165, 250, 0.4)'
2025-06-29 19:55:58 +00:00
};
export const commonStyles = css`
/* Button styles */
.button {
display: inline-flex;
align-items: center;
justify-content: center;
font-family: ${unsafeCSS(fonts.base)};
font-size: 13px;
2025-06-29 19:55:58 +00:00
font-weight: 500;
height: 36px;
padding: 0 14px;
2025-06-29 19:55:58 +00:00
border-radius: ${unsafeCSS(borderRadius.base)};
border: 1px solid ${colors.border.default};
background: ${colors.background.primary};
2025-06-29 19:55:58 +00:00
color: ${colors.text.primary};
cursor: pointer;
user-select: none;
transition: all ${unsafeCSS(durations.normal)} ${unsafeCSS(easings.default)};
gap: 6px;
white-space: nowrap;
letter-spacing: -0.01em;
2025-06-29 19:55:58 +00:00
}
2025-06-29 19:55:58 +00:00
.button:hover {
background: ${colors.background.secondary};
border-color: ${cssManager.bdTheme('#d4d4d8', '#3f3f46')};
box-shadow: ${unsafeCSS(shadows.xs)};
2025-06-29 19:55:58 +00:00
}
2025-06-29 19:55:58 +00:00
.button:active {
transform: scale(0.98);
transition-duration: ${unsafeCSS(durations.fast)};
}
.button:focus-visible {
outline: 2px solid ${colors.accent.focus};
outline-offset: 2px;
2025-06-29 19:55:58 +00:00
}
2025-06-29 19:55:58 +00:00
.button.primary {
background: ${colors.accent.primary};
2025-06-29 19:55:58 +00:00
color: ${colors.background.primary};
border-color: transparent;
2025-06-29 19:55:58 +00:00
}
2025-06-29 19:55:58 +00:00
.button.primary:hover {
background: ${colors.accent.hover};
box-shadow: ${unsafeCSS(shadows.sm)};
2025-06-29 19:55:58 +00:00
}
.button.ghost {
background: transparent;
border-color: transparent;
}
.button.ghost:hover {
background: ${colors.background.muted};
}
.button.sm {
height: 32px;
padding: 0 12px;
font-size: 12px;
}
.button.lg {
height: 44px;
padding: 0 20px;
font-size: 15px;
}
2025-06-29 19:55:58 +00:00
/* Card styles */
.card {
background: ${colors.background.card};
border: 1px solid ${colors.border.default};
border-radius: ${unsafeCSS(borderRadius.lg)};
2025-06-29 19:55:58 +00:00
padding: ${unsafeCSS(spacing.lg)};
box-shadow: ${unsafeCSS(shadows.sm)};
transition: all ${unsafeCSS(durations.normal)} ${unsafeCSS(easings.default)};
}
.card:hover {
border-color: ${colors.border.muted};
box-shadow: ${unsafeCSS(shadows.base)};
}
.card.interactive {
cursor: pointer;
}
.card.interactive:hover {
transform: translateY(-2px);
box-shadow: ${unsafeCSS(shadows.md)};
2025-06-29 19:55:58 +00:00
}
2025-06-29 19:55:58 +00:00
/* Loading skeleton */
.skeleton {
background: ${cssManager.bdTheme(
'linear-gradient(90deg, #f4f4f5 0%, #e4e4e7 50%, #f4f4f5 100%)',
'linear-gradient(90deg, #18181b 0%, #27272a 50%, #18181b 100%)'
2025-06-29 19:55:58 +00:00
)};
background-size: 200% 100%;
animation: skeleton-loading 1.5s ease-in-out infinite;
2025-06-29 19:55:58 +00:00
border-radius: ${unsafeCSS(borderRadius.base)};
}
2025-06-29 19:55:58 +00:00
@keyframes skeleton-loading {
0% { background-position: 200% 0; }
100% { background-position: -200% 0; }
}
/* Pulse animation for status indicators */
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
/* Pulse ring animation for active status */
@keyframes pulse-ring {
0% {
transform: scale(1);
opacity: 0.8;
}
100% {
transform: scale(2.5);
opacity: 0;
}
}
/* Shimmer effect for loading states */
@keyframes shimmer {
0% {
background-position: -200% 0;
}
100% {
background-position: 200% 0;
}
}
/* Fade in animation */
@keyframes fadeIn {
from { opacity: 0; transform: translateY(4px); }
to { opacity: 1; transform: translateY(0); }
}
.fade-in {
animation: fadeIn ${unsafeCSS(durations.slow)} ${unsafeCSS(easings.default)} forwards;
}
/* Fade in up animation */
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(16px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.fade-in-up {
animation: fadeInUp ${unsafeCSS(durations.slower)} ${unsafeCSS(easings.default)} forwards;
}
/* Scale in animation */
@keyframes scaleIn {
from { opacity: 0; transform: scale(0.95); }
to { opacity: 1; transform: scale(1); }
}
.scale-in {
animation: scaleIn ${unsafeCSS(durations.slow)} ${unsafeCSS(easings.bounce)} forwards;
}
/* Slide down animation for expanding content */
@keyframes slideDown {
from {
opacity: 0;
transform: translateY(-8px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.slide-down {
animation: slideDown ${unsafeCSS(durations.slow)} ${unsafeCSS(easings.default)} forwards;
}
/* Stagger animation delay utilities */
.stagger-1 { animation-delay: 50ms; }
.stagger-2 { animation-delay: 100ms; }
.stagger-3 { animation-delay: 150ms; }
.stagger-4 { animation-delay: 200ms; }
.stagger-5 { animation-delay: 250ms; }
/* Status indicator with pulse ring */
.status-dot-animated {
position: relative;
width: 10px;
height: 10px;
border-radius: 50%;
}
.status-dot-animated::before {
content: '';
position: absolute;
inset: 0;
border-radius: 50%;
background: inherit;
animation: pulse-ring 2s ${unsafeCSS(easings.default)} infinite;
}
.status-dot-animated.operational::before {
background: ${colors.status.operational};
}
.status-dot-animated.degraded::before,
.status-dot-animated.partial_outage::before,
.status-dot-animated.major_outage::before {
animation: pulse-ring 1.5s ${unsafeCSS(easings.default)} infinite;
}
/* Hover lift effect */
.hover-lift {
transition: transform ${unsafeCSS(durations.normal)} ${unsafeCSS(easings.default)},
box-shadow ${unsafeCSS(durations.normal)} ${unsafeCSS(easings.default)};
}
.hover-lift:hover {
transform: translateY(-2px);
}
/* Icon animation */
.icon-spin {
animation: spin 1s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
/* Bounce animation for attention */
@keyframes bounce {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-4px); }
}
.bounce {
animation: bounce 1s ${unsafeCSS(easings.bounce)} infinite;
}
2025-06-29 19:55:58 +00:00
/* Container styles */
.container {
max-width: 1200px;
margin: 0 auto;
padding: 0 ${unsafeCSS(spacing.lg)};
}
/* Status pill */
.status-pill {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px 10px;
border-radius: ${unsafeCSS(borderRadius.full)};
font-size: 12px;
font-weight: 500;
letter-spacing: 0.01em;
}
.status-pill .status-dot {
width: 6px;
height: 6px;
border-radius: 50%;
flex-shrink: 0;
}
.status-pill.operational {
background: ${cssManager.bdTheme('rgba(22, 163, 74, 0.1)', 'rgba(34, 197, 94, 0.15)')};
color: ${cssManager.bdTheme('#15803d', '#4ade80')};
}
.status-pill.operational .status-dot {
background: ${colors.status.operational};
}
.status-pill.degraded {
background: ${cssManager.bdTheme('rgba(217, 119, 6, 0.1)', 'rgba(251, 191, 36, 0.15)')};
color: ${cssManager.bdTheme('#b45309', '#fcd34d')};
}
.status-pill.degraded .status-dot {
background: ${colors.status.degraded};
}
.status-pill.partial_outage,
.status-pill.major_outage {
background: ${cssManager.bdTheme('rgba(220, 38, 38, 0.1)', 'rgba(248, 113, 113, 0.15)')};
color: ${cssManager.bdTheme('#b91c1c', '#fca5a5')};
}
.status-pill.partial_outage .status-dot,
.status-pill.major_outage .status-dot {
background: ${colors.status.major};
}
.status-pill.maintenance {
background: ${cssManager.bdTheme('rgba(37, 99, 235, 0.1)', 'rgba(96, 165, 250, 0.15)')};
color: ${cssManager.bdTheme('#1d4ed8', '#93c5fd')};
}
.status-pill.maintenance .status-dot {
background: ${colors.status.maintenance};
}
2025-06-29 19:55:58 +00:00
/* Responsive utilities */
@media (max-width: 1024px) {
.container {
padding: 0 ${unsafeCSS(spacing.md)};
}
}
2025-06-29 19:55:58 +00:00
@media (max-width: 640px) {
.container {
padding: 0 ${unsafeCSS(spacing.md)};
}
.button {
height: 40px;
padding: 0 16px;
}
.button.sm {
height: 36px;
}
}
/* Visually hidden (for accessibility) */
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
2025-06-29 19:55:58 +00:00
}
`;
export const getStatusColor = (status: string) => {
switch (status) {
case 'operational':
return colors.status.operational;
case 'degraded':
return colors.status.degraded;
case 'partial_outage':
return colors.status.partial;
case 'major_outage':
return colors.status.major;
case 'maintenance':
return colors.status.maintenance;
default:
return colors.text.secondary;
}
};
export const getStatusIcon = (status: string) => {
switch (status) {
case 'operational':
return '✓';
case 'degraded':
return '!';
case 'partial_outage':
return '⚠';
case 'major_outage':
return '✕';
case 'maintenance':
return '🔧';
default:
return '?';
}
};