mui-toolpad-extended-tuni 1.0.2 → 2.0.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.
Files changed (54) hide show
  1. package/README.md +400 -8
  2. package/dist/LMSToolpad/EduMLProvider.d.ts +21 -0
  3. package/dist/LMSToolpad/components/Courses/CourseLoader.d.ts +7 -0
  4. package/dist/LMSToolpad/components/MicroserviceRoutes.d.ts +19 -0
  5. package/dist/index.cjs +81 -81
  6. package/dist/index.d.ts +30 -24
  7. package/dist/index.es.js +4168 -4036
  8. package/package.json +1 -1
  9. /package/dist/{EduMLToolpad/EduMLProvider.d.ts → LMSToolpad/LMSProvider.d.ts} +0 -0
  10. /package/dist/{EduMLToolpad → LMSToolpad}/components/Courses/CourseItem.d.ts +0 -0
  11. /package/dist/{EduMLToolpad → LMSToolpad}/components/Courses/CourseList.d.ts +0 -0
  12. /package/dist/{EduMLToolpad → LMSToolpad}/components/Courses/CourseSelector.d.ts +0 -0
  13. /package/dist/{EduMLToolpad → LMSToolpad}/components/Courses/CourseTools.d.ts +0 -0
  14. /package/dist/{EduMLToolpad → LMSToolpad}/components/Courses/LtiLoginUrlForm.d.ts +0 -0
  15. /package/dist/{EduMLToolpad → LMSToolpad}/components/Courses/NoCoursesMessage.d.ts +0 -0
  16. /package/dist/{EduMLToolpad → LMSToolpad}/components/DevelopmentTools.d.ts +0 -0
  17. /package/dist/{EduMLToolpad → LMSToolpad}/components/Dialogs/DialogOpener.d.ts +0 -0
  18. /package/dist/{EduMLToolpad → LMSToolpad}/components/Dialogs/FormDialog.d.ts +0 -0
  19. /package/dist/{EduMLToolpad → LMSToolpad}/components/EduMLDialog.d.ts +0 -0
  20. /package/dist/{EduMLToolpad → LMSToolpad}/components/Home.d.ts +0 -0
  21. /package/dist/{EduMLToolpad → LMSToolpad}/components/IconWithBadge.d.ts +0 -0
  22. /package/dist/{EduMLToolpad → LMSToolpad}/components/LoadingScreen.d.ts +0 -0
  23. /package/dist/{EduMLToolpad → LMSToolpad}/components/Logo.d.ts +0 -0
  24. /package/dist/{EduMLToolpad → LMSToolpad}/components/Notifications.d.ts +0 -0
  25. /package/dist/{EduMLToolpad → LMSToolpad}/components/PageToolBar.d.ts +0 -0
  26. /package/dist/{EduMLToolpad → LMSToolpad}/components/ToolSelector.d.ts +0 -0
  27. /package/dist/{EduMLToolpad → LMSToolpad}/components/UserSwitcher.d.ts +0 -0
  28. /package/dist/{EduMLToolpad → LMSToolpad}/components/sidebar/Footer.d.ts +0 -0
  29. /package/dist/{EduMLToolpad → LMSToolpad}/components/toolbar/Account.d.ts +0 -0
  30. /package/dist/{EduMLToolpad → LMSToolpad}/components/toolbar/Actions.d.ts +0 -0
  31. /package/dist/{EduMLToolpad → LMSToolpad}/components/tools/addActions.d.ts +0 -0
  32. /package/dist/{EduMLToolpad → LMSToolpad}/components/tools/addIcons.d.ts +0 -0
  33. /package/dist/{EduMLToolpad → LMSToolpad}/components/tools/iconsByType.d.ts +0 -0
  34. /package/dist/{EduMLToolpad → LMSToolpad}/components/tools/utils/ActionFCWrapper.d.ts +0 -0
  35. /package/dist/{EduMLToolpad → LMSToolpad}/components/tools/utils/IconFCWrapper.d.ts +0 -0
  36. /package/dist/{EduMLToolpad → LMSToolpad}/constants.d.ts +0 -0
  37. /package/dist/{EduMLToolpad → LMSToolpad}/hooks/useCustomRouter.d.ts +0 -0
  38. /package/dist/{EduMLToolpad → LMSToolpad}/interfaces.d.ts +0 -0
  39. /package/dist/{EduMLToolpad → LMSToolpad}/layout/breadcrumbs/SizableContentHeader.d.ts +0 -0
  40. /package/dist/{EduMLToolpad → LMSToolpad}/network/axiosConfig.d.ts +0 -0
  41. /package/dist/{EduMLToolpad → LMSToolpad}/network/courses.d.ts +0 -0
  42. /package/dist/{EduMLToolpad → LMSToolpad}/network/users.d.ts +0 -0
  43. /package/dist/{EduMLToolpad → LMSToolpad}/store/useCourseStore.d.ts +0 -0
  44. /package/dist/{EduMLToolpad → LMSToolpad}/store/useDialogStore.d.ts +0 -0
  45. /package/dist/{EduMLToolpad → LMSToolpad}/store/useNavigationStore.d.ts +0 -0
  46. /package/dist/{EduMLToolpad → LMSToolpad}/store/useNotificationsStore.d.ts +0 -0
  47. /package/dist/{EduMLToolpad → LMSToolpad}/store/useUserStore.d.ts +0 -0
  48. /package/dist/{EduMLToolpad → LMSToolpad}/theme/EduMLTheme.d.ts +0 -0
  49. /package/dist/{EduMLToolpad → LMSToolpad}/tools/ErrorBoundary.d.ts +0 -0
  50. /package/dist/{EduMLToolpad → LMSToolpad}/tools/NullStateWarning.d.ts +0 -0
  51. /package/dist/{EduMLToolpad → LMSToolpad}/types/toolpad.d.ts +0 -0
  52. /package/dist/{EduMLToolpad → LMSToolpad}/types/vite-env.d.ts +0 -0
  53. /package/dist/{EduMLToolpad → LMSToolpad}/utils/caseConverter.d.ts +0 -0
  54. /package/dist/{EduMLToolpad → LMSToolpad}/utils/slugify.d.ts +0 -0
package/README.md CHANGED
@@ -1,20 +1,412 @@
1
1
  <!-- @format -->
2
2
 
3
- # MUI Toolpad extended Library (TUNI)
3
+ # MUI Toolpad Extended Library (TUNI)
4
4
 
5
- This project is an extended version of MUI Toolpad, originally developed by MUI. It includes modifications and additional features to enhance functionality.
5
+ A React library extending MUI Toolpad functionality with additional features for educational applications. This library provides components and tools for building interactive educational interfaces.
6
6
 
7
- ## Installation
7
+ ## Breaking Changes in v2.0.0
8
+
9
+ 1. Renamed `EduMLProvider` to `LMSProvider` (EduMLProvider is now deprecated)
10
+ 2. All routing components must now be imported from this package
11
+ 3. State management is now centralized through the package
12
+
13
+ ## Prerequisites
14
+
15
+ This library requires the following peer dependencies:
8
16
 
9
- Install with:
17
+ - React ≥18.0.0
18
+ - React DOM ≥18.0.0
19
+ - @mui/material ≥6.0.0
20
+ - @mui/icons-material ≥6.0.0
21
+ - @emotion/react ≥11.0.0
22
+ - @emotion/styled ≥11.0.0
23
+
24
+ ## Installation
10
25
 
11
26
  ```bash
12
- npm install @jalez/mui-toolpad-extended-tuni'
27
+ npm install mui-toolpad-extended-tuni
28
+ ```
29
+
30
+ ## Basic Usage
31
+
32
+ 1. Setup your application with `LMSProvider` and routing:
33
+
34
+ ```tsx
35
+ import { BrowserRouter } from 'react-router-dom';
36
+ import { LMSProvider } from 'mui-toolpad-extended-tuni';
37
+
38
+ function App() {
39
+ return (
40
+ <BrowserRouter>
41
+ <LMSProvider>{/* Your application content */}</LMSProvider>
42
+ </BrowserRouter>
43
+ );
44
+ }
45
+ ```
46
+
47
+ 2. Use the included stores and components:
48
+
49
+ ```tsx
50
+ import {
51
+ useUserStore,
52
+ useCourseStore,
53
+ useNavigationStore,
54
+ } from 'mui-toolpad-extended-tuni';
55
+
56
+ function MyComponent() {
57
+ const { user } = useUserStore();
58
+ const { currentCourse } = useCourseStore();
59
+
60
+ return (
61
+ <div>
62
+ <h1>Welcome, {user?.name}!</h1>
63
+ <p>Current course: {currentCourse?.title}</p>
64
+ </div>
65
+ );
66
+ }
67
+ ```
68
+
69
+ ## Core Components
70
+
71
+ ### LMSProvider
72
+
73
+ The main provider component that sets up the application context:
74
+
75
+ ```tsx
76
+ import { LMSProvider, BrowserRouter } from 'mui-toolpad-extended-tuni';
77
+
78
+ function App() {
79
+ return (
80
+ <BrowserRouter>
81
+ <LMSProvider>
82
+ <YourComponents />
83
+ </LMSProvider>
84
+ </BrowserRouter>
85
+ );
86
+ }
87
+ ```
88
+
89
+ ### LoadingScreen
90
+
91
+ A customizable loading indicator with animations:
92
+
93
+ ```tsx
94
+ import { LoadingScreen } from 'mui-toolpad-extended-tuni';
95
+
96
+ function MyComponent() {
97
+ return isLoading ? <LoadingScreen /> : <YourContent />;
98
+ }
99
+ ```
100
+
101
+ ### Notifications
102
+
103
+ Built-in notification system using notistack:
104
+
105
+ ```tsx
106
+ import { useNotificationStore } from 'mui-toolpad-extended-tuni';
107
+
108
+ function MyComponent() {
109
+ const { addNotificationData } = useNotificationStore();
110
+
111
+ const showNotification = () => {
112
+ addNotificationData({
113
+ type: 'success',
114
+ message: 'Operation completed successfully',
115
+ singular: true, // Optional: show only once
116
+ });
117
+ };
118
+ }
119
+ ```
120
+
121
+ ### ExtendedDialog
122
+
123
+ A responsive dialog component:
124
+
125
+ ```tsx
126
+ import { ExtendedDialog } from 'mui-toolpad-extended-tuni';
127
+
128
+ function MyComponent() {
129
+ const [open, setOpen] = useState(false);
130
+
131
+ return (
132
+ <ExtendedDialog open={open} onClose={() => setOpen(false)}>
133
+ <DialogContent>Your content here</DialogContent>
134
+ </ExtendedDialog>
135
+ );
136
+ }
137
+ ```
138
+
139
+ ### Course Management Components
140
+
141
+ #### CourseSelector
142
+
143
+ A component for listing and selecting courses:
144
+
145
+ ```tsx
146
+ import { CourseSelector } from 'mui-toolpad-extended-tuni';
147
+
148
+ function MyComponent() {
149
+ return <CourseSelector />;
150
+ }
151
+ ```
152
+
153
+ #### CourseTools
154
+
155
+ Manages course-specific tools and LTI configuration:
156
+
157
+ ```tsx
158
+ import { CourseTools } from 'mui-toolpad-extended-tuni';
159
+
160
+ function MyComponent() {
161
+ return <CourseTools />;
162
+ }
163
+ ```
164
+
165
+ #### LTI Login Configuration
166
+
167
+ For teachers to set up course authentication:
168
+
169
+ ```tsx
170
+ import { LtiLoginUrlForm } from 'mui-toolpad-extended-tuni';
171
+
172
+ function MyComponent() {
173
+ return <LtiLoginUrlForm />;
174
+ }
175
+ ```
176
+
177
+ ### Error Handling Components
178
+
179
+ #### ErrorBoundary
180
+
181
+ Catches and handles React component errors:
182
+
183
+ ```tsx
184
+ import { ErrorBoundary } from 'mui-toolpad-extended-tuni';
185
+
186
+ function App() {
187
+ return (
188
+ <ErrorBoundary>
189
+ <YourComponents />
190
+ </ErrorBoundary>
191
+ );
192
+ }
193
+ ```
194
+
195
+ #### NullStateWarning
196
+
197
+ Detects and displays warnings for null states:
198
+
199
+ ```tsx
200
+ import { NullStateWarning } from 'mui-toolpad-extended-tuni';
201
+
202
+ function MyComponent() {
203
+ const states = [{ user: currentUser }, { course: currentCourse }];
204
+
205
+ return (
206
+ <NullStateWarning states={states}>
207
+ <YourContent />
208
+ </NullStateWarning>
209
+ );
210
+ }
211
+ ```
212
+
213
+ ## Development Tools
214
+
215
+ When running in development mode (localhost), the library provides additional tools:
216
+
217
+ - User Switcher: Easily switch between different user roles (student/teacher/guest)
218
+ - Development Toolbar: Additional debugging and testing features
219
+
220
+ ## Features
221
+
222
+ - User authentication and management
223
+ - Course handling and navigation
224
+ - Notification system
225
+ - Custom dialog management
226
+ - Role-based navigation filtering
227
+ - LTI integration support
228
+ - Customizable theme
229
+
230
+ ## Available Stores
231
+
232
+ ### useUserStore
233
+
234
+ ```tsx
235
+ const {
236
+ user, // Current user data
237
+ getUser, // Fetch user data
238
+ changeRole, // Switch user role
239
+ logout, // Logout current user
240
+ } = useUserStore();
241
+ ```
242
+
243
+ ### useCourseStore
244
+
245
+ ```tsx
246
+ const {
247
+ currentCourse, // Current active course
248
+ courses, // List of available courses
249
+ getCourses, // Fetch all courses
250
+ getCourseByUrl, // Get course by URL
251
+ } = useCourseStore();
252
+ ```
253
+
254
+ ### useNavigationStore
255
+
256
+ ```tsx
257
+ const {
258
+ navigation, // Current navigation structure
259
+ updateSection, // Update navigation section
260
+ setNavigation, // Set entire navigation
261
+ } = useNavigationStore();
262
+ ```
263
+
264
+ ### useNotificationStore
265
+
266
+ ```tsx
267
+ const {
268
+ addNotificationData, // Add new notification
269
+ removeNotificationData, // Remove notification
270
+ } = useNotificationStore();
271
+ ```
272
+
273
+ ## Utility Functions
274
+
275
+ ### String Manipulation
276
+
277
+ ```tsx
278
+ import {
279
+ slugify,
280
+ camelCaseToUnderscore,
281
+ underscoreToCamelCase,
282
+ } from 'mui-toolpad-extended-tuni';
283
+
284
+ // Convert strings to URL-friendly format
285
+ const slug = slugify('My Course Title'); // 'my-course-title'
286
+
287
+ // Convert between case styles
288
+ const underscore = camelCaseToUnderscore('myVariable'); // 'my_variable'
289
+ const camelCase = underscoreToCamelCase('my_variable'); // 'myVariable'
290
+ ```
291
+
292
+ ### Object Key Conversion
293
+
294
+ ```tsx
295
+ import {
296
+ convertObjectKeysToCamelCase,
297
+ convertObjectKeysToUnderscore,
298
+ } from 'mui-toolpad-extended-tuni';
299
+
300
+ // Convert API responses
301
+ const camelCaseData = convertObjectKeysToCamelCase(apiResponse);
302
+ const underscoreData = convertObjectKeysToUnderscore(requestData);
303
+ ```
304
+
305
+ ## Network Configuration
306
+
307
+ The library includes pre-configured Axios instance for API communications:
308
+
309
+ ```tsx
310
+ import { axiosInstance } from 'mui-toolpad-extended-tuni';
311
+
312
+ // Handles CSRF tokens and base URL automatically
313
+ const response = await axiosInstance.get('/api/endpoint');
314
+ ```
315
+
316
+ ## Course Types and Interfaces
317
+
318
+ ```tsx
319
+ interface Course {
320
+ id: string;
321
+ title: string;
322
+ description: string;
323
+ createdAt: string;
324
+ ltiLoginUrl: string;
325
+ updatedAt: string;
326
+ }
327
+
328
+ // Course creation payload
329
+ interface CourseRaw {
330
+ title: string;
331
+ description: string;
332
+ }
13
333
  ```
14
334
 
15
- Use in your React project:
335
+ ## Theme Customization
336
+
337
+ The library includes a customizable Material-UI theme:
338
+
339
+ ```tsx
340
+ import { EduMLTheme } from 'mui-toolpad-extended-tuni';
341
+
342
+ // Theme includes predefined:
343
+ // - Color schemes (light/dark)
344
+ // - Typography scales
345
+ // - Component style overrides
346
+ // - Transition effects
347
+ // - Z-index hierarchy
348
+ ```
349
+
350
+ ## Current Limitations
351
+
352
+ 1. **Authentication:**
353
+
354
+ - LTI login URL must be configured per course
355
+ - Only supports single active session
356
+ - Development mode uses mock authentication
357
+
358
+ 2. **Course Management:**
359
+
360
+ - Limited to predefined course structure
361
+ - No bulk operations support
362
+ - Course tools must follow specific navigation structure
363
+
364
+ 3. **State Management:**
365
+
366
+ - No persistence between page reloads
367
+ - Limited offline support
368
+ - State updates are synchronous
369
+
370
+ 4. **Network:**
371
+
372
+ - Base URL is fixed to '/'
373
+ - CSRF token handling is mandatory
374
+ - No request caching implementation
375
+
376
+ 5. **Browser Support:**
377
+ - Requires modern browser features
378
+ - Limited mobile responsiveness
379
+ - No IE11 support
380
+
381
+ ## Types and Interfaces
382
+
383
+ ### Common Types
16
384
 
17
385
  ```typescript
18
- import { EduMLProvider } from '@jalez/mui-toolpad-extended-tuni';
19
- // ...existing code...
386
+ type fetchState = 'idle' | 'loading' | 'error' | 'success';
387
+
388
+ interface NavigationStoreItem {
389
+ kind: 'header' | 'page';
390
+ title: string;
391
+ segment?: string;
392
+ children?: NavigationStoreItem[];
393
+ }
20
394
  ```
395
+
396
+ ## License
397
+
398
+ MIT License - See LICENSE file for details.
399
+
400
+ ## Contributing
401
+
402
+ When contributing, please note:
403
+
404
+ - All components must implement error boundaries
405
+ - State management should use Zustand stores
406
+ - Network requests must use the provided axios instance
407
+ - Theme modifications should extend EduMLTheme
408
+ - Components should handle null states appropriately
409
+
410
+ ## Support
411
+
412
+ For issues and feature requests, please use the GitHub issue tracker.
@@ -0,0 +1,21 @@
1
+ /** @format */
2
+ import { ReactNode } from 'react';
3
+ export interface EduMLProviderProps {
4
+ children?: ReactNode;
5
+ }
6
+ /**
7
+ * @deprecated Use LMSProvider instead of EduMLProvider. Will be removed in version 2.0.0
8
+ * EduMLProvider must be wrapped in a Router component from react-router-dom
9
+ * Example:
10
+ * ```tsx
11
+ * import { BrowserRouter } from 'react-router-dom';
12
+ *
13
+ * <BrowserRouter>
14
+ * <EduMLProvider>
15
+ * {children}
16
+ * </EduMLProvider>
17
+ * </BrowserRouter>
18
+ * ```
19
+ */
20
+ declare const EduMLProvider: ({ children }: EduMLProviderProps) => import("react/jsx-runtime").JSX.Element;
21
+ export default EduMLProvider;
@@ -0,0 +1,7 @@
1
+ /** @format */
2
+ /**
3
+ * @description - This component is responsible for loading the course data and rendering the course tools
4
+ * @returns {React.ReactElement} - Returns the course loader component
5
+ */
6
+ declare const CourseLoader: () => import("react/jsx-runtime").JSX.Element;
7
+ export default CourseLoader;
@@ -0,0 +1,19 @@
1
+ /** @format */
2
+ import React from 'react';
3
+ export interface MicroserviceConfig {
4
+ path: string;
5
+ Component: React.ComponentType;
6
+ fetchHooks?: Array<(courseId: string) => void>;
7
+ buildNavigation?: (courseId: string, isTeacher: boolean) => any[];
8
+ }
9
+ interface MicroserviceRoutesProps {
10
+ microservices: MicroserviceConfig[];
11
+ }
12
+ /**
13
+ * @description - This component is responsible for rendering the microservices routes, fetching data and building navigation for each microservice based on the current course and user.
14
+
15
+ * @param {MicroserviceConfig[]} props.microservices - List of microservices to render
16
+ * @returns {React.ReactElement} - Returns the microservices routes
17
+ */
18
+ declare const MicroserviceRoutes: React.FC<MicroserviceRoutesProps>;
19
+ export default MicroserviceRoutes;