primus-react-ui 1.0.14 → 1.1.0
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/README.md +40 -30
- package/dist/index.d.mts +229 -115
- package/dist/index.d.ts +229 -115
- package/dist/index.js +1294 -611
- package/dist/index.mjs +1194 -534
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -45,17 +45,24 @@ __export(index_exports, {
|
|
|
45
45
|
DashboardGrid: () => DashboardGrid,
|
|
46
46
|
DocumentViewer: () => DocumentViewer,
|
|
47
47
|
FeatureFlagToggle: () => FeatureFlagToggle,
|
|
48
|
+
Field: () => Field,
|
|
49
|
+
FieldDescription: () => FieldDescription,
|
|
50
|
+
FieldError: () => FieldError,
|
|
48
51
|
FileUploader: () => FileUploader,
|
|
49
52
|
FraudDetectionDashboard: () => FraudDetectionDashboard,
|
|
50
53
|
Grid: () => Grid,
|
|
51
54
|
Input: () => Input,
|
|
55
|
+
InputAddon: () => InputAddon,
|
|
56
|
+
InputGroup: () => InputGroup,
|
|
52
57
|
KYCVerification: () => KYCVerification,
|
|
58
|
+
Label: () => Label,
|
|
53
59
|
LoanCalculator: () => LoanCalculator,
|
|
54
60
|
LogViewer: () => LogViewer,
|
|
55
61
|
LoginPage: () => LoginPage,
|
|
56
62
|
Modal: () => Modal,
|
|
57
63
|
NotificationBell: () => NotificationBell,
|
|
58
64
|
NotificationFeed: () => PrimusNotificationFeed,
|
|
65
|
+
PasswordInput: () => PasswordInput,
|
|
59
66
|
PolicyCard: () => PolicyCard,
|
|
60
67
|
PremiumCalculator: () => PremiumCalculator,
|
|
61
68
|
PrimusActivityFeed: () => PrimusActivityFeed,
|
|
@@ -71,10 +78,16 @@ __export(index_exports, {
|
|
|
71
78
|
PrimusDataTable: () => PrimusDataTable,
|
|
72
79
|
PrimusDateRangePicker: () => PrimusDateRangePicker,
|
|
73
80
|
PrimusExportMenu: () => PrimusExportMenu,
|
|
81
|
+
PrimusField: () => Field,
|
|
82
|
+
PrimusFieldDescription: () => FieldDescription,
|
|
83
|
+
PrimusFieldError: () => FieldError,
|
|
74
84
|
PrimusFilterBar: () => PrimusFilterBar,
|
|
75
85
|
PrimusGrid: () => Grid,
|
|
76
86
|
PrimusHeader: () => PrimusHeader,
|
|
77
87
|
PrimusInput: () => Input,
|
|
88
|
+
PrimusInputAddon: () => InputAddon,
|
|
89
|
+
PrimusInputGroup: () => InputGroup,
|
|
90
|
+
PrimusLabel: () => Label,
|
|
78
91
|
PrimusLayout: () => PrimusLayout,
|
|
79
92
|
PrimusLineChart: () => PrimusLineChart,
|
|
80
93
|
PrimusLogin: () => PrimusLogin,
|
|
@@ -83,22 +96,31 @@ __export(index_exports, {
|
|
|
83
96
|
PrimusNotificationCenter: () => PrimusNotificationCenter,
|
|
84
97
|
PrimusNotificationFeed: () => PrimusNotificationFeed,
|
|
85
98
|
PrimusNotifications: () => PrimusNotifications,
|
|
99
|
+
PrimusPasswordInput: () => PasswordInput,
|
|
86
100
|
PrimusPieChart: () => PrimusPieChart,
|
|
87
101
|
PrimusProvider: () => PrimusProvider,
|
|
88
102
|
PrimusRadioGroup: () => RadioGroup,
|
|
89
103
|
PrimusSearch: () => PrimusSearch,
|
|
104
|
+
PrimusSearchInput: () => SearchInput,
|
|
105
|
+
PrimusSection: () => PrimusSection,
|
|
90
106
|
PrimusSelect: () => Select,
|
|
91
107
|
PrimusSidebar: () => PrimusSidebar,
|
|
92
108
|
PrimusSparkline: () => PrimusSparkline,
|
|
93
109
|
PrimusStack: () => Stack,
|
|
94
110
|
PrimusStatCard: () => PrimusStatCard,
|
|
111
|
+
PrimusStatsCard: () => PrimusStatCard,
|
|
112
|
+
PrimusStep: () => PrimusStep,
|
|
113
|
+
PrimusStepper: () => PrimusStepper,
|
|
114
|
+
PrimusSummaryCard: () => PrimusSummaryCard,
|
|
95
115
|
PrimusTable: () => Table,
|
|
96
116
|
PrimusTextarea: () => Textarea,
|
|
97
117
|
PrimusThemeProvider: () => PrimusThemeProvider,
|
|
98
118
|
PrimusThemeToggle: () => PrimusThemeToggle,
|
|
99
119
|
PrimusToggle: () => Toggle,
|
|
120
|
+
PrimusWizard: () => PrimusWizard,
|
|
100
121
|
QuoteComparison: () => QuoteComparison,
|
|
101
122
|
RadioGroup: () => RadioGroup,
|
|
123
|
+
SearchInput: () => SearchInput,
|
|
102
124
|
SecurityDashboard: () => SecurityDashboard,
|
|
103
125
|
Select: () => Select,
|
|
104
126
|
Stack: () => Stack,
|
|
@@ -110,6 +132,7 @@ __export(index_exports, {
|
|
|
110
132
|
themeColors: () => themeColors,
|
|
111
133
|
useNotifications: () => useNotifications,
|
|
112
134
|
usePrimusAuth: () => usePrimusAuth,
|
|
135
|
+
usePrimusFetch: () => usePrimusFetch,
|
|
113
136
|
usePrimusTheme: () => usePrimusTheme,
|
|
114
137
|
useRealtimeNotifications: () => useRealtimeNotifications
|
|
115
138
|
});
|
|
@@ -877,7 +900,7 @@ var SecurityDashboard = ({
|
|
|
877
900
|
};
|
|
878
901
|
|
|
879
902
|
// src/components/auth/PrimusLogin.tsx
|
|
880
|
-
var
|
|
903
|
+
var import_react14 = require("react");
|
|
881
904
|
|
|
882
905
|
// src/context/PrimusThemeProvider.tsx
|
|
883
906
|
var import_react12 = require("react");
|
|
@@ -961,55 +984,345 @@ function PrimusThemeToggle() {
|
|
|
961
984
|
);
|
|
962
985
|
}
|
|
963
986
|
|
|
964
|
-
// src/
|
|
987
|
+
// src/context/PrimusProvider.tsx
|
|
988
|
+
var import_react13 = require("react");
|
|
965
989
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
966
|
-
var
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
990
|
+
var PrimusAuthContext = (0, import_react13.createContext)(void 0);
|
|
991
|
+
var PrimusProvider = ({
|
|
992
|
+
children,
|
|
993
|
+
authority,
|
|
994
|
+
authBasePath = "/api/auth",
|
|
995
|
+
csrfCookieName = "XSRF-TOKEN",
|
|
996
|
+
csrfHeaderName = "X-Primus-CSRF",
|
|
997
|
+
seedCsrfOnLoad = true,
|
|
998
|
+
clientId,
|
|
999
|
+
onLoginSuccess,
|
|
1000
|
+
onLoginError,
|
|
1001
|
+
heartbeatInterval = 3e5
|
|
1002
|
+
// 5 minutes
|
|
1003
|
+
}) => {
|
|
1004
|
+
void clientId;
|
|
1005
|
+
const [isAuthenticated, setIsAuthenticated] = (0, import_react13.useState)(false);
|
|
1006
|
+
const [user, setUser] = (0, import_react13.useState)(null);
|
|
1007
|
+
const [token, setToken] = (0, import_react13.useState)(null);
|
|
1008
|
+
const [isLoading, setIsLoading] = (0, import_react13.useState)(true);
|
|
1009
|
+
const heartbeatRef = (0, import_react13.useRef)(null);
|
|
1010
|
+
const trimTrailingSlash = (value) => value.replace(/\/+$/, "");
|
|
1011
|
+
const ensureLeadingSlash = (value) => value.startsWith("/") ? value : `/${value}`;
|
|
1012
|
+
const joinUrl = (base, path) => `${trimTrailingSlash(base)}${ensureLeadingSlash(path)}`;
|
|
1013
|
+
const authBaseUrl = trimTrailingSlash(joinUrl(authority, authBasePath));
|
|
1014
|
+
const getCookie = (name) => {
|
|
1015
|
+
if (typeof document === "undefined") return null;
|
|
1016
|
+
const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1017
|
+
const matches = document.cookie.match(new RegExp(`(?:^|; )${escaped}=([^;]*)`));
|
|
1018
|
+
return matches ? decodeURIComponent(matches[1]) : null;
|
|
1019
|
+
};
|
|
1020
|
+
const fetchSessionUser = (0, import_react13.useCallback)(async () => {
|
|
1021
|
+
const response = await fetch(`${authBaseUrl}/me`, {
|
|
1022
|
+
credentials: "include",
|
|
1023
|
+
headers: {
|
|
1024
|
+
"Accept": "application/json"
|
|
1025
|
+
}
|
|
1026
|
+
});
|
|
1027
|
+
if (!response.ok) return null;
|
|
1028
|
+
const data = await response.json().catch(() => null);
|
|
1029
|
+
if (!data) return null;
|
|
1030
|
+
const resolvedUser = data.user ?? data;
|
|
1031
|
+
return resolvedUser ?? null;
|
|
1032
|
+
}, [authBaseUrl]);
|
|
1033
|
+
const startHeartbeat = (0, import_react13.useCallback)(() => {
|
|
1034
|
+
if (typeof window === "undefined") return;
|
|
1035
|
+
if (heartbeatRef.current) clearInterval(heartbeatRef.current);
|
|
1036
|
+
heartbeatRef.current = setInterval(() => {
|
|
1037
|
+
fetchSessionUser().catch(() => {
|
|
1038
|
+
});
|
|
1039
|
+
}, heartbeatInterval);
|
|
1040
|
+
}, [heartbeatInterval, fetchSessionUser]);
|
|
1041
|
+
const stopHeartbeat = (0, import_react13.useCallback)(() => {
|
|
1042
|
+
if (heartbeatRef.current) {
|
|
1043
|
+
clearInterval(heartbeatRef.current);
|
|
1044
|
+
heartbeatRef.current = null;
|
|
1045
|
+
}
|
|
1046
|
+
}, []);
|
|
1047
|
+
(0, import_react13.useEffect)(() => {
|
|
1048
|
+
return () => stopHeartbeat();
|
|
1049
|
+
}, [stopHeartbeat]);
|
|
1050
|
+
const seedCsrf = (0, import_react13.useCallback)(async () => {
|
|
1051
|
+
try {
|
|
1052
|
+
await fetch(`${authBaseUrl}/providers`, {
|
|
1053
|
+
credentials: "include",
|
|
1054
|
+
headers: { "Accept": "application/json" }
|
|
1055
|
+
});
|
|
1056
|
+
} catch {
|
|
1057
|
+
}
|
|
1058
|
+
}, [authBaseUrl]);
|
|
1059
|
+
(0, import_react13.useEffect)(() => {
|
|
1060
|
+
const checkSession = async () => {
|
|
1061
|
+
setIsLoading(true);
|
|
1062
|
+
try {
|
|
1063
|
+
if (seedCsrfOnLoad) {
|
|
1064
|
+
await seedCsrf();
|
|
1065
|
+
}
|
|
1066
|
+
const userData = await fetchSessionUser();
|
|
1067
|
+
if (userData) {
|
|
1068
|
+
setUser(userData);
|
|
1069
|
+
setIsAuthenticated(true);
|
|
1070
|
+
setToken("session-active");
|
|
1071
|
+
startHeartbeat();
|
|
1072
|
+
} else {
|
|
1073
|
+
stopHeartbeat();
|
|
1074
|
+
}
|
|
1075
|
+
} catch (err) {
|
|
1076
|
+
console.debug("No active session found", err);
|
|
1077
|
+
setIsAuthenticated(false);
|
|
1078
|
+
setUser(null);
|
|
1079
|
+
stopHeartbeat();
|
|
1080
|
+
} finally {
|
|
1081
|
+
setIsLoading(false);
|
|
1082
|
+
}
|
|
1083
|
+
};
|
|
1084
|
+
checkSession();
|
|
1085
|
+
}, [fetchSessionUser, seedCsrf, seedCsrfOnLoad, startHeartbeat, stopHeartbeat]);
|
|
1086
|
+
const login = (0, import_react13.useCallback)(async (credentials) => {
|
|
1087
|
+
setIsLoading(true);
|
|
1088
|
+
try {
|
|
1089
|
+
if ("provider" in credentials) {
|
|
1090
|
+
window.location.href = `${authBaseUrl}/${credentials.provider}`;
|
|
1091
|
+
return { success: true };
|
|
1092
|
+
}
|
|
1093
|
+
const csrfToken = getCookie(csrfCookieName);
|
|
1094
|
+
const headers = {
|
|
1095
|
+
"Content-Type": "application/json"
|
|
1096
|
+
};
|
|
1097
|
+
if (csrfToken) {
|
|
1098
|
+
headers[csrfHeaderName] = csrfToken;
|
|
1099
|
+
}
|
|
1100
|
+
const response = await fetch(`${authBaseUrl}/login`, {
|
|
1101
|
+
method: "POST",
|
|
1102
|
+
headers,
|
|
1103
|
+
credentials: "include",
|
|
1104
|
+
// CRITICAL: Persist HttpOnly Cookie
|
|
1105
|
+
body: JSON.stringify({ email: credentials.email, password: credentials.password })
|
|
1106
|
+
});
|
|
1107
|
+
if (!response.ok) {
|
|
1108
|
+
const errorData = await response.json().catch(() => ({}));
|
|
1109
|
+
const errorMsg = errorData.message || errorData.title || `Login failed (${response.status})`;
|
|
1110
|
+
onLoginError?.(errorMsg);
|
|
1111
|
+
return { success: false, error: errorMsg };
|
|
1112
|
+
}
|
|
1113
|
+
const data = await response.json().catch(() => null);
|
|
1114
|
+
const userData = data ? data.user || data : null;
|
|
1115
|
+
const refreshedUser = userData ?? await fetchSessionUser();
|
|
1116
|
+
setToken("session-active");
|
|
1117
|
+
if (refreshedUser) {
|
|
1118
|
+
setUser(refreshedUser);
|
|
1119
|
+
startHeartbeat();
|
|
1120
|
+
}
|
|
1121
|
+
setIsAuthenticated(true);
|
|
1122
|
+
if (refreshedUser) {
|
|
1123
|
+
onLoginSuccess?.(refreshedUser, "session-active");
|
|
1124
|
+
}
|
|
1125
|
+
return { success: true };
|
|
1126
|
+
} catch (err) {
|
|
1127
|
+
const errorMsg = err instanceof Error ? err.message : "Network error";
|
|
1128
|
+
onLoginError?.(errorMsg);
|
|
1129
|
+
return { success: false, error: errorMsg };
|
|
1130
|
+
} finally {
|
|
1131
|
+
setIsLoading(false);
|
|
1132
|
+
}
|
|
1133
|
+
}, [authBaseUrl, csrfCookieName, csrfHeaderName, fetchSessionUser, onLoginError, onLoginSuccess, startHeartbeat]);
|
|
1134
|
+
const logout = (0, import_react13.useCallback)(async () => {
|
|
1135
|
+
try {
|
|
1136
|
+
stopHeartbeat();
|
|
1137
|
+
const csrfToken = getCookie(csrfCookieName);
|
|
1138
|
+
const headers = {};
|
|
1139
|
+
if (csrfToken) {
|
|
1140
|
+
headers[csrfHeaderName] = csrfToken;
|
|
1141
|
+
}
|
|
1142
|
+
await fetch(`${authBaseUrl}/logout`, {
|
|
1143
|
+
method: "POST",
|
|
1144
|
+
credentials: "include",
|
|
1145
|
+
headers
|
|
1146
|
+
});
|
|
1147
|
+
} catch (e) {
|
|
1148
|
+
console.error("Logout failed", e);
|
|
1149
|
+
} finally {
|
|
1150
|
+
setToken(null);
|
|
1151
|
+
setIsAuthenticated(false);
|
|
1152
|
+
setUser(null);
|
|
1153
|
+
}
|
|
1154
|
+
}, [authBaseUrl, csrfCookieName, csrfHeaderName, stopHeartbeat]);
|
|
1155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PrimusAuthContext.Provider, { value: {
|
|
1156
|
+
isAuthenticated,
|
|
1157
|
+
user,
|
|
1158
|
+
login,
|
|
1159
|
+
logout,
|
|
1160
|
+
token,
|
|
1161
|
+
isLoading,
|
|
1162
|
+
csrfCookieName,
|
|
1163
|
+
csrfHeaderName
|
|
1164
|
+
}, children });
|
|
1165
|
+
};
|
|
1166
|
+
var usePrimusAuth = () => {
|
|
1167
|
+
const context = (0, import_react13.useContext)(PrimusAuthContext);
|
|
1168
|
+
if (context === void 0) {
|
|
1169
|
+
return {
|
|
1170
|
+
isAuthenticated: false,
|
|
1171
|
+
user: null,
|
|
1172
|
+
login: async () => ({ success: false, error: "PrimusProvider not configured" }),
|
|
1173
|
+
logout: async () => {
|
|
1174
|
+
},
|
|
1175
|
+
token: null,
|
|
1176
|
+
isLoading: false,
|
|
1177
|
+
csrfCookieName: "XSRF-TOKEN",
|
|
1178
|
+
csrfHeaderName: "X-Primus-CSRF"
|
|
1179
|
+
};
|
|
1180
|
+
}
|
|
1181
|
+
return context;
|
|
1182
|
+
};
|
|
1183
|
+
|
|
1184
|
+
// src/components/auth/PrimusLogin.tsx
|
|
1185
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1186
|
+
var styles = {
|
|
1187
|
+
container: {
|
|
1188
|
+
minHeight: "100vh",
|
|
1189
|
+
display: "flex",
|
|
1190
|
+
alignItems: "center",
|
|
1191
|
+
justifyContent: "center",
|
|
1192
|
+
padding: "24px",
|
|
1193
|
+
fontFamily: '"Segoe UI", Arial, sans-serif',
|
|
1194
|
+
transition: "background-color 0.3s, color 0.3s"
|
|
976
1195
|
},
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
colors: { light: "bg-white hover:bg-gray-50 text-gray-700 border-gray-300", dark: "bg-white hover:bg-gray-100 text-gray-700 border-gray-300" }
|
|
1196
|
+
card: {
|
|
1197
|
+
width: "100%",
|
|
1198
|
+
maxWidth: "420px",
|
|
1199
|
+
borderRadius: "16px",
|
|
1200
|
+
padding: "24px",
|
|
1201
|
+
boxShadow: "0 20px 40px rgba(15, 23, 42, 0.08)",
|
|
1202
|
+
border: "1px solid #e2e8f0",
|
|
1203
|
+
backgroundColor: "#ffffff"
|
|
986
1204
|
},
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
colors: { light: "bg-gray-900 hover:bg-gray-800 text-white border-gray-900", dark: "bg-white hover:bg-gray-100 text-gray-900 border-gray-300" }
|
|
1205
|
+
header: {
|
|
1206
|
+
marginBottom: "24px",
|
|
1207
|
+
textAlign: "center"
|
|
991
1208
|
},
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1209
|
+
logoStr: {
|
|
1210
|
+
width: "48px",
|
|
1211
|
+
height: "48px",
|
|
1212
|
+
borderRadius: "12px",
|
|
1213
|
+
marginBottom: "16px",
|
|
1214
|
+
objectFit: "cover"
|
|
1215
|
+
},
|
|
1216
|
+
title: {
|
|
1217
|
+
margin: "12px 0 4px",
|
|
1218
|
+
fontSize: "22px",
|
|
1219
|
+
fontWeight: "600"
|
|
1220
|
+
},
|
|
1221
|
+
subtitle: {
|
|
1222
|
+
margin: 0,
|
|
1223
|
+
fontSize: "13px",
|
|
1224
|
+
color: "#64748b"
|
|
1225
|
+
},
|
|
1226
|
+
socialGrid: {
|
|
1227
|
+
display: "grid",
|
|
1228
|
+
gap: "10px",
|
|
1229
|
+
marginTop: "16px"
|
|
1230
|
+
},
|
|
1231
|
+
socialBtn: {
|
|
1232
|
+
border: "1px solid #cbd5e1",
|
|
1233
|
+
background: "#ffffff",
|
|
1234
|
+
padding: "10px",
|
|
1235
|
+
borderRadius: "10px",
|
|
1236
|
+
fontSize: "13px",
|
|
1237
|
+
cursor: "pointer",
|
|
1238
|
+
color: "#0f172a",
|
|
1239
|
+
display: "flex",
|
|
1240
|
+
alignItems: "center",
|
|
1241
|
+
justifyContent: "center",
|
|
1242
|
+
gap: "8px",
|
|
1243
|
+
width: "100%",
|
|
1244
|
+
fontWeight: 500,
|
|
1245
|
+
transition: "background-color 0.2s"
|
|
1246
|
+
},
|
|
1247
|
+
divider: {
|
|
1248
|
+
margin: "24px 0",
|
|
1249
|
+
textAlign: "center",
|
|
1250
|
+
fontSize: "12px",
|
|
1251
|
+
color: "#94a3b8",
|
|
1252
|
+
position: "relative"
|
|
1253
|
+
},
|
|
1254
|
+
// Form
|
|
1255
|
+
form: {
|
|
1256
|
+
display: "grid",
|
|
1257
|
+
gap: "16px"
|
|
1001
1258
|
},
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1259
|
+
label: {
|
|
1260
|
+
display: "block",
|
|
1261
|
+
fontSize: "12px",
|
|
1262
|
+
color: "#64748b",
|
|
1263
|
+
fontWeight: 600,
|
|
1264
|
+
marginBottom: "6px",
|
|
1265
|
+
textTransform: "uppercase",
|
|
1266
|
+
letterSpacing: "0.5px"
|
|
1267
|
+
},
|
|
1268
|
+
input: {
|
|
1269
|
+
width: "100%",
|
|
1270
|
+
border: "1px solid #cbd5e1",
|
|
1271
|
+
borderRadius: "8px",
|
|
1272
|
+
padding: "10px 12px",
|
|
1273
|
+
background: "#ffffff",
|
|
1274
|
+
color: "#0f172a",
|
|
1275
|
+
fontSize: "14px",
|
|
1276
|
+
outline: "none"
|
|
1277
|
+
},
|
|
1278
|
+
submitBtn: {
|
|
1279
|
+
marginTop: "8px",
|
|
1280
|
+
background: "#0f172a",
|
|
1281
|
+
// Slate-900
|
|
1282
|
+
color: "#ffffff",
|
|
1283
|
+
border: "none",
|
|
1284
|
+
borderRadius: "8px",
|
|
1285
|
+
padding: "12px",
|
|
1286
|
+
cursor: "pointer",
|
|
1287
|
+
fontWeight: 600,
|
|
1288
|
+
fontSize: "14px",
|
|
1289
|
+
width: "100%"
|
|
1006
1290
|
},
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1291
|
+
error: {
|
|
1292
|
+
marginTop: "12px",
|
|
1293
|
+
color: "#dc2626",
|
|
1294
|
+
fontSize: "12px",
|
|
1295
|
+
textAlign: "center"
|
|
1011
1296
|
}
|
|
1012
1297
|
};
|
|
1298
|
+
var darkStyles = {
|
|
1299
|
+
container: { backgroundColor: "#0f172a", color: "#f8fafc" },
|
|
1300
|
+
card: { backgroundColor: "#1e293b", borderColor: "#334155", boxShadow: "none" },
|
|
1301
|
+
subtitle: { color: "#94a3b8" },
|
|
1302
|
+
socialBtn: { backgroundColor: "#1e293b", borderColor: "#334155", color: "#f8fafc" },
|
|
1303
|
+
label: { color: "#94a3b8" },
|
|
1304
|
+
input: { backgroundColor: "#0f172a", borderColor: "#334155", color: "#f8fafc" },
|
|
1305
|
+
submitBtn: { backgroundColor: "#8b5cf6" }
|
|
1306
|
+
// Violet for dark mode
|
|
1307
|
+
};
|
|
1308
|
+
var Icons = {
|
|
1309
|
+
google: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", children: [
|
|
1310
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M17.64 9.2c0-.637-.057-1.251-.164-1.84H9v3.481h4.844c-.209 1.125-.843 2.078-1.796 2.717v2.258h2.908c1.702-1.567 2.684-3.874 2.684-6.615z", fill: "#4285F4" }),
|
|
1311
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M9 18c2.43 0 4.467-.806 5.956-2.184l-2.908-2.258c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H.957v2.332C2.438 15.983 5.482 18 9 18z", fill: "#34A853" }),
|
|
1312
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M3.964 10.707c-.18-.54-.282-1.117-.282-1.707 0-.593.102-1.17.282-1.709V4.958H.957C.347 6.173 0 7.548 0 9c0 1.452.348 2.827.957 4.042l3.007-2.335z", fill: "#FBBC05" }),
|
|
1313
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M9 3.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C13.463.891 11.426 0 9 0 5.482 0 2.438 2.017.957 4.958L3.964 7.29C4.672 5.163 6.656 3.58 9 3.58z", fill: "#EA4335" })
|
|
1314
|
+
] }),
|
|
1315
|
+
microsoft: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", children: [
|
|
1316
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M0 0h8.571v8.571H0V0z", fill: "#F25022" }),
|
|
1317
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M9.429 0H18v8.571H9.429V0z", fill: "#7FBA00" }),
|
|
1318
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M0 9.429h8.571V18H0V9.429z", fill: "#00A4EF" }),
|
|
1319
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M9.429 9.429H18V18H9.429V9.429z", fill: "#FFB900" })
|
|
1320
|
+
] }),
|
|
1321
|
+
github: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M9 0C4.029 0 0 4.029 0 9c0 3.977 2.578 7.348 6.155 8.537.45.082.615-.195.615-.433 0-.213-.008-.923-.012-1.674-2.505.544-3.034-1.073-3.034-1.073-.41-1.04-1-1.316-1-1.316-.817-.558.062-.547.062-.547.903.064 1.378.927 1.378.927.803 1.376 2.107.978 2.62.748.082-.582.314-.978.572-1.203-2-.227-4.1-1-4.1-4.448 0-.983.35-1.786.927-2.416-.093-.228-.402-1.144.088-2.383 0 0 .756-.242 2.475.923A8.63 8.63 0 019 4.347c.765.004 1.535.103 2.254.303 1.718-1.165 2.473-.923 2.473-.923.491 1.239.182 2.155.089 2.383.578.63.926 1.433.926 2.416 0 3.457-2.104 4.218-4.109 4.44.323.278.611.827.611 1.667 0 1.203-.011 2.173-.011 2.469 0 .24.163.52.619.432C15.424 16.345 18 12.976 18 9c0-4.971-4.029-9-9-9z" }) }),
|
|
1322
|
+
apple: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M14.94 13.52c-.36.77-.54 1.12-1.01 1.8-.66.95-1.59 2.13-2.74 2.14-1.02.01-1.29-.66-2.68-.65-1.39.01-1.69.66-2.71.65-1.15-.01-2.01-1.07-2.67-2.02-1.85-2.66-2.04-5.78-.9-7.44.81-1.18 2.09-1.87 3.29-1.87 1.22 0 1.99.67 3 .67.98 0 1.58-.67 2.99-.67 1.07 0 2.2.58 3.01 1.58-2.64 1.45-2.21 5.23.42 6.81zM11.53 3.96c.52-.67.92-1.61.77-2.56-.84.04-1.84.59-2.43 1.29-.52.62-.96 1.58-.79 2.5.94.02 1.91-.53 2.45-1.23z" }) }),
|
|
1323
|
+
auth0: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "#EB5424", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M13.98 0L9 7.83 4.02 0H0l9 15.59L18 0h-4.02zM9 10.41L4.02 18h9.96L9 10.41z" }) }),
|
|
1324
|
+
facebook: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "#1877F2", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M18 9.05C18 4.05 13.97 0 9 0S0 4.05 0 9.05C0 13.58 3.29 17.34 7.59 18v-6.28H5.31V9.05h2.28V7.05c0-2.25 1.34-3.49 3.39-3.49.98 0 2.01.18 2.01.18v2.21h-1.13c-1.11 0-1.46.69-1.46 1.4v1.68h2.49l-.4 2.67h-2.09V18C14.71 17.34 18 13.58 18 9.05z" }) })
|
|
1325
|
+
};
|
|
1013
1326
|
function PrimusLogin({
|
|
1014
1327
|
onLogin,
|
|
1015
1328
|
socialProviders = [],
|
|
@@ -1019,20 +1332,45 @@ function PrimusLogin({
|
|
|
1019
1332
|
title = "Welcome Back",
|
|
1020
1333
|
subtitle = "Enter your credentials to continue",
|
|
1021
1334
|
logo,
|
|
1022
|
-
theme: themeOverride
|
|
1335
|
+
theme: themeOverride,
|
|
1336
|
+
variant = "standalone",
|
|
1337
|
+
useAuth = false
|
|
1023
1338
|
}) {
|
|
1024
1339
|
const themeContext = usePrimusTheme();
|
|
1340
|
+
const auth = usePrimusAuth();
|
|
1025
1341
|
const theme = themeOverride || themeContext.theme;
|
|
1026
1342
|
const isLight = theme === "light";
|
|
1027
|
-
const
|
|
1028
|
-
const [
|
|
1029
|
-
const [
|
|
1343
|
+
const isDark = !isLight;
|
|
1344
|
+
const [username, setUsername] = (0, import_react14.useState)("");
|
|
1345
|
+
const [password, setPassword] = (0, import_react14.useState)("");
|
|
1346
|
+
const [loading, setLoading] = (0, import_react14.useState)(false);
|
|
1347
|
+
const [errorMessage, setErrorMessage] = (0, import_react14.useState)("");
|
|
1348
|
+
const currentStyles = {
|
|
1349
|
+
container: { ...styles.container, ...isDark ? darkStyles.container : {} },
|
|
1350
|
+
card: { ...styles.card, ...isDark ? darkStyles.card : {} },
|
|
1351
|
+
title: { ...styles.title, color: isLight ? "#0f172a" : "#f8fafc" },
|
|
1352
|
+
subtitle: { ...styles.subtitle, ...isDark ? darkStyles.subtitle : {} },
|
|
1353
|
+
input: { ...styles.input, ...isDark ? darkStyles.input : {} },
|
|
1354
|
+
socialBtn: { ...styles.socialBtn, ...isDark ? darkStyles.socialBtn : {} },
|
|
1355
|
+
label: { ...styles.label, ...isDark ? darkStyles.label : {} },
|
|
1356
|
+
submitBtn: { ...styles.submitBtn, ...isDark ? darkStyles.submitBtn : {} }
|
|
1357
|
+
};
|
|
1030
1358
|
const handleSubmit = async (e) => {
|
|
1031
1359
|
e.preventDefault();
|
|
1032
1360
|
if (!username || !password) return;
|
|
1033
1361
|
setLoading(true);
|
|
1362
|
+
setErrorMessage("");
|
|
1034
1363
|
try {
|
|
1364
|
+
if (useAuth) {
|
|
1365
|
+
const result = await auth.login({ email: username, password });
|
|
1366
|
+
if (!result.success) {
|
|
1367
|
+
setErrorMessage(result.error || "Login failed");
|
|
1368
|
+
return;
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1035
1371
|
onLogin?.({ username, password });
|
|
1372
|
+
} catch (err) {
|
|
1373
|
+
setErrorMessage("Login failed. Please try again.");
|
|
1036
1374
|
} finally {
|
|
1037
1375
|
setLoading(false);
|
|
1038
1376
|
}
|
|
@@ -1041,194 +1379,92 @@ function PrimusLogin({
|
|
|
1041
1379
|
if (onSocialLogin) {
|
|
1042
1380
|
onSocialLogin(provider);
|
|
1043
1381
|
} else {
|
|
1044
|
-
|
|
1382
|
+
const base = authEndpoint.replace(/\/+$/, "");
|
|
1383
|
+
window.location.href = `${base}/${provider}`;
|
|
1045
1384
|
}
|
|
1046
1385
|
};
|
|
1047
|
-
const
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
const
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
const hasSocial = socialProviders.length > 0;
|
|
1057
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `min-h-screen ${bgGradient} flex items-center justify-center p-4`, children: [
|
|
1058
|
-
!isLight && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "absolute inset-0 overflow-hidden", children: [
|
|
1059
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "absolute -top-[20%] -left-[10%] w-[50%] h-[50%] bg-blue-600/20 rounded-full blur-[120px]" }),
|
|
1060
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "absolute -bottom-[20%] -right-[10%] w-[50%] h-[50%] bg-purple-600/20 rounded-full blur-[120px]" })
|
|
1386
|
+
const renderSocialIcon = (p) => {
|
|
1387
|
+
const key = p === "azure" ? "microsoft" : p;
|
|
1388
|
+
return Icons[key] || null;
|
|
1389
|
+
};
|
|
1390
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: currentStyles.card, className: "primus-login-card", children: [
|
|
1391
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: styles.header, className: "primus-login-header", children: [
|
|
1392
|
+
logo && (typeof logo === "string" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("img", { src: logo, alt: "Logo", style: styles.logoStr }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { marginBottom: "16px", display: "flex", justifyContent: "center" }, children: logo })),
|
|
1393
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h2", { style: currentStyles.title, children: title }),
|
|
1394
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { style: currentStyles.subtitle, children: subtitle })
|
|
1061
1395
|
] }),
|
|
1062
|
-
/* @__PURE__ */ (0,
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1396
|
+
socialProviders.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: styles.socialGrid, className: "primus-social", children: socialProviders.map((provider) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1397
|
+
"button",
|
|
1398
|
+
{
|
|
1399
|
+
type: "button",
|
|
1400
|
+
onClick: () => handleSocialClick(provider),
|
|
1401
|
+
style: currentStyles.socialBtn,
|
|
1402
|
+
onMouseOver: (e) => {
|
|
1403
|
+
if (isLight) e.currentTarget.style.backgroundColor = "#f1f5f9";
|
|
1404
|
+
else e.currentTarget.style.backgroundColor = "#334155";
|
|
1405
|
+
},
|
|
1406
|
+
onMouseOut: (e) => {
|
|
1407
|
+
if (isLight) e.currentTarget.style.backgroundColor = "#ffffff";
|
|
1408
|
+
else e.currentTarget.style.backgroundColor = "#1e293b";
|
|
1409
|
+
},
|
|
1410
|
+
children: [
|
|
1411
|
+
renderSocialIcon(provider),
|
|
1412
|
+
"Continue with ",
|
|
1413
|
+
provider === "azure" ? "Microsoft" : provider.charAt(0).toUpperCase() + provider.slice(1)
|
|
1414
|
+
]
|
|
1415
|
+
},
|
|
1416
|
+
provider
|
|
1417
|
+
)) }),
|
|
1418
|
+
socialProviders.length > 0 && showEmailLogin && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: styles.divider, className: "primus-divider", children: [
|
|
1419
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { backgroundColor: isLight ? "#fff" : "#1e293b", padding: "0 8px", position: "relative", zIndex: 1 }, children: "Or continue with email" }),
|
|
1420
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { position: "absolute", top: "50%", left: 0, right: 0, borderTop: isLight ? "1px solid #e2e8f0" : "1px solid #334155", zIndex: 0 } })
|
|
1421
|
+
] }),
|
|
1422
|
+
showEmailLogin && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("form", { onSubmit: handleSubmit, style: styles.form, className: "primus-form", children: [
|
|
1423
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
1424
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { style: currentStyles.label, children: "Email" }),
|
|
1425
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1426
|
+
"input",
|
|
1073
1427
|
{
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
] })
|
|
1082
|
-
]
|
|
1083
|
-
},
|
|
1084
|
-
provider
|
|
1085
|
-
);
|
|
1086
|
-
}) }),
|
|
1087
|
-
hasSocial && showEmailLogin && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "relative my-6", children: [
|
|
1088
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "absolute inset-0 flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: `w-full border-t ${dividerColor}` }) }),
|
|
1089
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "relative flex justify-center text-xs uppercase", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: `${isLight ? "bg-white" : "bg-gray-900/50"} px-2 ${subtextColor}`, children: "Or continue with email" }) })
|
|
1428
|
+
type: "text",
|
|
1429
|
+
value: username,
|
|
1430
|
+
onChange: (e) => setUsername(e.target.value),
|
|
1431
|
+
style: currentStyles.input,
|
|
1432
|
+
placeholder: "you@example.com"
|
|
1433
|
+
}
|
|
1434
|
+
)
|
|
1090
1435
|
] }),
|
|
1091
|
-
|
|
1092
|
-
/* @__PURE__ */ (0,
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
"input",
|
|
1096
|
-
{
|
|
1097
|
-
type: "text",
|
|
1098
|
-
value: username,
|
|
1099
|
-
onChange: (e) => setUsername(e.target.value),
|
|
1100
|
-
className: `w-full px-4 py-2.5 ${inputClasses} border rounded-lg focus:outline-none focus:ring-1 transition-all text-sm`,
|
|
1101
|
-
placeholder: "you@example.com"
|
|
1102
|
-
}
|
|
1103
|
-
)
|
|
1104
|
-
] }),
|
|
1105
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "space-y-2", children: [
|
|
1106
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { className: `text-xs font-medium ${labelColor} ml-1`, children: "PASSWORD" }),
|
|
1107
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1108
|
-
"input",
|
|
1109
|
-
{
|
|
1110
|
-
type: "password",
|
|
1111
|
-
value: password,
|
|
1112
|
-
onChange: (e) => setPassword(e.target.value),
|
|
1113
|
-
className: `w-full px-4 py-2.5 ${inputClasses} border rounded-lg focus:outline-none focus:ring-1 transition-all text-sm`,
|
|
1114
|
-
placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"
|
|
1115
|
-
}
|
|
1116
|
-
)
|
|
1117
|
-
] }),
|
|
1118
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1119
|
-
"button",
|
|
1436
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
1437
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { style: currentStyles.label, children: "Password" }),
|
|
1438
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1439
|
+
"input",
|
|
1120
1440
|
{
|
|
1121
|
-
type: "
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1441
|
+
type: "password",
|
|
1442
|
+
value: password,
|
|
1443
|
+
onChange: (e) => setPassword(e.target.value),
|
|
1444
|
+
style: currentStyles.input,
|
|
1445
|
+
placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"
|
|
1125
1446
|
}
|
|
1126
1447
|
)
|
|
1127
|
-
] })
|
|
1128
|
-
|
|
1448
|
+
] }),
|
|
1449
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1450
|
+
"button",
|
|
1451
|
+
{
|
|
1452
|
+
type: "submit",
|
|
1453
|
+
disabled: loading,
|
|
1454
|
+
style: { ...currentStyles.submitBtn, opacity: loading ? 0.7 : 1 },
|
|
1455
|
+
children: loading ? "Signing in..." : "Sign In"
|
|
1456
|
+
}
|
|
1457
|
+
)
|
|
1458
|
+
] }),
|
|
1459
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { style: styles.error, children: errorMessage })
|
|
1129
1460
|
] });
|
|
1461
|
+
if (variant === "embedded") {
|
|
1462
|
+
return content;
|
|
1463
|
+
}
|
|
1464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { ...currentStyles.container, background: isLight ? "#f8fafc" : "#0f172a" }, className: `primus-login ${isDark ? "dark" : ""}`, children: content });
|
|
1130
1465
|
}
|
|
1131
1466
|
var LoginPage = PrimusLogin;
|
|
1132
1467
|
|
|
1133
|
-
// src/context/PrimusProvider.tsx
|
|
1134
|
-
var import_react14 = require("react");
|
|
1135
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1136
|
-
var PrimusAuthContext = (0, import_react14.createContext)(void 0);
|
|
1137
|
-
var PrimusProvider = ({
|
|
1138
|
-
children,
|
|
1139
|
-
authority,
|
|
1140
|
-
clientId,
|
|
1141
|
-
onLoginSuccess,
|
|
1142
|
-
onLoginError
|
|
1143
|
-
}) => {
|
|
1144
|
-
void clientId;
|
|
1145
|
-
const [isAuthenticated, setIsAuthenticated] = (0, import_react14.useState)(false);
|
|
1146
|
-
const [user, setUser] = (0, import_react14.useState)(null);
|
|
1147
|
-
const [token, setToken] = (0, import_react14.useState)(null);
|
|
1148
|
-
const [isLoading, setIsLoading] = (0, import_react14.useState)(false);
|
|
1149
|
-
(0, import_react14.useEffect)(() => {
|
|
1150
|
-
const storedToken = localStorage.getItem("primus_token");
|
|
1151
|
-
const storedUser = localStorage.getItem("primus_user");
|
|
1152
|
-
if (storedToken && storedUser) {
|
|
1153
|
-
try {
|
|
1154
|
-
setToken(storedToken);
|
|
1155
|
-
setUser(JSON.parse(storedUser));
|
|
1156
|
-
setIsAuthenticated(true);
|
|
1157
|
-
} catch {
|
|
1158
|
-
localStorage.removeItem("primus_token");
|
|
1159
|
-
localStorage.removeItem("primus_user");
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
|
-
}, []);
|
|
1163
|
-
const login = (0, import_react14.useCallback)(async (credentials) => {
|
|
1164
|
-
setIsLoading(true);
|
|
1165
|
-
try {
|
|
1166
|
-
let endpoint;
|
|
1167
|
-
let body;
|
|
1168
|
-
if ("provider" in credentials) {
|
|
1169
|
-
endpoint = `${authority}/auth/${credentials.provider}`;
|
|
1170
|
-
body = {};
|
|
1171
|
-
} else {
|
|
1172
|
-
endpoint = `${authority}/auth/local`;
|
|
1173
|
-
body = { email: credentials.email, password: credentials.password };
|
|
1174
|
-
}
|
|
1175
|
-
const response = await fetch(endpoint, {
|
|
1176
|
-
method: "POST",
|
|
1177
|
-
headers: { "Content-Type": "application/json" },
|
|
1178
|
-
body: JSON.stringify(body)
|
|
1179
|
-
});
|
|
1180
|
-
if (!response.ok) {
|
|
1181
|
-
const errorData = await response.json().catch(() => ({}));
|
|
1182
|
-
const errorMsg = errorData.message || `Login failed (${response.status})`;
|
|
1183
|
-
onLoginError?.(errorMsg);
|
|
1184
|
-
return { success: false, error: errorMsg };
|
|
1185
|
-
}
|
|
1186
|
-
const data = await response.json();
|
|
1187
|
-
const accessToken = data.access_token || data.token;
|
|
1188
|
-
const userData = data.user || {
|
|
1189
|
-
name: "Authenticated User",
|
|
1190
|
-
email: "provider" in credentials ? `${credentials.provider}@primus.local` : credentials.email
|
|
1191
|
-
};
|
|
1192
|
-
localStorage.setItem("primus_token", accessToken);
|
|
1193
|
-
localStorage.setItem("primus_user", JSON.stringify(userData));
|
|
1194
|
-
setToken(accessToken);
|
|
1195
|
-
setUser(userData);
|
|
1196
|
-
setIsAuthenticated(true);
|
|
1197
|
-
onLoginSuccess?.(userData, accessToken);
|
|
1198
|
-
return { success: true };
|
|
1199
|
-
} catch (err) {
|
|
1200
|
-
const errorMsg = err instanceof Error ? err.message : "Network error";
|
|
1201
|
-
onLoginError?.(errorMsg);
|
|
1202
|
-
return { success: false, error: errorMsg };
|
|
1203
|
-
} finally {
|
|
1204
|
-
setIsLoading(false);
|
|
1205
|
-
}
|
|
1206
|
-
}, [authority, onLoginSuccess, onLoginError]);
|
|
1207
|
-
const logout = (0, import_react14.useCallback)(async () => {
|
|
1208
|
-
localStorage.removeItem("primus_token");
|
|
1209
|
-
localStorage.removeItem("primus_user");
|
|
1210
|
-
setToken(null);
|
|
1211
|
-
setIsAuthenticated(false);
|
|
1212
|
-
setUser(null);
|
|
1213
|
-
}, []);
|
|
1214
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PrimusAuthContext.Provider, { value: { isAuthenticated, user, login, logout, token, isLoading }, children });
|
|
1215
|
-
};
|
|
1216
|
-
var usePrimusAuth = () => {
|
|
1217
|
-
const context = (0, import_react14.useContext)(PrimusAuthContext);
|
|
1218
|
-
if (context === void 0) {
|
|
1219
|
-
return {
|
|
1220
|
-
isAuthenticated: false,
|
|
1221
|
-
user: null,
|
|
1222
|
-
login: async () => ({ success: false, error: "PrimusProvider not configured" }),
|
|
1223
|
-
logout: async () => {
|
|
1224
|
-
},
|
|
1225
|
-
token: null,
|
|
1226
|
-
isLoading: false
|
|
1227
|
-
};
|
|
1228
|
-
}
|
|
1229
|
-
return context;
|
|
1230
|
-
};
|
|
1231
|
-
|
|
1232
1468
|
// src/components/shared/Button.tsx
|
|
1233
1469
|
var import_react15 = __toESM(require("react"));
|
|
1234
1470
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
@@ -1373,23 +1609,68 @@ var UserProfile = ({
|
|
|
1373
1609
|
] });
|
|
1374
1610
|
};
|
|
1375
1611
|
|
|
1376
|
-
// src/hooks/
|
|
1612
|
+
// src/hooks/usePrimusFetch.ts
|
|
1377
1613
|
var import_react16 = require("react");
|
|
1614
|
+
function usePrimusFetch() {
|
|
1615
|
+
const { logout, csrfCookieName = "XSRF-TOKEN", csrfHeaderName = "X-Primus-CSRF" } = usePrimusAuth();
|
|
1616
|
+
const getCookie = (0, import_react16.useCallback)((name) => {
|
|
1617
|
+
if (typeof document === "undefined") return null;
|
|
1618
|
+
try {
|
|
1619
|
+
const matches = document.cookie.match(new RegExp("(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, "\\$1") + "=([^;]*)"));
|
|
1620
|
+
return matches ? decodeURIComponent(matches[1]) : null;
|
|
1621
|
+
} catch {
|
|
1622
|
+
return null;
|
|
1623
|
+
}
|
|
1624
|
+
}, []);
|
|
1625
|
+
const primusFetch = (0, import_react16.useCallback)(async (input, init) => {
|
|
1626
|
+
const { skipAuth, ...fetchInit } = init || {};
|
|
1627
|
+
const config = {
|
|
1628
|
+
...fetchInit,
|
|
1629
|
+
headers: new Headers(fetchInit.headers)
|
|
1630
|
+
};
|
|
1631
|
+
if (!skipAuth) {
|
|
1632
|
+
config.credentials = "include";
|
|
1633
|
+
}
|
|
1634
|
+
const method = (config.method || "GET").toUpperCase();
|
|
1635
|
+
if (!["GET", "HEAD", "OPTIONS"].includes(method)) {
|
|
1636
|
+
const csrfToken = getCookie(csrfCookieName);
|
|
1637
|
+
if (csrfToken) {
|
|
1638
|
+
config.headers.set(csrfHeaderName, csrfToken);
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
try {
|
|
1642
|
+
const response = await window.fetch(input, config);
|
|
1643
|
+
if (response.status === 401 && !skipAuth) {
|
|
1644
|
+
console.debug("[PrimusFetch] 401 Unauthorized detected. triggering logout.");
|
|
1645
|
+
logout();
|
|
1646
|
+
}
|
|
1647
|
+
return response;
|
|
1648
|
+
} catch (error) {
|
|
1649
|
+
throw error;
|
|
1650
|
+
}
|
|
1651
|
+
}, [getCookie, logout, csrfCookieName, csrfHeaderName]);
|
|
1652
|
+
return {
|
|
1653
|
+
fetch: primusFetch
|
|
1654
|
+
};
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
// src/hooks/useNotifications.ts
|
|
1658
|
+
var import_react17 = require("react");
|
|
1378
1659
|
var useNotifications = ({
|
|
1379
1660
|
apiUrl = "http://localhost:5221",
|
|
1380
1661
|
useMock = false,
|
|
1381
1662
|
mockData = []
|
|
1382
1663
|
} = {}) => {
|
|
1383
|
-
const [notifications, setNotifications] = (0,
|
|
1384
|
-
const [unreadCount, setUnreadCount] = (0,
|
|
1385
|
-
const [loading, setLoading] = (0,
|
|
1386
|
-
const safeMockData = (0,
|
|
1664
|
+
const [notifications, setNotifications] = (0, import_react17.useState)([]);
|
|
1665
|
+
const [unreadCount, setUnreadCount] = (0, import_react17.useState)(0);
|
|
1666
|
+
const [loading, setLoading] = (0, import_react17.useState)(true);
|
|
1667
|
+
const safeMockData = (0, import_react17.useMemo)(() => mockData || [], [JSON.stringify(mockData)]);
|
|
1387
1668
|
const DEFAULT_MOCK_DATA = [
|
|
1388
1669
|
{ id: "1", title: "Welcome", message: "Welcome to Primus UI", type: "info", timestamp: (/* @__PURE__ */ new Date()).toISOString(), read: false },
|
|
1389
1670
|
{ id: "2", title: "System Update", message: "Maintenance scheduled", type: "warning", timestamp: (/* @__PURE__ */ new Date()).toISOString(), read: false },
|
|
1390
1671
|
{ id: "3", title: "Payment Success", message: "Your payment was processed", type: "success", timestamp: (/* @__PURE__ */ new Date()).toISOString(), read: false }
|
|
1391
1672
|
];
|
|
1392
|
-
(0,
|
|
1673
|
+
(0, import_react17.useEffect)(() => {
|
|
1393
1674
|
if (useMock) {
|
|
1394
1675
|
const data = safeMockData.length > 0 ? safeMockData : DEFAULT_MOCK_DATA;
|
|
1395
1676
|
setNotifications(data);
|
|
@@ -1440,8 +1721,8 @@ var useNotifications = ({
|
|
|
1440
1721
|
|
|
1441
1722
|
// src/components/notifications/NotificationFeed.tsx
|
|
1442
1723
|
var import_outline = require("@heroicons/react/24/outline");
|
|
1443
|
-
var
|
|
1444
|
-
var
|
|
1724
|
+
var import_react18 = require("@headlessui/react");
|
|
1725
|
+
var import_react19 = require("react");
|
|
1445
1726
|
var import_clsx = require("clsx");
|
|
1446
1727
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1447
1728
|
var NotificationIcon = ({ type }) => {
|
|
@@ -1458,8 +1739,8 @@ var NotificationIcon = ({ type }) => {
|
|
|
1458
1739
|
};
|
|
1459
1740
|
var PrimusNotificationFeed = ({ useMock, mockData, apiUrl, className }) => {
|
|
1460
1741
|
const { notifications, unreadCount, markAsRead, markAllAsRead } = useNotifications({ useMock, mockData, apiUrl });
|
|
1461
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1462
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react18.Popover, { className: (0, import_clsx.clsx)("relative", className), children: ({ open }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
1743
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react18.Popover.Button, { className: (0, import_clsx.clsx)(
|
|
1463
1744
|
"relative p-2 rounded-full hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-primus-500",
|
|
1464
1745
|
open && "bg-gray-100"
|
|
1465
1746
|
), children: [
|
|
@@ -1467,16 +1748,16 @@ var PrimusNotificationFeed = ({ useMock, mockData, apiUrl, className }) => {
|
|
|
1467
1748
|
unreadCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "absolute top-1 right-1 block h-2.5 w-2.5 rounded-full bg-red-500 ring-2 ring-white" })
|
|
1468
1749
|
] }),
|
|
1469
1750
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1470
|
-
|
|
1751
|
+
import_react18.Transition,
|
|
1471
1752
|
{
|
|
1472
|
-
as:
|
|
1753
|
+
as: import_react19.Fragment,
|
|
1473
1754
|
enter: "transition ease-out duration-200",
|
|
1474
1755
|
enterFrom: "opacity-0 translate-y-1",
|
|
1475
1756
|
enterTo: "opacity-100 translate-y-0",
|
|
1476
1757
|
leave: "transition ease-in duration-150",
|
|
1477
1758
|
leaveFrom: "opacity-100 translate-y-0",
|
|
1478
1759
|
leaveTo: "opacity-0 translate-y-1",
|
|
1479
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1760
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react18.Popover.Panel, { className: "absolute right-0 z-10 mt-2 w-80 origin-top-right rounded-md bg-white py-1 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:w-96", children: [
|
|
1480
1761
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "px-4 py-3 flex items-center justify-between border-b border-gray-100", children: [
|
|
1481
1762
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h3", { className: "text-sm font-semibold text-gray-900", children: "Notifications" }),
|
|
1482
1763
|
unreadCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
@@ -1516,7 +1797,7 @@ var PrimusNotificationFeed = ({ useMock, mockData, apiUrl, className }) => {
|
|
|
1516
1797
|
};
|
|
1517
1798
|
|
|
1518
1799
|
// src/components/notifications/PrimusNotificationCenter.tsx
|
|
1519
|
-
var
|
|
1800
|
+
var import_react20 = require("react");
|
|
1520
1801
|
var import_lucide_react = require("lucide-react");
|
|
1521
1802
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1522
1803
|
var API_URL = "http://localhost:5222";
|
|
@@ -1530,15 +1811,15 @@ function PrimusNotificationCenter({
|
|
|
1530
1811
|
const themeContext = usePrimusTheme();
|
|
1531
1812
|
const theme = themeOverride || themeContext.theme;
|
|
1532
1813
|
const t = themeColors[theme];
|
|
1533
|
-
const [notifications, setNotifications] = (0,
|
|
1534
|
-
const [isOpen, setIsOpen] = (0,
|
|
1535
|
-
const [showSendForm, setShowSendForm] = (0,
|
|
1536
|
-
const [unreadCount, setUnreadCount] = (0,
|
|
1537
|
-
const [newTitle, setNewTitle] = (0,
|
|
1538
|
-
const [newMessage, setNewMessage] = (0,
|
|
1539
|
-
const [newType, setNewType] = (0,
|
|
1540
|
-
const [sending, setSending] = (0,
|
|
1541
|
-
const fetchNotifications = (0,
|
|
1814
|
+
const [notifications, setNotifications] = (0, import_react20.useState)([]);
|
|
1815
|
+
const [isOpen, setIsOpen] = (0, import_react20.useState)(false);
|
|
1816
|
+
const [showSendForm, setShowSendForm] = (0, import_react20.useState)(false);
|
|
1817
|
+
const [unreadCount, setUnreadCount] = (0, import_react20.useState)(0);
|
|
1818
|
+
const [newTitle, setNewTitle] = (0, import_react20.useState)("");
|
|
1819
|
+
const [newMessage, setNewMessage] = (0, import_react20.useState)("");
|
|
1820
|
+
const [newType, setNewType] = (0, import_react20.useState)("info");
|
|
1821
|
+
const [sending, setSending] = (0, import_react20.useState)(false);
|
|
1822
|
+
const fetchNotifications = (0, import_react20.useCallback)(async () => {
|
|
1542
1823
|
try {
|
|
1543
1824
|
const response = await fetch(`${apiUrl}/api/notifications`);
|
|
1544
1825
|
if (response.ok) {
|
|
@@ -1549,7 +1830,7 @@ function PrimusNotificationCenter({
|
|
|
1549
1830
|
} catch (error) {
|
|
1550
1831
|
}
|
|
1551
1832
|
}, [apiUrl]);
|
|
1552
|
-
(0,
|
|
1833
|
+
(0, import_react20.useEffect)(() => {
|
|
1553
1834
|
if (useMock || mockData) {
|
|
1554
1835
|
const next = mockData ?? [];
|
|
1555
1836
|
setNotifications(next);
|
|
@@ -1762,15 +2043,15 @@ var NotificationBell = PrimusNotificationCenter;
|
|
|
1762
2043
|
var PrimusNotifications = PrimusNotificationCenter;
|
|
1763
2044
|
|
|
1764
2045
|
// src/hooks/useRealtimeNotifications.ts
|
|
1765
|
-
var
|
|
2046
|
+
var import_react21 = require("react");
|
|
1766
2047
|
var useRealtimeNotifications = (options) => {
|
|
1767
2048
|
const { apiUrl, pollInterval = 3e3, userId } = options;
|
|
1768
|
-
const [notifications, setNotifications] = (0,
|
|
1769
|
-
const [unreadCount, setUnreadCount] = (0,
|
|
1770
|
-
const [loading, setLoading] = (0,
|
|
1771
|
-
const [error, setError] = (0,
|
|
2049
|
+
const [notifications, setNotifications] = (0, import_react21.useState)([]);
|
|
2050
|
+
const [unreadCount, setUnreadCount] = (0, import_react21.useState)(0);
|
|
2051
|
+
const [loading, setLoading] = (0, import_react21.useState)(true);
|
|
2052
|
+
const [error, setError] = (0, import_react21.useState)(null);
|
|
1772
2053
|
const baseUrl = `${apiUrl}/api/notifications`;
|
|
1773
|
-
const fetchNotifications = (0,
|
|
2054
|
+
const fetchNotifications = (0, import_react21.useCallback)(async () => {
|
|
1774
2055
|
try {
|
|
1775
2056
|
const url = userId ? `${baseUrl}?userId=${userId}` : baseUrl;
|
|
1776
2057
|
const response = await fetch(url);
|
|
@@ -1786,7 +2067,7 @@ var useRealtimeNotifications = (options) => {
|
|
|
1786
2067
|
setLoading(false);
|
|
1787
2068
|
}
|
|
1788
2069
|
}, [baseUrl, userId]);
|
|
1789
|
-
const sendNotification = (0,
|
|
2070
|
+
const sendNotification = (0, import_react21.useCallback)(async (title, message, type = "info") => {
|
|
1790
2071
|
try {
|
|
1791
2072
|
const response = await fetch(baseUrl, {
|
|
1792
2073
|
method: "POST",
|
|
@@ -1802,7 +2083,7 @@ var useRealtimeNotifications = (options) => {
|
|
|
1802
2083
|
return false;
|
|
1803
2084
|
}
|
|
1804
2085
|
}, [baseUrl, userId, fetchNotifications]);
|
|
1805
|
-
const markAsRead = (0,
|
|
2086
|
+
const markAsRead = (0, import_react21.useCallback)(async (id) => {
|
|
1806
2087
|
try {
|
|
1807
2088
|
await fetch(`${baseUrl}/${id}/read`, { method: "PUT" });
|
|
1808
2089
|
setNotifications((prev) => prev.map((n) => n.id === id ? { ...n, read: true } : n));
|
|
@@ -1810,20 +2091,20 @@ var useRealtimeNotifications = (options) => {
|
|
|
1810
2091
|
} catch {
|
|
1811
2092
|
}
|
|
1812
2093
|
}, [baseUrl]);
|
|
1813
|
-
const markAllAsRead = (0,
|
|
2094
|
+
const markAllAsRead = (0, import_react21.useCallback)(async () => {
|
|
1814
2095
|
const unread = notifications.filter((n) => !n.read);
|
|
1815
2096
|
await Promise.all(unread.map((n) => fetch(`${baseUrl}/${n.id}/read`, { method: "PUT" })));
|
|
1816
2097
|
setNotifications((prev) => prev.map((n) => ({ ...n, read: true })));
|
|
1817
2098
|
setUnreadCount(0);
|
|
1818
2099
|
}, [notifications, baseUrl]);
|
|
1819
|
-
const deleteNotification = (0,
|
|
2100
|
+
const deleteNotification = (0, import_react21.useCallback)(async (id) => {
|
|
1820
2101
|
try {
|
|
1821
2102
|
await fetch(`${baseUrl}/${id}`, { method: "DELETE" });
|
|
1822
2103
|
setNotifications((prev) => prev.filter((n) => n.id !== id));
|
|
1823
2104
|
} catch {
|
|
1824
2105
|
}
|
|
1825
2106
|
}, [baseUrl]);
|
|
1826
|
-
(0,
|
|
2107
|
+
(0, import_react21.useEffect)(() => {
|
|
1827
2108
|
fetchNotifications();
|
|
1828
2109
|
const interval = setInterval(fetchNotifications, pollInterval);
|
|
1829
2110
|
return () => clearInterval(interval);
|
|
@@ -1842,10 +2123,10 @@ var useRealtimeNotifications = (options) => {
|
|
|
1842
2123
|
};
|
|
1843
2124
|
|
|
1844
2125
|
// src/components/payments/CheckoutForm.tsx
|
|
1845
|
-
var
|
|
2126
|
+
var import_react23 = require("react");
|
|
1846
2127
|
|
|
1847
2128
|
// src/components/shared/Input.tsx
|
|
1848
|
-
var
|
|
2129
|
+
var import_react22 = __toESM(require("react"));
|
|
1849
2130
|
var import_clsx2 = require("clsx");
|
|
1850
2131
|
var import_solid = require("@heroicons/react/20/solid");
|
|
1851
2132
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
@@ -1859,20 +2140,48 @@ var iconSizeClasses = {
|
|
|
1859
2140
|
md: "w-5 h-5 [&>*]:w-full [&>*]:h-full",
|
|
1860
2141
|
lg: "w-6 h-6 [&>*]:w-full [&>*]:h-full"
|
|
1861
2142
|
};
|
|
1862
|
-
var Input =
|
|
1863
|
-
({
|
|
2143
|
+
var Input = import_react22.default.forwardRef(
|
|
2144
|
+
({
|
|
2145
|
+
className,
|
|
2146
|
+
style,
|
|
2147
|
+
label,
|
|
2148
|
+
error,
|
|
2149
|
+
disabled,
|
|
2150
|
+
startIcon,
|
|
2151
|
+
endIcon,
|
|
2152
|
+
onClear,
|
|
2153
|
+
value,
|
|
2154
|
+
onChange,
|
|
2155
|
+
onValueChange,
|
|
2156
|
+
size = "md",
|
|
2157
|
+
loading = false,
|
|
2158
|
+
autoSelect = false,
|
|
2159
|
+
onFocus,
|
|
2160
|
+
...props
|
|
2161
|
+
}, ref) => {
|
|
2162
|
+
const handleFocus = (e) => {
|
|
2163
|
+
if (autoSelect) {
|
|
2164
|
+
e.target.select();
|
|
2165
|
+
}
|
|
2166
|
+
onFocus?.(e);
|
|
2167
|
+
};
|
|
2168
|
+
const handleChange = (e) => {
|
|
2169
|
+
onChange?.(e);
|
|
2170
|
+
onValueChange?.(e.target.value);
|
|
2171
|
+
};
|
|
1864
2172
|
const hasValue = value !== void 0 && value !== "" && value !== null;
|
|
2173
|
+
const isDisabled = disabled || loading;
|
|
1865
2174
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: (0, import_clsx2.clsx)("w-full", className), style, children: [
|
|
1866
2175
|
label && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { className: (0, import_clsx2.clsx)(
|
|
1867
2176
|
"block font-medium mb-1.5",
|
|
1868
2177
|
size === "sm" ? "text-xs" : "text-sm",
|
|
1869
|
-
|
|
2178
|
+
isDisabled ? "text-gray-400 opacity-70" : "text-gray-700"
|
|
1870
2179
|
), children: label }),
|
|
1871
2180
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: (0, import_clsx2.clsx)(
|
|
1872
2181
|
"relative flex items-center w-full rounded-lg transition-all duration-200 ease-in-out bg-white overflow-hidden",
|
|
1873
2182
|
"border",
|
|
1874
2183
|
error ? "border-red-500 hover:border-red-600 focus-within:ring-2 focus-within:ring-red-500/20 focus-within:border-red-500" : "border-gray-200 hover:border-gray-300 focus-within:ring-2 focus-within:ring-primus-500/20 focus-within:border-primus-500",
|
|
1875
|
-
|
|
2184
|
+
isDisabled && "bg-gray-50 opacity-60 cursor-not-allowed"
|
|
1876
2185
|
), children: [
|
|
1877
2186
|
startIcon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: (0, import_clsx2.clsx)(
|
|
1878
2187
|
"flex-shrink-0 pl-3 pr-2 text-gray-400 select-none pointer-events-none flex items-center justify-center",
|
|
@@ -1882,9 +2191,10 @@ var Input = import_react21.default.forwardRef(
|
|
|
1882
2191
|
"input",
|
|
1883
2192
|
{
|
|
1884
2193
|
ref,
|
|
1885
|
-
disabled,
|
|
2194
|
+
disabled: isDisabled,
|
|
1886
2195
|
value,
|
|
1887
|
-
onChange,
|
|
2196
|
+
onChange: handleChange,
|
|
2197
|
+
onFocus: handleFocus,
|
|
1888
2198
|
className: (0, import_clsx2.clsx)(
|
|
1889
2199
|
"flex-1 w-full border-none bg-transparent p-0 placeholder:text-gray-400 focus:ring-0 outline-none",
|
|
1890
2200
|
sizeClasses[size],
|
|
@@ -1895,7 +2205,7 @@ var Input = import_react21.default.forwardRef(
|
|
|
1895
2205
|
...props
|
|
1896
2206
|
}
|
|
1897
2207
|
),
|
|
1898
|
-
onClear && hasValue && !
|
|
2208
|
+
onClear && hasValue && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex-shrink-0 pr-2 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1899
2209
|
"button",
|
|
1900
2210
|
{
|
|
1901
2211
|
type: "button",
|
|
@@ -1903,7 +2213,8 @@ var Input = import_react21.default.forwardRef(
|
|
|
1903
2213
|
e.stopPropagation();
|
|
1904
2214
|
onClear();
|
|
1905
2215
|
},
|
|
1906
|
-
className: "p-1 rounded-full text-gray-400 hover:text-gray-600 hover:bg-gray-100 transition-colors",
|
|
2216
|
+
className: "p-1 rounded-full text-gray-400 hover:text-gray-600 hover:bg-gray-100 transition-colors focus:outline-none focus:ring-2 focus:ring-offset-1 focus:ring-primus-500",
|
|
2217
|
+
tabIndex: 0,
|
|
1907
2218
|
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_solid.XMarkIcon, { className: "h-4 w-4" })
|
|
1908
2219
|
}
|
|
1909
2220
|
) }),
|
|
@@ -1932,13 +2243,13 @@ var CheckoutForm = ({
|
|
|
1932
2243
|
onSuccess,
|
|
1933
2244
|
onError
|
|
1934
2245
|
}) => {
|
|
1935
|
-
const [loading, setLoading] = (0,
|
|
1936
|
-
const [cardholderName, setCardholderName] = (0,
|
|
1937
|
-
const [cardNumber, setCardNumber] = (0,
|
|
1938
|
-
const [expiry, setExpiry] = (0,
|
|
1939
|
-
const [cvc, setCvc] = (0,
|
|
1940
|
-
const [error, setError] = (0,
|
|
1941
|
-
const [success, setSuccess] = (0,
|
|
2246
|
+
const [loading, setLoading] = (0, import_react23.useState)(false);
|
|
2247
|
+
const [cardholderName, setCardholderName] = (0, import_react23.useState)("");
|
|
2248
|
+
const [cardNumber, setCardNumber] = (0, import_react23.useState)("");
|
|
2249
|
+
const [expiry, setExpiry] = (0, import_react23.useState)("");
|
|
2250
|
+
const [cvc, setCvc] = (0, import_react23.useState)("");
|
|
2251
|
+
const [error, setError] = (0, import_react23.useState)(null);
|
|
2252
|
+
const [success, setSuccess] = (0, import_react23.useState)(false);
|
|
1942
2253
|
const handleSubmit = async (e) => {
|
|
1943
2254
|
e.preventDefault();
|
|
1944
2255
|
setError(null);
|
|
@@ -2331,14 +2642,14 @@ var ClaimStatusTracker = ({
|
|
|
2331
2642
|
};
|
|
2332
2643
|
|
|
2333
2644
|
// src/components/featureflags/FeatureFlagToggle.tsx
|
|
2334
|
-
var
|
|
2645
|
+
var import_react24 = require("react");
|
|
2335
2646
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2336
2647
|
var FeatureFlagToggle = ({
|
|
2337
2648
|
apiUrl = "http://localhost:5221"
|
|
2338
2649
|
}) => {
|
|
2339
|
-
const [flags, setFlags] = (0,
|
|
2340
|
-
const [loading, setLoading] = (0,
|
|
2341
|
-
(0,
|
|
2650
|
+
const [flags, setFlags] = (0, import_react24.useState)([]);
|
|
2651
|
+
const [loading, setLoading] = (0, import_react24.useState)(true);
|
|
2652
|
+
(0, import_react24.useEffect)(() => {
|
|
2342
2653
|
fetchFlags();
|
|
2343
2654
|
}, []);
|
|
2344
2655
|
const fetchFlags = async () => {
|
|
@@ -2375,15 +2686,15 @@ var FeatureFlagToggle = ({
|
|
|
2375
2686
|
};
|
|
2376
2687
|
|
|
2377
2688
|
// src/components/logging/LogViewer.tsx
|
|
2378
|
-
var
|
|
2689
|
+
var import_react25 = require("react");
|
|
2379
2690
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2380
2691
|
var LogViewer = ({
|
|
2381
2692
|
apiUrl = "http://localhost:5221"
|
|
2382
2693
|
}) => {
|
|
2383
|
-
const [logs, setLogs] = (0,
|
|
2384
|
-
const [filter, setFilter] = (0,
|
|
2385
|
-
const [loading, setLoading] = (0,
|
|
2386
|
-
(0,
|
|
2694
|
+
const [logs, setLogs] = (0, import_react25.useState)([]);
|
|
2695
|
+
const [filter, setFilter] = (0, import_react25.useState)("");
|
|
2696
|
+
const [loading, setLoading] = (0, import_react25.useState)(true);
|
|
2697
|
+
(0, import_react25.useEffect)(() => {
|
|
2387
2698
|
fetchLogs();
|
|
2388
2699
|
const interval = setInterval(fetchLogs, 1e4);
|
|
2389
2700
|
return () => clearInterval(interval);
|
|
@@ -2503,7 +2814,7 @@ var PrimusSidebar = ({
|
|
|
2503
2814
|
};
|
|
2504
2815
|
|
|
2505
2816
|
// src/components/layout/PrimusHeader.tsx
|
|
2506
|
-
var
|
|
2817
|
+
var import_react26 = __toESM(require("react"));
|
|
2507
2818
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2508
2819
|
var PrimusHeader = ({
|
|
2509
2820
|
title,
|
|
@@ -2514,7 +2825,7 @@ var PrimusHeader = ({
|
|
|
2514
2825
|
}) => {
|
|
2515
2826
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center justify-between w-full", children: [
|
|
2516
2827
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
2517
|
-
breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("nav", { className: "flex items-center gap-2 text-sm", children: breadcrumbs.map((crumb, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
2828
|
+
breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("nav", { className: "flex items-center gap-2 text-sm", children: breadcrumbs.map((crumb, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react26.default.Fragment, { children: [
|
|
2518
2829
|
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-gray-500", children: "/" }),
|
|
2519
2830
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: index === breadcrumbs.length - 1 ? "text-white" : "text-gray-400 hover:text-white cursor-pointer", children: crumb.label })
|
|
2520
2831
|
] }, index)) }),
|
|
@@ -2540,20 +2851,41 @@ var PrimusHeader = ({
|
|
|
2540
2851
|
] });
|
|
2541
2852
|
};
|
|
2542
2853
|
|
|
2543
|
-
// src/components/
|
|
2544
|
-
var import_react26 = require("react");
|
|
2854
|
+
// src/components/layout/PrimusSection.tsx
|
|
2545
2855
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2856
|
+
var PrimusSection = ({
|
|
2857
|
+
title,
|
|
2858
|
+
subtitle,
|
|
2859
|
+
children,
|
|
2860
|
+
className = "",
|
|
2861
|
+
actions
|
|
2862
|
+
}) => {
|
|
2863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("section", { className: `py-6 ${className}`, children: [
|
|
2864
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-end justify-between mb-6 border-b border-gray-200 dark:border-gray-800 pb-4", children: [
|
|
2865
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { children: [
|
|
2866
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("h2", { className: "text-2xl font-bold tracking-tight text-gray-900 dark:text-white", children: title }),
|
|
2867
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "mt-1 text-base text-gray-500 dark:text-gray-400", children: subtitle })
|
|
2868
|
+
] }),
|
|
2869
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex items-center gap-2", children: actions })
|
|
2870
|
+
] }),
|
|
2871
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children })
|
|
2872
|
+
] });
|
|
2873
|
+
};
|
|
2874
|
+
|
|
2875
|
+
// src/components/crud/PrimusDataTable.tsx
|
|
2876
|
+
var import_react27 = require("react");
|
|
2877
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2878
|
+
function PrimusDataTable({
|
|
2879
|
+
data,
|
|
2880
|
+
columns,
|
|
2881
|
+
rowKey,
|
|
2882
|
+
loading = false,
|
|
2883
|
+
selectable = false,
|
|
2884
|
+
selectedKeys = [],
|
|
2885
|
+
onSelectionChange,
|
|
2886
|
+
onRowClick,
|
|
2887
|
+
actions,
|
|
2888
|
+
emptyMessage = "No data available",
|
|
2557
2889
|
searchPlaceholder = "Filter...",
|
|
2558
2890
|
searchable = true,
|
|
2559
2891
|
paginated = false,
|
|
@@ -2561,11 +2893,11 @@ function PrimusDataTable({
|
|
|
2561
2893
|
pageIndex,
|
|
2562
2894
|
onPageChange
|
|
2563
2895
|
}) {
|
|
2564
|
-
const [search, setSearch] = (0,
|
|
2565
|
-
const [sortKey, setSortKey] = (0,
|
|
2566
|
-
const [sortDir, setSortDir] = (0,
|
|
2567
|
-
const [internalPageIndex, setInternalPageIndex] = (0,
|
|
2568
|
-
const filteredData = (0,
|
|
2896
|
+
const [search, setSearch] = (0, import_react27.useState)("");
|
|
2897
|
+
const [sortKey, setSortKey] = (0, import_react27.useState)(null);
|
|
2898
|
+
const [sortDir, setSortDir] = (0, import_react27.useState)("asc");
|
|
2899
|
+
const [internalPageIndex, setInternalPageIndex] = (0, import_react27.useState)(0);
|
|
2900
|
+
const filteredData = (0, import_react27.useMemo)(() => {
|
|
2569
2901
|
let result = [...data];
|
|
2570
2902
|
if (search) {
|
|
2571
2903
|
const lowerSearch = search.toLowerCase();
|
|
@@ -2621,10 +2953,10 @@ function PrimusDataTable({
|
|
|
2621
2953
|
onSelectionChange?.(scopeKeys);
|
|
2622
2954
|
}
|
|
2623
2955
|
};
|
|
2624
|
-
return /* @__PURE__ */ (0,
|
|
2625
|
-
searchable && /* @__PURE__ */ (0,
|
|
2626
|
-
/* @__PURE__ */ (0,
|
|
2627
|
-
/* @__PURE__ */ (0,
|
|
2956
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col space-y-4", children: [
|
|
2957
|
+
searchable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex items-center justify-between px-1", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "relative group", children: [
|
|
2958
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("svg", { className: "h-4 w-4 text-gray-500 group-focus-within:text-purple-400 transition-colors", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" }) }) }),
|
|
2959
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2628
2960
|
"input",
|
|
2629
2961
|
{
|
|
2630
2962
|
type: "text",
|
|
@@ -2640,9 +2972,9 @@ function PrimusDataTable({
|
|
|
2640
2972
|
}
|
|
2641
2973
|
)
|
|
2642
2974
|
] }) }),
|
|
2643
|
-
/* @__PURE__ */ (0,
|
|
2644
|
-
/* @__PURE__ */ (0,
|
|
2645
|
-
selectable && /* @__PURE__ */ (0,
|
|
2975
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: `overflow-hidden rounded-xl border border-white/5 bg-slate-900/40 backdrop-blur-md shadow-xl ring-1 ring-white/5 ${loading ? "opacity-80" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("table", { className: "w-full text-left border-collapse", children: [
|
|
2976
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("thead", { className: "bg-white/5 border-b border-white/5 backdrop-blur-md sticky top-0 z-20", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("tr", { children: [
|
|
2977
|
+
selectable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("th", { className: "w-12 px-6 py-4", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2646
2978
|
"input",
|
|
2647
2979
|
{
|
|
2648
2980
|
type: "checkbox",
|
|
@@ -2651,25 +2983,25 @@ function PrimusDataTable({
|
|
|
2651
2983
|
className: "rounded border-gray-600 bg-gray-800 text-purple-600 focus:ring-offset-gray-900 focus:ring-purple-500 transition-colors cursor-pointer"
|
|
2652
2984
|
}
|
|
2653
2985
|
) }),
|
|
2654
|
-
columns.map((col) => /* @__PURE__ */ (0,
|
|
2986
|
+
columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2655
2987
|
"th",
|
|
2656
2988
|
{
|
|
2657
2989
|
className: `px-6 py-4 text-xs font-semibold text-gray-400 uppercase tracking-wider ${col.sortable ? "cursor-pointer hover:text-white group" : ""}`,
|
|
2658
2990
|
style: { width: col.width },
|
|
2659
2991
|
onClick: () => col.sortable && handleSort(String(col.key)),
|
|
2660
|
-
children: /* @__PURE__ */ (0,
|
|
2992
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2661
2993
|
col.header,
|
|
2662
|
-
col.sortable && /* @__PURE__ */ (0,
|
|
2994
|
+
col.sortable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: `transition-opacity duration-200 ${sortKey === col.key ? "opacity-100 text-purple-400" : "opacity-0 group-hover:opacity-50"}`, children: sortDir === "asc" ? "\u2191" : "\u2193" })
|
|
2663
2995
|
] })
|
|
2664
2996
|
},
|
|
2665
2997
|
String(col.key)
|
|
2666
2998
|
)),
|
|
2667
|
-
actions && /* @__PURE__ */ (0,
|
|
2999
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("th", { className: "w-24 px-6 py-4 text-right text-xs font-semibold text-gray-400 uppercase tracking-wider" })
|
|
2668
3000
|
] }) }),
|
|
2669
|
-
/* @__PURE__ */ (0,
|
|
2670
|
-
/* @__PURE__ */ (0,
|
|
2671
|
-
/* @__PURE__ */ (0,
|
|
2672
|
-
] }) }) }) : filteredData.length === 0 ? /* @__PURE__ */ (0,
|
|
3001
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("tbody", { className: "divide-y divide-white/5", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { colSpan: columns.length + (selectable ? 1 : 0) + (actions ? 1 : 0), className: "px-6 py-24 text-center text-gray-500", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col items-center justify-center gap-3", children: [
|
|
3002
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "w-6 h-6 border-2 border-purple-500/50 border-t-purple-500 rounded-full animate-spin" }),
|
|
3003
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-sm font-medium", children: "Loading data..." })
|
|
3004
|
+
] }) }) }) : filteredData.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { colSpan: columns.length + (selectable ? 1 : 0) + (actions ? 1 : 0), className: "px-6 py-24 text-center text-gray-500", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-sm", children: emptyMessage }) }) }) : pageData.map((row) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
2673
3005
|
"tr",
|
|
2674
3006
|
{
|
|
2675
3007
|
onClick: () => onRowClick?.(row),
|
|
@@ -2679,7 +3011,7 @@ function PrimusDataTable({
|
|
|
2679
3011
|
${selectedKeys.includes(row[rowKey]) ? "bg-purple-500/10 hover:bg-purple-500/20" : ""}
|
|
2680
3012
|
`,
|
|
2681
3013
|
children: [
|
|
2682
|
-
selectable && /* @__PURE__ */ (0,
|
|
3014
|
+
selectable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: "px-6 py-4", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2683
3015
|
"input",
|
|
2684
3016
|
{
|
|
2685
3017
|
type: "checkbox",
|
|
@@ -2688,15 +3020,15 @@ function PrimusDataTable({
|
|
|
2688
3020
|
className: "rounded border-gray-600 bg-gray-800 text-purple-600 focus:ring-offset-gray-900 focus:ring-purple-500 cursor-pointer"
|
|
2689
3021
|
}
|
|
2690
3022
|
) }),
|
|
2691
|
-
columns.map((col) => /* @__PURE__ */ (0,
|
|
2692
|
-
actions && /* @__PURE__ */ (0,
|
|
3023
|
+
columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: "px-6 py-4 text-sm text-gray-300 group-hover:text-white transition-colors", children: col.render ? col.render(row[col.key], row) : String(row[col.key] ?? "") }, String(col.key))),
|
|
3024
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: "px-6 py-4 text-right", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "opacity-0 group-hover:opacity-100 transition-opacity transform translate-x-2 group-hover:translate-x-0", children: actions(row) }) })
|
|
2693
3025
|
]
|
|
2694
3026
|
},
|
|
2695
3027
|
String(row[rowKey])
|
|
2696
3028
|
)) })
|
|
2697
3029
|
] }) }) }),
|
|
2698
|
-
paginated && totalPages > 1 && /* @__PURE__ */ (0,
|
|
2699
|
-
/* @__PURE__ */ (0,
|
|
3030
|
+
paginated && totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between text-sm text-gray-400 px-2", children: [
|
|
3031
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2700
3032
|
"button",
|
|
2701
3033
|
{
|
|
2702
3034
|
type: "button",
|
|
@@ -2706,13 +3038,13 @@ function PrimusDataTable({
|
|
|
2706
3038
|
children: "Previous"
|
|
2707
3039
|
}
|
|
2708
3040
|
),
|
|
2709
|
-
/* @__PURE__ */ (0,
|
|
3041
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { children: [
|
|
2710
3042
|
"Page ",
|
|
2711
3043
|
currentPageIndex + 1,
|
|
2712
3044
|
" of ",
|
|
2713
3045
|
totalPages
|
|
2714
3046
|
] }),
|
|
2715
|
-
/* @__PURE__ */ (0,
|
|
3047
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2716
3048
|
"button",
|
|
2717
3049
|
{
|
|
2718
3050
|
type: "button",
|
|
@@ -2727,7 +3059,7 @@ function PrimusDataTable({
|
|
|
2727
3059
|
}
|
|
2728
3060
|
|
|
2729
3061
|
// src/components/crud/PrimusModal.tsx
|
|
2730
|
-
var
|
|
3062
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2731
3063
|
var PrimusModal = ({
|
|
2732
3064
|
open,
|
|
2733
3065
|
onClose,
|
|
@@ -2743,34 +3075,34 @@ var PrimusModal = ({
|
|
|
2743
3075
|
lg: "max-w-lg",
|
|
2744
3076
|
xl: "max-w-xl"
|
|
2745
3077
|
};
|
|
2746
|
-
return /* @__PURE__ */ (0,
|
|
2747
|
-
/* @__PURE__ */ (0,
|
|
3078
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "fixed inset-0 z-50 flex items-center justify-center", children: [
|
|
3079
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2748
3080
|
"div",
|
|
2749
3081
|
{
|
|
2750
3082
|
className: "absolute inset-0 bg-black/60 backdrop-blur-sm",
|
|
2751
3083
|
onClick: onClose
|
|
2752
3084
|
}
|
|
2753
3085
|
),
|
|
2754
|
-
/* @__PURE__ */ (0,
|
|
2755
|
-
title && /* @__PURE__ */ (0,
|
|
2756
|
-
/* @__PURE__ */ (0,
|
|
2757
|
-
/* @__PURE__ */ (0,
|
|
3086
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: `relative w-full ${sizeClasses2[size]} mx-4 bg-gray-800 rounded-xl border border-gray-700 shadow-2xl`, children: [
|
|
3087
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center justify-between px-6 py-4 border-b border-gray-700", children: [
|
|
3088
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("h2", { className: "text-lg font-semibold text-white", children: title }),
|
|
3089
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2758
3090
|
"button",
|
|
2759
3091
|
{
|
|
2760
3092
|
onClick: onClose,
|
|
2761
3093
|
className: "text-gray-400 hover:text-white transition-colors",
|
|
2762
|
-
children: /* @__PURE__ */ (0,
|
|
3094
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
2763
3095
|
}
|
|
2764
3096
|
)
|
|
2765
3097
|
] }),
|
|
2766
|
-
/* @__PURE__ */ (0,
|
|
2767
|
-
footer && /* @__PURE__ */ (0,
|
|
3098
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "p-6", children }),
|
|
3099
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex justify-end gap-3 px-6 py-4 border-t border-gray-700 bg-gray-800/50", children: footer })
|
|
2768
3100
|
] })
|
|
2769
3101
|
] });
|
|
2770
3102
|
};
|
|
2771
3103
|
|
|
2772
3104
|
// src/components/dashboard/PrimusDashboard.tsx
|
|
2773
|
-
var
|
|
3105
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2774
3106
|
var PrimusStatCard = ({
|
|
2775
3107
|
title,
|
|
2776
3108
|
value,
|
|
@@ -2806,35 +3138,35 @@ var PrimusStatCard = ({
|
|
|
2806
3138
|
const linePath = points.map((point, index) => `${index === 0 ? "M" : "L"} ${point.x} ${point.y}`).join(" ");
|
|
2807
3139
|
const areaPath = `${linePath} L 100 100 L 0 100 Z`;
|
|
2808
3140
|
const gradientId = `gradient-${title.replace(/\s/g, "")}`;
|
|
2809
|
-
return /* @__PURE__ */ (0,
|
|
2810
|
-
/* @__PURE__ */ (0,
|
|
2811
|
-
/* @__PURE__ */ (0,
|
|
2812
|
-
/* @__PURE__ */ (0,
|
|
3141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("svg", { className: "w-full h-12 opacity-60 absolute bottom-0 left-0", viewBox: "0 0 100 100", preserveAspectRatio: "none", "data-trend": trend.join(","), children: [
|
|
3142
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
3143
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("stop", { offset: "0%", stopColor: "currentColor", stopOpacity: "0.25" }),
|
|
3144
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("stop", { offset: "100%", stopColor: "currentColor", stopOpacity: "0" })
|
|
2813
3145
|
] }) }),
|
|
2814
|
-
/* @__PURE__ */ (0,
|
|
2815
|
-
/* @__PURE__ */ (0,
|
|
3146
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: areaPath, fill: `url(#${gradientId})`, stroke: "none" }),
|
|
3147
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: linePath, fill: "none", stroke: "currentColor", strokeWidth: "1.8", opacity: "0.6" })
|
|
2816
3148
|
] });
|
|
2817
3149
|
};
|
|
2818
|
-
return /* @__PURE__ */ (0,
|
|
2819
|
-
/* @__PURE__ */ (0,
|
|
2820
|
-
/* @__PURE__ */ (0,
|
|
2821
|
-
/* @__PURE__ */ (0,
|
|
2822
|
-
/* @__PURE__ */ (0,
|
|
2823
|
-
change && /* @__PURE__ */ (0,
|
|
3150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "relative overflow-hidden bg-slate-900/40 backdrop-blur-md rounded-2xl border border-white/5 hover:border-white/10 transition-all duration-300 group", children: [
|
|
3151
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "absolute inset-0 bg-gradient-to-br from-white/5 to-transparent opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none" }),
|
|
3152
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "p-6 relative z-10", children: [
|
|
3153
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-start justify-between mb-4", children: [
|
|
3154
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "p-2.5 rounded-lg bg-white/5 text-gray-300 ring-1 ring-white/10 group-hover:bg-purple-500/20 group-hover:text-purple-300 transition-colors", children: icon || /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "w-5 h-5 bg-current opacity-20" }) }),
|
|
3155
|
+
change && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: `px-2 py-0.5 text-xs font-medium rounded-full flex items-center gap-1 ${changeColors[change.type]}`, children: [
|
|
2824
3156
|
changeIcons[change.type],
|
|
2825
3157
|
" ",
|
|
2826
3158
|
Math.abs(change.value),
|
|
2827
3159
|
"%"
|
|
2828
3160
|
] })
|
|
2829
3161
|
] }),
|
|
2830
|
-
/* @__PURE__ */ (0,
|
|
2831
|
-
/* @__PURE__ */ (0,
|
|
2832
|
-
/* @__PURE__ */ (0,
|
|
2833
|
-
description && /* @__PURE__ */ (0,
|
|
3162
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
|
|
3163
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("h3", { className: "text-sm font-medium text-gray-400 tracking-wide", children: title }),
|
|
3164
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "mt-1 flex items-baseline gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-3xl font-bold text-transparent bg-clip-text bg-gradient-to-r from-white to-gray-400", children: value }) }),
|
|
3165
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-xs text-gray-500 mt-2 font-medium", children: description })
|
|
2834
3166
|
] })
|
|
2835
3167
|
] }),
|
|
2836
3168
|
renderSparkline(),
|
|
2837
|
-
/* @__PURE__ */ (0,
|
|
3169
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: `absolute -bottom-2 -right-4 w-32 h-32 blur-2xl opacity-20 rounded-full transition-colors duration-500 ${change?.type === "increase" ? "bg-emerald-500" : change?.type === "decrease" ? "bg-rose-500" : "bg-blue-500"}` })
|
|
2838
3170
|
] });
|
|
2839
3171
|
};
|
|
2840
3172
|
var PrimusDashboard = ({
|
|
@@ -2843,13 +3175,13 @@ var PrimusDashboard = ({
|
|
|
2843
3175
|
subtitle,
|
|
2844
3176
|
actions
|
|
2845
3177
|
}) => {
|
|
2846
|
-
return /* @__PURE__ */ (0,
|
|
2847
|
-
(title || actions) && /* @__PURE__ */ (0,
|
|
2848
|
-
/* @__PURE__ */ (0,
|
|
2849
|
-
title && /* @__PURE__ */ (0,
|
|
2850
|
-
subtitle && /* @__PURE__ */ (0,
|
|
3178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "space-y-8 animate-enter", children: [
|
|
3179
|
+
(title || actions) && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col md:flex-row md:items-end justify-between gap-4 border-b border-white/5 pb-6", children: [
|
|
3180
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
|
|
3181
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("h1", { className: "text-3xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-white via-gray-200 to-gray-400 tracking-tight", children: title }),
|
|
3182
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-gray-400 mt-2 text-lg font-light leading-relaxed", children: subtitle })
|
|
2851
3183
|
] }),
|
|
2852
|
-
actions && /* @__PURE__ */ (0,
|
|
3184
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex items-center gap-3", children: actions })
|
|
2853
3185
|
] }),
|
|
2854
3186
|
children
|
|
2855
3187
|
] });
|
|
@@ -2864,12 +3196,106 @@ var DashboardGrid = ({
|
|
|
2864
3196
|
3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3",
|
|
2865
3197
|
4: "grid-cols-1 md:grid-cols-2 lg:grid-cols-4"
|
|
2866
3198
|
};
|
|
2867
|
-
return /* @__PURE__ */ (0,
|
|
3199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: `grid gap-6 ${colClasses[columns]}`, children });
|
|
3200
|
+
};
|
|
3201
|
+
|
|
3202
|
+
// src/components/shared/Card.tsx
|
|
3203
|
+
var import_react28 = __toESM(require("react"));
|
|
3204
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
3205
|
+
var Card = import_react28.default.forwardRef(
|
|
3206
|
+
({ style, variant = "default", padding = "md", children, ...props }, ref) => {
|
|
3207
|
+
const [isHovered, setIsHovered] = import_react28.default.useState(false);
|
|
3208
|
+
const paddingStyles = {
|
|
3209
|
+
none: "0",
|
|
3210
|
+
sm: "0.75rem",
|
|
3211
|
+
md: "1.5rem",
|
|
3212
|
+
lg: "2rem"
|
|
3213
|
+
};
|
|
3214
|
+
const variantStyles = {
|
|
3215
|
+
default: {
|
|
3216
|
+
normal: {
|
|
3217
|
+
backgroundColor: "#ffffff",
|
|
3218
|
+
border: "1px solid #e5e7eb",
|
|
3219
|
+
boxShadow: "0 1px 2px rgba(0, 0, 0, 0.05)"
|
|
3220
|
+
},
|
|
3221
|
+
hover: {
|
|
3222
|
+
boxShadow: "0 4px 6px rgba(0, 0, 0, 0.1)"
|
|
3223
|
+
}
|
|
3224
|
+
},
|
|
3225
|
+
outlined: {
|
|
3226
|
+
normal: {
|
|
3227
|
+
backgroundColor: "#ffffff",
|
|
3228
|
+
border: "2px solid #e5e7eb",
|
|
3229
|
+
boxShadow: "none"
|
|
3230
|
+
},
|
|
3231
|
+
hover: {
|
|
3232
|
+
borderColor: "#d1d5db"
|
|
3233
|
+
}
|
|
3234
|
+
},
|
|
3235
|
+
elevated: {
|
|
3236
|
+
normal: {
|
|
3237
|
+
backgroundColor: "#ffffff",
|
|
3238
|
+
border: "none",
|
|
3239
|
+
boxShadow: "0 4px 6px rgba(0, 0, 0, 0.1)"
|
|
3240
|
+
},
|
|
3241
|
+
hover: {
|
|
3242
|
+
boxShadow: "0 10px 15px rgba(0, 0, 0, 0.15)",
|
|
3243
|
+
transform: "translateY(-2px)"
|
|
3244
|
+
}
|
|
3245
|
+
}
|
|
3246
|
+
};
|
|
3247
|
+
const baseStyles = {
|
|
3248
|
+
borderRadius: "0.5rem",
|
|
3249
|
+
padding: paddingStyles[padding],
|
|
3250
|
+
transition: "all 0.2s ease"
|
|
3251
|
+
};
|
|
3252
|
+
const currentVariant = variantStyles[variant];
|
|
3253
|
+
const combinedStyles = {
|
|
3254
|
+
...baseStyles,
|
|
3255
|
+
...currentVariant.normal,
|
|
3256
|
+
...isHovered ? currentVariant.hover : {},
|
|
3257
|
+
...style
|
|
3258
|
+
};
|
|
3259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3260
|
+
"div",
|
|
3261
|
+
{
|
|
3262
|
+
ref,
|
|
3263
|
+
style: combinedStyles,
|
|
3264
|
+
onMouseEnter: () => setIsHovered(true),
|
|
3265
|
+
onMouseLeave: () => setIsHovered(false),
|
|
3266
|
+
...props,
|
|
3267
|
+
children
|
|
3268
|
+
}
|
|
3269
|
+
);
|
|
3270
|
+
}
|
|
3271
|
+
);
|
|
3272
|
+
Card.displayName = "Card";
|
|
3273
|
+
|
|
3274
|
+
// src/components/dashboard/PrimusSummaryCard.tsx
|
|
3275
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
3276
|
+
var PrimusSummaryCard = ({
|
|
3277
|
+
title,
|
|
3278
|
+
subtitle,
|
|
3279
|
+
actionLabel,
|
|
3280
|
+
onAction,
|
|
3281
|
+
children,
|
|
3282
|
+
className
|
|
3283
|
+
}) => {
|
|
3284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Card, { className, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "p-6", children: [
|
|
3285
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [
|
|
3286
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
|
|
3287
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: title }),
|
|
3288
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "text-sm text-gray-500 dark:text-gray-400 mt-1", children: subtitle })
|
|
3289
|
+
] }),
|
|
3290
|
+
actionLabel && onAction && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Button, { variant: "outline", size: "sm", onClick: onAction, children: actionLabel })
|
|
3291
|
+
] }),
|
|
3292
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "mt-4", children })
|
|
3293
|
+
] }) });
|
|
2868
3294
|
};
|
|
2869
3295
|
|
|
2870
3296
|
// src/components/dashboard/PrimusActivityFeed.tsx
|
|
2871
|
-
var
|
|
2872
|
-
var
|
|
3297
|
+
var import_react29 = require("react");
|
|
3298
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2873
3299
|
var statusClasses = {
|
|
2874
3300
|
success: "bg-emerald-500/10 text-emerald-300 border-emerald-500/30",
|
|
2875
3301
|
warning: "bg-amber-500/10 text-amber-300 border-amber-500/30",
|
|
@@ -2883,8 +3309,8 @@ var PrimusActivityFeed = ({
|
|
|
2883
3309
|
groupByDate = false,
|
|
2884
3310
|
loading = false
|
|
2885
3311
|
}) => {
|
|
2886
|
-
const visibleItems = (0,
|
|
2887
|
-
const groups = (0,
|
|
3312
|
+
const visibleItems = (0, import_react29.useMemo)(() => items.slice(0, maxItems), [items, maxItems]);
|
|
3313
|
+
const groups = (0, import_react29.useMemo)(() => {
|
|
2888
3314
|
if (!groupByDate) {
|
|
2889
3315
|
return [{ label: "", items: visibleItems }];
|
|
2890
3316
|
}
|
|
@@ -2898,18 +3324,18 @@ var PrimusActivityFeed = ({
|
|
|
2898
3324
|
return Array.from(map.entries()).map(([label, groupItems]) => ({ label, items: groupItems }));
|
|
2899
3325
|
}, [groupByDate, visibleItems]);
|
|
2900
3326
|
if (loading) {
|
|
2901
|
-
return /* @__PURE__ */ (0,
|
|
3327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "rounded-xl border border-white/10 bg-slate-900/40 p-6 text-sm text-gray-400", children: "Loading activity..." });
|
|
2902
3328
|
}
|
|
2903
|
-
return /* @__PURE__ */ (0,
|
|
2904
|
-
group.label && /* @__PURE__ */ (0,
|
|
2905
|
-
/* @__PURE__ */ (0,
|
|
2906
|
-
/* @__PURE__ */ (0,
|
|
2907
|
-
/* @__PURE__ */ (0,
|
|
2908
|
-
/* @__PURE__ */ (0,
|
|
2909
|
-
/* @__PURE__ */ (0,
|
|
2910
|
-
showTimestamps && /* @__PURE__ */ (0,
|
|
3329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "rounded-xl border border-white/10 bg-slate-900/40 p-6 space-y-6", children: groups.map((group, index) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
|
|
3330
|
+
group.label && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "text-xs uppercase tracking-wide text-gray-500 mb-3", children: group.label }),
|
|
3331
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "space-y-4", children: group.items.map((item, itemIndex) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-start gap-4", children: [
|
|
3332
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: `mt-1 h-2.5 w-2.5 rounded-full border ${statusClasses[item.status ?? "info"]}` }),
|
|
3333
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex-1", children: [
|
|
3334
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
|
|
3335
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "text-sm font-medium text-gray-100", children: item.title }),
|
|
3336
|
+
showTimestamps && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "text-xs text-gray-500", children: formatTime(item.timestamp) })
|
|
2911
3337
|
] }),
|
|
2912
|
-
item.description && /* @__PURE__ */ (0,
|
|
3338
|
+
item.description && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "text-xs text-gray-400 mt-1", children: item.description })
|
|
2913
3339
|
] })
|
|
2914
3340
|
] }, item.id ?? `${itemIndex}-${item.title}`)) })
|
|
2915
3341
|
] }, `${group.label}-${index}`)) });
|
|
@@ -2936,9 +3362,9 @@ var formatTime = (value) => {
|
|
|
2936
3362
|
};
|
|
2937
3363
|
|
|
2938
3364
|
// src/components/charts/PrimusChartBase.tsx
|
|
2939
|
-
var
|
|
3365
|
+
var import_react30 = require("react");
|
|
2940
3366
|
var import_chart = require("chart.js");
|
|
2941
|
-
var
|
|
3367
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2942
3368
|
var registered = false;
|
|
2943
3369
|
var ensureRegistered = () => {
|
|
2944
3370
|
if (!registered) {
|
|
@@ -2961,9 +3387,9 @@ var PrimusChartBase = ({
|
|
|
2961
3387
|
className,
|
|
2962
3388
|
datasetTransform
|
|
2963
3389
|
}) => {
|
|
2964
|
-
const canvasRef = (0,
|
|
2965
|
-
const chartRef = (0,
|
|
2966
|
-
const builtData = (0,
|
|
3390
|
+
const canvasRef = (0, import_react30.useRef)(null);
|
|
3391
|
+
const chartRef = (0, import_react30.useRef)(null);
|
|
3392
|
+
const builtData = (0, import_react30.useMemo)(() => {
|
|
2967
3393
|
if (data) {
|
|
2968
3394
|
return data;
|
|
2969
3395
|
}
|
|
@@ -2987,7 +3413,7 @@ var PrimusChartBase = ({
|
|
|
2987
3413
|
datasets
|
|
2988
3414
|
};
|
|
2989
3415
|
}, [data, labels, series, datasetTransform]);
|
|
2990
|
-
const builtOptions = (0,
|
|
3416
|
+
const builtOptions = (0, import_react30.useMemo)(() => {
|
|
2991
3417
|
const mergedPlugins = {
|
|
2992
3418
|
...options?.plugins ?? {},
|
|
2993
3419
|
legend: {
|
|
@@ -3005,7 +3431,7 @@ var PrimusChartBase = ({
|
|
|
3005
3431
|
}
|
|
3006
3432
|
};
|
|
3007
3433
|
}, [options, responsive, maintainAspectRatio, legend]);
|
|
3008
|
-
(0,
|
|
3434
|
+
(0, import_react30.useEffect)(() => {
|
|
3009
3435
|
ensureRegistered();
|
|
3010
3436
|
const canvas = canvasRef.current;
|
|
3011
3437
|
if (!canvas) {
|
|
@@ -3029,13 +3455,13 @@ var PrimusChartBase = ({
|
|
|
3029
3455
|
chartRef.current = null;
|
|
3030
3456
|
};
|
|
3031
3457
|
}, [type, builtData, builtOptions]);
|
|
3032
|
-
return /* @__PURE__ */ (0,
|
|
3458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className, style: { height, width }, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("canvas", { ref: canvasRef, "aria-label": ariaLabel, role: "img" }) });
|
|
3033
3459
|
};
|
|
3034
3460
|
|
|
3035
3461
|
// src/components/charts/PrimusLineChart.tsx
|
|
3036
|
-
var
|
|
3462
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
3037
3463
|
var PrimusLineChart = (props) => {
|
|
3038
|
-
return /* @__PURE__ */ (0,
|
|
3464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3039
3465
|
PrimusChartBase,
|
|
3040
3466
|
{
|
|
3041
3467
|
...props,
|
|
@@ -3053,9 +3479,9 @@ var PrimusLineChart = (props) => {
|
|
|
3053
3479
|
};
|
|
3054
3480
|
|
|
3055
3481
|
// src/components/charts/PrimusAreaChart.tsx
|
|
3056
|
-
var
|
|
3482
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3057
3483
|
var PrimusAreaChart = (props) => {
|
|
3058
|
-
return /* @__PURE__ */ (0,
|
|
3484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3059
3485
|
PrimusChartBase,
|
|
3060
3486
|
{
|
|
3061
3487
|
...props,
|
|
@@ -3073,7 +3499,7 @@ var PrimusAreaChart = (props) => {
|
|
|
3073
3499
|
};
|
|
3074
3500
|
|
|
3075
3501
|
// src/components/charts/PrimusBarChart.tsx
|
|
3076
|
-
var
|
|
3502
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3077
3503
|
var PrimusBarChart = ({ stacked = false, options, ...props }) => {
|
|
3078
3504
|
const mergedOptions = {
|
|
3079
3505
|
...options,
|
|
@@ -3083,7 +3509,7 @@ var PrimusBarChart = ({ stacked = false, options, ...props }) => {
|
|
|
3083
3509
|
...options?.scales ?? {}
|
|
3084
3510
|
}
|
|
3085
3511
|
};
|
|
3086
|
-
return /* @__PURE__ */ (0,
|
|
3512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3087
3513
|
PrimusChartBase,
|
|
3088
3514
|
{
|
|
3089
3515
|
...props,
|
|
@@ -3099,13 +3525,13 @@ var PrimusBarChart = ({ stacked = false, options, ...props }) => {
|
|
|
3099
3525
|
};
|
|
3100
3526
|
|
|
3101
3527
|
// src/components/charts/PrimusPieChart.tsx
|
|
3102
|
-
var
|
|
3528
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3103
3529
|
var PrimusPieChart = ({ donut = false, cutout = "55%", options, ...props }) => {
|
|
3104
3530
|
const mergedOptions = {
|
|
3105
3531
|
...options,
|
|
3106
3532
|
cutout: donut ? cutout : void 0
|
|
3107
3533
|
};
|
|
3108
|
-
return /* @__PURE__ */ (0,
|
|
3534
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3109
3535
|
PrimusChartBase,
|
|
3110
3536
|
{
|
|
3111
3537
|
...props,
|
|
@@ -3121,8 +3547,8 @@ var PrimusPieChart = ({ donut = false, cutout = "55%", options, ...props }) => {
|
|
|
3121
3547
|
};
|
|
3122
3548
|
|
|
3123
3549
|
// src/components/charts/PrimusSparkline.tsx
|
|
3124
|
-
var
|
|
3125
|
-
var
|
|
3550
|
+
var import_react31 = require("react");
|
|
3551
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
3126
3552
|
var PrimusSparkline = ({
|
|
3127
3553
|
series = [],
|
|
3128
3554
|
data,
|
|
@@ -3135,7 +3561,7 @@ var PrimusSparkline = ({
|
|
|
3135
3561
|
}) => {
|
|
3136
3562
|
const values = data ?? series[0]?.data ?? [];
|
|
3137
3563
|
const color = series[0]?.color ?? series[0]?.borderColor ?? "#3b82f6";
|
|
3138
|
-
const { linePath, areaPath } = (0,
|
|
3564
|
+
const { linePath, areaPath } = (0, import_react31.useMemo)(() => {
|
|
3139
3565
|
if (!values.length) {
|
|
3140
3566
|
return { linePath: "", areaPath: "" };
|
|
3141
3567
|
}
|
|
@@ -3155,7 +3581,7 @@ var PrimusSparkline = ({
|
|
|
3155
3581
|
if (!values.length) {
|
|
3156
3582
|
return null;
|
|
3157
3583
|
}
|
|
3158
|
-
return /* @__PURE__ */ (0,
|
|
3584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
3159
3585
|
"svg",
|
|
3160
3586
|
{
|
|
3161
3587
|
className,
|
|
@@ -3166,17 +3592,17 @@ var PrimusSparkline = ({
|
|
|
3166
3592
|
"aria-label": ariaLabel,
|
|
3167
3593
|
role: "img",
|
|
3168
3594
|
children: [
|
|
3169
|
-
type === "area" && /* @__PURE__ */ (0,
|
|
3170
|
-
/* @__PURE__ */ (0,
|
|
3595
|
+
type === "area" && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("path", { d: areaPath, fill: color, opacity: 0.2, stroke: "none" }),
|
|
3596
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("path", { d: linePath, fill: "none", stroke: color, strokeWidth })
|
|
3171
3597
|
]
|
|
3172
3598
|
}
|
|
3173
3599
|
);
|
|
3174
3600
|
};
|
|
3175
3601
|
|
|
3176
3602
|
// src/components/shared/Checkbox.tsx
|
|
3177
|
-
var
|
|
3178
|
-
var
|
|
3179
|
-
var Checkbox =
|
|
3603
|
+
var import_react32 = __toESM(require("react"));
|
|
3604
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3605
|
+
var Checkbox = import_react32.default.forwardRef(
|
|
3180
3606
|
({ style, label, error, disabled, className, ...props }, ref) => {
|
|
3181
3607
|
const containerStyles = {
|
|
3182
3608
|
display: "flex",
|
|
@@ -3213,9 +3639,9 @@ var Checkbox = import_react30.default.forwardRef(
|
|
|
3213
3639
|
marginTop: "0.25rem",
|
|
3214
3640
|
marginLeft: "1.75rem"
|
|
3215
3641
|
};
|
|
3216
|
-
return /* @__PURE__ */ (0,
|
|
3217
|
-
/* @__PURE__ */ (0,
|
|
3218
|
-
/* @__PURE__ */ (0,
|
|
3642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { children: [
|
|
3643
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { style: containerStyles, children: [
|
|
3644
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { style: checkboxWrapperStyles, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3219
3645
|
"input",
|
|
3220
3646
|
{
|
|
3221
3647
|
ref,
|
|
@@ -3228,21 +3654,21 @@ var Checkbox = import_react30.default.forwardRef(
|
|
|
3228
3654
|
...props
|
|
3229
3655
|
}
|
|
3230
3656
|
) }),
|
|
3231
|
-
label && /* @__PURE__ */ (0,
|
|
3657
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("label", { style: labelStyles, onClick: (e) => {
|
|
3232
3658
|
if (!disabled) {
|
|
3233
3659
|
const input = e.currentTarget.previousElementSibling?.querySelector("input");
|
|
3234
3660
|
input?.click();
|
|
3235
3661
|
}
|
|
3236
3662
|
}, children: label })
|
|
3237
3663
|
] }),
|
|
3238
|
-
error && /* @__PURE__ */ (0,
|
|
3664
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { style: errorTextStyles, children: error })
|
|
3239
3665
|
] });
|
|
3240
3666
|
}
|
|
3241
3667
|
);
|
|
3242
3668
|
Checkbox.displayName = "Checkbox";
|
|
3243
3669
|
|
|
3244
3670
|
// src/components/shared/RadioGroup.tsx
|
|
3245
|
-
var
|
|
3671
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3246
3672
|
var RadioGroup = ({
|
|
3247
3673
|
name,
|
|
3248
3674
|
options,
|
|
@@ -3282,9 +3708,9 @@ var RadioGroup = ({
|
|
|
3282
3708
|
color: "#ef4444",
|
|
3283
3709
|
marginTop: "0.5rem"
|
|
3284
3710
|
};
|
|
3285
|
-
return /* @__PURE__ */ (0,
|
|
3286
|
-
/* @__PURE__ */ (0,
|
|
3287
|
-
/* @__PURE__ */ (0,
|
|
3711
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { children: [
|
|
3712
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { style: containerStyles, children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { style: optionStyles, children: [
|
|
3713
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3288
3714
|
"input",
|
|
3289
3715
|
{
|
|
3290
3716
|
type: "radio",
|
|
@@ -3296,7 +3722,7 @@ var RadioGroup = ({
|
|
|
3296
3722
|
style: radioStyles
|
|
3297
3723
|
}
|
|
3298
3724
|
),
|
|
3299
|
-
/* @__PURE__ */ (0,
|
|
3725
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3300
3726
|
"label",
|
|
3301
3727
|
{
|
|
3302
3728
|
style: {
|
|
@@ -3312,17 +3738,17 @@ var RadioGroup = ({
|
|
|
3312
3738
|
}
|
|
3313
3739
|
)
|
|
3314
3740
|
] }, option.value)) }),
|
|
3315
|
-
error && /* @__PURE__ */ (0,
|
|
3741
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { style: errorTextStyles, children: error })
|
|
3316
3742
|
] });
|
|
3317
3743
|
};
|
|
3318
3744
|
RadioGroup.displayName = "RadioGroup";
|
|
3319
3745
|
|
|
3320
3746
|
// src/components/shared/Select.tsx
|
|
3321
|
-
var
|
|
3322
|
-
var
|
|
3747
|
+
var import_react33 = __toESM(require("react"));
|
|
3748
|
+
var import_react34 = require("@headlessui/react");
|
|
3323
3749
|
var import_solid4 = require("@heroicons/react/20/solid");
|
|
3324
3750
|
var import_clsx7 = require("clsx");
|
|
3325
|
-
var
|
|
3751
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3326
3752
|
var Select = ({
|
|
3327
3753
|
label,
|
|
3328
3754
|
error,
|
|
@@ -3334,7 +3760,7 @@ var Select = ({
|
|
|
3334
3760
|
disabled = false,
|
|
3335
3761
|
className
|
|
3336
3762
|
}) => {
|
|
3337
|
-
const [query, setQuery] = (0,
|
|
3763
|
+
const [query, setQuery] = (0, import_react33.useState)("");
|
|
3338
3764
|
const filteredOptions = query === "" ? options : options.filter(
|
|
3339
3765
|
(option) => option.label.toLowerCase().replace(/\s+/g, "").includes(query.toLowerCase().replace(/\s+/g, ""))
|
|
3340
3766
|
);
|
|
@@ -3344,8 +3770,8 @@ var Select = ({
|
|
|
3344
3770
|
onChange?.(value.filter((v) => v !== valToRemove));
|
|
3345
3771
|
}
|
|
3346
3772
|
};
|
|
3347
|
-
return /* @__PURE__ */ (0,
|
|
3348
|
-
|
|
3773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: (0, import_clsx7.clsx)("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3774
|
+
import_react34.Combobox,
|
|
3349
3775
|
{
|
|
3350
3776
|
value,
|
|
3351
3777
|
onChange: (val) => {
|
|
@@ -3353,21 +3779,21 @@ var Select = ({
|
|
|
3353
3779
|
},
|
|
3354
3780
|
multiple,
|
|
3355
3781
|
disabled,
|
|
3356
|
-
children: ({}) => /* @__PURE__ */ (0,
|
|
3357
|
-
label && /* @__PURE__ */ (0,
|
|
3358
|
-
/* @__PURE__ */ (0,
|
|
3782
|
+
children: ({}) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "relative", children: [
|
|
3783
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react34.Combobox.Label, { className: "block text-sm font-medium text-gray-700 mb-1", children: label }),
|
|
3784
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: (0, import_clsx7.clsx)(
|
|
3359
3785
|
"relative w-full cursor-default overflow-hidden rounded-lg bg-white text-left focus-within:ring-2 focus-within:ring-primus-500",
|
|
3360
3786
|
"border transition-all duration-200 ease-in-out",
|
|
3361
3787
|
error ? "border-red-500 focus-within:ring-red-500" : "border-gray-300",
|
|
3362
3788
|
disabled && "opacity-50 cursor-not-allowed bg-gray-50"
|
|
3363
3789
|
), children: [
|
|
3364
|
-
/* @__PURE__ */ (0,
|
|
3790
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: (0, import_clsx7.clsx)(
|
|
3365
3791
|
"flex flex-wrap items-center gap-1.5 w-full py-1.5 pl-3 pr-10 text-sm",
|
|
3366
3792
|
"min-h-[2.5rem]"
|
|
3367
3793
|
), children: [
|
|
3368
|
-
multiple && Array.isArray(value) && value.map((val) => /* @__PURE__ */ (0,
|
|
3369
|
-
/* @__PURE__ */ (0,
|
|
3370
|
-
/* @__PURE__ */ (0,
|
|
3794
|
+
multiple && Array.isArray(value) && value.map((val) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { className: "inline-flex items-center gap-1 rounded bg-primus-50 px-2 py-0.5 text-xs font-medium text-primus-700 ring-1 ring-inset ring-primus-700/10 max-w-[150px]", children: [
|
|
3795
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "truncate", children: getLabel(val) }),
|
|
3796
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3371
3797
|
"button",
|
|
3372
3798
|
{
|
|
3373
3799
|
type: "button",
|
|
@@ -3379,14 +3805,14 @@ var Select = ({
|
|
|
3379
3805
|
},
|
|
3380
3806
|
onMouseDown: (e) => e.preventDefault(),
|
|
3381
3807
|
children: [
|
|
3382
|
-
/* @__PURE__ */ (0,
|
|
3383
|
-
/* @__PURE__ */ (0,
|
|
3808
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "sr-only", children: "Remove" }),
|
|
3809
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_solid4.XMarkIcon, { className: "h-3.5 w-3.5", "aria-hidden": "true" })
|
|
3384
3810
|
]
|
|
3385
3811
|
}
|
|
3386
3812
|
)
|
|
3387
3813
|
] }, val)),
|
|
3388
|
-
/* @__PURE__ */ (0,
|
|
3389
|
-
|
|
3814
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3815
|
+
import_react34.Combobox.Input,
|
|
3390
3816
|
{
|
|
3391
3817
|
className: "border-none p-0 text-gray-900 focus:ring-0 outline-none placeholder:text-gray-400 bg-transparent min-w-[50px] flex-1 text-sm leading-5 py-0.5",
|
|
3392
3818
|
displayValue: (val) => !multiple && val ? getLabel(val) : query,
|
|
@@ -3395,7 +3821,7 @@ var Select = ({
|
|
|
3395
3821
|
}
|
|
3396
3822
|
)
|
|
3397
3823
|
] }),
|
|
3398
|
-
/* @__PURE__ */ (0,
|
|
3824
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react34.Combobox.Button, { className: "absolute inset-y-0 right-0 flex items-center pr-2", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3399
3825
|
import_solid4.ChevronUpDownIcon,
|
|
3400
3826
|
{
|
|
3401
3827
|
className: "h-5 w-5 text-gray-400",
|
|
@@ -3403,16 +3829,16 @@ var Select = ({
|
|
|
3403
3829
|
}
|
|
3404
3830
|
) })
|
|
3405
3831
|
] }),
|
|
3406
|
-
/* @__PURE__ */ (0,
|
|
3407
|
-
|
|
3832
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3833
|
+
import_react34.Transition,
|
|
3408
3834
|
{
|
|
3409
|
-
as:
|
|
3835
|
+
as: import_react33.default.Fragment,
|
|
3410
3836
|
leave: "transition ease-in duration-100",
|
|
3411
3837
|
leaveFrom: "opacity-100",
|
|
3412
3838
|
leaveTo: "opacity-0",
|
|
3413
3839
|
afterLeave: () => setQuery(""),
|
|
3414
|
-
children: /* @__PURE__ */ (0,
|
|
3415
|
-
|
|
3840
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react34.Combobox.Options, { className: "absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm", children: filteredOptions.length === 0 && query !== "" ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "relative cursor-default select-none py-2 px-4 text-gray-700", children: "Nothing found." }) : filteredOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3841
|
+
import_react34.Combobox.Option,
|
|
3416
3842
|
{
|
|
3417
3843
|
className: ({ active }) => (0, import_clsx7.clsx)(
|
|
3418
3844
|
"relative cursor-default select-none py-2 pl-10 pr-4",
|
|
@@ -3420,16 +3846,16 @@ var Select = ({
|
|
|
3420
3846
|
),
|
|
3421
3847
|
value: option.value,
|
|
3422
3848
|
disabled: option.disabled,
|
|
3423
|
-
children: ({ selected, active }) => /* @__PURE__ */ (0,
|
|
3424
|
-
/* @__PURE__ */ (0,
|
|
3425
|
-
selected ? /* @__PURE__ */ (0,
|
|
3849
|
+
children: ({ selected, active }) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
3850
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: (0, import_clsx7.clsx)("block truncate", selected ? "font-medium" : "font-normal"), children: option.label }),
|
|
3851
|
+
selected ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3426
3852
|
"span",
|
|
3427
3853
|
{
|
|
3428
3854
|
className: (0, import_clsx7.clsx)(
|
|
3429
3855
|
"absolute inset-y-0 left-0 flex items-center pl-3",
|
|
3430
3856
|
active ? "text-white" : "text-primus-600"
|
|
3431
3857
|
),
|
|
3432
|
-
children: /* @__PURE__ */ (0,
|
|
3858
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_solid4.CheckIcon, { className: "h-5 w-5", "aria-hidden": "true" })
|
|
3433
3859
|
}
|
|
3434
3860
|
) : null
|
|
3435
3861
|
] })
|
|
@@ -3438,15 +3864,15 @@ var Select = ({
|
|
|
3438
3864
|
)) })
|
|
3439
3865
|
}
|
|
3440
3866
|
),
|
|
3441
|
-
error && /* @__PURE__ */ (0,
|
|
3867
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "mt-1 text-sm text-red-500", children: error })
|
|
3442
3868
|
] })
|
|
3443
3869
|
}
|
|
3444
3870
|
) });
|
|
3445
3871
|
};
|
|
3446
3872
|
|
|
3447
3873
|
// src/components/shared/Toggle.tsx
|
|
3448
|
-
var
|
|
3449
|
-
var
|
|
3874
|
+
var import_react35 = __toESM(require("react"));
|
|
3875
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3450
3876
|
var Toggle = ({
|
|
3451
3877
|
checked = false,
|
|
3452
3878
|
onChange,
|
|
@@ -3454,7 +3880,7 @@ var Toggle = ({
|
|
|
3454
3880
|
label,
|
|
3455
3881
|
size = "md"
|
|
3456
3882
|
}) => {
|
|
3457
|
-
const [isHovered, setIsHovered] =
|
|
3883
|
+
const [isHovered, setIsHovered] = import_react35.default.useState(false);
|
|
3458
3884
|
const sizes = {
|
|
3459
3885
|
sm: { width: "2.25rem", height: "1.25rem", thumbSize: "0.875rem" },
|
|
3460
3886
|
md: { width: "2.75rem", height: "1.5rem", thumbSize: "1.125rem" },
|
|
@@ -3501,8 +3927,8 @@ var Toggle = ({
|
|
|
3501
3927
|
onChange?.(!checked);
|
|
3502
3928
|
}
|
|
3503
3929
|
};
|
|
3504
|
-
return /* @__PURE__ */ (0,
|
|
3505
|
-
/* @__PURE__ */ (0,
|
|
3930
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { style: containerStyles, children: [
|
|
3931
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3506
3932
|
"div",
|
|
3507
3933
|
{
|
|
3508
3934
|
style: switchStyles,
|
|
@@ -3518,20 +3944,23 @@ var Toggle = ({
|
|
|
3518
3944
|
handleClick();
|
|
3519
3945
|
}
|
|
3520
3946
|
},
|
|
3521
|
-
children: /* @__PURE__ */ (0,
|
|
3947
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { style: thumbStyles })
|
|
3522
3948
|
}
|
|
3523
3949
|
),
|
|
3524
|
-
label && /* @__PURE__ */ (0,
|
|
3950
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("label", { style: labelStyles, onClick: handleClick, children: label })
|
|
3525
3951
|
] });
|
|
3526
3952
|
};
|
|
3527
3953
|
Toggle.displayName = "Toggle";
|
|
3528
3954
|
|
|
3529
3955
|
// src/components/shared/Textarea.tsx
|
|
3530
|
-
var
|
|
3531
|
-
var
|
|
3532
|
-
var Textarea =
|
|
3533
|
-
({ style, label, error, disabled, resize = "vertical", ...props }, ref) => {
|
|
3534
|
-
const
|
|
3956
|
+
var import_react36 = __toESM(require("react"));
|
|
3957
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
3958
|
+
var Textarea = import_react36.default.forwardRef(
|
|
3959
|
+
({ style, label, error, disabled, resize = "vertical", onChange, onValueChange, className, ...props }, ref) => {
|
|
3960
|
+
const handleChange = (e) => {
|
|
3961
|
+
onChange?.(e);
|
|
3962
|
+
onValueChange?.(e.target.value);
|
|
3963
|
+
};
|
|
3535
3964
|
const containerStyles = {
|
|
3536
3965
|
width: "100%"
|
|
3537
3966
|
};
|
|
@@ -3539,11 +3968,11 @@ var Textarea = import_react34.default.forwardRef(
|
|
|
3539
3968
|
fontSize: "0.875rem",
|
|
3540
3969
|
lineHeight: "1.25rem",
|
|
3541
3970
|
fontWeight: "500",
|
|
3542
|
-
marginBottom: "0.
|
|
3971
|
+
marginBottom: "0.375rem",
|
|
3543
3972
|
display: "block",
|
|
3544
3973
|
color: "#374151",
|
|
3545
|
-
|
|
3546
|
-
|
|
3974
|
+
opacity: disabled ? 0.7 : 1,
|
|
3975
|
+
cursor: disabled ? "not-allowed" : "default"
|
|
3547
3976
|
};
|
|
3548
3977
|
const textareaStyles = {
|
|
3549
3978
|
display: "flex",
|
|
@@ -3556,12 +3985,11 @@ var Textarea = import_react34.default.forwardRef(
|
|
|
3556
3985
|
fontSize: "0.875rem",
|
|
3557
3986
|
lineHeight: "1.5rem",
|
|
3558
3987
|
outline: "none",
|
|
3559
|
-
transition: "
|
|
3560
|
-
cursor: disabled ? "not-allowed" : "text",
|
|
3988
|
+
transition: "border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out",
|
|
3561
3989
|
opacity: disabled ? 0.5 : 1,
|
|
3990
|
+
cursor: disabled ? "not-allowed" : "text",
|
|
3562
3991
|
resize,
|
|
3563
|
-
fontFamily: "inherit"
|
|
3564
|
-
boxShadow: isFocused ? error ? "0 0 0 2px rgba(239, 68, 68, 0.2)" : "0 0 0 2px rgba(3, 7, 18, 0.1)" : "none"
|
|
3992
|
+
fontFamily: "inherit"
|
|
3565
3993
|
};
|
|
3566
3994
|
const errorTextStyles = {
|
|
3567
3995
|
fontSize: "0.875rem",
|
|
@@ -3569,9 +3997,9 @@ var Textarea = import_react34.default.forwardRef(
|
|
|
3569
3997
|
color: "#ef4444",
|
|
3570
3998
|
marginTop: "0.25rem"
|
|
3571
3999
|
};
|
|
3572
|
-
return /* @__PURE__ */ (0,
|
|
3573
|
-
label && /* @__PURE__ */ (0,
|
|
3574
|
-
/* @__PURE__ */ (0,
|
|
4000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { style: containerStyles, className, children: [
|
|
4001
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("label", { style: labelStyles, children: label }),
|
|
4002
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3575
4003
|
"textarea",
|
|
3576
4004
|
{
|
|
3577
4005
|
ref,
|
|
@@ -3579,94 +4007,28 @@ var Textarea = import_react34.default.forwardRef(
|
|
|
3579
4007
|
...textareaStyles,
|
|
3580
4008
|
...style
|
|
3581
4009
|
},
|
|
3582
|
-
onFocus: () => setIsFocused(true),
|
|
3583
|
-
onBlur: () => setIsFocused(false),
|
|
3584
4010
|
disabled,
|
|
4011
|
+
onChange: handleChange,
|
|
4012
|
+
className: `primus-textarea ${error ? "error" : ""}`,
|
|
3585
4013
|
...props
|
|
3586
4014
|
}
|
|
3587
4015
|
),
|
|
3588
|
-
|
|
4016
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("style", { children: `
|
|
4017
|
+
.primus-textarea:focus {
|
|
4018
|
+
border-color: ${error ? "#ef4444" : "#6366f1"};
|
|
4019
|
+
box-shadow: 0 0 0 1px ${error ? "#ef4444" : "#6366f1"};
|
|
4020
|
+
}
|
|
4021
|
+
` }),
|
|
4022
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { style: errorTextStyles, children: error })
|
|
3589
4023
|
] });
|
|
3590
4024
|
}
|
|
3591
4025
|
);
|
|
3592
4026
|
Textarea.displayName = "Textarea";
|
|
3593
4027
|
|
|
3594
|
-
// src/components/shared/Card.tsx
|
|
3595
|
-
var import_react35 = __toESM(require("react"));
|
|
3596
|
-
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3597
|
-
var Card = import_react35.default.forwardRef(
|
|
3598
|
-
({ style, variant = "default", padding = "md", children, ...props }, ref) => {
|
|
3599
|
-
const [isHovered, setIsHovered] = import_react35.default.useState(false);
|
|
3600
|
-
const paddingStyles = {
|
|
3601
|
-
none: "0",
|
|
3602
|
-
sm: "0.75rem",
|
|
3603
|
-
md: "1.5rem",
|
|
3604
|
-
lg: "2rem"
|
|
3605
|
-
};
|
|
3606
|
-
const variantStyles = {
|
|
3607
|
-
default: {
|
|
3608
|
-
normal: {
|
|
3609
|
-
backgroundColor: "#ffffff",
|
|
3610
|
-
border: "1px solid #e5e7eb",
|
|
3611
|
-
boxShadow: "0 1px 2px rgba(0, 0, 0, 0.05)"
|
|
3612
|
-
},
|
|
3613
|
-
hover: {
|
|
3614
|
-
boxShadow: "0 4px 6px rgba(0, 0, 0, 0.1)"
|
|
3615
|
-
}
|
|
3616
|
-
},
|
|
3617
|
-
outlined: {
|
|
3618
|
-
normal: {
|
|
3619
|
-
backgroundColor: "#ffffff",
|
|
3620
|
-
border: "2px solid #e5e7eb",
|
|
3621
|
-
boxShadow: "none"
|
|
3622
|
-
},
|
|
3623
|
-
hover: {
|
|
3624
|
-
borderColor: "#d1d5db"
|
|
3625
|
-
}
|
|
3626
|
-
},
|
|
3627
|
-
elevated: {
|
|
3628
|
-
normal: {
|
|
3629
|
-
backgroundColor: "#ffffff",
|
|
3630
|
-
border: "none",
|
|
3631
|
-
boxShadow: "0 4px 6px rgba(0, 0, 0, 0.1)"
|
|
3632
|
-
},
|
|
3633
|
-
hover: {
|
|
3634
|
-
boxShadow: "0 10px 15px rgba(0, 0, 0, 0.15)",
|
|
3635
|
-
transform: "translateY(-2px)"
|
|
3636
|
-
}
|
|
3637
|
-
}
|
|
3638
|
-
};
|
|
3639
|
-
const baseStyles = {
|
|
3640
|
-
borderRadius: "0.5rem",
|
|
3641
|
-
padding: paddingStyles[padding],
|
|
3642
|
-
transition: "all 0.2s ease"
|
|
3643
|
-
};
|
|
3644
|
-
const currentVariant = variantStyles[variant];
|
|
3645
|
-
const combinedStyles = {
|
|
3646
|
-
...baseStyles,
|
|
3647
|
-
...currentVariant.normal,
|
|
3648
|
-
...isHovered ? currentVariant.hover : {},
|
|
3649
|
-
...style
|
|
3650
|
-
};
|
|
3651
|
-
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3652
|
-
"div",
|
|
3653
|
-
{
|
|
3654
|
-
ref,
|
|
3655
|
-
style: combinedStyles,
|
|
3656
|
-
onMouseEnter: () => setIsHovered(true),
|
|
3657
|
-
onMouseLeave: () => setIsHovered(false),
|
|
3658
|
-
...props,
|
|
3659
|
-
children
|
|
3660
|
-
}
|
|
3661
|
-
);
|
|
3662
|
-
}
|
|
3663
|
-
);
|
|
3664
|
-
Card.displayName = "Card";
|
|
3665
|
-
|
|
3666
4028
|
// src/components/shared/Badge.tsx
|
|
3667
|
-
var
|
|
3668
|
-
var
|
|
3669
|
-
var Badge =
|
|
4029
|
+
var import_react37 = __toESM(require("react"));
|
|
4030
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
4031
|
+
var Badge = import_react37.default.forwardRef(
|
|
3670
4032
|
({ style, variant = "default", size = "md", children, ...props }, ref) => {
|
|
3671
4033
|
const variantStyles = {
|
|
3672
4034
|
default: {
|
|
@@ -3720,14 +4082,14 @@ var Badge = import_react36.default.forwardRef(
|
|
|
3720
4082
|
...sizeStyles[size],
|
|
3721
4083
|
...style
|
|
3722
4084
|
};
|
|
3723
|
-
return /* @__PURE__ */ (0,
|
|
4085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { ref, style: combinedStyles, ...props, children });
|
|
3724
4086
|
}
|
|
3725
4087
|
);
|
|
3726
4088
|
Badge.displayName = "Badge";
|
|
3727
4089
|
|
|
3728
4090
|
// src/components/shared/Table.tsx
|
|
3729
|
-
var
|
|
3730
|
-
var
|
|
4091
|
+
var import_react38 = __toESM(require("react"));
|
|
4092
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3731
4093
|
function Table({
|
|
3732
4094
|
columns,
|
|
3733
4095
|
data,
|
|
@@ -3736,7 +4098,7 @@ function Table({
|
|
|
3736
4098
|
bordered = true,
|
|
3737
4099
|
style
|
|
3738
4100
|
}) {
|
|
3739
|
-
const [hoveredRow, setHoveredRow] =
|
|
4101
|
+
const [hoveredRow, setHoveredRow] = import_react38.default.useState(null);
|
|
3740
4102
|
const tableStyles = {
|
|
3741
4103
|
width: "100%",
|
|
3742
4104
|
borderCollapse: "collapse",
|
|
@@ -3761,8 +4123,8 @@ function Table({
|
|
|
3761
4123
|
backgroundColor: hoverable && hoveredRow === rowIndex ? "#f9fafb" : striped && rowIndex % 2 === 1 ? "#f9fafb" : "#ffffff",
|
|
3762
4124
|
transition: "background-color 0.15s ease"
|
|
3763
4125
|
});
|
|
3764
|
-
return /* @__PURE__ */ (0,
|
|
3765
|
-
/* @__PURE__ */ (0,
|
|
4126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { style: { overflowX: "auto", borderRadius: "0.5rem", border: bordered ? "1px solid #e5e7eb" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("table", { style: tableStyles, children: [
|
|
4127
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("thead", { style: theadStyles, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("tr", { children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3766
4128
|
"th",
|
|
3767
4129
|
{
|
|
3768
4130
|
style: {
|
|
@@ -3773,12 +4135,12 @@ function Table({
|
|
|
3773
4135
|
},
|
|
3774
4136
|
column.key
|
|
3775
4137
|
)) }) }),
|
|
3776
|
-
/* @__PURE__ */ (0,
|
|
4138
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("tbody", { children: data.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3777
4139
|
"tr",
|
|
3778
4140
|
{
|
|
3779
4141
|
onMouseEnter: () => hoverable && setHoveredRow(rowIndex),
|
|
3780
4142
|
onMouseLeave: () => hoverable && setHoveredRow(null),
|
|
3781
|
-
children: columns.map((column) => /* @__PURE__ */ (0,
|
|
4143
|
+
children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("td", { style: getTdStyles(rowIndex), children: column.render ? column.render(row) : row[column.key] }, column.key))
|
|
3782
4144
|
},
|
|
3783
4145
|
rowIndex
|
|
3784
4146
|
)) })
|
|
@@ -3787,9 +4149,9 @@ function Table({
|
|
|
3787
4149
|
Table.displayName = "Table";
|
|
3788
4150
|
|
|
3789
4151
|
// src/components/shared/Container.tsx
|
|
3790
|
-
var
|
|
3791
|
-
var
|
|
3792
|
-
var Container =
|
|
4152
|
+
var import_react39 = __toESM(require("react"));
|
|
4153
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
4154
|
+
var Container = import_react39.default.forwardRef(
|
|
3793
4155
|
({ style, maxWidth = "lg", padding = "md", children, ...props }, ref) => {
|
|
3794
4156
|
const maxWidthStyles = {
|
|
3795
4157
|
sm: "640px",
|
|
@@ -3814,15 +4176,15 @@ var Container = import_react38.default.forwardRef(
|
|
|
3814
4176
|
paddingRight: paddingStyles[padding],
|
|
3815
4177
|
...style
|
|
3816
4178
|
};
|
|
3817
|
-
return /* @__PURE__ */ (0,
|
|
4179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { ref, style: containerStyles, ...props, children });
|
|
3818
4180
|
}
|
|
3819
4181
|
);
|
|
3820
4182
|
Container.displayName = "Container";
|
|
3821
4183
|
|
|
3822
4184
|
// src/components/shared/Grid.tsx
|
|
3823
|
-
var
|
|
3824
|
-
var
|
|
3825
|
-
var Grid =
|
|
4185
|
+
var import_react40 = __toESM(require("react"));
|
|
4186
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
4187
|
+
var Grid = import_react40.default.forwardRef(
|
|
3826
4188
|
({ style, columns = 3, rows, gap = "md", width = "100%", height = "auto", responsive = true, children, ...props }, ref) => {
|
|
3827
4189
|
const gapStyles = {
|
|
3828
4190
|
none: "0",
|
|
@@ -3840,15 +4202,15 @@ var Grid = import_react39.default.forwardRef(
|
|
|
3840
4202
|
height,
|
|
3841
4203
|
...style
|
|
3842
4204
|
};
|
|
3843
|
-
return /* @__PURE__ */ (0,
|
|
4205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { ref, style: gridStyles, ...props, children });
|
|
3844
4206
|
}
|
|
3845
4207
|
);
|
|
3846
4208
|
Grid.displayName = "Grid";
|
|
3847
4209
|
|
|
3848
4210
|
// src/components/shared/Stack.tsx
|
|
3849
|
-
var
|
|
3850
|
-
var
|
|
3851
|
-
var Stack =
|
|
4211
|
+
var import_react41 = __toESM(require("react"));
|
|
4212
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
4213
|
+
var Stack = import_react41.default.forwardRef(
|
|
3852
4214
|
({ style, direction = "vertical", gap = "md", align = "stretch", justify = "start", children, ...props }, ref) => {
|
|
3853
4215
|
const gapStyles = {
|
|
3854
4216
|
none: "0",
|
|
@@ -3878,14 +4240,14 @@ var Stack = import_react40.default.forwardRef(
|
|
|
3878
4240
|
justifyContent: justifyStyles[justify],
|
|
3879
4241
|
...style
|
|
3880
4242
|
};
|
|
3881
|
-
return /* @__PURE__ */ (0,
|
|
4243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { ref, style: stackStyles, ...props, children });
|
|
3882
4244
|
}
|
|
3883
4245
|
);
|
|
3884
4246
|
Stack.displayName = "Stack";
|
|
3885
4247
|
|
|
3886
4248
|
// src/components/shared/Modal.tsx
|
|
3887
|
-
var
|
|
3888
|
-
var
|
|
4249
|
+
var import_react42 = __toESM(require("react"));
|
|
4250
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
3889
4251
|
var Modal = ({
|
|
3890
4252
|
isOpen,
|
|
3891
4253
|
onClose,
|
|
@@ -3894,7 +4256,7 @@ var Modal = ({
|
|
|
3894
4256
|
size = "md",
|
|
3895
4257
|
closeOnOverlayClick = true
|
|
3896
4258
|
}) => {
|
|
3897
|
-
|
|
4259
|
+
import_react42.default.useEffect(() => {
|
|
3898
4260
|
if (isOpen) {
|
|
3899
4261
|
document.body.style.overflow = "hidden";
|
|
3900
4262
|
} else {
|
|
@@ -3963,20 +4325,20 @@ var Modal = ({
|
|
|
3963
4325
|
overflowY: "auto",
|
|
3964
4326
|
flex: 1
|
|
3965
4327
|
};
|
|
3966
|
-
return /* @__PURE__ */ (0,
|
|
4328
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3967
4329
|
"div",
|
|
3968
4330
|
{
|
|
3969
4331
|
style: overlayStyles,
|
|
3970
4332
|
onClick: closeOnOverlayClick ? onClose : void 0,
|
|
3971
|
-
children: /* @__PURE__ */ (0,
|
|
4333
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
3972
4334
|
"div",
|
|
3973
4335
|
{
|
|
3974
4336
|
style: modalStyles,
|
|
3975
4337
|
onClick: (e) => e.stopPropagation(),
|
|
3976
4338
|
children: [
|
|
3977
|
-
title && /* @__PURE__ */ (0,
|
|
3978
|
-
/* @__PURE__ */ (0,
|
|
3979
|
-
/* @__PURE__ */ (0,
|
|
4339
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { style: headerStyles, children: [
|
|
4340
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("h2", { style: titleStyles, children: title }),
|
|
4341
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3980
4342
|
"button",
|
|
3981
4343
|
{
|
|
3982
4344
|
style: closeButtonStyles,
|
|
@@ -3986,7 +4348,7 @@ var Modal = ({
|
|
|
3986
4348
|
}
|
|
3987
4349
|
)
|
|
3988
4350
|
] }),
|
|
3989
|
-
/* @__PURE__ */ (0,
|
|
4351
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { style: contentStyles, children })
|
|
3990
4352
|
]
|
|
3991
4353
|
}
|
|
3992
4354
|
)
|
|
@@ -3996,8 +4358,8 @@ var Modal = ({
|
|
|
3996
4358
|
Modal.displayName = "Modal";
|
|
3997
4359
|
|
|
3998
4360
|
// src/components/shared/DateRangePicker.tsx
|
|
3999
|
-
var
|
|
4000
|
-
var
|
|
4361
|
+
var import_react43 = require("react");
|
|
4362
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
4001
4363
|
var PrimusDateRangePicker = ({
|
|
4002
4364
|
startDate = null,
|
|
4003
4365
|
endDate = null,
|
|
@@ -4007,15 +4369,15 @@ var PrimusDateRangePicker = ({
|
|
|
4007
4369
|
disabled = false,
|
|
4008
4370
|
onRangeChange
|
|
4009
4371
|
}) => {
|
|
4010
|
-
const [start, setStart] = (0,
|
|
4011
|
-
const [end, setEnd] = (0,
|
|
4012
|
-
(0,
|
|
4372
|
+
const [start, setStart] = (0, import_react43.useState)(startDate ?? "");
|
|
4373
|
+
const [end, setEnd] = (0, import_react43.useState)(endDate ?? "");
|
|
4374
|
+
(0, import_react43.useEffect)(() => {
|
|
4013
4375
|
setStart(startDate ?? "");
|
|
4014
4376
|
}, [startDate]);
|
|
4015
|
-
(0,
|
|
4377
|
+
(0, import_react43.useEffect)(() => {
|
|
4016
4378
|
setEnd(endDate ?? "");
|
|
4017
4379
|
}, [endDate]);
|
|
4018
|
-
const normalizedRanges = (0,
|
|
4380
|
+
const normalizedRanges = (0, import_react43.useMemo)(() => {
|
|
4019
4381
|
return ranges.map((range) => typeof range === "string" ? resolvePreset(range) : range).filter((range) => !!range);
|
|
4020
4382
|
}, [ranges]);
|
|
4021
4383
|
const handleStartChange = (value) => {
|
|
@@ -4033,8 +4395,8 @@ var PrimusDateRangePicker = ({
|
|
|
4033
4395
|
setEnd(nextEnd);
|
|
4034
4396
|
onRangeChange?.({ startDate: nextStart, endDate: nextEnd, label: range.label });
|
|
4035
4397
|
};
|
|
4036
|
-
return /* @__PURE__ */ (0,
|
|
4037
|
-
normalizedRanges.length > 0 && /* @__PURE__ */ (0,
|
|
4398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "space-y-3", children: [
|
|
4399
|
+
normalizedRanges.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "flex flex-wrap gap-2", children: normalizedRanges.map((range) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4038
4400
|
"button",
|
|
4039
4401
|
{
|
|
4040
4402
|
type: "button",
|
|
@@ -4045,8 +4407,8 @@ var PrimusDateRangePicker = ({
|
|
|
4045
4407
|
},
|
|
4046
4408
|
range.label
|
|
4047
4409
|
)) }),
|
|
4048
|
-
/* @__PURE__ */ (0,
|
|
4049
|
-
/* @__PURE__ */ (0,
|
|
4410
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex flex-col md:flex-row gap-3", children: [
|
|
4411
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4050
4412
|
"input",
|
|
4051
4413
|
{
|
|
4052
4414
|
type: "date",
|
|
@@ -4058,7 +4420,7 @@ var PrimusDateRangePicker = ({
|
|
|
4058
4420
|
className: "w-full px-3 py-2 rounded-lg border border-white/10 bg-white/5 text-gray-200 text-sm focus:outline-none focus:ring-1 focus:ring-purple-500/50"
|
|
4059
4421
|
}
|
|
4060
4422
|
),
|
|
4061
|
-
/* @__PURE__ */ (0,
|
|
4423
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4062
4424
|
"input",
|
|
4063
4425
|
{
|
|
4064
4426
|
type: "date",
|
|
@@ -4109,7 +4471,7 @@ var toDateInputValue = (value) => {
|
|
|
4109
4471
|
};
|
|
4110
4472
|
|
|
4111
4473
|
// src/components/shared/FilterBar.tsx
|
|
4112
|
-
var
|
|
4474
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
4113
4475
|
var PrimusFilterBar = ({
|
|
4114
4476
|
filters,
|
|
4115
4477
|
activeFilters,
|
|
@@ -4123,9 +4485,9 @@ var PrimusFilterBar = ({
|
|
|
4123
4485
|
};
|
|
4124
4486
|
onChange?.(next);
|
|
4125
4487
|
};
|
|
4126
|
-
return /* @__PURE__ */ (0,
|
|
4127
|
-
filters.map((filter) => /* @__PURE__ */ (0,
|
|
4128
|
-
filter.type === "select" && /* @__PURE__ */ (0,
|
|
4488
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex flex-wrap gap-4 items-end", children: [
|
|
4489
|
+
filters.map((filter) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "min-w-[220px]", children: [
|
|
4490
|
+
filter.type === "select" && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4129
4491
|
Select,
|
|
4130
4492
|
{
|
|
4131
4493
|
label: filter.label,
|
|
@@ -4135,7 +4497,7 @@ var PrimusFilterBar = ({
|
|
|
4135
4497
|
onChange: (value) => updateFilter(filter.key, value)
|
|
4136
4498
|
}
|
|
4137
4499
|
),
|
|
4138
|
-
filter.type === "toggle" && /* @__PURE__ */ (0,
|
|
4500
|
+
filter.type === "toggle" && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4139
4501
|
Toggle,
|
|
4140
4502
|
{
|
|
4141
4503
|
label: filter.label,
|
|
@@ -4143,7 +4505,7 @@ var PrimusFilterBar = ({
|
|
|
4143
4505
|
onChange: (checked) => updateFilter(filter.key, checked)
|
|
4144
4506
|
}
|
|
4145
4507
|
),
|
|
4146
|
-
filter.type === "search" && /* @__PURE__ */ (0,
|
|
4508
|
+
filter.type === "search" && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4147
4509
|
Input,
|
|
4148
4510
|
{
|
|
4149
4511
|
label: filter.label,
|
|
@@ -4158,8 +4520,8 @@ var PrimusFilterBar = ({
|
|
|
4158
4520
|
};
|
|
4159
4521
|
|
|
4160
4522
|
// src/components/shared/ExportMenu.tsx
|
|
4161
|
-
var
|
|
4162
|
-
var
|
|
4523
|
+
var import_react44 = require("react");
|
|
4524
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
4163
4525
|
var PrimusExportMenu = ({
|
|
4164
4526
|
formats = ["CSV", "PDF", "PNG", "JSON"],
|
|
4165
4527
|
includeCharts = true,
|
|
@@ -4167,11 +4529,11 @@ var PrimusExportMenu = ({
|
|
|
4167
4529
|
includeTables = true,
|
|
4168
4530
|
onExport
|
|
4169
4531
|
}) => {
|
|
4170
|
-
const [format, setFormat] = (0,
|
|
4171
|
-
const [charts, setCharts] = (0,
|
|
4172
|
-
const [stats, setStats] = (0,
|
|
4173
|
-
const [tables, setTables] = (0,
|
|
4174
|
-
(0,
|
|
4532
|
+
const [format, setFormat] = (0, import_react44.useState)(formats[0] ?? "CSV");
|
|
4533
|
+
const [charts, setCharts] = (0, import_react44.useState)(includeCharts);
|
|
4534
|
+
const [stats, setStats] = (0, import_react44.useState)(includeStats);
|
|
4535
|
+
const [tables, setTables] = (0, import_react44.useState)(includeTables);
|
|
4536
|
+
(0, import_react44.useEffect)(() => {
|
|
4175
4537
|
if (!formats.includes(format)) {
|
|
4176
4538
|
setFormat(formats[0] ?? "CSV");
|
|
4177
4539
|
}
|
|
@@ -4184,29 +4546,29 @@ var PrimusExportMenu = ({
|
|
|
4184
4546
|
includeTables: tables
|
|
4185
4547
|
});
|
|
4186
4548
|
};
|
|
4187
|
-
return /* @__PURE__ */ (0,
|
|
4188
|
-
/* @__PURE__ */ (0,
|
|
4549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
4550
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
4189
4551
|
"select",
|
|
4190
4552
|
{
|
|
4191
4553
|
value: format,
|
|
4192
4554
|
onChange: (event) => setFormat(event.target.value),
|
|
4193
4555
|
className: "px-3 py-2 rounded-lg border border-white/10 bg-white/5 text-gray-200 text-sm",
|
|
4194
|
-
children: formats.map((item) => /* @__PURE__ */ (0,
|
|
4556
|
+
children: formats.map((item) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("option", { value: item, children: item }, item))
|
|
4195
4557
|
}
|
|
4196
4558
|
),
|
|
4197
|
-
/* @__PURE__ */ (0,
|
|
4198
|
-
/* @__PURE__ */ (0,
|
|
4559
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("label", { className: "flex items-center gap-2 text-xs text-gray-300", children: [
|
|
4560
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("input", { type: "checkbox", checked: charts, onChange: (e) => setCharts(e.target.checked) }),
|
|
4199
4561
|
"Charts"
|
|
4200
4562
|
] }),
|
|
4201
|
-
/* @__PURE__ */ (0,
|
|
4202
|
-
/* @__PURE__ */ (0,
|
|
4563
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("label", { className: "flex items-center gap-2 text-xs text-gray-300", children: [
|
|
4564
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("input", { type: "checkbox", checked: stats, onChange: (e) => setStats(e.target.checked) }),
|
|
4203
4565
|
"Stats"
|
|
4204
4566
|
] }),
|
|
4205
|
-
/* @__PURE__ */ (0,
|
|
4206
|
-
/* @__PURE__ */ (0,
|
|
4567
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("label", { className: "flex items-center gap-2 text-xs text-gray-300", children: [
|
|
4568
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("input", { type: "checkbox", checked: tables, onChange: (e) => setTables(e.target.checked) }),
|
|
4207
4569
|
"Tables"
|
|
4208
4570
|
] }),
|
|
4209
|
-
/* @__PURE__ */ (0,
|
|
4571
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
4210
4572
|
"button",
|
|
4211
4573
|
{
|
|
4212
4574
|
type: "button",
|
|
@@ -4219,8 +4581,8 @@ var PrimusExportMenu = ({
|
|
|
4219
4581
|
};
|
|
4220
4582
|
|
|
4221
4583
|
// src/components/shared/Search.tsx
|
|
4222
|
-
var
|
|
4223
|
-
var
|
|
4584
|
+
var import_react45 = require("react");
|
|
4585
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
4224
4586
|
var PrimusSearch = ({
|
|
4225
4587
|
placeholder = "Search...",
|
|
4226
4588
|
debounce = 300,
|
|
@@ -4229,17 +4591,17 @@ var PrimusSearch = ({
|
|
|
4229
4591
|
suggestions = [],
|
|
4230
4592
|
onSearch
|
|
4231
4593
|
}) => {
|
|
4232
|
-
const [query, setQuery] = (0,
|
|
4233
|
-
(0,
|
|
4594
|
+
const [query, setQuery] = (0, import_react45.useState)(value);
|
|
4595
|
+
(0, import_react45.useEffect)(() => {
|
|
4234
4596
|
setQuery(value);
|
|
4235
4597
|
}, [value]);
|
|
4236
|
-
(0,
|
|
4598
|
+
(0, import_react45.useEffect)(() => {
|
|
4237
4599
|
const handle = window.setTimeout(() => {
|
|
4238
4600
|
onSearch?.(query);
|
|
4239
4601
|
}, debounce);
|
|
4240
4602
|
return () => window.clearTimeout(handle);
|
|
4241
4603
|
}, [query, debounce, onSearch]);
|
|
4242
|
-
const visibleSuggestions = (0,
|
|
4604
|
+
const visibleSuggestions = (0, import_react45.useMemo)(() => {
|
|
4243
4605
|
if (!showSuggestions || !suggestions.length) {
|
|
4244
4606
|
return [];
|
|
4245
4607
|
}
|
|
@@ -4248,8 +4610,8 @@ var PrimusSearch = ({
|
|
|
4248
4610
|
}
|
|
4249
4611
|
return suggestions.filter((item) => item.toLowerCase().includes(query.toLowerCase())).slice(0, 5);
|
|
4250
4612
|
}, [suggestions, query, showSuggestions]);
|
|
4251
|
-
return /* @__PURE__ */ (0,
|
|
4252
|
-
/* @__PURE__ */ (0,
|
|
4613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "relative", children: [
|
|
4614
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
4253
4615
|
"input",
|
|
4254
4616
|
{
|
|
4255
4617
|
type: "text",
|
|
@@ -4259,7 +4621,7 @@ var PrimusSearch = ({
|
|
|
4259
4621
|
className: "w-full px-3 py-2 rounded-lg border border-white/10 bg-white/5 text-gray-200 text-sm focus:outline-none focus:ring-1 focus:ring-purple-500/50"
|
|
4260
4622
|
}
|
|
4261
4623
|
),
|
|
4262
|
-
visibleSuggestions.length > 0 && /* @__PURE__ */ (0,
|
|
4624
|
+
visibleSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "absolute mt-2 w-full rounded-lg border border-white/10 bg-slate-900/90 backdrop-blur-sm shadow-lg z-10", children: visibleSuggestions.map((item) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
4263
4625
|
"button",
|
|
4264
4626
|
{
|
|
4265
4627
|
type: "button",
|
|
@@ -4271,6 +4633,304 @@ var PrimusSearch = ({
|
|
|
4271
4633
|
)) })
|
|
4272
4634
|
] });
|
|
4273
4635
|
};
|
|
4636
|
+
|
|
4637
|
+
// src/components/shared/PrimusWizard.tsx
|
|
4638
|
+
var import_react46 = __toESM(require("react"));
|
|
4639
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
4640
|
+
var PrimusStep = ({ children }) => {
|
|
4641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_jsx_runtime59.Fragment, { children });
|
|
4642
|
+
};
|
|
4643
|
+
var PrimusStepper = ({ steps, currentStep }) => {
|
|
4644
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("nav", { "aria-label": "Progress", className: "mb-8", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("ol", { role: "list", className: "overflow-hidden rounded-md items-center flex md:border md:border-gray-200 dark:md:border-gray-800", children: steps.map((step, stepIdx) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("li", { className: "relative md:flex-1 md:flex", children: stepIdx < currentStep ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "group flex flex-1 items-center md:border-b-0 md:border-r border-gray-200 dark:border-gray-800 py-2 pl-4 md:py-3 md:pl-6 bg-white dark:bg-gray-900", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { className: "flex items-center text-sm font-medium text-purple-600 dark:text-purple-400", children: [
|
|
4645
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-purple-600 hover:bg-purple-800 text-white dark:bg-purple-500 dark:text-white", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("svg", { className: "h-5 w-5", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("path", { fillRule: "evenodd", d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z", clipRule: "evenodd" }) }) }),
|
|
4646
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ml-4 text-sm font-medium", children: step.label })
|
|
4647
|
+
] }) }) : stepIdx === currentStep ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "flex flex-1 items-center md:border-b-0 md:border-r border-gray-200 dark:border-gray-800 py-2 pl-4 md:py-3 md:pl-6 bg-white dark:bg-gray-900", "aria-current": "step", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { className: "flex items-center text-sm font-medium text-purple-600 dark:text-purple-400", children: [
|
|
4648
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full border-2 border-purple-600 dark:border-purple-500", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "text-purple-600 dark:text-purple-500 font-bold", children: stepIdx + 1 }) }),
|
|
4649
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ml-4 text-sm font-medium text-gray-900 dark:text-white", children: step.label })
|
|
4650
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "group flex flex-1 items-center md:border-b-0 md:border-r border-gray-200 dark:border-gray-800 py-2 pl-4 md:py-3 md:pl-6 bg-gray-50 dark:bg-gray-800/50", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { className: "flex items-center text-sm font-medium text-gray-500 dark:text-gray-400", children: [
|
|
4651
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full border-2 border-gray-300 dark:border-gray-700", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "text-gray-500 dark:text-gray-400 font-medium", children: stepIdx + 1 }) }),
|
|
4652
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ml-4", children: step.label })
|
|
4653
|
+
] }) }) }, step.label)) }) });
|
|
4654
|
+
};
|
|
4655
|
+
var PrimusWizard = ({
|
|
4656
|
+
title,
|
|
4657
|
+
subtitle,
|
|
4658
|
+
children,
|
|
4659
|
+
onComplete,
|
|
4660
|
+
className,
|
|
4661
|
+
startStep = 0
|
|
4662
|
+
}) => {
|
|
4663
|
+
const [currentStep, setCurrentStep] = (0, import_react46.useState)(startStep);
|
|
4664
|
+
const steps = import_react46.default.Children.toArray(children).filter(
|
|
4665
|
+
(child) => import_react46.default.isValidElement(child) && (child.type === PrimusStep || child.type.name === "PrimusStep")
|
|
4666
|
+
);
|
|
4667
|
+
const totalSteps = steps.length;
|
|
4668
|
+
const isFirstStep = currentStep === 0;
|
|
4669
|
+
const isLastStep = currentStep === totalSteps - 1;
|
|
4670
|
+
const handleNext = () => {
|
|
4671
|
+
if (isLastStep) {
|
|
4672
|
+
onComplete?.();
|
|
4673
|
+
} else {
|
|
4674
|
+
setCurrentStep((prev) => prev + 1);
|
|
4675
|
+
}
|
|
4676
|
+
};
|
|
4677
|
+
const handleBack = () => {
|
|
4678
|
+
if (!isFirstStep) {
|
|
4679
|
+
setCurrentStep((prev) => prev - 1);
|
|
4680
|
+
}
|
|
4681
|
+
};
|
|
4682
|
+
if (totalSteps === 0) {
|
|
4683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "text-red-500", children: "Error: PrimusWizard requires PrimusStep children" });
|
|
4684
|
+
}
|
|
4685
|
+
const currentStepConfig = steps[currentStep].props;
|
|
4686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: `space-y-6 ${className}`, children: [
|
|
4687
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { children: [
|
|
4688
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: title }),
|
|
4689
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "mt-1 text-gray-500 dark:text-gray-400", children: subtitle })
|
|
4690
|
+
] }),
|
|
4691
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4692
|
+
PrimusStepper,
|
|
4693
|
+
{
|
|
4694
|
+
steps: steps.map((s) => ({ label: s.props.label, description: s.props.description })),
|
|
4695
|
+
currentStep
|
|
4696
|
+
}
|
|
4697
|
+
),
|
|
4698
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(Card, { className: "p-6 min-h-[300px]", children: [
|
|
4699
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "mb-8", children: steps[currentStep] }),
|
|
4700
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex justify-between pt-6 border-t border-gray-100 dark:border-gray-800", children: [
|
|
4701
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4702
|
+
Button,
|
|
4703
|
+
{
|
|
4704
|
+
variant: "ghost",
|
|
4705
|
+
onClick: handleBack,
|
|
4706
|
+
disabled: isFirstStep,
|
|
4707
|
+
children: "Back"
|
|
4708
|
+
}
|
|
4709
|
+
),
|
|
4710
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4711
|
+
Button,
|
|
4712
|
+
{
|
|
4713
|
+
onClick: handleNext,
|
|
4714
|
+
disabled: currentStepConfig.isValid === false,
|
|
4715
|
+
children: isLastStep ? "Complete" : "Next"
|
|
4716
|
+
}
|
|
4717
|
+
)
|
|
4718
|
+
] })
|
|
4719
|
+
] })
|
|
4720
|
+
] });
|
|
4721
|
+
};
|
|
4722
|
+
|
|
4723
|
+
// src/components/shared/Field.tsx
|
|
4724
|
+
var import_react47 = __toESM(require("react"));
|
|
4725
|
+
var import_clsx8 = require("clsx");
|
|
4726
|
+
var import_solid5 = require("@heroicons/react/20/solid");
|
|
4727
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
4728
|
+
var FieldContext = import_react47.default.createContext(void 0);
|
|
4729
|
+
var useFieldContext = () => import_react47.default.useContext(FieldContext);
|
|
4730
|
+
var Field = ({ children, error, disabled, dense, className, ...props }) => {
|
|
4731
|
+
const id = import_react47.default.useId();
|
|
4732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(FieldContext.Provider, { value: { id, error, disabled }, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4733
|
+
"div",
|
|
4734
|
+
{
|
|
4735
|
+
className: (0, import_clsx8.clsx)(
|
|
4736
|
+
"flex flex-col w-full",
|
|
4737
|
+
dense ? "gap-1" : "gap-1.5",
|
|
4738
|
+
className
|
|
4739
|
+
),
|
|
4740
|
+
...props,
|
|
4741
|
+
children
|
|
4742
|
+
}
|
|
4743
|
+
) });
|
|
4744
|
+
};
|
|
4745
|
+
var Label = ({ className, children, required, indicator, ...props }) => {
|
|
4746
|
+
const context = useFieldContext();
|
|
4747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
4748
|
+
"label",
|
|
4749
|
+
{
|
|
4750
|
+
htmlFor: context?.id,
|
|
4751
|
+
className: (0, import_clsx8.clsx)(
|
|
4752
|
+
"block text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
4753
|
+
context?.disabled ? "text-gray-400 opacity-70" : "text-gray-700",
|
|
4754
|
+
props.onClick ? "cursor-pointer" : "cursor-default",
|
|
4755
|
+
className
|
|
4756
|
+
),
|
|
4757
|
+
...props,
|
|
4758
|
+
children: [
|
|
4759
|
+
children,
|
|
4760
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "ml-0.5 text-red-500", children: "*" }),
|
|
4761
|
+
indicator
|
|
4762
|
+
]
|
|
4763
|
+
}
|
|
4764
|
+
);
|
|
4765
|
+
};
|
|
4766
|
+
var FieldDescription = ({ className, children, ...props }) => {
|
|
4767
|
+
const context = useFieldContext();
|
|
4768
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4769
|
+
"p",
|
|
4770
|
+
{
|
|
4771
|
+
className: (0, import_clsx8.clsx)(
|
|
4772
|
+
"text-[0.8rem] text-muted-foreground text-gray-500",
|
|
4773
|
+
context?.disabled && "opacity-70",
|
|
4774
|
+
className
|
|
4775
|
+
),
|
|
4776
|
+
...props,
|
|
4777
|
+
children
|
|
4778
|
+
}
|
|
4779
|
+
);
|
|
4780
|
+
};
|
|
4781
|
+
var FieldError = ({ className, children, forceVisible, ...props }) => {
|
|
4782
|
+
const context = useFieldContext();
|
|
4783
|
+
const error = context?.error || children;
|
|
4784
|
+
if (!error && !forceVisible) return null;
|
|
4785
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
4786
|
+
"p",
|
|
4787
|
+
{
|
|
4788
|
+
className: (0, import_clsx8.clsx)(
|
|
4789
|
+
"text-[0.8rem] font-medium text-red-500 flex items-center gap-1.5 animate-in slide-in-from-top-1 fade-in-50",
|
|
4790
|
+
className
|
|
4791
|
+
),
|
|
4792
|
+
...props,
|
|
4793
|
+
children: [
|
|
4794
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_solid5.ExclamationCircleIcon, { className: "h-4 w-4 shrink-0" }),
|
|
4795
|
+
error
|
|
4796
|
+
]
|
|
4797
|
+
}
|
|
4798
|
+
);
|
|
4799
|
+
};
|
|
4800
|
+
|
|
4801
|
+
// src/components/shared/InputGroup.tsx
|
|
4802
|
+
var import_react48 = __toESM(require("react"));
|
|
4803
|
+
var import_clsx9 = require("clsx");
|
|
4804
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
4805
|
+
var InputGroup = ({ className, children, size = "md", ...props }) => {
|
|
4806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
4807
|
+
"div",
|
|
4808
|
+
{
|
|
4809
|
+
className: (0, import_clsx9.clsx)(
|
|
4810
|
+
"flex items-stretch w-full rounded-lg shadow-sm",
|
|
4811
|
+
// Target direct children to remove borders and rounded corners where they touch
|
|
4812
|
+
"[&>*:first-child]:rounded-r-none",
|
|
4813
|
+
"[&>*:last-child]:rounded-l-none",
|
|
4814
|
+
"[&>*:not(:first-child):not(:last-child)]:rounded-none",
|
|
4815
|
+
// Handle borders to prevent double borders
|
|
4816
|
+
"[&>*:not(:first-child)]:-ml-px",
|
|
4817
|
+
// Ensure z-index handling for focus rings
|
|
4818
|
+
"[&>*:focus-within]:z-10",
|
|
4819
|
+
className
|
|
4820
|
+
),
|
|
4821
|
+
...props,
|
|
4822
|
+
children: import_react48.default.Children.map(children, (child) => {
|
|
4823
|
+
if (import_react48.default.isValidElement(child)) {
|
|
4824
|
+
return import_react48.default.cloneElement(child, { size });
|
|
4825
|
+
}
|
|
4826
|
+
return child;
|
|
4827
|
+
})
|
|
4828
|
+
}
|
|
4829
|
+
);
|
|
4830
|
+
};
|
|
4831
|
+
var InputAddon = ({ className, children, ...props }) => {
|
|
4832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
4833
|
+
"div",
|
|
4834
|
+
{
|
|
4835
|
+
className: (0, import_clsx9.clsx)(
|
|
4836
|
+
"flex items-center px-3 border border-gray-200 bg-gray-50 text-gray-500 text-sm whitespace-nowrap",
|
|
4837
|
+
// These will be overridden by the group's first/last child selectors usually, but good defaults:
|
|
4838
|
+
"first:rounded-l-lg last:rounded-r-lg",
|
|
4839
|
+
className
|
|
4840
|
+
),
|
|
4841
|
+
...props,
|
|
4842
|
+
children
|
|
4843
|
+
}
|
|
4844
|
+
);
|
|
4845
|
+
};
|
|
4846
|
+
|
|
4847
|
+
// src/components/shared/PasswordInput.tsx
|
|
4848
|
+
var import_react49 = __toESM(require("react"));
|
|
4849
|
+
var import_solid6 = require("@heroicons/react/20/solid");
|
|
4850
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
4851
|
+
var PasswordInput = import_react49.default.forwardRef(
|
|
4852
|
+
(props, ref) => {
|
|
4853
|
+
const [showPassword, setShowPassword] = (0, import_react49.useState)(false);
|
|
4854
|
+
const toggleVisibility = () => {
|
|
4855
|
+
setShowPassword(!showPassword);
|
|
4856
|
+
};
|
|
4857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
4858
|
+
Input,
|
|
4859
|
+
{
|
|
4860
|
+
ref,
|
|
4861
|
+
type: showPassword ? "text" : "password",
|
|
4862
|
+
endIcon: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
4863
|
+
"button",
|
|
4864
|
+
{
|
|
4865
|
+
type: "button",
|
|
4866
|
+
onClick: toggleVisibility,
|
|
4867
|
+
className: "text-gray-400 hover:text-gray-600 focus:outline-none focus:text-primus-600 transition-colors pointer-events-auto cursor-pointer p-0.5 rounded",
|
|
4868
|
+
tabIndex: -1,
|
|
4869
|
+
children: [
|
|
4870
|
+
showPassword ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_solid6.EyeSlashIcon, { className: "h-4 w-4", "aria-hidden": "true" }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_solid6.EyeIcon, { className: "h-4 w-4", "aria-hidden": "true" }),
|
|
4871
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "sr-only", children: showPassword ? "Hide password" : "Show password" })
|
|
4872
|
+
]
|
|
4873
|
+
}
|
|
4874
|
+
),
|
|
4875
|
+
...props
|
|
4876
|
+
}
|
|
4877
|
+
);
|
|
4878
|
+
}
|
|
4879
|
+
);
|
|
4880
|
+
PasswordInput.displayName = "PasswordInput";
|
|
4881
|
+
|
|
4882
|
+
// src/components/shared/SearchInput.tsx
|
|
4883
|
+
var import_react50 = __toESM(require("react"));
|
|
4884
|
+
var import_solid7 = require("@heroicons/react/20/solid");
|
|
4885
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
4886
|
+
var SearchInput = import_react50.default.forwardRef(
|
|
4887
|
+
({ value, onSearch, debounceMs = 300, className, ...props }, ref) => {
|
|
4888
|
+
const [localValue, setLocalValue] = (0, import_react50.useState)(value || "");
|
|
4889
|
+
const [isDebouncing, setIsDebouncing] = (0, import_react50.useState)(false);
|
|
4890
|
+
(0, import_react50.useEffect)(() => {
|
|
4891
|
+
if (value !== void 0) {
|
|
4892
|
+
setLocalValue(value);
|
|
4893
|
+
}
|
|
4894
|
+
}, [value]);
|
|
4895
|
+
(0, import_react50.useEffect)(() => {
|
|
4896
|
+
if (debounceMs === 0) {
|
|
4897
|
+
onSearch?.(localValue);
|
|
4898
|
+
return;
|
|
4899
|
+
}
|
|
4900
|
+
const handler = setTimeout(() => {
|
|
4901
|
+
onSearch?.(localValue);
|
|
4902
|
+
setIsDebouncing(false);
|
|
4903
|
+
}, debounceMs);
|
|
4904
|
+
return () => {
|
|
4905
|
+
clearTimeout(handler);
|
|
4906
|
+
};
|
|
4907
|
+
}, [localValue, debounceMs]);
|
|
4908
|
+
const handleChange = (e) => {
|
|
4909
|
+
const newVal = e.target.value;
|
|
4910
|
+
setLocalValue(newVal);
|
|
4911
|
+
if (debounceMs > 0) setIsDebouncing(true);
|
|
4912
|
+
};
|
|
4913
|
+
const handleClear = () => {
|
|
4914
|
+
setLocalValue("");
|
|
4915
|
+
props.onClear?.();
|
|
4916
|
+
};
|
|
4917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
4918
|
+
Input,
|
|
4919
|
+
{
|
|
4920
|
+
ref,
|
|
4921
|
+
type: "text",
|
|
4922
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_solid7.MagnifyingGlassIcon, { className: "h-4 w-4" }),
|
|
4923
|
+
value: localValue,
|
|
4924
|
+
onChange: handleChange,
|
|
4925
|
+
onClear: handleClear,
|
|
4926
|
+
loading: props.loading || props.loading === void 0 && isDebouncing,
|
|
4927
|
+
className,
|
|
4928
|
+
...props
|
|
4929
|
+
}
|
|
4930
|
+
);
|
|
4931
|
+
}
|
|
4932
|
+
);
|
|
4933
|
+
SearchInput.displayName = "SearchInput";
|
|
4274
4934
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4275
4935
|
0 && (module.exports = {
|
|
4276
4936
|
AICopilot,
|
|
@@ -4288,17 +4948,24 @@ var PrimusSearch = ({
|
|
|
4288
4948
|
DashboardGrid,
|
|
4289
4949
|
DocumentViewer,
|
|
4290
4950
|
FeatureFlagToggle,
|
|
4951
|
+
Field,
|
|
4952
|
+
FieldDescription,
|
|
4953
|
+
FieldError,
|
|
4291
4954
|
FileUploader,
|
|
4292
4955
|
FraudDetectionDashboard,
|
|
4293
4956
|
Grid,
|
|
4294
4957
|
Input,
|
|
4958
|
+
InputAddon,
|
|
4959
|
+
InputGroup,
|
|
4295
4960
|
KYCVerification,
|
|
4961
|
+
Label,
|
|
4296
4962
|
LoanCalculator,
|
|
4297
4963
|
LogViewer,
|
|
4298
4964
|
LoginPage,
|
|
4299
4965
|
Modal,
|
|
4300
4966
|
NotificationBell,
|
|
4301
4967
|
NotificationFeed,
|
|
4968
|
+
PasswordInput,
|
|
4302
4969
|
PolicyCard,
|
|
4303
4970
|
PremiumCalculator,
|
|
4304
4971
|
PrimusActivityFeed,
|
|
@@ -4314,10 +4981,16 @@ var PrimusSearch = ({
|
|
|
4314
4981
|
PrimusDataTable,
|
|
4315
4982
|
PrimusDateRangePicker,
|
|
4316
4983
|
PrimusExportMenu,
|
|
4984
|
+
PrimusField,
|
|
4985
|
+
PrimusFieldDescription,
|
|
4986
|
+
PrimusFieldError,
|
|
4317
4987
|
PrimusFilterBar,
|
|
4318
4988
|
PrimusGrid,
|
|
4319
4989
|
PrimusHeader,
|
|
4320
4990
|
PrimusInput,
|
|
4991
|
+
PrimusInputAddon,
|
|
4992
|
+
PrimusInputGroup,
|
|
4993
|
+
PrimusLabel,
|
|
4321
4994
|
PrimusLayout,
|
|
4322
4995
|
PrimusLineChart,
|
|
4323
4996
|
PrimusLogin,
|
|
@@ -4326,22 +4999,31 @@ var PrimusSearch = ({
|
|
|
4326
4999
|
PrimusNotificationCenter,
|
|
4327
5000
|
PrimusNotificationFeed,
|
|
4328
5001
|
PrimusNotifications,
|
|
5002
|
+
PrimusPasswordInput,
|
|
4329
5003
|
PrimusPieChart,
|
|
4330
5004
|
PrimusProvider,
|
|
4331
5005
|
PrimusRadioGroup,
|
|
4332
5006
|
PrimusSearch,
|
|
5007
|
+
PrimusSearchInput,
|
|
5008
|
+
PrimusSection,
|
|
4333
5009
|
PrimusSelect,
|
|
4334
5010
|
PrimusSidebar,
|
|
4335
5011
|
PrimusSparkline,
|
|
4336
5012
|
PrimusStack,
|
|
4337
5013
|
PrimusStatCard,
|
|
5014
|
+
PrimusStatsCard,
|
|
5015
|
+
PrimusStep,
|
|
5016
|
+
PrimusStepper,
|
|
5017
|
+
PrimusSummaryCard,
|
|
4338
5018
|
PrimusTable,
|
|
4339
5019
|
PrimusTextarea,
|
|
4340
5020
|
PrimusThemeProvider,
|
|
4341
5021
|
PrimusThemeToggle,
|
|
4342
5022
|
PrimusToggle,
|
|
5023
|
+
PrimusWizard,
|
|
4343
5024
|
QuoteComparison,
|
|
4344
5025
|
RadioGroup,
|
|
5026
|
+
SearchInput,
|
|
4345
5027
|
SecurityDashboard,
|
|
4346
5028
|
Select,
|
|
4347
5029
|
Stack,
|
|
@@ -4353,6 +5035,7 @@ var PrimusSearch = ({
|
|
|
4353
5035
|
themeColors,
|
|
4354
5036
|
useNotifications,
|
|
4355
5037
|
usePrimusAuth,
|
|
5038
|
+
usePrimusFetch,
|
|
4356
5039
|
usePrimusTheme,
|
|
4357
5040
|
useRealtimeNotifications
|
|
4358
5041
|
});
|