ptechcore_ui 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +95 -5
- package/dist/index.d.cts +64 -1
- package/dist/index.d.ts +64 -1
- package/dist/index.js +91 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -29,13 +29,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
// src/index.ts
|
|
30
30
|
var index_exports = {};
|
|
31
31
|
__export(index_exports, {
|
|
32
|
+
Pages: () => Pages_default,
|
|
32
33
|
PrimaryButton: () => Buttons_default,
|
|
33
34
|
RewiseLayout: () => ModernDoubleSidebarLayout_default,
|
|
34
35
|
SecondaryButton: () => SecondaryButton,
|
|
35
36
|
SessionProvider: () => SessionProvider,
|
|
36
37
|
ThemeProvider: () => ThemeContext_default,
|
|
37
38
|
ToastContainer: () => Toast_default,
|
|
38
|
-
ToastProvider: () => ToastProvider
|
|
39
|
+
ToastProvider: () => ToastProvider,
|
|
40
|
+
useSession: () => useSession,
|
|
41
|
+
useToast: () => useToast
|
|
39
42
|
});
|
|
40
43
|
module.exports = __toCommonJS(index_exports);
|
|
41
44
|
|
|
@@ -454,7 +457,7 @@ var ThemeContext_default = ThemeProvider;
|
|
|
454
457
|
|
|
455
458
|
// src/components/layout/ModernDoubleSidebarLayout.tsx
|
|
456
459
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
457
|
-
var RewiseLayout = ({ children, module_name = "Rewise", primaryMenuItems, secondaryMenuItems }) => {
|
|
460
|
+
var RewiseLayout = ({ children, module_name = "Rewise", module_description = "Description du module", primaryMenuItems, secondaryMenuItems }) => {
|
|
458
461
|
const location = (0, import_react_router_dom.useLocation)();
|
|
459
462
|
const navigate = (0, import_react_router_dom.useNavigate)();
|
|
460
463
|
const { theme, themeType, setTheme } = useTheme();
|
|
@@ -565,8 +568,8 @@ var RewiseLayout = ({ children, module_name = "Rewise", primaryMenuItems, second
|
|
|
565
568
|
), children: [
|
|
566
569
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "w-10 h-10 bg-[var(--color-primary)] rounded-lg flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-[var(--color-background)] font-bold text-xl", children: "W" }) }),
|
|
567
570
|
!primaryCollapsed && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
568
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h1", { className: "text-[var(--color-sidebar-text)] font-bold text-lg", children:
|
|
569
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "text-[var(--color-sidebar-text-secondary)] text-xs", children:
|
|
571
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h1", { className: "text-[var(--color-sidebar-text)] font-bold text-lg", children: module_name }),
|
|
572
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "text-[var(--color-sidebar-text-secondary)] text-xs", children: module_description })
|
|
570
573
|
] })
|
|
571
574
|
] }),
|
|
572
575
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -1266,6 +1269,13 @@ var AuthServices = {
|
|
|
1266
1269
|
// src/contexts/SessionContext.tsx
|
|
1267
1270
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1268
1271
|
var SessionContext = (0, import_react5.createContext)(void 0);
|
|
1272
|
+
var useSession = () => {
|
|
1273
|
+
const context = (0, import_react5.useContext)(SessionContext);
|
|
1274
|
+
if (!context) {
|
|
1275
|
+
throw new Error("useSession must be used within a SessionProvider");
|
|
1276
|
+
}
|
|
1277
|
+
return context;
|
|
1278
|
+
};
|
|
1269
1279
|
var SessionProvider = ({ children }) => {
|
|
1270
1280
|
const [token, setToken] = (0, import_react5.useState)(localStorage.getItem("token"));
|
|
1271
1281
|
const [loggedUser, setLoggedUser] = (0, import_react5.useState)(null);
|
|
@@ -1305,13 +1315,93 @@ var SessionProvider = ({ children }) => {
|
|
|
1305
1315
|
logout
|
|
1306
1316
|
}, children });
|
|
1307
1317
|
};
|
|
1318
|
+
|
|
1319
|
+
// src/components/common/Pages.tsx
|
|
1320
|
+
var import_lucide_react3 = require("lucide-react");
|
|
1321
|
+
var import_react6 = require("react");
|
|
1322
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1323
|
+
var Pages = ({
|
|
1324
|
+
title = "",
|
|
1325
|
+
description = "",
|
|
1326
|
+
sideAction,
|
|
1327
|
+
sidebar,
|
|
1328
|
+
tabs = [],
|
|
1329
|
+
children
|
|
1330
|
+
}) => {
|
|
1331
|
+
const [sidebarOpen, setSidebarOpen] = (0, import_react6.useState)(false);
|
|
1332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex h-full bg-gray-50", children: [
|
|
1333
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex-1 flex flex-col", children: [
|
|
1334
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "bg-white border-b border-gray-200 p-6", children: [
|
|
1335
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
1336
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex items-center space-x-4", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
1337
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h1", { className: "text-2xl font-bold text-gray-900", children: title }),
|
|
1338
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-sm text-gray-600", children: description })
|
|
1339
|
+
] }) }),
|
|
1340
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex items-center space-x-3", children: sideAction })
|
|
1341
|
+
] }),
|
|
1342
|
+
tabs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex space-x-1 mt-4 overflow-x-auto", children: tabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1343
|
+
"button",
|
|
1344
|
+
{
|
|
1345
|
+
className: `px-4 py-2 text-sm rounded-lg transition-all whitespace-nowrap ${tab.id === "manual" ? "bg-[#6A8A82] text-white shadow-md" : "text-gray-600 hover:bg-gray-100"}`,
|
|
1346
|
+
children: tab.label
|
|
1347
|
+
},
|
|
1348
|
+
tab.id
|
|
1349
|
+
)) })
|
|
1350
|
+
] }),
|
|
1351
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex-1 p-6 space-y-6", children })
|
|
1352
|
+
] }),
|
|
1353
|
+
sidebar && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `${sidebarOpen ? "w-80" : "w-16"} bg-[var(--color-surface)] border-r border-[var(--color-border)] transition-all duration-300 flex flex-col`, children: [
|
|
1354
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "p-4 ", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
1355
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { className: `font-semibold text-[var(--color-text-primary)] ${!sidebarOpen && "hidden"}`, children: "Classes SYSCOHADA" }),
|
|
1356
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1357
|
+
"button",
|
|
1358
|
+
{
|
|
1359
|
+
onClick: () => setSidebarOpen(!sidebarOpen),
|
|
1360
|
+
className: "p-2 hover:bg-[var(--color-surface-hover)] rounded-lg transition-colors",
|
|
1361
|
+
"aria-label": sidebarOpen ? "R\xE9duire" : "Ouvrir",
|
|
1362
|
+
children: sidebarOpen ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.ChevronLeft, { className: "w-5 h-5" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.Menu, { className: "w-5 h-5" })
|
|
1363
|
+
}
|
|
1364
|
+
)
|
|
1365
|
+
] }) }),
|
|
1366
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex-1 overflow-y-auto py-2", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1367
|
+
"button",
|
|
1368
|
+
{
|
|
1369
|
+
onClick: () => {
|
|
1370
|
+
},
|
|
1371
|
+
className: `w-full flex items-center gap-3 px-4 py-3 transition-all relative group hover:bg-[var(--color-surface-hover)]`,
|
|
1372
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1373
|
+
"div",
|
|
1374
|
+
{
|
|
1375
|
+
className: `flex-shrink-0 w-10 h-10 rounded-lg flex items-center justify-center transition-colors bg-[var(--color-background)]`,
|
|
1376
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "font-bold text-lg", children: 1 })
|
|
1377
|
+
}
|
|
1378
|
+
)
|
|
1379
|
+
}
|
|
1380
|
+
) }),
|
|
1381
|
+
sidebarOpen && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "p-4 border-t border-[var(--color-border)]", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-2", children: [
|
|
1382
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { className: "w-full px-3 py-2 bg-[var(--color-background)] rounded-lg text-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-hover)] transition-colors flex items-center gap-2", children: [
|
|
1383
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.Download, { className: "w-4 h-4" }),
|
|
1384
|
+
"Exporter le plan"
|
|
1385
|
+
] }),
|
|
1386
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { className: "w-full px-3 py-2 bg-[var(--color-background)] rounded-lg text-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-hover)] transition-colors flex items-center gap-2", children: [
|
|
1387
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.Settings, { className: "w-4 h-4" }),
|
|
1388
|
+
"Configuration"
|
|
1389
|
+
] })
|
|
1390
|
+
] }) })
|
|
1391
|
+
] })
|
|
1392
|
+
] });
|
|
1393
|
+
};
|
|
1394
|
+
var Pages_default = Pages;
|
|
1308
1395
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1309
1396
|
0 && (module.exports = {
|
|
1397
|
+
Pages,
|
|
1310
1398
|
PrimaryButton,
|
|
1311
1399
|
RewiseLayout,
|
|
1312
1400
|
SecondaryButton,
|
|
1313
1401
|
SessionProvider,
|
|
1314
1402
|
ThemeProvider,
|
|
1315
1403
|
ToastContainer,
|
|
1316
|
-
ToastProvider
|
|
1404
|
+
ToastProvider,
|
|
1405
|
+
useSession,
|
|
1406
|
+
useToast
|
|
1317
1407
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -21,6 +21,7 @@ interface MenuItem {
|
|
|
21
21
|
interface PrivateLayoutProps {
|
|
22
22
|
children: React.ReactNode;
|
|
23
23
|
module_name: string;
|
|
24
|
+
module_description?: string;
|
|
24
25
|
primaryMenuItems: MenuItem[];
|
|
25
26
|
secondaryMenuItems: Record<string, MenuItem[]>;
|
|
26
27
|
}
|
|
@@ -28,6 +29,36 @@ declare const RewiseLayout: React.FC<PrivateLayoutProps>;
|
|
|
28
29
|
|
|
29
30
|
declare const ToastContainer: React.FC;
|
|
30
31
|
|
|
32
|
+
interface User {
|
|
33
|
+
id: number;
|
|
34
|
+
last_login: string | null;
|
|
35
|
+
is_superuser: boolean;
|
|
36
|
+
username: string;
|
|
37
|
+
first_name: string;
|
|
38
|
+
last_name: string;
|
|
39
|
+
email: string;
|
|
40
|
+
is_staff: boolean;
|
|
41
|
+
is_active: boolean;
|
|
42
|
+
date_joined: string;
|
|
43
|
+
is_deleted: boolean;
|
|
44
|
+
deleted_at: string | null;
|
|
45
|
+
phonenumber: string | null;
|
|
46
|
+
groups: any[];
|
|
47
|
+
user_permissions: any[];
|
|
48
|
+
centers_access?: Array<{
|
|
49
|
+
id: number;
|
|
50
|
+
permissions?: number[];
|
|
51
|
+
}>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface SessionContextType {
|
|
55
|
+
isAuthenticated: boolean;
|
|
56
|
+
token: string | null;
|
|
57
|
+
loggedUser: User | null;
|
|
58
|
+
login: (token: string) => void;
|
|
59
|
+
logout: () => void;
|
|
60
|
+
}
|
|
61
|
+
declare const useSession: () => SessionContextType;
|
|
31
62
|
declare const SessionProvider: ({ children }: {
|
|
32
63
|
children: ReactNode;
|
|
33
64
|
}) => react_jsx_runtime.JSX.Element;
|
|
@@ -37,9 +68,41 @@ interface ThemeProviderProps {
|
|
|
37
68
|
}
|
|
38
69
|
declare const ThemeProvider: React.FC<ThemeProviderProps>;
|
|
39
70
|
|
|
71
|
+
interface Toast {
|
|
72
|
+
id: string;
|
|
73
|
+
message: string;
|
|
74
|
+
type: 'success' | 'error' | 'warning' | 'info';
|
|
75
|
+
duration?: number;
|
|
76
|
+
}
|
|
77
|
+
interface ToastContextType {
|
|
78
|
+
toasts: Toast[];
|
|
79
|
+
addToast: (toast: Omit<Toast, 'id'>) => void;
|
|
80
|
+
removeToast: (id: string) => void;
|
|
81
|
+
success: (message: string, duration?: number) => void;
|
|
82
|
+
error: (message: string, duration?: number) => void;
|
|
83
|
+
warning: (message: string, duration?: number) => void;
|
|
84
|
+
info: (message: string, duration?: number) => void;
|
|
85
|
+
}
|
|
86
|
+
declare const useToast: () => ToastContextType;
|
|
40
87
|
interface ToastProviderProps {
|
|
41
88
|
children: ReactNode;
|
|
42
89
|
}
|
|
43
90
|
declare const ToastProvider: React.FC<ToastProviderProps>;
|
|
44
91
|
|
|
45
|
-
|
|
92
|
+
interface PagesProps {
|
|
93
|
+
title?: string;
|
|
94
|
+
description?: string;
|
|
95
|
+
sideAction?: React.ReactNode;
|
|
96
|
+
sidebar?: React.ReactNode;
|
|
97
|
+
tabs?: Array<{
|
|
98
|
+
id: string;
|
|
99
|
+
label: string;
|
|
100
|
+
icon: React.ComponentType<{
|
|
101
|
+
className?: string;
|
|
102
|
+
}>;
|
|
103
|
+
}>;
|
|
104
|
+
children?: React.ReactNode;
|
|
105
|
+
}
|
|
106
|
+
declare const Pages: React.FC<PagesProps>;
|
|
107
|
+
|
|
108
|
+
export { type MenuItem, Pages, PrimaryButton, RewiseLayout, SecondaryButton, SessionProvider, ThemeProvider, ToastContainer, ToastProvider, useSession, useToast };
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ interface MenuItem {
|
|
|
21
21
|
interface PrivateLayoutProps {
|
|
22
22
|
children: React.ReactNode;
|
|
23
23
|
module_name: string;
|
|
24
|
+
module_description?: string;
|
|
24
25
|
primaryMenuItems: MenuItem[];
|
|
25
26
|
secondaryMenuItems: Record<string, MenuItem[]>;
|
|
26
27
|
}
|
|
@@ -28,6 +29,36 @@ declare const RewiseLayout: React.FC<PrivateLayoutProps>;
|
|
|
28
29
|
|
|
29
30
|
declare const ToastContainer: React.FC;
|
|
30
31
|
|
|
32
|
+
interface User {
|
|
33
|
+
id: number;
|
|
34
|
+
last_login: string | null;
|
|
35
|
+
is_superuser: boolean;
|
|
36
|
+
username: string;
|
|
37
|
+
first_name: string;
|
|
38
|
+
last_name: string;
|
|
39
|
+
email: string;
|
|
40
|
+
is_staff: boolean;
|
|
41
|
+
is_active: boolean;
|
|
42
|
+
date_joined: string;
|
|
43
|
+
is_deleted: boolean;
|
|
44
|
+
deleted_at: string | null;
|
|
45
|
+
phonenumber: string | null;
|
|
46
|
+
groups: any[];
|
|
47
|
+
user_permissions: any[];
|
|
48
|
+
centers_access?: Array<{
|
|
49
|
+
id: number;
|
|
50
|
+
permissions?: number[];
|
|
51
|
+
}>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface SessionContextType {
|
|
55
|
+
isAuthenticated: boolean;
|
|
56
|
+
token: string | null;
|
|
57
|
+
loggedUser: User | null;
|
|
58
|
+
login: (token: string) => void;
|
|
59
|
+
logout: () => void;
|
|
60
|
+
}
|
|
61
|
+
declare const useSession: () => SessionContextType;
|
|
31
62
|
declare const SessionProvider: ({ children }: {
|
|
32
63
|
children: ReactNode;
|
|
33
64
|
}) => react_jsx_runtime.JSX.Element;
|
|
@@ -37,9 +68,41 @@ interface ThemeProviderProps {
|
|
|
37
68
|
}
|
|
38
69
|
declare const ThemeProvider: React.FC<ThemeProviderProps>;
|
|
39
70
|
|
|
71
|
+
interface Toast {
|
|
72
|
+
id: string;
|
|
73
|
+
message: string;
|
|
74
|
+
type: 'success' | 'error' | 'warning' | 'info';
|
|
75
|
+
duration?: number;
|
|
76
|
+
}
|
|
77
|
+
interface ToastContextType {
|
|
78
|
+
toasts: Toast[];
|
|
79
|
+
addToast: (toast: Omit<Toast, 'id'>) => void;
|
|
80
|
+
removeToast: (id: string) => void;
|
|
81
|
+
success: (message: string, duration?: number) => void;
|
|
82
|
+
error: (message: string, duration?: number) => void;
|
|
83
|
+
warning: (message: string, duration?: number) => void;
|
|
84
|
+
info: (message: string, duration?: number) => void;
|
|
85
|
+
}
|
|
86
|
+
declare const useToast: () => ToastContextType;
|
|
40
87
|
interface ToastProviderProps {
|
|
41
88
|
children: ReactNode;
|
|
42
89
|
}
|
|
43
90
|
declare const ToastProvider: React.FC<ToastProviderProps>;
|
|
44
91
|
|
|
45
|
-
|
|
92
|
+
interface PagesProps {
|
|
93
|
+
title?: string;
|
|
94
|
+
description?: string;
|
|
95
|
+
sideAction?: React.ReactNode;
|
|
96
|
+
sidebar?: React.ReactNode;
|
|
97
|
+
tabs?: Array<{
|
|
98
|
+
id: string;
|
|
99
|
+
label: string;
|
|
100
|
+
icon: React.ComponentType<{
|
|
101
|
+
className?: string;
|
|
102
|
+
}>;
|
|
103
|
+
}>;
|
|
104
|
+
children?: React.ReactNode;
|
|
105
|
+
}
|
|
106
|
+
declare const Pages: React.FC<PagesProps>;
|
|
107
|
+
|
|
108
|
+
export { type MenuItem, Pages, PrimaryButton, RewiseLayout, SecondaryButton, SessionProvider, ThemeProvider, ToastContainer, ToastProvider, useSession, useToast };
|
package/dist/index.js
CHANGED
|
@@ -426,7 +426,7 @@ var ThemeContext_default = ThemeProvider;
|
|
|
426
426
|
|
|
427
427
|
// src/components/layout/ModernDoubleSidebarLayout.tsx
|
|
428
428
|
import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
429
|
-
var RewiseLayout = ({ children, module_name = "Rewise", primaryMenuItems, secondaryMenuItems }) => {
|
|
429
|
+
var RewiseLayout = ({ children, module_name = "Rewise", module_description = "Description du module", primaryMenuItems, secondaryMenuItems }) => {
|
|
430
430
|
const location = useLocation();
|
|
431
431
|
const navigate = useNavigate();
|
|
432
432
|
const { theme, themeType, setTheme } = useTheme();
|
|
@@ -537,8 +537,8 @@ var RewiseLayout = ({ children, module_name = "Rewise", primaryMenuItems, second
|
|
|
537
537
|
), children: [
|
|
538
538
|
/* @__PURE__ */ jsx3("div", { className: "w-10 h-10 bg-[var(--color-primary)] rounded-lg flex items-center justify-center", children: /* @__PURE__ */ jsx3("span", { className: "text-[var(--color-background)] font-bold text-xl", children: "W" }) }),
|
|
539
539
|
!primaryCollapsed && /* @__PURE__ */ jsxs("div", { children: [
|
|
540
|
-
/* @__PURE__ */ jsx3("h1", { className: "text-[var(--color-sidebar-text)] font-bold text-lg", children:
|
|
541
|
-
/* @__PURE__ */ jsx3("p", { className: "text-[var(--color-sidebar-text-secondary)] text-xs", children:
|
|
540
|
+
/* @__PURE__ */ jsx3("h1", { className: "text-[var(--color-sidebar-text)] font-bold text-lg", children: module_name }),
|
|
541
|
+
/* @__PURE__ */ jsx3("p", { className: "text-[var(--color-sidebar-text-secondary)] text-xs", children: module_description })
|
|
542
542
|
] })
|
|
543
543
|
] }),
|
|
544
544
|
/* @__PURE__ */ jsx3(
|
|
@@ -1238,6 +1238,13 @@ var AuthServices = {
|
|
|
1238
1238
|
// src/contexts/SessionContext.tsx
|
|
1239
1239
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1240
1240
|
var SessionContext = createContext3(void 0);
|
|
1241
|
+
var useSession = () => {
|
|
1242
|
+
const context = useContext3(SessionContext);
|
|
1243
|
+
if (!context) {
|
|
1244
|
+
throw new Error("useSession must be used within a SessionProvider");
|
|
1245
|
+
}
|
|
1246
|
+
return context;
|
|
1247
|
+
};
|
|
1241
1248
|
var SessionProvider = ({ children }) => {
|
|
1242
1249
|
const [token, setToken] = useState5(localStorage.getItem("token"));
|
|
1243
1250
|
const [loggedUser, setLoggedUser] = useState5(null);
|
|
@@ -1277,12 +1284,92 @@ var SessionProvider = ({ children }) => {
|
|
|
1277
1284
|
logout
|
|
1278
1285
|
}, children });
|
|
1279
1286
|
};
|
|
1287
|
+
|
|
1288
|
+
// src/components/common/Pages.tsx
|
|
1289
|
+
import { ChevronLeft as ChevronLeft2, Download, Menu as Menu2, Settings as Settings2 } from "lucide-react";
|
|
1290
|
+
import { useState as useState6 } from "react";
|
|
1291
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1292
|
+
var Pages = ({
|
|
1293
|
+
title = "",
|
|
1294
|
+
description = "",
|
|
1295
|
+
sideAction,
|
|
1296
|
+
sidebar,
|
|
1297
|
+
tabs = [],
|
|
1298
|
+
children
|
|
1299
|
+
}) => {
|
|
1300
|
+
const [sidebarOpen, setSidebarOpen] = useState6(false);
|
|
1301
|
+
return /* @__PURE__ */ jsxs3("div", { className: "flex h-full bg-gray-50", children: [
|
|
1302
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex-1 flex flex-col", children: [
|
|
1303
|
+
/* @__PURE__ */ jsxs3("div", { className: "bg-white border-b border-gray-200 p-6", children: [
|
|
1304
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between", children: [
|
|
1305
|
+
/* @__PURE__ */ jsx7("div", { className: "flex items-center space-x-4", children: /* @__PURE__ */ jsxs3("div", { children: [
|
|
1306
|
+
/* @__PURE__ */ jsx7("h1", { className: "text-2xl font-bold text-gray-900", children: title }),
|
|
1307
|
+
/* @__PURE__ */ jsx7("p", { className: "text-sm text-gray-600", children: description })
|
|
1308
|
+
] }) }),
|
|
1309
|
+
/* @__PURE__ */ jsx7("div", { className: "flex items-center space-x-3", children: sideAction })
|
|
1310
|
+
] }),
|
|
1311
|
+
tabs.length > 0 && /* @__PURE__ */ jsx7("div", { className: "flex space-x-1 mt-4 overflow-x-auto", children: tabs.map((tab) => /* @__PURE__ */ jsx7(
|
|
1312
|
+
"button",
|
|
1313
|
+
{
|
|
1314
|
+
className: `px-4 py-2 text-sm rounded-lg transition-all whitespace-nowrap ${tab.id === "manual" ? "bg-[#6A8A82] text-white shadow-md" : "text-gray-600 hover:bg-gray-100"}`,
|
|
1315
|
+
children: tab.label
|
|
1316
|
+
},
|
|
1317
|
+
tab.id
|
|
1318
|
+
)) })
|
|
1319
|
+
] }),
|
|
1320
|
+
/* @__PURE__ */ jsx7("div", { className: "flex-1 p-6 space-y-6", children })
|
|
1321
|
+
] }),
|
|
1322
|
+
sidebar && /* @__PURE__ */ jsxs3("div", { className: `${sidebarOpen ? "w-80" : "w-16"} bg-[var(--color-surface)] border-r border-[var(--color-border)] transition-all duration-300 flex flex-col`, children: [
|
|
1323
|
+
/* @__PURE__ */ jsx7("div", { className: "p-4 ", children: /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between", children: [
|
|
1324
|
+
/* @__PURE__ */ jsx7("h2", { className: `font-semibold text-[var(--color-text-primary)] ${!sidebarOpen && "hidden"}`, children: "Classes SYSCOHADA" }),
|
|
1325
|
+
/* @__PURE__ */ jsx7(
|
|
1326
|
+
"button",
|
|
1327
|
+
{
|
|
1328
|
+
onClick: () => setSidebarOpen(!sidebarOpen),
|
|
1329
|
+
className: "p-2 hover:bg-[var(--color-surface-hover)] rounded-lg transition-colors",
|
|
1330
|
+
"aria-label": sidebarOpen ? "R\xE9duire" : "Ouvrir",
|
|
1331
|
+
children: sidebarOpen ? /* @__PURE__ */ jsx7(ChevronLeft2, { className: "w-5 h-5" }) : /* @__PURE__ */ jsx7(Menu2, { className: "w-5 h-5" })
|
|
1332
|
+
}
|
|
1333
|
+
)
|
|
1334
|
+
] }) }),
|
|
1335
|
+
/* @__PURE__ */ jsx7("div", { className: "flex-1 overflow-y-auto py-2", children: /* @__PURE__ */ jsx7(
|
|
1336
|
+
"button",
|
|
1337
|
+
{
|
|
1338
|
+
onClick: () => {
|
|
1339
|
+
},
|
|
1340
|
+
className: `w-full flex items-center gap-3 px-4 py-3 transition-all relative group hover:bg-[var(--color-surface-hover)]`,
|
|
1341
|
+
children: /* @__PURE__ */ jsx7(
|
|
1342
|
+
"div",
|
|
1343
|
+
{
|
|
1344
|
+
className: `flex-shrink-0 w-10 h-10 rounded-lg flex items-center justify-center transition-colors bg-[var(--color-background)]`,
|
|
1345
|
+
children: /* @__PURE__ */ jsx7("span", { className: "font-bold text-lg", children: 1 })
|
|
1346
|
+
}
|
|
1347
|
+
)
|
|
1348
|
+
}
|
|
1349
|
+
) }),
|
|
1350
|
+
sidebarOpen && /* @__PURE__ */ jsx7("div", { className: "p-4 border-t border-[var(--color-border)]", children: /* @__PURE__ */ jsxs3("div", { className: "space-y-2", children: [
|
|
1351
|
+
/* @__PURE__ */ jsxs3("button", { className: "w-full px-3 py-2 bg-[var(--color-background)] rounded-lg text-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-hover)] transition-colors flex items-center gap-2", children: [
|
|
1352
|
+
/* @__PURE__ */ jsx7(Download, { className: "w-4 h-4" }),
|
|
1353
|
+
"Exporter le plan"
|
|
1354
|
+
] }),
|
|
1355
|
+
/* @__PURE__ */ jsxs3("button", { className: "w-full px-3 py-2 bg-[var(--color-background)] rounded-lg text-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-hover)] transition-colors flex items-center gap-2", children: [
|
|
1356
|
+
/* @__PURE__ */ jsx7(Settings2, { className: "w-4 h-4" }),
|
|
1357
|
+
"Configuration"
|
|
1358
|
+
] })
|
|
1359
|
+
] }) })
|
|
1360
|
+
] })
|
|
1361
|
+
] });
|
|
1362
|
+
};
|
|
1363
|
+
var Pages_default = Pages;
|
|
1280
1364
|
export {
|
|
1365
|
+
Pages_default as Pages,
|
|
1281
1366
|
Buttons_default as PrimaryButton,
|
|
1282
1367
|
ModernDoubleSidebarLayout_default as RewiseLayout,
|
|
1283
1368
|
SecondaryButton,
|
|
1284
1369
|
SessionProvider,
|
|
1285
1370
|
ThemeContext_default as ThemeProvider,
|
|
1286
1371
|
Toast_default as ToastContainer,
|
|
1287
|
-
ToastProvider
|
|
1372
|
+
ToastProvider,
|
|
1373
|
+
useSession,
|
|
1374
|
+
useToast
|
|
1288
1375
|
};
|