@b3-crow/ui-kit 0.0.31-pr25.10 → 0.0.31-pr30.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/cards/PricingCard.d.ts +35 -0
- package/dist/components/cards/PricingCard.d.ts.map +1 -0
- package/dist/components/cards/PricingCard.js +42 -0
- package/dist/components/cards/PricingCard.js.map +1 -0
- package/dist/components/dashboard/ChatHistorySection.d.ts +1 -1
- package/dist/components/dashboard/ChatHistorySection.d.ts.map +1 -1
- package/dist/components/dashboard/ChatHistorySection.js +30 -49
- package/dist/components/dashboard/ChatHistorySection.js.map +1 -1
- package/dist/components/dashboard/DashboardBackground.d.ts +1 -1
- package/dist/components/dashboard/DashboardBackground.d.ts.map +1 -1
- package/dist/components/dashboard/DashboardBackground.js +6 -79
- package/dist/components/dashboard/DashboardBackground.js.map +1 -1
- package/dist/components/dashboard/FilterDropdown.d.ts.map +1 -1
- package/dist/components/dashboard/FilterDropdown.js +55 -9
- package/dist/components/dashboard/FilterDropdown.js.map +1 -1
- package/dist/components/dashboard/GlassPanel.d.ts +9 -0
- package/dist/components/dashboard/GlassPanel.d.ts.map +1 -1
- package/dist/components/dashboard/GlassPanel.js +10 -1
- package/dist/components/dashboard/GlassPanel.js.map +1 -1
- package/dist/components/dashboard/Header.d.ts.map +1 -1
- package/dist/components/dashboard/Header.js +60 -44
- package/dist/components/dashboard/Header.js.map +1 -1
- package/dist/components/dashboard/IconBadge.d.ts +11 -1
- package/dist/components/dashboard/IconBadge.d.ts.map +1 -1
- package/dist/components/dashboard/IconBadge.js +23 -1
- package/dist/components/dashboard/IconBadge.js.map +1 -1
- package/dist/components/dashboard/ListItem.d.ts +12 -0
- package/dist/components/dashboard/ListItem.d.ts.map +1 -1
- package/dist/components/dashboard/ListItem.js +12 -0
- package/dist/components/dashboard/ListItem.js.map +1 -1
- package/dist/components/dashboard/MetricsCard.js +4 -2
- package/dist/components/dashboard/MetricsCard.js.map +1 -1
- package/dist/components/dashboard/MobileSidebar.d.ts +1 -1
- package/dist/components/dashboard/MobileSidebar.d.ts.map +1 -1
- package/dist/components/dashboard/MobileSidebar.js +18 -25
- package/dist/components/dashboard/MobileSidebar.js.map +1 -1
- package/dist/components/dashboard/NavMenu.d.ts.map +1 -1
- package/dist/components/dashboard/NavMenu.js +27 -106
- package/dist/components/dashboard/NavMenu.js.map +1 -1
- package/dist/components/dashboard/PatternCard.d.ts +2 -3
- package/dist/components/dashboard/PatternCard.d.ts.map +1 -1
- package/dist/components/dashboard/PatternCard.js +4 -43
- package/dist/components/dashboard/PatternCard.js.map +1 -1
- package/dist/components/dashboard/SearchInput.d.ts +16 -1
- package/dist/components/dashboard/SearchInput.d.ts.map +1 -1
- package/dist/components/dashboard/SearchInput.js +21 -10
- package/dist/components/dashboard/SearchInput.js.map +1 -1
- package/dist/components/dashboard/SectionHeader.d.ts.map +1 -1
- package/dist/components/dashboard/SectionHeader.js +3 -6
- package/dist/components/dashboard/SectionHeader.js.map +1 -1
- package/dist/components/dashboard/SettingsDropup.d.ts +1 -3
- package/dist/components/dashboard/SettingsDropup.d.ts.map +1 -1
- package/dist/components/dashboard/SettingsDropup.js +7 -147
- package/dist/components/dashboard/SettingsDropup.js.map +1 -1
- package/dist/components/dashboard/SettingsModal.d.ts +1 -1
- package/dist/components/dashboard/SettingsModal.d.ts.map +1 -1
- package/dist/components/dashboard/SettingsModal.js +10 -194
- package/dist/components/dashboard/SettingsModal.js.map +1 -1
- package/dist/components/dashboard/SidePanel.d.ts.map +1 -1
- package/dist/components/dashboard/SidePanel.js +41 -7
- package/dist/components/dashboard/SidePanel.js.map +1 -1
- package/dist/components/dashboard/Sidebar.d.ts +1 -1
- package/dist/components/dashboard/Sidebar.d.ts.map +1 -1
- package/dist/components/dashboard/Sidebar.js +5 -29
- package/dist/components/dashboard/Sidebar.js.map +1 -1
- package/dist/components/dashboard/SidebarLogo.d.ts.map +1 -1
- package/dist/components/dashboard/SidebarLogo.js +1 -41
- package/dist/components/dashboard/SidebarLogo.js.map +1 -1
- package/dist/components/dashboard/SourceIcon.d.ts +8 -0
- package/dist/components/dashboard/SourceIcon.d.ts.map +1 -1
- package/dist/components/dashboard/SourceIcon.js +13 -1
- package/dist/components/dashboard/SourceIcon.js.map +1 -1
- package/dist/components/dashboard/StatusBadge.d.ts +14 -2
- package/dist/components/dashboard/StatusBadge.d.ts.map +1 -1
- package/dist/components/dashboard/StatusBadge.js +12 -0
- package/dist/components/dashboard/StatusBadge.js.map +1 -1
- package/dist/components/dashboard/StatusIndicator.d.ts +9 -0
- package/dist/components/dashboard/StatusIndicator.d.ts.map +1 -1
- package/dist/components/dashboard/StatusIndicator.js +10 -4
- package/dist/components/dashboard/StatusIndicator.js.map +1 -1
- package/dist/components/dashboard/Tag.d.ts +9 -0
- package/dist/components/dashboard/Tag.d.ts.map +1 -1
- package/dist/components/dashboard/Tag.js +9 -0
- package/dist/components/dashboard/Tag.js.map +1 -1
- package/dist/components/dashboard/TipCard.d.ts +7 -0
- package/dist/components/dashboard/TipCard.d.ts.map +1 -1
- package/dist/components/dashboard/TipCard.js +7 -0
- package/dist/components/dashboard/TipCard.js.map +1 -1
- package/dist/components/dashboard/ToggleSwitch.d.ts +11 -1
- package/dist/components/dashboard/ToggleSwitch.d.ts.map +1 -1
- package/dist/components/dashboard/ToggleSwitch.js +20 -26
- package/dist/components/dashboard/ToggleSwitch.js.map +1 -1
- package/dist/components/dashboard/constants.d.ts +28 -0
- package/dist/components/dashboard/constants.d.ts.map +1 -0
- package/dist/components/dashboard/constants.js +104 -0
- package/dist/components/dashboard/constants.js.map +1 -0
- package/dist/components/dashboard/index.d.ts +2 -1
- package/dist/components/dashboard/index.d.ts.map +1 -1
- package/dist/components/dashboard/index.js +2 -1
- package/dist/components/dashboard/index.js.map +1 -1
- package/dist/components/dashboard/types.d.ts +11 -4
- package/dist/components/dashboard/types.d.ts.map +1 -1
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/layout/Navbar.js +1 -1
- package/dist/components/layout/Navbar.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +5 -4
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { Bell, BellOff, ChevronUp, LogOut, Settings, User, } from 'lucide-react';
|
|
4
|
+
import { useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
5
6
|
import { ToggleSwitch } from './ToggleSwitch';
|
|
6
|
-
export function SettingsDropup({ userName = 'User', userEmail = 'user@example.com',
|
|
7
|
+
export function SettingsDropup({ userName = 'User', userEmail = 'user@example.com', initialNotifications = true, onNotificationsChange, onLogout, }) {
|
|
7
8
|
const [isOpen, setIsOpen] = useState(false);
|
|
8
|
-
const [theme, setTheme] = useState(initialTheme);
|
|
9
9
|
const [notifications, setNotifications] = useState(initialNotifications);
|
|
10
10
|
const ref = useRef(null);
|
|
11
11
|
useEffect(() => {
|
|
@@ -17,153 +17,13 @@ export function SettingsDropup({ userName = 'User', userEmail = 'user@example.co
|
|
|
17
17
|
document.addEventListener('mousedown', handleClickOutside);
|
|
18
18
|
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
19
19
|
}, []);
|
|
20
|
-
const handleThemeToggle = () => {
|
|
21
|
-
const newTheme = theme === 'dark' ? 'light' : 'dark';
|
|
22
|
-
setTheme(newTheme);
|
|
23
|
-
onThemeChange?.(newTheme);
|
|
24
|
-
};
|
|
25
20
|
const handleNotificationsToggle = () => {
|
|
26
21
|
const newValue = !notifications;
|
|
27
22
|
setNotifications(newValue);
|
|
28
23
|
onNotificationsChange?.(newValue);
|
|
29
24
|
};
|
|
30
|
-
return (_jsxs("div", { ref: ref,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
bottom: 24,
|
|
34
|
-
position: 'absolute',
|
|
35
|
-
}, children: [_jsxs("div", { style: {
|
|
36
|
-
position: 'absolute',
|
|
37
|
-
bottom: 52,
|
|
38
|
-
left: 0,
|
|
39
|
-
width: 247,
|
|
40
|
-
background: 'rgba(10, 5, 20, 0.98)',
|
|
41
|
-
backdropFilter: 'blur(20px)',
|
|
42
|
-
borderRadius: 12,
|
|
43
|
-
border: '1px solid rgba(255, 255, 255, 0.08)',
|
|
44
|
-
boxShadow: '0px -8px 32px rgba(0, 0, 0, 0.4)',
|
|
45
|
-
overflow: 'hidden',
|
|
46
|
-
opacity: isOpen ? 1 : 0,
|
|
47
|
-
transform: isOpen ? 'translateY(0) scale(1)' : 'translateY(8px) scale(0.96)',
|
|
48
|
-
pointerEvents: isOpen ? 'auto' : 'none',
|
|
49
|
-
transition: 'all 0.2s cubic-bezier(0.16, 1, 0.3, 1)',
|
|
50
|
-
zIndex: 50,
|
|
51
|
-
}, children: [_jsxs("div", { style: {
|
|
52
|
-
padding: '14px 12px',
|
|
53
|
-
borderBottom: '1px solid rgba(255, 255, 255, 0.06)',
|
|
54
|
-
display: 'flex',
|
|
55
|
-
alignItems: 'center',
|
|
56
|
-
gap: 10,
|
|
57
|
-
}, children: [_jsx("div", { style: {
|
|
58
|
-
width: 36,
|
|
59
|
-
height: 36,
|
|
60
|
-
borderRadius: 9999,
|
|
61
|
-
background: 'rgba(139, 92, 246, 0.2)',
|
|
62
|
-
display: 'flex',
|
|
63
|
-
alignItems: 'center',
|
|
64
|
-
justifyContent: 'center',
|
|
65
|
-
border: '1px solid rgba(139, 92, 246, 0.3)',
|
|
66
|
-
flexShrink: 0,
|
|
67
|
-
}, children: _jsx(User, { size: 18, color: "#A78BFA", strokeWidth: 1.5 }) }), _jsxs("div", { style: { overflow: 'hidden' }, children: [_jsx("div", { style: {
|
|
68
|
-
color: 'white',
|
|
69
|
-
fontSize: 13,
|
|
70
|
-
fontWeight: 500,
|
|
71
|
-
fontFamily: 'Sora, sans-serif',
|
|
72
|
-
whiteSpace: 'nowrap',
|
|
73
|
-
overflow: 'hidden',
|
|
74
|
-
textOverflow: 'ellipsis',
|
|
75
|
-
}, children: userName }), _jsx("div", { style: {
|
|
76
|
-
color: '#6B7280',
|
|
77
|
-
fontSize: 11,
|
|
78
|
-
fontFamily: 'Sora, sans-serif',
|
|
79
|
-
whiteSpace: 'nowrap',
|
|
80
|
-
overflow: 'hidden',
|
|
81
|
-
textOverflow: 'ellipsis',
|
|
82
|
-
}, children: userEmail })] })] }), _jsxs("div", { style: { padding: '6px' }, children: [_jsxs("button", { type: "button", onClick: handleThemeToggle, style: {
|
|
83
|
-
width: '100%',
|
|
84
|
-
padding: '10px 8px',
|
|
85
|
-
display: 'flex',
|
|
86
|
-
alignItems: 'center',
|
|
87
|
-
justifyContent: 'space-between',
|
|
88
|
-
background: 'transparent',
|
|
89
|
-
border: 'none',
|
|
90
|
-
borderRadius: 8,
|
|
91
|
-
cursor: 'pointer',
|
|
92
|
-
transition: 'background 0.15s ease',
|
|
93
|
-
}, onMouseEnter: (e) => {
|
|
94
|
-
e.currentTarget.style.background = 'rgba(255, 255, 255, 0.04)';
|
|
95
|
-
}, onMouseLeave: (e) => {
|
|
96
|
-
e.currentTarget.style.background = 'transparent';
|
|
97
|
-
}, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 10 }, children: [theme === 'dark' ? (_jsx(Moon, { size: 15, color: "#A78BFA", strokeWidth: 2 })) : (_jsx(Sun, { size: 15, color: "#FBBF24", strokeWidth: 2 })), _jsx("span", { style: { color: '#D1D5DB', fontSize: 13, fontFamily: 'Sora, sans-serif' }, children: "Theme" })] }), _jsx("div", { style: {
|
|
98
|
-
padding: '3px 8px',
|
|
99
|
-
background: 'rgba(139, 92, 246, 0.15)',
|
|
100
|
-
borderRadius: 5,
|
|
101
|
-
color: '#C4B5FD',
|
|
102
|
-
fontSize: 11,
|
|
103
|
-
fontWeight: 500,
|
|
104
|
-
fontFamily: 'Sora, sans-serif',
|
|
105
|
-
}, children: theme === 'dark' ? 'Dark' : 'Light' })] }), _jsxs("button", { type: "button", onClick: handleNotificationsToggle, style: {
|
|
106
|
-
width: '100%',
|
|
107
|
-
padding: '10px 8px',
|
|
108
|
-
display: 'flex',
|
|
109
|
-
alignItems: 'center',
|
|
110
|
-
justifyContent: 'space-between',
|
|
111
|
-
background: 'transparent',
|
|
112
|
-
border: 'none',
|
|
113
|
-
borderRadius: 8,
|
|
114
|
-
cursor: 'pointer',
|
|
115
|
-
transition: 'background 0.15s ease',
|
|
116
|
-
}, onMouseEnter: (e) => {
|
|
117
|
-
e.currentTarget.style.background = 'rgba(255, 255, 255, 0.04)';
|
|
118
|
-
}, onMouseLeave: (e) => {
|
|
119
|
-
e.currentTarget.style.background = 'transparent';
|
|
120
|
-
}, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 10 }, children: [notifications ? (_jsx(Bell, { size: 15, color: "#10B981", strokeWidth: 2 })) : (_jsx(BellOff, { size: 15, color: "#6B7280", strokeWidth: 2 })), _jsx("span", { style: { color: '#D1D5DB', fontSize: 13, fontFamily: 'Sora, sans-serif' }, children: "Notifications" })] }), _jsx(ToggleSwitch, { enabled: notifications, size: "sm" })] })] }), onLogout && (_jsx("div", { style: {
|
|
121
|
-
padding: '6px',
|
|
122
|
-
borderTop: '1px solid rgba(255, 255, 255, 0.06)',
|
|
123
|
-
}, children: _jsxs("button", { type: "button", onClick: onLogout, style: {
|
|
124
|
-
width: '100%',
|
|
125
|
-
padding: '10px 8px',
|
|
126
|
-
display: 'flex',
|
|
127
|
-
alignItems: 'center',
|
|
128
|
-
gap: 10,
|
|
129
|
-
background: 'transparent',
|
|
130
|
-
border: 'none',
|
|
131
|
-
borderRadius: 8,
|
|
132
|
-
cursor: 'pointer',
|
|
133
|
-
transition: 'background 0.15s ease',
|
|
134
|
-
}, onMouseEnter: (e) => {
|
|
135
|
-
e.currentTarget.style.background = 'rgba(239, 68, 68, 0.1)';
|
|
136
|
-
}, onMouseLeave: (e) => {
|
|
137
|
-
e.currentTarget.style.background = 'transparent';
|
|
138
|
-
}, children: [_jsx(LogOut, { size: 15, color: "#EF4444", strokeWidth: 2 }), _jsx("span", { style: { color: '#EF4444', fontSize: 13, fontFamily: 'Sora, sans-serif' }, children: "Sign out" })] }) }))] }), _jsx("div", { style: { borderTop: '1px rgba(255, 255, 255, 0.08) solid', paddingTop: 12 }, children: _jsxs("button", { type: "button", onClick: () => setIsOpen(!isOpen), "aria-label": "Open settings", "aria-expanded": isOpen, style: {
|
|
139
|
-
width: 247,
|
|
140
|
-
height: 41,
|
|
141
|
-
borderRadius: 8,
|
|
142
|
-
background: isOpen ? 'rgba(255, 255, 255, 0.06)' : 'transparent',
|
|
143
|
-
border: 'none',
|
|
144
|
-
cursor: 'pointer',
|
|
145
|
-
transition: 'background 0.15s ease',
|
|
146
|
-
display: 'flex',
|
|
147
|
-
alignItems: 'center',
|
|
148
|
-
paddingLeft: 12,
|
|
149
|
-
gap: 12,
|
|
150
|
-
}, onMouseEnter: (e) => {
|
|
151
|
-
if (!isOpen)
|
|
152
|
-
e.currentTarget.style.background = 'rgba(255, 255, 255, 0.04)';
|
|
153
|
-
}, onMouseLeave: (e) => {
|
|
154
|
-
if (!isOpen)
|
|
155
|
-
e.currentTarget.style.background = 'transparent';
|
|
156
|
-
}, children: [_jsx("div", { style: { width: 20, height: 24, display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: _jsx(Settings, { size: 15, color: isOpen ? '#A78BFA' : '#6B7280', strokeWidth: 2 }) }), _jsx("span", { style: {
|
|
157
|
-
color: isOpen ? 'white' : '#9CA3AF',
|
|
158
|
-
fontSize: 14,
|
|
159
|
-
fontFamily: 'Sora, sans-serif',
|
|
160
|
-
fontWeight: 400,
|
|
161
|
-
lineHeight: '21px',
|
|
162
|
-
flex: 1,
|
|
163
|
-
textAlign: 'left',
|
|
164
|
-
}, children: "Settings" }), _jsx("div", { style: { width: 18, height: 22, display: 'flex', alignItems: 'center', justifyContent: 'center', marginRight: 12 }, children: _jsx(ChevronUp, { size: 12, color: isOpen ? '#A78BFA' : '#4B5563', strokeWidth: 2, style: {
|
|
165
|
-
transform: isOpen ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
166
|
-
transition: 'transform 0.2s ease',
|
|
167
|
-
} }) })] }) })] }));
|
|
25
|
+
return (_jsxs("div", { ref: ref, className: "w-[247px] absolute left-4 bottom-6", children: [_jsxs("div", { className: cn('absolute bottom-[52px] left-0 w-[247px]', 'bg-[rgba(10,5,20,0.98)] backdrop-blur-[20px] rounded-xl', 'border border-white/[0.08] shadow-[0px_-8px_32px_rgba(0,0,0,0.4)]', 'overflow-hidden z-50 transition-all duration-200 ease-[cubic-bezier(0.16,1,0.3,1)]', isOpen
|
|
26
|
+
? 'opacity-100 translate-y-0 scale-100 pointer-events-auto'
|
|
27
|
+
: 'opacity-0 translate-y-2 scale-[0.96] pointer-events-none'), children: [_jsxs("div", { className: "p-3 px-3 border-b border-white/[0.06] flex items-center gap-2.5", children: [_jsx("div", { className: "w-9 h-9 rounded-full bg-violet-500/20 flex items-center justify-center border border-violet-500/30 shrink-0", children: _jsx(User, { size: 18, className: "text-violet-400", strokeWidth: 1.5 }) }), _jsxs("div", { className: "overflow-hidden", children: [_jsx("div", { className: "text-white text-[13px] font-medium font-[Sora,sans-serif] truncate", children: userName }), _jsx("div", { className: "text-gray-500 text-[11px] font-[Sora,sans-serif] truncate", children: userEmail })] })] }), _jsx("div", { className: "p-1.5", children: _jsxs("button", { type: "button", onClick: handleNotificationsToggle, className: "w-full py-2.5 px-2 flex items-center justify-between bg-transparent border-none rounded-lg cursor-pointer transition-colors hover:bg-white/[0.04]", children: [_jsxs("div", { className: "flex items-center gap-2.5", children: [notifications ? (_jsx(Bell, { size: 15, className: "text-emerald-500", strokeWidth: 2 })) : (_jsx(BellOff, { size: 15, className: "text-gray-500", strokeWidth: 2 })), _jsx("span", { className: "text-gray-300 text-[13px] font-[Sora,sans-serif]", children: "Notifications" })] }), _jsx(ToggleSwitch, { enabled: notifications, onChange: handleNotificationsToggle, size: "sm", "aria-label": "Toggle notifications" })] }) }), onLogout && (_jsx("div", { className: "p-1.5 border-t border-white/[0.06]", children: _jsxs("button", { type: "button", onClick: onLogout, className: "w-full py-2.5 px-2 flex items-center gap-2.5 bg-transparent border-none rounded-lg cursor-pointer transition-colors hover:bg-red-500/10", children: [_jsx(LogOut, { size: 15, className: "text-red-500", strokeWidth: 2 }), _jsx("span", { className: "text-red-500 text-[13px] font-[Sora,sans-serif]", children: "Sign out" })] }) }))] }), _jsx("div", { className: "border-t border-white/[0.08] pt-3", children: _jsxs("button", { type: "button", onClick: () => setIsOpen(!isOpen), "aria-label": "Open settings", "aria-expanded": isOpen, className: cn('w-[247px] h-[41px] rounded-lg border-none cursor-pointer transition-colors', 'flex items-center pl-3 gap-3', isOpen ? 'bg-white/[0.06]' : 'bg-transparent hover:bg-white/[0.04]'), children: [_jsx("div", { className: "w-5 h-6 flex items-center justify-center", children: _jsx(Settings, { size: 15, className: cn(isOpen ? 'text-violet-400' : 'text-gray-500'), strokeWidth: 2 }) }), _jsx("span", { className: cn('text-sm font-normal leading-[21px] font-[Sora,sans-serif] flex-1 text-left', isOpen ? 'text-white' : 'text-gray-400'), children: "Settings" }), _jsx("div", { className: "w-[18px] h-[22px] flex items-center justify-center mr-3", children: _jsx(ChevronUp, { size: 12, className: cn('transition-transform duration-200', isOpen ? 'text-violet-400 rotate-180' : 'text-gray-600'), strokeWidth: 2 }) })] }) })] }));
|
|
168
28
|
}
|
|
169
29
|
//# sourceMappingURL=SettingsDropup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsDropup.js","sourceRoot":"","sources":["../../../src/components/dashboard/SettingsDropup.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,
|
|
1
|
+
{"version":3,"file":"SettingsDropup.js","sourceRoot":"","sources":["../../../src/components/dashboard/SettingsDropup.tsx"],"names":[],"m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oCAAoC,YACjD,kBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,QAAQ,EACjB,SAAS,EAAC,yIAAyI,aAEnJ,KAAC,MAAM,IAAC,IAAI,EAAE,EAAE,EAAE,SAAS,EAAC,cAAc,EAAC,WAAW,EAAE,CAAC,GAAI,EAC7D,eAAM,SAAS,EAAC,iDAAiD,yBAE1D,IACA,GACL,CACP,IACG,EAEN,cAAK,SAAS,EAAC,mCAAmC,YAChD,kBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,gBACtB,eAAe,mBACX,MAAM,EACrB,SAAS,EAAE,EAAE,CACX,4EAA4E,EAC5E,8BAA8B,EAC9B,MAAM,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,sCAAsC,CACpE,aAED,cAAK,SAAS,EAAC,0CAA0C,YACvD,KAAC,QAAQ,IACP,IAAI,EAAE,EAAE,EACR,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,eAAe,CAAC,EAC3D,WAAW,EAAE,CAAC,GACd,GACE,EACN,eACE,SAAS,EAAE,EAAE,CACX,4EAA4E,EAC5E,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,eAAe,CACxC,yBAGI,EACP,cAAK,SAAS,EAAC,yDAAyD,YACtE,KAAC,SAAS,IACR,IAAI,EAAE,EAAE,EACR,SAAS,EAAE,EAAE,CACX,mCAAmC,EACnC,MAAM,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,eAAe,CACxD,EACD,WAAW,EAAE,CAAC,GACd,GACE,IACC,GACL,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { SettingsModalProps } from './types';
|
|
2
2
|
export type { SettingsModalProps };
|
|
3
|
-
export declare function SettingsModal({ isOpen, onClose, userEmail, userName, onLogout,
|
|
3
|
+
export declare function SettingsModal({ isOpen, onClose, userEmail, userName, onLogout, onNotificationsChange, initialNotifications, }: SettingsModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
4
4
|
//# sourceMappingURL=SettingsModal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsModal.d.ts","sourceRoot":"","sources":["../../../src/components/dashboard/SettingsModal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SettingsModal.d.ts","sourceRoot":"","sources":["../../../src/components/dashboard/SettingsModal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAMlD,YAAY,EAAE,kBAAkB,EAAE,CAAC;AAEnC,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,OAAO,EACP,SAA8B,EAC9B,QAAiB,EACjB,QAAQ,EACR,qBAAqB,EACrB,oBAA2B,GAC5B,EAAE,kBAAkB,kDA2KpB"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { Bell, BellOff, Globe, LogOut, User, X } from 'lucide-react';
|
|
4
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
import { ToggleSwitch } from './ToggleSwitch';
|
|
7
|
+
export function SettingsModal({ isOpen, onClose, userEmail = 'user@example.com', userName = 'User', onLogout, onNotificationsChange, initialNotifications = true, }) {
|
|
7
8
|
const [notifications, setNotifications] = useState(initialNotifications);
|
|
8
9
|
const [isClosing, setIsClosing] = useState(false);
|
|
9
10
|
const closeTimeoutRef = useRef(null);
|
|
11
|
+
const modalRef = useRef(null);
|
|
10
12
|
useEffect(() => {
|
|
11
13
|
if (isOpen) {
|
|
12
14
|
setIsClosing(false);
|
|
15
|
+
modalRef.current?.focus();
|
|
13
16
|
}
|
|
14
17
|
}, [isOpen]);
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
setTheme(initialTheme);
|
|
17
|
-
}, [initialTheme]);
|
|
18
18
|
useEffect(() => {
|
|
19
19
|
setNotifications(initialNotifications);
|
|
20
20
|
}, [initialNotifications]);
|
|
@@ -42,11 +42,6 @@ export function SettingsModal({ isOpen, onClose, userEmail = 'user@example.com',
|
|
|
42
42
|
document.addEventListener('keydown', handleKeyDown);
|
|
43
43
|
return () => document.removeEventListener('keydown', handleKeyDown);
|
|
44
44
|
}, [isOpen, handleClose]);
|
|
45
|
-
const handleThemeToggle = () => {
|
|
46
|
-
const newTheme = theme === 'dark' ? 'light' : 'dark';
|
|
47
|
-
setTheme(newTheme);
|
|
48
|
-
onThemeChange?.(newTheme);
|
|
49
|
-
};
|
|
50
45
|
const handleNotificationsToggle = () => {
|
|
51
46
|
const newValue = !notifications;
|
|
52
47
|
setNotifications(newValue);
|
|
@@ -54,187 +49,8 @@ export function SettingsModal({ isOpen, onClose, userEmail = 'user@example.com',
|
|
|
54
49
|
};
|
|
55
50
|
if (!isOpen)
|
|
56
51
|
return null;
|
|
57
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { role: "presentation", "aria-hidden": "true", onClick: handleClose,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
background: 'rgba(0, 0, 0, 0.6)',
|
|
61
|
-
backdropFilter: 'blur(4px)',
|
|
62
|
-
zIndex: 100,
|
|
63
|
-
opacity: isClosing ? 0 : 1,
|
|
64
|
-
transition: 'opacity 0.2s ease',
|
|
65
|
-
} }), _jsxs("div", { role: "dialog", "aria-modal": "true", "aria-labelledby": "settings-modal-title", style: {
|
|
66
|
-
position: 'fixed',
|
|
67
|
-
top: '50%',
|
|
68
|
-
left: '50%',
|
|
69
|
-
transform: isClosing
|
|
70
|
-
? 'translate(-50%, -50%) scale(0.95)'
|
|
71
|
-
: 'translate(-50%, -50%) scale(1)',
|
|
72
|
-
width: 400,
|
|
73
|
-
maxWidth: '90vw',
|
|
74
|
-
background: 'rgba(10, 5, 20, 0.98)',
|
|
75
|
-
backdropFilter: 'blur(20px)',
|
|
76
|
-
borderRadius: 16,
|
|
77
|
-
border: '1px solid rgba(255, 255, 255, 0.08)',
|
|
78
|
-
boxShadow: '0px 24px 48px rgba(0, 0, 0, 0.5), 0px 0px 1px rgba(139, 92, 246, 0.3)',
|
|
79
|
-
zIndex: 101,
|
|
80
|
-
opacity: isClosing ? 0 : 1,
|
|
81
|
-
transition: 'all 0.2s cubic-bezier(0.16, 1, 0.3, 1)',
|
|
82
|
-
}, children: [_jsxs("div", { style: {
|
|
83
|
-
display: 'flex',
|
|
84
|
-
alignItems: 'center',
|
|
85
|
-
justifyContent: 'space-between',
|
|
86
|
-
padding: '20px 24px',
|
|
87
|
-
borderBottom: '1px solid rgba(255, 255, 255, 0.06)',
|
|
88
|
-
}, children: [_jsx("h2", { id: "settings-modal-title", style: {
|
|
89
|
-
color: 'white',
|
|
90
|
-
fontSize: 18,
|
|
91
|
-
fontWeight: 600,
|
|
92
|
-
fontFamily: 'Sora, sans-serif',
|
|
93
|
-
margin: 0,
|
|
94
|
-
}, children: "Settings" }), _jsx("button", { type: "button", onClick: handleClose, "aria-label": "Close settings", style: {
|
|
95
|
-
width: 32,
|
|
96
|
-
height: 32,
|
|
97
|
-
display: 'flex',
|
|
98
|
-
alignItems: 'center',
|
|
99
|
-
justifyContent: 'center',
|
|
100
|
-
background: 'transparent',
|
|
101
|
-
border: 'none',
|
|
102
|
-
borderRadius: 8,
|
|
103
|
-
cursor: 'pointer',
|
|
104
|
-
transition: 'background 0.15s ease',
|
|
105
|
-
}, onMouseEnter: (e) => {
|
|
106
|
-
e.currentTarget.style.background = 'rgba(255, 255, 255, 0.06)';
|
|
107
|
-
}, onMouseLeave: (e) => {
|
|
108
|
-
e.currentTarget.style.background = 'transparent';
|
|
109
|
-
}, children: _jsx(X, { size: 18, color: "#6B7280", strokeWidth: 2 }) })] }), _jsx("div", { style: {
|
|
110
|
-
padding: '20px 24px',
|
|
111
|
-
borderBottom: '1px solid rgba(255, 255, 255, 0.06)',
|
|
112
|
-
}, children: _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 12 }, children: [_jsx("div", { style: {
|
|
113
|
-
width: 48,
|
|
114
|
-
height: 48,
|
|
115
|
-
borderRadius: 9999,
|
|
116
|
-
background: 'rgba(139, 92, 246, 0.2)',
|
|
117
|
-
display: 'flex',
|
|
118
|
-
alignItems: 'center',
|
|
119
|
-
justifyContent: 'center',
|
|
120
|
-
border: '1px solid rgba(139, 92, 246, 0.3)',
|
|
121
|
-
}, children: _jsx(User, { size: 24, color: "#A78BFA", strokeWidth: 1.5 }) }), _jsxs("div", { children: [_jsx("div", { style: {
|
|
122
|
-
color: 'white',
|
|
123
|
-
fontSize: 14,
|
|
124
|
-
fontWeight: 500,
|
|
125
|
-
fontFamily: 'Sora, sans-serif',
|
|
126
|
-
}, children: userName }), _jsx("div", { style: {
|
|
127
|
-
color: '#6B7280',
|
|
128
|
-
fontSize: 12,
|
|
129
|
-
fontFamily: 'Sora, sans-serif',
|
|
130
|
-
marginTop: 2,
|
|
131
|
-
}, children: userEmail })] })] }) }), _jsxs("div", { style: { padding: '12px 16px' }, children: [_jsxs("button", { type: "button", onClick: handleThemeToggle, style: {
|
|
132
|
-
width: '100%',
|
|
133
|
-
padding: '14px 12px',
|
|
134
|
-
display: 'flex',
|
|
135
|
-
alignItems: 'center',
|
|
136
|
-
justifyContent: 'space-between',
|
|
137
|
-
background: 'transparent',
|
|
138
|
-
border: 'none',
|
|
139
|
-
borderRadius: 10,
|
|
140
|
-
cursor: 'pointer',
|
|
141
|
-
transition: 'background 0.15s ease',
|
|
142
|
-
}, onMouseEnter: (e) => {
|
|
143
|
-
e.currentTarget.style.background = 'rgba(255, 255, 255, 0.04)';
|
|
144
|
-
}, onMouseLeave: (e) => {
|
|
145
|
-
e.currentTarget.style.background = 'transparent';
|
|
146
|
-
}, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 12 }, children: [theme === 'dark' ? (_jsx(Moon, { size: 18, color: "#A78BFA", strokeWidth: 2 })) : (_jsx(Sun, { size: 18, color: "#FBBF24", strokeWidth: 2 })), _jsx("span", { style: {
|
|
147
|
-
color: '#D1D5DB',
|
|
148
|
-
fontSize: 14,
|
|
149
|
-
fontFamily: 'Sora, sans-serif',
|
|
150
|
-
}, children: "Theme" })] }), _jsx("div", { style: {
|
|
151
|
-
padding: '4px 10px',
|
|
152
|
-
background: 'rgba(139, 92, 246, 0.15)',
|
|
153
|
-
borderRadius: 6,
|
|
154
|
-
color: '#C4B5FD',
|
|
155
|
-
fontSize: 12,
|
|
156
|
-
fontWeight: 500,
|
|
157
|
-
fontFamily: 'Sora, sans-serif',
|
|
158
|
-
}, children: theme === 'dark' ? 'Dark' : 'Light' })] }), _jsxs("button", { type: "button", onClick: handleNotificationsToggle, style: {
|
|
159
|
-
width: '100%',
|
|
160
|
-
padding: '14px 12px',
|
|
161
|
-
display: 'flex',
|
|
162
|
-
alignItems: 'center',
|
|
163
|
-
justifyContent: 'space-between',
|
|
164
|
-
background: 'transparent',
|
|
165
|
-
border: 'none',
|
|
166
|
-
borderRadius: 10,
|
|
167
|
-
cursor: 'pointer',
|
|
168
|
-
transition: 'background 0.15s ease',
|
|
169
|
-
}, onMouseEnter: (e) => {
|
|
170
|
-
e.currentTarget.style.background = 'rgba(255, 255, 255, 0.04)';
|
|
171
|
-
}, onMouseLeave: (e) => {
|
|
172
|
-
e.currentTarget.style.background = 'transparent';
|
|
173
|
-
}, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 12 }, children: [notifications ? (_jsx(Bell, { size: 18, color: "#10B981", strokeWidth: 2 })) : (_jsx(BellOff, { size: 18, color: "#6B7280", strokeWidth: 2 })), _jsx("span", { style: {
|
|
174
|
-
color: '#D1D5DB',
|
|
175
|
-
fontSize: 14,
|
|
176
|
-
fontFamily: 'Sora, sans-serif',
|
|
177
|
-
}, children: "Notifications" })] }), _jsx("div", { style: {
|
|
178
|
-
width: 44,
|
|
179
|
-
height: 24,
|
|
180
|
-
borderRadius: 12,
|
|
181
|
-
background: notifications ? 'rgba(16, 185, 129, 0.3)' : 'rgba(107, 114, 128, 0.3)',
|
|
182
|
-
padding: 2,
|
|
183
|
-
transition: 'background 0.2s ease',
|
|
184
|
-
position: 'relative',
|
|
185
|
-
}, children: _jsx("div", { style: {
|
|
186
|
-
width: 20,
|
|
187
|
-
height: 20,
|
|
188
|
-
borderRadius: 10,
|
|
189
|
-
background: notifications ? '#10B981' : '#4B5563',
|
|
190
|
-
transition: 'all 0.2s ease',
|
|
191
|
-
transform: notifications ? 'translateX(20px)' : 'translateX(0)',
|
|
192
|
-
} }) })] }), _jsxs("button", { type: "button", disabled: true, "aria-disabled": "true", style: {
|
|
193
|
-
width: '100%',
|
|
194
|
-
padding: '14px 12px',
|
|
195
|
-
display: 'flex',
|
|
196
|
-
alignItems: 'center',
|
|
197
|
-
justifyContent: 'space-between',
|
|
198
|
-
background: 'transparent',
|
|
199
|
-
border: 'none',
|
|
200
|
-
borderRadius: 10,
|
|
201
|
-
cursor: 'not-allowed',
|
|
202
|
-
opacity: 0.6,
|
|
203
|
-
transition: 'background 0.15s ease',
|
|
204
|
-
}, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 12 }, children: [_jsx(Globe, { size: 18, color: "#6B7280", strokeWidth: 2 }), _jsx("span", { style: {
|
|
205
|
-
color: '#D1D5DB',
|
|
206
|
-
fontSize: 14,
|
|
207
|
-
fontFamily: 'Sora, sans-serif',
|
|
208
|
-
}, children: "Language" })] }), _jsx("div", { style: {
|
|
209
|
-
color: '#6B7280',
|
|
210
|
-
fontSize: 13,
|
|
211
|
-
fontFamily: 'Sora, sans-serif',
|
|
212
|
-
}, children: "English" })] })] }), onLogout && (_jsx("div", { style: {
|
|
213
|
-
padding: '12px 16px 20px',
|
|
214
|
-
borderTop: '1px solid rgba(255, 255, 255, 0.06)',
|
|
215
|
-
}, children: _jsxs("button", { type: "button", onClick: onLogout, style: {
|
|
216
|
-
width: '100%',
|
|
217
|
-
padding: '12px',
|
|
218
|
-
display: 'flex',
|
|
219
|
-
alignItems: 'center',
|
|
220
|
-
justifyContent: 'center',
|
|
221
|
-
gap: 8,
|
|
222
|
-
background: 'rgba(239, 68, 68, 0.1)',
|
|
223
|
-
border: '1px solid rgba(239, 68, 68, 0.2)',
|
|
224
|
-
borderRadius: 10,
|
|
225
|
-
cursor: 'pointer',
|
|
226
|
-
transition: 'all 0.15s ease',
|
|
227
|
-
}, onMouseEnter: (e) => {
|
|
228
|
-
e.currentTarget.style.background = 'rgba(239, 68, 68, 0.15)';
|
|
229
|
-
e.currentTarget.style.borderColor = 'rgba(239, 68, 68, 0.3)';
|
|
230
|
-
}, onMouseLeave: (e) => {
|
|
231
|
-
e.currentTarget.style.background = 'rgba(239, 68, 68, 0.1)';
|
|
232
|
-
e.currentTarget.style.borderColor = 'rgba(239, 68, 68, 0.2)';
|
|
233
|
-
}, children: [_jsx(LogOut, { size: 16, color: "#EF4444", strokeWidth: 2 }), _jsx("span", { style: {
|
|
234
|
-
color: '#EF4444',
|
|
235
|
-
fontSize: 14,
|
|
236
|
-
fontWeight: 500,
|
|
237
|
-
fontFamily: 'Sora, sans-serif',
|
|
238
|
-
}, children: "Sign out" })] }) }))] })] }));
|
|
52
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { role: "presentation", "aria-hidden": "true", onClick: handleClose, className: cn('fixed inset-0 bg-black/60 backdrop-blur-sm z-[100] transition-opacity duration-200', isClosing ? 'opacity-0' : 'opacity-100') }), _jsxs("div", { ref: modalRef, role: "dialog", "aria-modal": "true", "aria-labelledby": "settings-modal-title", tabIndex: -1, className: cn('fixed top-1/2 left-1/2 w-[400px] max-w-[90vw] z-[101]', 'bg-[rgba(10,5,20,0.98)] backdrop-blur-[20px] rounded-2xl', 'border border-white/[0.08]', 'shadow-[0px_24px_48px_rgba(0,0,0,0.5),0px_0px_1px_rgba(139,92,246,0.3)]', 'transition-all duration-200 ease-[cubic-bezier(0.16,1,0.3,1)]', isClosing
|
|
53
|
+
? 'opacity-0 -translate-x-1/2 -translate-y-1/2 scale-95'
|
|
54
|
+
: 'opacity-100 -translate-x-1/2 -translate-y-1/2 scale-100'), children: [_jsxs("div", { className: "flex items-center justify-between px-6 py-5 border-b border-white/[0.06]", children: [_jsx("h2", { id: "settings-modal-title", className: "text-white text-lg font-semibold font-[Sora,sans-serif] m-0", children: "Settings" }), _jsx("button", { type: "button", onClick: handleClose, "aria-label": "Close settings", className: "w-8 h-8 flex items-center justify-center bg-transparent border-none rounded-lg cursor-pointer transition-colors hover:bg-white/[0.06]", children: _jsx(X, { size: 18, className: "text-gray-500", strokeWidth: 2 }) })] }), _jsx("div", { className: "px-6 py-5 border-b border-white/[0.06]", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "w-12 h-12 rounded-full bg-violet-500/20 flex items-center justify-center border border-violet-500/30", children: _jsx(User, { size: 24, className: "text-violet-400", strokeWidth: 1.5 }) }), _jsxs("div", { children: [_jsx("div", { className: "text-white text-sm font-medium font-[Sora,sans-serif]", children: userName }), _jsx("div", { className: "text-gray-500 text-xs font-[Sora,sans-serif] mt-0.5", children: userEmail })] })] }) }), _jsxs("div", { className: "p-3 px-4", children: [_jsxs("button", { type: "button", onClick: handleNotificationsToggle, className: "w-full px-3 py-3.5 flex items-center justify-between bg-transparent border-none rounded-[10px] cursor-pointer transition-colors hover:bg-white/[0.04]", children: [_jsxs("div", { className: "flex items-center gap-3", children: [notifications ? (_jsx(Bell, { size: 18, className: "text-emerald-500", strokeWidth: 2 })) : (_jsx(BellOff, { size: 18, className: "text-gray-500", strokeWidth: 2 })), _jsx("span", { className: "text-gray-300 text-sm font-[Sora,sans-serif]", children: "Notifications" })] }), _jsx(ToggleSwitch, { enabled: notifications, onChange: handleNotificationsToggle, "aria-label": "Toggle notifications" })] }), _jsxs("button", { type: "button", disabled: true, "aria-disabled": "true", className: "w-full px-3 py-3.5 flex items-center justify-between bg-transparent border-none rounded-[10px] cursor-not-allowed opacity-60", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Globe, { size: 18, className: "text-gray-500", strokeWidth: 2 }), _jsx("span", { className: "text-gray-300 text-sm font-[Sora,sans-serif]", children: "Language" })] }), _jsx("div", { className: "text-gray-500 text-[13px] font-[Sora,sans-serif]", children: "English" })] })] }), onLogout && (_jsx("div", { className: "px-4 pt-3 pb-5 border-t border-white/[0.06]", children: _jsxs("button", { type: "button", onClick: onLogout, className: "w-full p-3 flex items-center justify-center gap-2 bg-red-500/10 border border-red-500/20 rounded-[10px] cursor-pointer transition-all hover:bg-red-500/15 hover:border-red-500/30", children: [_jsx(LogOut, { size: 16, className: "text-red-500", strokeWidth: 2 }), _jsx("span", { className: "text-red-500 text-sm font-medium font-[Sora,sans-serif]", children: "Sign out" })] }) }))] })] }));
|
|
239
55
|
}
|
|
240
56
|
//# sourceMappingURL=SettingsModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsModal.js","sourceRoot":"","sources":["../../../src/components/dashboard/SettingsModal.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;
|
|
1
|
+
{"version":3,"file":"SettingsModal.js","sourceRoot":"","sources":["../../../src/components/dashboard/SettingsModal.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C,MAAM,UAAU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,WAAW,EAAE,CAAC,GAAI,EAC7D,eAAM,SAAS,EAAC,8CAA8C,yBAEvD,IACH,EACN,cAAK,SAAS,EAAC,kDAAkD,wBAE3D,IACC,IACL,EAEL,QAAQ,IAAI,CACX,cAAK,SAAS,EAAC,6CAA6C,YAC1D,kBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,QAAQ,EACjB,SAAS,EAAC,mLAAmL,aAE7L,KAAC,MAAM,IAAC,IAAI,EAAE,EAAE,EAAE,SAAS,EAAC,cAAc,EAAC,WAAW,EAAE,CAAC,GAAI,EAC7D,eAAM,SAAS,EAAC,yDAAyD,yBAElE,IACA,GACL,CACP,IACG,IACL,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidePanel.d.ts","sourceRoot":"","sources":["../../../src/components/dashboard/SidePanel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SidePanel.d.ts","sourceRoot":"","sources":["../../../src/components/dashboard/SidePanel.tsx"],"names":[],"mappings":"AASA,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAQD,wBAAgB,SAAS,CAAC,EACxB,MAAM,EACN,OAAO,EACP,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,KAAY,EACZ,YAAmB,EACnB,SAAS,GACV,EAAE,cAAc,2CA8IhB"}
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { X } from 'lucide-react';
|
|
4
4
|
import { useCallback, useEffect, useRef } from 'react';
|
|
5
5
|
import { cn } from '../../lib/utils';
|
|
6
|
+
const FOCUSABLE_ELEMENTS = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
|
6
7
|
const widthClasses = {
|
|
7
8
|
sm: 'w-[380px]',
|
|
8
9
|
md: 'w-[480px]',
|
|
@@ -10,28 +11,61 @@ const widthClasses = {
|
|
|
10
11
|
};
|
|
11
12
|
export function SidePanel({ isOpen, onClose, title, subtitle, children, width = 'md', showBackdrop = true, className, }) {
|
|
12
13
|
const scrollContainerRef = useRef(null);
|
|
13
|
-
const
|
|
14
|
-
|
|
14
|
+
const panelRef = useRef(null);
|
|
15
|
+
const previousActiveElement = useRef(null);
|
|
16
|
+
const handleKeyDown = useCallback((e) => {
|
|
17
|
+
if (e.key === 'Escape') {
|
|
15
18
|
onClose();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
// Focus trap
|
|
22
|
+
if (e.key === 'Tab' && panelRef.current) {
|
|
23
|
+
const focusableElements = panelRef.current.querySelectorAll(FOCUSABLE_ELEMENTS);
|
|
24
|
+
const firstElement = focusableElements[0];
|
|
25
|
+
const lastElement = focusableElements[focusableElements.length - 1];
|
|
26
|
+
if (e.shiftKey && document.activeElement === firstElement) {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
lastElement?.focus();
|
|
29
|
+
}
|
|
30
|
+
else if (!e.shiftKey && document.activeElement === lastElement) {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
firstElement?.focus();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
16
35
|
}, [onClose]);
|
|
17
36
|
useEffect(() => {
|
|
18
37
|
if (isOpen) {
|
|
19
|
-
document.
|
|
38
|
+
previousActiveElement.current = document.activeElement;
|
|
39
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
40
|
+
// Focus first focusable element in panel
|
|
41
|
+
setTimeout(() => {
|
|
42
|
+
if (panelRef.current) {
|
|
43
|
+
const focusableElements = panelRef.current.querySelectorAll(FOCUSABLE_ELEMENTS);
|
|
44
|
+
focusableElements[0]?.focus();
|
|
45
|
+
}
|
|
46
|
+
}, 0);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
// Restore focus to previous element
|
|
50
|
+
previousActiveElement.current?.focus();
|
|
20
51
|
}
|
|
21
52
|
return () => {
|
|
22
|
-
document.removeEventListener('keydown',
|
|
53
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
23
54
|
};
|
|
24
|
-
}, [isOpen,
|
|
55
|
+
}, [isOpen, handleKeyDown]);
|
|
25
56
|
useEffect(() => {
|
|
26
57
|
if (isOpen && scrollContainerRef.current) {
|
|
27
58
|
scrollContainerRef.current.scrollTop = 0;
|
|
28
59
|
}
|
|
29
60
|
}, [isOpen]);
|
|
30
|
-
return (_jsxs(_Fragment, { children: [showBackdrop && (_jsx("div", { className: cn('fixed inset-0 z-[200] transition-opacity duration-300', isOpen ? 'opacity-100' : 'opacity-0 pointer-events-none'), style: {
|
|
61
|
+
return (_jsxs(_Fragment, { children: [showBackdrop && (_jsx("div", { className: cn('fixed inset-0 z-[200] transition-opacity duration-300', isOpen ? 'opacity-100' : 'opacity-0 pointer-events-none'), style: {
|
|
62
|
+
background: 'rgba(0, 0, 0, 0.60)',
|
|
63
|
+
backdropFilter: 'blur(4px)',
|
|
64
|
+
}, onClick: onClose })), _jsxs("div", { ref: panelRef, role: "dialog", "aria-modal": "true", "aria-labelledby": title ? 'side-panel-title' : undefined, className: cn('fixed top-0 right-0 h-full z-[201] flex flex-col transition-transform duration-300 ease-out', widthClasses[width], isOpen ? 'translate-x-0' : 'translate-x-full', className), style: {
|
|
31
65
|
background: 'linear-gradient(180deg, rgba(10, 5, 20, 0.98) 0%, rgba(5, 2, 12, 0.99) 100%)',
|
|
32
66
|
borderLeft: '1px solid rgba(255, 255, 255, 0.08)',
|
|
33
67
|
boxShadow: '-20px 0 60px rgba(0, 0, 0, 0.5)',
|
|
34
|
-
}, children: [_jsxs("div", { className: "flex-shrink-0 flex items-start justify-between p-6 border-b", style: { borderColor: 'rgba(255, 255, 255, 0.08)' }, children: [_jsxs("div", { className: "flex-1 min-w-0 pr-4", children: [title && (_jsx("h2", { className: "text-lg font-semibold truncate",
|
|
68
|
+
}, children: [_jsxs("div", { className: "flex-shrink-0 flex items-start justify-between p-6 border-b", style: { borderColor: 'rgba(255, 255, 255, 0.08)' }, children: [_jsxs("div", { className: "flex-1 min-w-0 pr-4", children: [title && (_jsx("h2", { id: "side-panel-title", className: "text-lg font-semibold truncate text-gray-100", children: title })), subtitle && (_jsx("p", { className: "text-sm mt-1 truncate text-gray-500", children: subtitle }))] }), _jsx("button", { type: "button", onClick: onClose, className: "p-2 -m-2 rounded-lg transition-colors hover:bg-white/5", "aria-label": "Close panel", children: _jsx(X, { size: 20, color: "#6B7280" }) })] }), _jsx("div", { ref: scrollContainerRef, className: "side-panel-content flex-1 overflow-y-auto overscroll-contain", "data-lenis-prevent": true, children: children }), _jsx("style", { children: `
|
|
35
69
|
.side-panel-content {
|
|
36
70
|
scroll-behavior: smooth;
|
|
37
71
|
-ms-overflow-style: none;
|