mui-toolpad-extended-tuni 2.0.0 → 2.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.
Files changed (29) hide show
  1. package/README.md +17 -0
  2. package/dist/LMSToolpad/LMSProvider.d.ts +14 -8
  3. package/dist/LMSToolpad/components/CenteredHeading.d.ts +7 -0
  4. package/dist/LMSToolpad/components/Courses/CourseCodeLoader.d.ts +15 -0
  5. package/dist/LMSToolpad/components/Courses/CourseInstanceLoader.d.ts +16 -0
  6. package/dist/LMSToolpad/components/Courses/CourseInstanceSelector.d.ts +15 -0
  7. package/dist/LMSToolpad/components/Courses/CourseItem.d.ts +18 -2
  8. package/dist/LMSToolpad/components/Courses/CourseList.d.ts +16 -1
  9. package/dist/LMSToolpad/components/Courses/CourseSelector.d.ts +21 -1
  10. package/dist/LMSToolpad/components/Courses/CourseTools.d.ts +20 -1
  11. package/dist/LMSToolpad/components/Courses/LayoutToggle.d.ts +7 -0
  12. package/dist/LMSToolpad/components/Home.d.ts +10 -0
  13. package/dist/LMSToolpad/components/MicroserviceNavigationBuilder.d.ts +45 -0
  14. package/dist/LMSToolpad/components/MicroserviceRoutes.d.ts +30 -5
  15. package/dist/LMSToolpad/components/ToolCard.d.ts +8 -0
  16. package/dist/LMSToolpad/components/ToolDisplayer.d.ts +21 -0
  17. package/dist/LMSToolpad/components/sidebar/Footer.d.ts +2 -1
  18. package/dist/LMSToolpad/constants.d.ts +1 -0
  19. package/dist/LMSToolpad/hooks/useCustomRouter.d.ts +1 -0
  20. package/dist/LMSToolpad/network/axiosConfig.d.ts +1 -0
  21. package/dist/LMSToolpad/store/useCourseStore.d.ts +23 -7
  22. package/dist/LMSToolpad/store/useNavigationStore.d.ts +14 -0
  23. package/dist/LMSToolpad/utils/courseFilters.d.ts +14 -0
  24. package/dist/index.cjs +83 -83
  25. package/dist/index.d.ts +2 -0
  26. package/dist/index.es.js +5758 -5148
  27. package/package.json +1 -1
  28. package/dist/LMSToolpad/components/Courses/CourseLoader.d.ts +0 -7
  29. package/dist/LMSToolpad/utils/slugify.d.ts +0 -1
package/README.md CHANGED
@@ -4,6 +4,23 @@
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
+ ## Version 2.1.0
8
+
9
+ ### Recent Changes
10
+
11
+ - Enhanced course navigation structure with support for course instances
12
+ - Improved MicroserviceRoutes component with better TypeScript support
13
+ - Added new CourseInstanceSelector and CourseCodeLoader components
14
+ - Updated navigation store with better course instance handling
15
+ - Introduced new course filtering utilities
16
+ - Improved sidebar footer with responsive design
17
+
18
+ ### Breaking Changes
19
+
20
+ - Navigation structure now requires course code and instance properties
21
+ - MicroserviceRoutes configuration requires updated navigation builder function
22
+ - Course data structure updated to include code and instance fields
23
+
7
24
  ## Breaking Changes in v2.0.0
8
25
 
9
26
  1. Renamed `EduMLProvider` to `LMSProvider` (EduMLProvider is now deprecated)
@@ -4,17 +4,23 @@ export interface EduMLProviderProps {
4
4
  children?: ReactNode;
5
5
  }
6
6
  /**
7
- * EduMLProvider must be wrapped in a Router component from react-router-dom
8
- * Example:
9
- * ```tsx
10
- * import { BrowserRouter } from 'react-router-dom';
7
+ * Main provider component for the LMS system.
8
+ *
9
+ * @version 2.1.0
10
+ * @breaking-changes
11
+ * - Renamed from EduMLProvider to LMSProvider
12
+ * - Updated authentication handling for course instances
13
+ * - Added support for course code level navigation
14
+ * - Improved context sharing between microservices
11
15
  *
16
+ * @example
17
+ * ```tsx
12
18
  * <BrowserRouter>
13
- * <EduMLProvider>
19
+ * <LMSProvider>
14
20
  * {children}
15
- * </EduMLProvider>
21
+ * </LMSProvider>
16
22
  * </BrowserRouter>
17
23
  * ```
18
24
  */
19
- declare const EduMLProvider: ({ children }: EduMLProviderProps) => import("react/jsx-runtime").JSX.Element;
20
- export default EduMLProvider;
25
+ declare const LMSProvider: ({ children }: EduMLProviderProps) => import("react/jsx-runtime").JSX.Element;
26
+ export default LMSProvider;
@@ -0,0 +1,7 @@
1
+ /** @format */
2
+ type CenteredHeadingProps = {
3
+ heading: string;
4
+ subheading?: string;
5
+ };
6
+ declare const CenteredHeading: ({ heading, subheading }: CenteredHeadingProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default CenteredHeading;
@@ -0,0 +1,15 @@
1
+ /** @format */
2
+ /**
3
+ * Component for loading and managing course code level data.
4
+ *
5
+ * @version 2.1.0
6
+ * @new-component
7
+ * - Handles course code level routing
8
+ * - Manages course code state in store
9
+ * - Provides course instance list context
10
+ * - Supports navigation between instances
11
+ * @description - This component is responsible for loading the course data and rendering the course tools
12
+ * @returns {React.ReactElement} - Returns the course loader component
13
+ */
14
+ declare const CourseCodeLoader: () => import("react/jsx-runtime").JSX.Element;
15
+ export default CourseCodeLoader;
@@ -0,0 +1,16 @@
1
+ /** @format */
2
+ /**
3
+ * Component for loading specific course instance data.
4
+ *
5
+ * @version 2.1.0
6
+ * @new-component
7
+ * - Manages course instance state
8
+ * - Handles instance-specific data loading
9
+ * - Provides instance context to children
10
+ * - Supports microservice integration
11
+ * - Handles instance not found scenarios
12
+ * @description - This component is responsible for loading the course data and rendering the course tools
13
+ * @returns {React.ReactElement} - Returns the course loader component
14
+ */
15
+ declare const CourseInstanceLoader: () => import("react/jsx-runtime").JSX.Element;
16
+ export default CourseInstanceLoader;
@@ -0,0 +1,15 @@
1
+ /** @format */
2
+ /**
3
+ * Component for selecting course instances from a filtered list.
4
+ *
5
+ * @version 2.1.0
6
+ * @new-component
7
+ * - Provides instance selection UI for courses
8
+ * - Groups instances by course code
9
+ * - Handles active/inactive instance states
10
+ * - Supports nested navigation structure
11
+ *
12
+ * @param {Course[]} courses - Available course instances
13
+ */
14
+ declare const CourseInstanceSelector: () => import("react/jsx-runtime").JSX.Element;
15
+ export default CourseInstanceSelector;
@@ -2,8 +2,24 @@
2
2
  import { Course } from '../../store/useCourseStore';
3
3
  type CourseItemProps = {
4
4
  course: Course;
5
- isSelected: boolean;
5
+ isSelected?: boolean;
6
+ isInactive?: boolean;
6
7
  onSelect: (course: Course) => void;
8
+ displayMode?: 'course' | 'instance' | 'instanceList';
7
9
  };
8
- declare const CourseItem: ({ course, isSelected, onSelect }: CourseItemProps) => import("react/jsx-runtime").JSX.Element;
10
+ /**
11
+ * Course item component for displaying individual course cards.
12
+ *
13
+ * @version 2.1.0
14
+ * @updates
15
+ * - Completely redesigned with new card-based layout
16
+ * - Added support for inactive course states
17
+ * - Enhanced display modes (course/instance/instanceList)
18
+ * - Added transition animations and hover effects
19
+ * - Improved accessibility with better contrast and focus states
20
+ *
21
+ * @component
22
+ * @param {CourseItemProps} props
23
+ */
24
+ declare const CourseItem: ({ course, isSelected, isInactive, onSelect, displayMode, }: CourseItemProps) => import("react/jsx-runtime").JSX.Element;
9
25
  export default CourseItem;
@@ -4,6 +4,21 @@ type CourseListProps = {
4
4
  courses: Course[];
5
5
  selectedCourse?: Course | null;
6
6
  onSelectCourse: (course: Course) => void;
7
+ displayMode?: 'course' | 'instance' | 'instanceList';
7
8
  };
8
- declare const CourseList: ({ courses, selectedCourse, onSelectCourse, }: CourseListProps) => import("react/jsx-runtime").JSX.Element;
9
+ /**
10
+ * Course list component for displaying course collections.
11
+ *
12
+ * @version 2.1.0
13
+ * @updates
14
+ * - Added support for active/inactive course grouping
15
+ * - Enhanced layout with responsive grid system
16
+ * - Added new display mode support
17
+ * - Improved course filtering and sorting
18
+ * - Added support for course instance display
19
+ *
20
+ * @component
21
+ * @param {CourseListProps} props
22
+ */
23
+ declare const CourseList: ({ courses, selectedCourse, onSelectCourse, displayMode, }: CourseListProps) => import("react/jsx-runtime").JSX.Element;
9
24
  export default CourseList;
@@ -1,3 +1,23 @@
1
1
  /** @format */
2
- declare const CourseSelector: () => import("react/jsx-runtime").JSX.Element;
2
+ import { Course } from '../../store/useCourseStore';
3
+ type CourseSelectorProps = {
4
+ courses: Course[];
5
+ navigationType?: 'direct' | 'instances';
6
+ };
7
+ /**
8
+ * Component for displaying and selecting courses with enhanced navigation features.
9
+ *
10
+ * @version 2.1.0
11
+ * @updates
12
+ * - Added support for direct and instance-based navigation modes
13
+ * - Enhanced course filtering with code and instance grouping
14
+ * - Added support for inactive course states
15
+ * - Improved course selection UI with new card-based design
16
+ *
17
+ * @component
18
+ * @param {CourseSelectorProps} props
19
+ * @param {Course[]} props.courses - Array of available courses
20
+ * @param {'direct' | 'instances'} [props.navigationType='direct'] - Navigation mode
21
+ */
22
+ declare const CourseSelector: ({ courses, navigationType, }: CourseSelectorProps) => import("react/jsx-runtime").JSX.Element;
3
23
  export default CourseSelector;
@@ -1,3 +1,22 @@
1
1
  /** @format */
2
- declare const CourseTools: () => import("react/jsx-runtime").JSX.Element;
2
+ import { NavigationPageStoreItem } from '../../store/useNavigationStore';
3
+ interface CourseToolsProps {
4
+ microservices: NavigationPageStoreItem[];
5
+ }
6
+ /**
7
+ * Component for managing and displaying course-specific tools.
8
+ *
9
+ * @version 2.1.0
10
+ * @updates
11
+ * - Added support for microservice-based tool management
12
+ * - Introduced enabled/available tools separation
13
+ * - Added service enablement/disablement functionality
14
+ * - Enhanced teacher-specific tool configuration
15
+ * - Improved UI with centered headings and tool groups
16
+ *
17
+ * @component
18
+ * @param {CourseToolsProps} props
19
+ * @param {NavigationPageStoreItem[]} props.microservices - Array of available microservice tools
20
+ */
21
+ declare const CourseTools: ({ microservices }: CourseToolsProps) => import("react/jsx-runtime").JSX.Element;
3
22
  export default CourseTools;
@@ -0,0 +1,7 @@
1
+ /** @format */
2
+ type LayoutToggleProps = {
3
+ value: 'direct' | 'instances';
4
+ onChange: (value: 'direct' | 'instances') => void;
5
+ };
6
+ declare const LayoutToggle: ({ value, onChange }: LayoutToggleProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default LayoutToggle;
@@ -1,3 +1,13 @@
1
1
  /** @format */
2
+ /**
3
+ * Home component with enhanced layout options.
4
+ *
5
+ * @version 2.1.0
6
+ * @updates
7
+ * - Added layout toggle functionality
8
+ * - Enhanced course display modes
9
+ * - Improved responsive design
10
+ * - Added support for instance/direct navigation
11
+ */
2
12
  declare const Home: () => import("react/jsx-runtime").JSX.Element;
3
13
  export default Home;
@@ -0,0 +1,45 @@
1
+ /** @format */
2
+ import { NavigationPageStoreItem } from '../store/useNavigationStore';
3
+ export type BuildMicroServiceNavigationProps = {
4
+ segment: string;
5
+ title: string;
6
+ description: string;
7
+ icon: any;
8
+ forRoles: string[];
9
+ children?: NavigationPageStoreItem[];
10
+ };
11
+ /**
12
+ * Builds a navigation structure for a microservice that can be integrated into the LMS navigation system.
13
+ *
14
+ * @param {BuildMicroServiceNavigation} options - Configuration options for the microservice navigation
15
+ * @param {string} options.segment - URL segment for the microservice (e.g., 'edutest')
16
+ * @param {string} options.title - Display title of the microservice
17
+ * @param {string} options.description - Description of the microservice's purpose
18
+ * @param {any} options.icon - MUI icon component to be used for the navigation item
19
+ * @param {string[]} options.forRoles - Array of role names that can access this microservice
20
+ * @param {NavigationPageStoreItem[]} [options.children] - Optional sub-navigation items
21
+ *
22
+ * @returns {NavigationPageStoreItem[]} Array containing the navigation structure
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * import ScienceIcon from '@mui/icons-material/Science';
27
+ *
28
+ * const eduTestNavigation = buildMicroServiceNavigation({
29
+ * segment: 'edutest',
30
+ * title: 'EduTest',
31
+ * description: 'Testing system for education',
32
+ * icon: ScienceIcon,
33
+ * forRoles: ['teacher', 'student'],
34
+ * children: [
35
+ * {
36
+ * kind: 'page',
37
+ * segment: 'assignments',
38
+ * title: 'Assignments',
39
+ * // ... other properties
40
+ * }
41
+ * ]
42
+ * });
43
+ * ```
44
+ */
45
+ export declare const buildMicroServiceNavigation: ({ segment, title, description, icon, forRoles, children, }: BuildMicroServiceNavigationProps) => NavigationPageStoreItem[];
@@ -4,16 +4,41 @@ export interface MicroserviceConfig {
4
4
  path: string;
5
5
  Component: React.ComponentType;
6
6
  fetchHooks?: Array<(courseId: string) => void>;
7
- buildNavigation?: (courseId: string, isTeacher: boolean) => any[];
7
+ buildNavigation: (courseId: string, isTeacher: boolean) => any[];
8
8
  }
9
9
  interface MicroserviceRoutesProps {
10
10
  microservices: MicroserviceConfig[];
11
11
  }
12
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
13
+ * Component responsible for managing and rendering microservice routes within the LMS.
14
+ *
15
+ * @version 2.1.0
16
+ * @breaking-changes
17
+ * - Navigation structure now requires course code and instance properties
18
+ * - Updated configuration interface for better TypeScript support
19
+ * - Changed route structure to support course instances
20
+ * - Added support for course code level navigation
21
+ * - Improved handling of microservice-specific navigation items
22
+ *
23
+ * @component
24
+ * @param {MicroserviceRoutesProps} props - Component properties
25
+ * @param {MicroserviceConfig[]} props.microservices - Array of microservice configurations
26
+ *
27
+ * @example
28
+ * ```tsx
29
+ * const microservices = [{
30
+ * path: 'assignments',
31
+ * Component: AssignmentsTool,
32
+ * fetchHooks: [(courseId) => fetchAssignmentData(courseId)],
33
+ * buildNavigation: (courseId, isTeacher) => ([{
34
+ * kind: 'page',
35
+ * segment: 'assignments',
36
+ * title: 'Assignments',
37
+ * description: 'Course assignments',
38
+ * forRoles: ['teacher', 'student']
39
+ * }])
40
+ * }];
41
+ * ```
17
42
  */
18
43
  declare const MicroserviceRoutes: React.FC<MicroserviceRoutesProps>;
19
44
  export default MicroserviceRoutes;
@@ -0,0 +1,8 @@
1
+ import { NavigationPageStoreItem } from '../store/useNavigationStore';
2
+ type ToolCardProps = {
3
+ item: NavigationPageStoreItem;
4
+ onToggleService?: (path: string) => void;
5
+ isUsed?: boolean;
6
+ };
7
+ declare const ToolCard: ({ item, onToggleService, isUsed }: ToolCardProps) => import("react/jsx-runtime").JSX.Element;
8
+ export default ToolCard;
@@ -0,0 +1,21 @@
1
+ import { NavigationPageStoreItem } from '../store/useNavigationStore';
2
+ import { MicroserviceConfig } from './MicroserviceRoutes';
3
+ export type ToolDisplayerItem = {
4
+ path: string;
5
+ icon: JSX.Element;
6
+ label: string;
7
+ description: string;
8
+ forRoles?: string[];
9
+ };
10
+ interface ToolDisplayerProps {
11
+ show: boolean;
12
+ title: string;
13
+ microservices?: MicroserviceConfig[];
14
+ onToggleService?: (path: string) => void;
15
+ navigationItems?: ToolDisplayerItem[];
16
+ navItems: NavigationPageStoreItem[];
17
+ roleCheck?: boolean;
18
+ isUsed?: boolean;
19
+ }
20
+ declare const ToolDisplayer: ({ show, onToggleService, navItems, roleCheck, isUsed, }: ToolDisplayerProps) => import("react/jsx-runtime").JSX.Element;
21
+ export default ToolDisplayer;
@@ -1,3 +1,4 @@
1
- import { SidebarFooterProps } from "@toolpad/core";
1
+ /** @format */
2
+ import { SidebarFooterProps } from '@toolpad/core';
2
3
  declare function SidebarFooter({ mini }: SidebarFooterProps): import("react/jsx-runtime").JSX.Element;
3
4
  export default SidebarFooter;
@@ -1,2 +1,3 @@
1
1
  /** @format */
2
2
  export declare const baseUrl = "/";
3
+ export declare const MTETVERSION = "2.1.0";
@@ -1,3 +1,4 @@
1
+ /** @format */
1
2
  declare function useCustomRouter(): {
2
3
  pathname: any;
3
4
  searchParams: URLSearchParams;
@@ -1,3 +1,4 @@
1
+ /** @format */
1
2
  export declare const csrftoken: string | null;
2
3
  declare const axiosInstance: any;
3
4
  export default axiosInstance;
@@ -1,15 +1,31 @@
1
1
  /** @format */
2
- export interface Course {
3
- id: string;
2
+ export interface CourseRaw {
4
3
  title: string;
5
4
  description: string;
5
+ code: string;
6
+ instance: string;
7
+ ltiLoginUrl?: string;
8
+ services?: string[];
9
+ }
10
+ export interface Course extends CourseRaw {
11
+ id: string;
6
12
  createdAt: string;
7
- ltiLoginUrl: string;
8
13
  updatedAt: string;
9
14
  }
10
- export interface CourseRaw {
11
- title: string;
12
- description: string;
13
- }
15
+ /**
16
+ * Course management store with enhanced instance handling.
17
+ *
18
+ * @version 2.1.0
19
+ * @updates
20
+ * - Added support for course codes and instances
21
+ * - Enhanced course filtering capabilities
22
+ * - Added currentCourseCode state
23
+ * - Updated Course interface with new fields
24
+ * - Added instance-specific state management
25
+ *
26
+ * @breaking-changes
27
+ * - Updated Course interface requires code and instance fields
28
+ * - Changed course identification logic to use code + instance
29
+ */
14
30
  declare const useCourseStore: any;
15
31
  export default useCourseStore;
@@ -23,6 +23,20 @@ export interface NavigationPageStoreItem extends NavigationItemBase {
23
23
  metadata?: ToolMetadata;
24
24
  }
25
25
  export type NavigationStoreItem = NavigationHeaderItem | NavigationPageStoreItem;
26
+ /**
27
+ * Navigation management store with enhanced course instance support.
28
+ *
29
+ * @version 2.1.0
30
+ * @updates
31
+ * - Added course instance section management
32
+ * - Enhanced navigation structure for course instances
33
+ * - Added support for instance-specific tools
34
+ * - Improved section management with code-based identification
35
+ *
36
+ * @breaking-changes
37
+ * - Changed section identification from slugified title to course code
38
+ * - Updated navigation structure to support instance hierarchy
39
+ */
26
40
  export declare const useNavigationStore: any;
27
41
  export declare const filterNavigationByRole: (role: string) => NavigationStoreItem[];
28
42
  export {};
@@ -0,0 +1,14 @@
1
+ /** @format */
2
+ import { Course } from '../store/useCourseStore';
3
+ export declare const filterUniqueCourses: (courses: Course[]) => Course[];
4
+ export declare const isActiveCourse: (course: Course) => boolean;
5
+ export declare const isActivecode: (courses: Course[], code: string) => boolean;
6
+ /**
7
+ * Group courses by activity status (active/inactive).
8
+ * @param courses List of courses or instances
9
+ * @param skipUnique If true, do not apply unique filtering/logic.
10
+ */
11
+ export declare const groupCoursesByActivity: (courses: Course[], skipUnique?: boolean) => {
12
+ active: Course[];
13
+ inactive: Course[];
14
+ };