mui-toolpad-extended-tuni 1.0.3 → 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.
- package/README.md +30 -25
- package/dist/LMSToolpad/EduMLProvider.d.ts +21 -0
- package/dist/LMSToolpad/components/Courses/CourseLoader.d.ts +7 -0
- package/dist/LMSToolpad/components/MicroserviceRoutes.d.ts +19 -0
- package/dist/index.cjs +81 -81
- package/dist/index.d.ts +30 -24
- package/dist/index.es.js +4168 -4036
- package/package.json +1 -1
- /package/dist/{EduMLToolpad/EduMLProvider.d.ts → LMSToolpad/LMSProvider.d.ts} +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/Courses/CourseItem.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/Courses/CourseList.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/Courses/CourseSelector.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/Courses/CourseTools.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/Courses/LtiLoginUrlForm.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/Courses/NoCoursesMessage.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/DevelopmentTools.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/Dialogs/DialogOpener.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/Dialogs/FormDialog.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/EduMLDialog.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/Home.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/IconWithBadge.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/LoadingScreen.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/Logo.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/Notifications.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/PageToolBar.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/ToolSelector.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/UserSwitcher.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/sidebar/Footer.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/toolbar/Account.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/toolbar/Actions.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/tools/addActions.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/tools/addIcons.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/tools/iconsByType.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/tools/utils/ActionFCWrapper.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/components/tools/utils/IconFCWrapper.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/constants.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/hooks/useCustomRouter.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/interfaces.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/layout/breadcrumbs/SizableContentHeader.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/network/axiosConfig.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/network/courses.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/network/users.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/store/useCourseStore.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/store/useDialogStore.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/store/useNavigationStore.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/store/useNotificationsStore.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/store/useUserStore.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/theme/EduMLTheme.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/tools/ErrorBoundary.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/tools/NullStateWarning.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/types/toolpad.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/types/vite-env.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/utils/caseConverter.d.ts +0 -0
- /package/dist/{EduMLToolpad → LMSToolpad}/utils/slugify.d.ts +0 -0
package/README.md
CHANGED
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
|
|
5
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
|
+
## 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
|
+
|
|
7
13
|
## Prerequisites
|
|
8
14
|
|
|
9
15
|
This library requires the following peer dependencies:
|
|
@@ -18,21 +24,21 @@ This library requires the following peer dependencies:
|
|
|
18
24
|
## Installation
|
|
19
25
|
|
|
20
26
|
```bash
|
|
21
|
-
npm install
|
|
27
|
+
npm install mui-toolpad-extended-tuni
|
|
22
28
|
```
|
|
23
29
|
|
|
24
30
|
## Basic Usage
|
|
25
31
|
|
|
26
|
-
1.
|
|
32
|
+
1. Setup your application with `LMSProvider` and routing:
|
|
27
33
|
|
|
28
34
|
```tsx
|
|
29
35
|
import { BrowserRouter } from 'react-router-dom';
|
|
30
|
-
import {
|
|
36
|
+
import { LMSProvider } from 'mui-toolpad-extended-tuni';
|
|
31
37
|
|
|
32
38
|
function App() {
|
|
33
39
|
return (
|
|
34
40
|
<BrowserRouter>
|
|
35
|
-
<
|
|
41
|
+
<LMSProvider>{/* Your application content */}</LMSProvider>
|
|
36
42
|
</BrowserRouter>
|
|
37
43
|
);
|
|
38
44
|
}
|
|
@@ -45,7 +51,7 @@ import {
|
|
|
45
51
|
useUserStore,
|
|
46
52
|
useCourseStore,
|
|
47
53
|
useNavigationStore,
|
|
48
|
-
} from '
|
|
54
|
+
} from 'mui-toolpad-extended-tuni';
|
|
49
55
|
|
|
50
56
|
function MyComponent() {
|
|
51
57
|
const { user } = useUserStore();
|
|
@@ -62,20 +68,19 @@ function MyComponent() {
|
|
|
62
68
|
|
|
63
69
|
## Core Components
|
|
64
70
|
|
|
65
|
-
###
|
|
71
|
+
### LMSProvider
|
|
66
72
|
|
|
67
73
|
The main provider component that sets up the application context:
|
|
68
74
|
|
|
69
75
|
```tsx
|
|
70
|
-
import { BrowserRouter } from '
|
|
71
|
-
import { EduMLProvider } from '@jalez/mui-toolpad-extended-tuni';
|
|
76
|
+
import { LMSProvider, BrowserRouter } from 'mui-toolpad-extended-tuni';
|
|
72
77
|
|
|
73
78
|
function App() {
|
|
74
79
|
return (
|
|
75
80
|
<BrowserRouter>
|
|
76
|
-
<
|
|
81
|
+
<LMSProvider>
|
|
77
82
|
<YourComponents />
|
|
78
|
-
</
|
|
83
|
+
</LMSProvider>
|
|
79
84
|
</BrowserRouter>
|
|
80
85
|
);
|
|
81
86
|
}
|
|
@@ -86,7 +91,7 @@ function App() {
|
|
|
86
91
|
A customizable loading indicator with animations:
|
|
87
92
|
|
|
88
93
|
```tsx
|
|
89
|
-
import { LoadingScreen } from '
|
|
94
|
+
import { LoadingScreen } from 'mui-toolpad-extended-tuni';
|
|
90
95
|
|
|
91
96
|
function MyComponent() {
|
|
92
97
|
return isLoading ? <LoadingScreen /> : <YourContent />;
|
|
@@ -98,7 +103,7 @@ function MyComponent() {
|
|
|
98
103
|
Built-in notification system using notistack:
|
|
99
104
|
|
|
100
105
|
```tsx
|
|
101
|
-
import { useNotificationStore } from '
|
|
106
|
+
import { useNotificationStore } from 'mui-toolpad-extended-tuni';
|
|
102
107
|
|
|
103
108
|
function MyComponent() {
|
|
104
109
|
const { addNotificationData } = useNotificationStore();
|
|
@@ -113,20 +118,20 @@ function MyComponent() {
|
|
|
113
118
|
}
|
|
114
119
|
```
|
|
115
120
|
|
|
116
|
-
###
|
|
121
|
+
### ExtendedDialog
|
|
117
122
|
|
|
118
123
|
A responsive dialog component:
|
|
119
124
|
|
|
120
125
|
```tsx
|
|
121
|
-
import {
|
|
126
|
+
import { ExtendedDialog } from 'mui-toolpad-extended-tuni';
|
|
122
127
|
|
|
123
128
|
function MyComponent() {
|
|
124
129
|
const [open, setOpen] = useState(false);
|
|
125
130
|
|
|
126
131
|
return (
|
|
127
|
-
<
|
|
132
|
+
<ExtendedDialog open={open} onClose={() => setOpen(false)}>
|
|
128
133
|
<DialogContent>Your content here</DialogContent>
|
|
129
|
-
</
|
|
134
|
+
</ExtendedDialog>
|
|
130
135
|
);
|
|
131
136
|
}
|
|
132
137
|
```
|
|
@@ -138,7 +143,7 @@ function MyComponent() {
|
|
|
138
143
|
A component for listing and selecting courses:
|
|
139
144
|
|
|
140
145
|
```tsx
|
|
141
|
-
import { CourseSelector } from '
|
|
146
|
+
import { CourseSelector } from 'mui-toolpad-extended-tuni';
|
|
142
147
|
|
|
143
148
|
function MyComponent() {
|
|
144
149
|
return <CourseSelector />;
|
|
@@ -150,7 +155,7 @@ function MyComponent() {
|
|
|
150
155
|
Manages course-specific tools and LTI configuration:
|
|
151
156
|
|
|
152
157
|
```tsx
|
|
153
|
-
import { CourseTools } from '
|
|
158
|
+
import { CourseTools } from 'mui-toolpad-extended-tuni';
|
|
154
159
|
|
|
155
160
|
function MyComponent() {
|
|
156
161
|
return <CourseTools />;
|
|
@@ -162,7 +167,7 @@ function MyComponent() {
|
|
|
162
167
|
For teachers to set up course authentication:
|
|
163
168
|
|
|
164
169
|
```tsx
|
|
165
|
-
import { LtiLoginUrlForm } from '
|
|
170
|
+
import { LtiLoginUrlForm } from 'mui-toolpad-extended-tuni';
|
|
166
171
|
|
|
167
172
|
function MyComponent() {
|
|
168
173
|
return <LtiLoginUrlForm />;
|
|
@@ -176,7 +181,7 @@ function MyComponent() {
|
|
|
176
181
|
Catches and handles React component errors:
|
|
177
182
|
|
|
178
183
|
```tsx
|
|
179
|
-
import { ErrorBoundary } from '
|
|
184
|
+
import { ErrorBoundary } from 'mui-toolpad-extended-tuni';
|
|
180
185
|
|
|
181
186
|
function App() {
|
|
182
187
|
return (
|
|
@@ -192,7 +197,7 @@ function App() {
|
|
|
192
197
|
Detects and displays warnings for null states:
|
|
193
198
|
|
|
194
199
|
```tsx
|
|
195
|
-
import { NullStateWarning } from '
|
|
200
|
+
import { NullStateWarning } from 'mui-toolpad-extended-tuni';
|
|
196
201
|
|
|
197
202
|
function MyComponent() {
|
|
198
203
|
const states = [{ user: currentUser }, { course: currentCourse }];
|
|
@@ -274,7 +279,7 @@ import {
|
|
|
274
279
|
slugify,
|
|
275
280
|
camelCaseToUnderscore,
|
|
276
281
|
underscoreToCamelCase,
|
|
277
|
-
} from '
|
|
282
|
+
} from 'mui-toolpad-extended-tuni';
|
|
278
283
|
|
|
279
284
|
// Convert strings to URL-friendly format
|
|
280
285
|
const slug = slugify('My Course Title'); // 'my-course-title'
|
|
@@ -290,7 +295,7 @@ const camelCase = underscoreToCamelCase('my_variable'); // 'myVariable'
|
|
|
290
295
|
import {
|
|
291
296
|
convertObjectKeysToCamelCase,
|
|
292
297
|
convertObjectKeysToUnderscore,
|
|
293
|
-
} from '
|
|
298
|
+
} from 'mui-toolpad-extended-tuni';
|
|
294
299
|
|
|
295
300
|
// Convert API responses
|
|
296
301
|
const camelCaseData = convertObjectKeysToCamelCase(apiResponse);
|
|
@@ -302,7 +307,7 @@ const underscoreData = convertObjectKeysToUnderscore(requestData);
|
|
|
302
307
|
The library includes pre-configured Axios instance for API communications:
|
|
303
308
|
|
|
304
309
|
```tsx
|
|
305
|
-
import { axiosInstance } from '
|
|
310
|
+
import { axiosInstance } from 'mui-toolpad-extended-tuni';
|
|
306
311
|
|
|
307
312
|
// Handles CSRF tokens and base URL automatically
|
|
308
313
|
const response = await axiosInstance.get('/api/endpoint');
|
|
@@ -332,7 +337,7 @@ interface CourseRaw {
|
|
|
332
337
|
The library includes a customizable Material-UI theme:
|
|
333
338
|
|
|
334
339
|
```tsx
|
|
335
|
-
import { EduMLTheme } from '
|
|
340
|
+
import { EduMLTheme } from 'mui-toolpad-extended-tuni';
|
|
336
341
|
|
|
337
342
|
// Theme includes predefined:
|
|
338
343
|
// - Color schemes (light/dark)
|
|
@@ -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;
|