@datalayer/core 0.0.3 → 0.0.5
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 +114 -3
- package/lib/App.css +2 -2
- package/lib/App.d.ts +1 -1
- package/lib/App.js +9 -9
- package/lib/__tests__/index.test.js +5 -5
- package/lib/api/DatalayerApi.d.ts +1 -1
- package/lib/api/DatalayerApi.js +3 -3
- package/lib/api/index.d.ts +3 -3
- package/lib/api/index.js +3 -3
- package/lib/api/runtimes/actions.js +22 -23
- package/lib/api/runtimes/settings.js +3 -3
- package/lib/api/runtimes/snapshots.d.ts +1 -1
- package/lib/api/runtimes/snapshots.js +8 -8
- package/lib/api/runtimes/utils.js +1 -4
- package/lib/collaboration/DatalayerCollaboration.d.ts +9 -0
- package/lib/collaboration/DatalayerCollaboration.js +28 -0
- package/lib/collaboration/DatalayerCollaborationProvider.d.ts +54 -0
- package/lib/collaboration/DatalayerCollaborationProvider.js +162 -0
- package/lib/collaboration/index.d.ts +2 -0
- package/lib/collaboration/index.js +6 -0
- package/lib/components/avatars/BoringAvatar.d.ts +1 -1
- package/lib/components/avatars/BoringAvatar.js +2 -2
- package/lib/components/avatars/UserProfileAvatar.js +2 -9
- package/lib/components/banners/NoAutomationBanner.js +4 -4
- package/lib/components/buttons/DownloadCSVButton.js +1 -1
- package/lib/components/buttons/UploadButton.js +1 -1
- package/lib/components/checkout/StripeCheckout.d.ts +1 -1
- package/lib/components/checkout/StripeCheckout.js +6 -6
- package/lib/components/confetti/ConfettiSuccess.js +1 -1
- package/lib/components/context/OrganizationSelect.js +5 -5
- package/lib/components/context/SpaceSelect.js +7 -7
- package/lib/components/display/AvatarSkeleton.js +1 -1
- package/lib/components/display/CenteredSpinner.js +4 -4
- package/lib/components/display/CodePreview.js +4 -4
- package/lib/components/display/DatalayerBox.js +13 -14
- package/lib/components/display/HorizontalCenter.d.ts +1 -1
- package/lib/components/display/HorizontalCenter.js +1 -1
- package/lib/components/display/JupyterDialog.js +17 -15
- package/lib/components/display/NavLink.d.ts +4 -2
- package/lib/components/display/NavLink.js +6 -4
- package/lib/components/display/NotebookSkeleton.js +2 -2
- package/lib/components/display/Placeholder.js +1 -1
- package/lib/components/display/ToTopBranded.js +1 -1
- package/lib/components/echarts/EChartsReact.d.ts +1 -1
- package/lib/components/echarts/EChartsReact.js +1 -1
- package/lib/components/flashes/FlashClosable.js +11 -11
- package/lib/components/flashes/FlashDisclaimer.js +2 -3
- package/lib/components/flashes/FlashGuest.js +3 -4
- package/lib/components/flashes/FlashSurveys.js +3 -4
- package/lib/components/flashes/FlashUnauthorized.js +2 -2
- package/lib/components/flashes/surveys/Survey2025_1.d.ts +1 -1
- package/lib/components/flashes/surveys/Survey2025_1.js +62 -85
- package/lib/components/iam/ExternalTokenSilentLogin.js +6 -4
- package/lib/components/icons/ArtifactIcon.d.ts +2 -2
- package/lib/components/icons/ArtifactIcon.js +39 -39
- package/lib/components/labels/VisibilityLabel.js +2 -5
- package/lib/components/landings/StepBlock.d.ts +1 -1
- package/lib/components/landings/StepBlock.js +1 -1
- package/lib/components/navbar/NavigationVisbilityObserver.js +2 -2
- package/lib/components/navbar/SubdomainNavBar.js +45 -23
- package/lib/components/navbar/SubdomainNavBar.module.css +33 -14
- package/lib/components/nbgrader/NbGradesDetails.d.ts +1 -1
- package/lib/components/nbgrader/NbGradesDetails.js +5 -8
- package/lib/components/notebooks/JupyterNotebook.js +5 -5
- package/lib/components/notebooks/JupyterNotebookToolbar.js +3 -3
- package/lib/components/primer/Helper.d.ts +1 -1
- package/lib/components/primer/Helper.js +5 -3
- package/lib/components/primer/Portals.d.ts +1 -1
- package/lib/components/primer/Portals.js +2 -2
- package/lib/components/primer/Styles.js +1 -1
- package/lib/components/progress/ConsumptionBar.js +2 -2
- package/lib/components/progress/CreditsIndicator.d.ts +1 -1
- package/lib/components/progress/CreditsIndicator.js +4 -7
- package/lib/components/progress/ProgressRing.js +2 -2
- package/lib/components/runtimes/RuntimeCellVariables.js +9 -9
- package/lib/components/runtimes/RuntimeCellVariablesDialog.js +3 -3
- package/lib/components/runtimes/RuntimeLauncherDialog.js +30 -34
- package/lib/components/runtimes/RuntimePickerBase.js +42 -31
- package/lib/components/runtimes/RuntimePickerCell.js +9 -12
- package/lib/components/runtimes/RuntimePickerNotebook.js +44 -44
- package/lib/components/runtimes/RuntimeReservationControl.js +10 -15
- package/lib/components/runtimes/RuntimeSimplePicker.js +9 -12
- package/lib/components/runtimes/RuntimeUtils.js +22 -12
- package/lib/components/runtimes/RuntimeVariables.js +7 -7
- package/lib/components/screenshot/ScreenCapture.js +9 -13
- package/lib/components/screenshot/ScreenCaptureButton.d.ts +1 -1
- package/lib/components/screenshot/ScreenCaptureButton.js +14 -8
- package/lib/components/snapshots/RuntimeSnapshotMenu.js +19 -17
- package/lib/components/snippets/SnippetDialog.js +5 -5
- package/lib/components/storage/ContentsBrowser.js +63 -56
- package/lib/components/storage/ContentsItems.js +10 -8
- package/lib/components/students/StudentItemStatus.d.ts +1 -1
- package/lib/components/students/StudentItemStatus.js +35 -16
- package/lib/components/subnav/SubNav.d.ts +1 -1
- package/lib/components/subnav/SubNav.js +30 -15
- package/lib/components/subnav/SubNav.module.css +55 -21
- package/lib/components/tables/DataTable.js +1 -4
- package/lib/components/text-reveal/TextRevealAnimation.js +7 -2
- package/lib/components/text-reveal/TextRevealAnimation.module.css +4 -2
- package/lib/components/tokens/SpaceVariantToken.d.ts +1 -1
- package/lib/components/tokens/SpaceVariantToken.js +5 -5
- package/lib/components/toolbars/AssignmentEditorToolbar.js +1 -3
- package/lib/components/users/PeerIndicator.d.ts +1 -1
- package/lib/components/users/PeerIndicator.js +5 -5
- package/lib/config/Configuration.d.ts +48 -0
- package/lib/config/Configuration.js +42 -0
- package/lib/config/integrations/Loom.js +3 -3
- package/lib/examples/CellExample.d.ts +2 -2
- package/lib/examples/CellExample.js +34 -3
- package/lib/examples/DatalayerNotebookExample.d.ts +16 -0
- package/lib/examples/DatalayerNotebookExample.js +75 -0
- package/lib/examples/NativeNavigationExample.d.ts +8 -0
- package/lib/examples/NativeNavigationExample.js +97 -0
- package/lib/examples/NotebookExample.d.ts +1 -3
- package/lib/examples/NotebookExample.js +9 -7
- package/lib/examples/NotebookMutationsKernel.d.ts +2 -0
- package/lib/examples/NotebookMutationsKernel.js +115 -0
- package/lib/examples/NotebookMutationsServiceManager.d.ts +2 -0
- package/lib/examples/NotebookMutationsServiceManager.js +107 -0
- package/lib/examples/ReactRouterExample.d.ts +6 -0
- package/lib/examples/ReactRouterExample.js +175 -0
- package/lib/examples/example-selector.d.ts +22 -0
- package/lib/examples/example-selector.js +45 -0
- package/lib/examples/index.d.ts +2 -0
- package/lib/examples/index.js +6 -0
- package/lib/examples/main.js +153 -0
- package/lib/examples/notebooks/IPyWidgetsExample.ipynb.json +101 -0
- package/lib/examples/notebooks/IPyWidgetsExampleWithState.ipynb.json +112 -0
- package/lib/examples/{NotebookExample1.ipynb.json → notebooks/Lite.ipynb.json} +45 -53
- package/lib/examples/notebooks/Matplotlib.ipynb.json +137 -0
- package/lib/examples/notebooks/NotebookExample1.ipynb.json +126 -0
- package/lib/examples/notebooks/NotebookExample2.ipynb.json +48 -0
- package/lib/examples/notebooks/NotebookOutputs.ipynb.json +49 -0
- package/lib/examples/notebooks/NotebookToCExample.ipynb.json +102 -0
- package/lib/examples/notebooks/OutputIPyWidgetsExample.d.ts +145 -0
- package/lib/examples/notebooks/OutputIPyWidgetsExample.js +153 -0
- package/lib/examples/notebooks/PyGWalker.ipynb.json +55 -0
- package/lib/hooks/assets/OutputshotPlaceholders.d.ts +10 -10
- package/lib/hooks/assets/OutputshotPlaceholders.js +10 -10
- package/lib/hooks/index.d.ts +29 -28
- package/lib/hooks/index.js +29 -28
- package/lib/hooks/layouts/LayoutBackdrop.js +3 -6
- package/lib/hooks/layouts/LayoutScreenshot.css +1 -1
- package/lib/hooks/layouts/LayoutScreenshot.js +6 -6
- package/lib/hooks/useAIAgents.d.ts +1 -1
- package/lib/hooks/useAIAgents.js +6 -6
- package/lib/hooks/useAuthorization.js +4 -4
- package/lib/hooks/useBackdrop.js +7 -7
- package/lib/hooks/useBackdropJupyterLab.d.ts +1 -1
- package/lib/hooks/useBackdropJupyterLab.js +4 -4
- package/lib/hooks/useCache.d.ts +6 -2
- package/lib/hooks/useCache.js +233 -179
- package/lib/hooks/useCellOutputshot.js +3 -6
- package/lib/hooks/useContainsFocus.js +2 -1
- package/lib/hooks/useDatalayer.js +5 -3
- package/lib/hooks/useError.d.ts +1 -1
- package/lib/hooks/useError.js +2 -2
- package/lib/hooks/useExternalScript.js +4 -4
- package/lib/hooks/useFocusTrap.js +2 -1
- package/lib/hooks/useIAM.js +4 -5
- package/lib/hooks/useId.js +3 -3
- package/lib/hooks/useJupyterLabTheme.js +3 -1
- package/lib/hooks/useLocation.d.ts +22 -0
- package/lib/hooks/useLocation.js +149 -0
- package/lib/hooks/useLocationHandles.d.ts +2 -2
- package/lib/hooks/useLocationHandles.js +6 -4
- package/lib/hooks/useNavigate.d.ts +5 -1
- package/lib/hooks/useNavigate.js +62 -7
- package/lib/hooks/useNotebookAIAgent.js +3 -1
- package/lib/hooks/useParams.d.ts +5 -0
- package/lib/hooks/useParams.js +112 -0
- package/lib/hooks/useRuntimes.js +2 -2
- package/lib/hooks/useScreenshot.js +5 -5
- package/lib/hooks/useToast.js +15 -13
- package/lib/hooks/useUpload.js +9 -9
- package/lib/hooks/useUser.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +6 -3
- package/lib/index.js +7 -3
- package/lib/mocks/components/FlashMock.js +4 -4
- package/lib/mocks/hooks/rests/rests.js +15 -18
- package/lib/mocks/hooks/useDatalayerMock.d.ts +2 -2
- package/lib/mocks/hooks/useDatalayerMock.js +7 -7
- package/lib/mocks/models/CodeBlockMock.js +1 -1
- package/lib/mocks/models/CodelineMock.js +1 -1
- package/lib/mocks/models/CourseMock.d.ts +1 -1
- package/lib/mocks/models/CourseMock.js +10 -10
- package/lib/mocks/models/InviteMock.d.ts +1 -1
- package/lib/mocks/models/InviteMock.js +21 -6
- package/lib/mocks/models/JupyterLabUserMock.js +2 -2
- package/lib/mocks/models/OrganisationMock.d.ts +1 -1
- package/lib/mocks/models/OrganisationMock.js +11 -7
- package/lib/mocks/models/SchoolMock.d.ts +1 -1
- package/lib/mocks/models/SchoolMock.js +6 -6
- package/lib/mocks/models/SpaceMock.d.ts +1 -1
- package/lib/mocks/models/SpaceMock.js +9 -9
- package/lib/mocks/models/TeamMock.d.ts +1 -1
- package/lib/mocks/models/TeamMock.js +6 -6
- package/lib/mocks/models/UserMock.d.ts +1 -1
- package/lib/mocks/models/UserMock.js +4 -6
- package/lib/mocks/views/ActionMenuMock.js +1 -1
- package/lib/mocks/views/ChartMock.js +3 -3
- package/lib/mocks/views/ChartMockOptions.js +24 -24
- package/lib/mocks/views/DashboardMock.js +74 -74
- package/lib/mocks/views/FormMock.js +1 -1
- package/lib/mocks/views/TableMock.js +1 -1
- package/lib/models/Account.d.ts +2 -2
- package/lib/models/Assignment.d.ts +2 -2
- package/lib/models/Cell.d.ts +1 -1
- package/lib/models/CodeBlock.d.ts +1 -1
- package/lib/models/CodefeedBlocks.d.ts +2 -2
- package/lib/models/Contact.d.ts +1 -1
- package/lib/models/Contact.js +14 -14
- package/lib/models/ContactIAMProvider.js +2 -2
- package/lib/models/Course.d.ts +7 -7
- package/lib/models/Dataset.d.ts +1 -1
- package/lib/models/Dean.d.ts +1 -1
- package/lib/models/Document.d.ts +1 -1
- package/lib/models/Environment.d.ts +2 -2
- package/lib/models/Exercise.d.ts +1 -1
- package/lib/models/IAMProviderLinked.js +1 -1
- package/lib/models/Instructor.d.ts +1 -1
- package/lib/models/Invite.d.ts +2 -2
- package/lib/models/Invite.js +1 -1
- package/lib/models/Item.d.ts +5 -5
- package/lib/models/LandingRoles.js +18 -18
- package/lib/models/Lesson.d.ts +1 -1
- package/lib/models/Member.d.ts +1 -1
- package/lib/models/Notebook.d.ts +1 -1
- package/lib/models/Organization.d.ts +4 -4
- package/lib/models/Organization.js +2 -2
- package/lib/models/OrganizationMember.d.ts +2 -2
- package/lib/models/Page.js +4 -2
- package/lib/models/PageTag.d.ts +1 -1
- package/lib/models/PageTag.js +56 -9
- package/lib/models/Profile.d.ts +1 -1
- package/lib/models/RolesOrganization.d.ts +1 -1
- package/lib/models/RolesOrganization.js +4 -12
- package/lib/models/RolesPlatform.d.ts +1 -1
- package/lib/models/RolesPlatform.js +12 -34
- package/lib/models/RolesTeam.d.ts +1 -1
- package/lib/models/RolesTeam.js +3 -10
- package/lib/models/Runtime.js +4 -4
- package/lib/models/RuntimeSnapshot.js +1 -1
- package/lib/models/School.d.ts +4 -4
- package/lib/models/Space.d.ts +5 -5
- package/lib/models/Space.js +3 -3
- package/lib/models/SpaceItem.d.ts +8 -8
- package/lib/models/SpaceMember.d.ts +2 -2
- package/lib/models/Student.d.ts +2 -2
- package/lib/models/StudentItem.d.ts +3 -3
- package/lib/models/Team.d.ts +3 -3
- package/lib/models/Team.js +2 -2
- package/lib/models/TeamMember.d.ts +2 -2
- package/lib/models/URN.js +1 -1
- package/lib/models/User.d.ts +2 -2
- package/lib/models/User.js +5 -3
- package/lib/models/UserOnboarding.d.ts +1 -1
- package/lib/models/UserOnboarding.js +7 -7
- package/lib/models/UserSettings.js +2 -2
- package/lib/models/index.d.ts +2 -2
- package/lib/models/index.js +2 -2
- package/lib/navigation/adapters/native.d.ts +11 -0
- package/lib/navigation/adapters/native.js +48 -0
- package/lib/navigation/adapters/nextjs.d.ts +9 -0
- package/lib/navigation/adapters/nextjs.js +35 -0
- package/lib/navigation/adapters/react-router.d.ts +4 -0
- package/lib/navigation/adapters/react-router.js +12 -0
- package/lib/navigation/components.d.ts +20 -0
- package/lib/navigation/components.js +36 -0
- package/lib/navigation/index.d.ts +4 -0
- package/lib/navigation/index.js +12 -0
- package/lib/routes/index.d.ts +1 -1
- package/lib/routes/index.js +1 -1
- package/lib/services/DatalayerServiceManager.d.ts +22 -0
- package/lib/services/DatalayerServiceManager.js +69 -0
- package/lib/services/index.d.ts +4 -0
- package/lib/services/index.js +7 -0
- package/lib/services/reconnectToRuntime.d.ts +32 -0
- package/lib/services/reconnectToRuntime.js +59 -0
- package/lib/state/State.d.ts +1 -1
- package/lib/state/State.js +1 -1
- package/lib/state/index.d.ts +1 -1
- package/lib/state/index.js +1 -1
- package/lib/state/storage/IAMStorage.js +14 -2
- package/lib/state/storage/index.d.ts +1 -1
- package/lib/state/storage/index.js +1 -1
- package/lib/state/substates/AIAgentState.js +4 -2
- package/lib/state/substates/CellState.js +6 -5
- package/lib/state/substates/CoreState.d.ts +1 -1
- package/lib/state/substates/CoreState.js +26 -17
- package/lib/state/substates/DatasourceState.js +1 -1
- package/lib/state/substates/IAMState.d.ts +4 -0
- package/lib/state/substates/IAMState.js +39 -23
- package/lib/state/substates/JupyterLabState.js +1 -1
- package/lib/state/substates/LayoutState.d.ts +2 -2
- package/lib/state/substates/LayoutState.js +41 -28
- package/lib/state/substates/OrganizationState.js +1 -1
- package/lib/state/substates/RuntimesState.js +11 -6
- package/lib/state/substates/SpaceState.js +1 -1
- package/lib/state/substates/SurveysState.js +4 -4
- package/lib/state/substates/TeamState.js +1 -1
- package/lib/test-setup.js +25 -3
- package/lib/theme/DatalayerTheme.js +1 -1
- package/lib/theme/DatalayerThemeProvider.js +17 -14
- package/lib/theme/Palette.js +1 -1
- package/lib/utils/Avatar.js +2 -2
- package/lib/utils/Browser.js +6 -6
- package/lib/utils/Cells.d.ts +1 -1
- package/lib/utils/Cookie.js +1 -1
- package/lib/utils/Date.js +2 -2
- package/lib/utils/Download.js +5 -3
- package/lib/utils/DownloadFile.js +4 -2
- package/lib/utils/Env.js +2 -1
- package/lib/utils/Lazy.d.ts +1 -1
- package/lib/utils/Lazy.js +2 -2
- package/lib/utils/Name.js +10 -8
- package/lib/utils/Notebook.d.ts +1 -1
- package/lib/utils/Notebook.js +3 -3
- package/lib/utils/Number.js +13 -9
- package/lib/utils/Plots.js +4 -4
- package/lib/utils/Screenshot.js +1 -1
- package/lib/utils/Sleep.js +1 -1
- package/lib/utils/Snapshot.js +2 -2
- package/lib/utils/String.js +2 -2
- package/lib/utils/Uri.js +1 -1
- package/lib/utils/WithSuspense.js +3 -6
- package/lib/utils/logger.d.ts +16 -0
- package/lib/utils/logger.js +52 -0
- package/package.json +49 -5
- package/lib/__tests__/App.test.js +0 -17
- /package/lib/{__tests__/App.test.d.ts → examples/main.d.ts} +0 -0
|
@@ -3,15 +3,15 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
|
-
import React, { useState, useCallback, useRef, forwardRef, useMemo, useEffect } from 'react';
|
|
6
|
+
import React, { useState, useCallback, useRef, forwardRef, useMemo, useEffect, } from 'react';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import { SearchIcon, XIcon, LinkExternalIcon } from '@primer/octicons-react';
|
|
9
|
-
import { Button, FormControl, Text, TextInput, Label } from '@primer/react-brand';
|
|
9
|
+
import { Button, FormControl, Text, TextInput, Label, } from '@primer/react-brand';
|
|
10
10
|
import { CircleYellowIcon } from '@datalayer/icons-react';
|
|
11
11
|
import { NavigationVisbilityObserver } from './NavigationVisbilityObserver';
|
|
12
|
-
import { useCoreStore } from
|
|
13
|
-
import { useOnClickOutside, useFocusTrap, useKeyboardEscape, useWindowSize, useNavigate } from
|
|
14
|
-
import { useRunStore } from
|
|
12
|
+
import { useCoreStore } from '../../state';
|
|
13
|
+
import { useOnClickOutside, useFocusTrap, useKeyboardEscape, useWindowSize, useNavigate, } from '../../hooks';
|
|
14
|
+
import { useRunStore } from '../../state';
|
|
15
15
|
import { useId } from '../../hooks';
|
|
16
16
|
/**
|
|
17
17
|
* Design tokens
|
|
@@ -55,7 +55,11 @@ function Root({ children, className, fixed = true, fullWidth = false, logoHref =
|
|
|
55
55
|
mainElRef.current = mainEl;
|
|
56
56
|
}
|
|
57
57
|
}, [startOfContentID]);
|
|
58
|
-
useFocusTrap({
|
|
58
|
+
useFocusTrap({
|
|
59
|
+
containerRef: focusTrapRef,
|
|
60
|
+
restoreFocusOnCleanUp: true,
|
|
61
|
+
disabled: menuHidden,
|
|
62
|
+
});
|
|
59
63
|
useKeyboardEscape(() => {
|
|
60
64
|
setMenuHidden(true);
|
|
61
65
|
});
|
|
@@ -70,7 +74,9 @@ function Root({ children, className, fixed = true, fullWidth = false, logoHref =
|
|
|
70
74
|
}, [menuHidden]);
|
|
71
75
|
const setStartOfContentButtonFocusedTrue = useCallback(() => setStartOfContentButtonFocused(true), []);
|
|
72
76
|
const setStartOfContentButtonFocusedFalse = useCallback(() => setStartOfContentButtonFocused(false), []);
|
|
73
|
-
const hasLinks = useMemo(() => React.Children.toArray(children).filter(child => React.isValidElement(child) &&
|
|
77
|
+
const hasLinks = useMemo(() => React.Children.toArray(children).filter(child => React.isValidElement(child) &&
|
|
78
|
+
typeof child.type !== 'string' &&
|
|
79
|
+
child.type === Link),
|
|
74
80
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
75
81
|
[]).length > 0;
|
|
76
82
|
const menuItems = useMemo(() => React.Children.toArray(children)
|
|
@@ -90,10 +96,11 @@ function Root({ children, className, fixed = true, fullWidth = false, logoHref =
|
|
|
90
96
|
}
|
|
91
97
|
})
|
|
92
98
|
.filter(Boolean), [children]);
|
|
93
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: clsx(styles['SubdomainNavBar-outer-container'], fixed && styles['SubdomainNavBar-outer-container--fixed']), children: [_jsx(Button, { as: "a", href: `#${mainElRef.current?.id || startOfContentID}`, variant: "primary", className: clsx(styles['SubdomainNavBar-skip-to-content'], !startOfContentButtonFocused && 'visually-hidden'), onFocus: setStartOfContentButtonFocusedTrue, onBlur: setStartOfContentButtonFocusedFalse, children: "Skip to content" }), _jsx("header", { className: clsx(styles['SubdomainNavBar'], className), "data-testid": testIds.root, ...rest, children: _jsxs("div", { ref: focusTrapRef, className: clsx(styles['SubdomainNavBar-inner-container'], searchVisible &&
|
|
94
|
-
|
|
99
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: clsx(styles['SubdomainNavBar-outer-container'], fixed && styles['SubdomainNavBar-outer-container--fixed']), children: [_jsx(Button, { as: "a", href: `#${mainElRef.current?.id || startOfContentID}`, variant: "primary", className: clsx(styles['SubdomainNavBar-skip-to-content'], !startOfContentButtonFocused && 'visually-hidden'), onFocus: setStartOfContentButtonFocusedTrue, onBlur: setStartOfContentButtonFocusedFalse, children: "Skip to content" }), _jsx("header", { className: clsx(styles['SubdomainNavBar'], className), "data-testid": testIds.root, ...rest, children: _jsxs("div", { ref: focusTrapRef, className: clsx(styles['SubdomainNavBar-inner-container'], searchVisible &&
|
|
100
|
+
styles['SubdomainNavBar-inner-container--search-open'], !fullWidth && styles['SubdomainNavBar-inner-container--centered']), "data-testid": testIds.innerContainer, children: [_jsx("nav", { "aria-label": "global breadcrumb", children: _jsxs("ol", { className: styles['SubdomainNavBar-title-area'], children: [_jsx("li", { children: _jsx("a", { href: "javascript: return false;", "aria-label": "Datalayer Home", className: styles['SubdomainNavBar-logo-mark'], onClick: e => navigate('/', e), children: _jsx("img", { src: configuration.brand.logoUrl, style: { height: 25 } }) }) }), isDev && (_jsx("li", { children: _jsx(Label, { leadingVisual: _jsx(CircleYellowIcon, {}), color: "green-blue", children: "DEV" }) }))] }) }), hasLinks && (_jsx("nav", { id: "menu-navigation", "aria-label": title, className: styles['SubdomainNavBar-primary-nav'], "data-testid": testIds.menuLinks, children: _jsx(NavigationVisbilityObserver, { className: clsx(styles['SubdomainNavBar-primary-nav-list--invisible']), children: menuItems }) })), _jsxs("div", { className: clsx(styles['SubdomainNavBar-secondary-nav']), children: [React.Children.toArray(children)
|
|
95
101
|
.map(child => {
|
|
96
|
-
if (React.isValidElement(child) &&
|
|
102
|
+
if (React.isValidElement(child) &&
|
|
103
|
+
typeof child.type !== 'string') {
|
|
97
104
|
if (child.type === Search) {
|
|
98
105
|
return React.cloneElement(child, {
|
|
99
106
|
active: searchVisible,
|
|
@@ -106,7 +113,8 @@ function Root({ children, className, fixed = true, fullWidth = false, logoHref =
|
|
|
106
113
|
})
|
|
107
114
|
.filter(Boolean), hasLinks && (_jsxs("button", { "aria-expanded": !menuHidden, "aria-label": "Menu", "aria-controls": "menu-navigation", "aria-haspopup": "true", className: clsx(styles['SubdomainNavBar-menu-button'], styles['SubdomainNavBar-mobile-menu-button'], !menuHidden && styles['SubdomainNavBar-menu-button--close']), "data-testid": testIds.menuButton, onClick: handleMobileMenuClick, children: [_jsx("div", { className: clsx(styles['SubdomainNavBar-menu-button-bar']) }), _jsx("div", { className: clsx(styles['SubdomainNavBar-menu-button-bar']) }), _jsx("div", { className: clsx(styles['SubdomainNavBar-menu-button-bar']) })] })), isMedium && (_jsx("div", { className: clsx(styles['SubdomainNavBar-button-area'], styles['SubdomainNavBar-button-area--visible']), children: _jsxs("div", { className: styles['SubdomainNavBar-button-area-inner'], children: [React.Children.toArray(children)
|
|
108
115
|
.map(child => {
|
|
109
|
-
if (React.isValidElement(child) &&
|
|
116
|
+
if (React.isValidElement(child) &&
|
|
117
|
+
typeof child.type !== 'string') {
|
|
110
118
|
if (child.type === PrimaryAction) {
|
|
111
119
|
return child;
|
|
112
120
|
}
|
|
@@ -115,7 +123,8 @@ function Root({ children, className, fixed = true, fullWidth = false, logoHref =
|
|
|
115
123
|
})
|
|
116
124
|
.filter(Boolean), React.Children.toArray(children)
|
|
117
125
|
.map(child => {
|
|
118
|
-
if (React.isValidElement(child) &&
|
|
126
|
+
if (React.isValidElement(child) &&
|
|
127
|
+
typeof child.type !== 'string') {
|
|
119
128
|
if (child.type === SecondaryAction) {
|
|
120
129
|
return child;
|
|
121
130
|
}
|
|
@@ -124,7 +133,8 @@ function Root({ children, className, fixed = true, fullWidth = false, logoHref =
|
|
|
124
133
|
})
|
|
125
134
|
.filter(Boolean)] }) })), !isMedium && (_jsxs("div", { className: clsx(styles['SubdomainNavBar-menu-wrapper'], menuHidden && styles['SubdomainNavBar-menu-wrapper--close']), children: [_jsxs("div", { children: [title && titleHref && (_jsx(Text, { as: "p", children: _jsx("a", { href: titleHref, "aria-label": `${title} home`, className: clsx(styles['SubdomainNavBar-link'], styles['SubdomainNavBar-link--title']), children: title }) })), hasLinks && !menuHidden && (_jsx(NavigationVisbilityObserver, { showOnlyOnNarrow: true, className: clsx(styles['SubdomainNavBar-primary-nav-list--visible']), children: menuItems }))] }), _jsx("div", { className: clsx(styles['SubdomainNavBar-button-area'], styles['SubdomainNavBar-button-area--visible']), children: _jsxs("div", { className: styles['SubdomainNavBar-button-area-inner'], children: [React.Children.toArray(children)
|
|
126
135
|
.map(child => {
|
|
127
|
-
if (React.isValidElement(child) &&
|
|
136
|
+
if (React.isValidElement(child) &&
|
|
137
|
+
typeof child.type !== 'string') {
|
|
128
138
|
if (child.type === PrimaryAction) {
|
|
129
139
|
return child;
|
|
130
140
|
}
|
|
@@ -133,7 +143,8 @@ function Root({ children, className, fixed = true, fullWidth = false, logoHref =
|
|
|
133
143
|
})
|
|
134
144
|
.filter(Boolean), React.Children.toArray(children)
|
|
135
145
|
.map(child => {
|
|
136
|
-
if (React.isValidElement(child) &&
|
|
146
|
+
if (React.isValidElement(child) &&
|
|
147
|
+
typeof child.type !== 'string') {
|
|
137
148
|
if (child.type === SecondaryAction) {
|
|
138
149
|
return child;
|
|
139
150
|
}
|
|
@@ -143,11 +154,15 @@ function Root({ children, className, fixed = true, fullWidth = false, logoHref =
|
|
|
143
154
|
.filter(Boolean)] }) })] }))] })] }) })] }), !mainElRef.current && _jsx("div", { id: `${startOfContentID}`, tabIndex: -1 })] }));
|
|
144
155
|
}
|
|
145
156
|
function Link({ href, className, children, isExternal, target, ...rest }) {
|
|
146
|
-
return (_jsx("li", { className: clsx(styles['SubdomainNavBar-primary-nav-list-item'], className), ...rest, children: _jsxs("a", { href: href, target: target ??
|
|
157
|
+
return (_jsx("li", { className: clsx(styles['SubdomainNavBar-primary-nav-list-item'], className), ...rest, children: _jsxs("a", { href: href, target: target ?? '_self', className: clsx(styles['SubdomainNavBar-link']), children: [_jsx("span", { className: clsx(styles['SubdomainNavBar-link-text']), children: children }), isExternal && (_jsx(LinkExternalIcon, { size: 16, "aria-label": "External link" }))] }) }));
|
|
147
158
|
}
|
|
148
|
-
const SearchInternal = ({ active, title, searchResults, searchTerm, handlerFn, onSubmit, onChange }, ref) => {
|
|
159
|
+
const SearchInternal = ({ active, title, searchResults, searchTerm, handlerFn, onSubmit, onChange, }, ref) => {
|
|
149
160
|
const dialogRef = useRef(null);
|
|
150
|
-
useFocusTrap({
|
|
161
|
+
useFocusTrap({
|
|
162
|
+
containerRef: dialogRef,
|
|
163
|
+
restoreFocusOnCleanUp: true,
|
|
164
|
+
disabled: !active,
|
|
165
|
+
});
|
|
151
166
|
useOnClickOutside(dialogRef, handlerFn);
|
|
152
167
|
const [activeDescendant, setActiveDescendant] = useState(-1);
|
|
153
168
|
const [listboxActive, setListboxActive] = useState();
|
|
@@ -175,7 +190,9 @@ const SearchInternal = ({ active, title, searchResults, searchTerm, handlerFn, o
|
|
|
175
190
|
let count;
|
|
176
191
|
// Prevent any other keys outside of supported from being prevented.
|
|
177
192
|
// Only prevent "Enter" if activeDescendant is greater than -1.
|
|
178
|
-
if (!supportedKeys.includes(event.key) ||
|
|
193
|
+
if (!supportedKeys.includes(event.key) ||
|
|
194
|
+
(event.key === 'Enter' && activeDescendant === -1) ||
|
|
195
|
+
!dialog) {
|
|
179
196
|
return false;
|
|
180
197
|
}
|
|
181
198
|
event.preventDefault();
|
|
@@ -186,11 +203,14 @@ const SearchInternal = ({ active, title, searchResults, searchTerm, handlerFn, o
|
|
|
186
203
|
}
|
|
187
204
|
else if (event.key === 'ArrowUp') {
|
|
188
205
|
// Reset to last search result item if
|
|
189
|
-
count =
|
|
206
|
+
count =
|
|
207
|
+
currentCount === -1 ? searchResultsLength - 1 : currentCount - 1;
|
|
190
208
|
setActiveDescendant(count);
|
|
191
209
|
}
|
|
192
210
|
if (['ArrowDown', 'ArrowUp'].includes(event.key)) {
|
|
193
|
-
dialog
|
|
211
|
+
dialog
|
|
212
|
+
.querySelector(`#subdomainnavbar-search-result-${count}`)
|
|
213
|
+
?.scrollIntoView();
|
|
194
214
|
}
|
|
195
215
|
if (event.key === 'Enter') {
|
|
196
216
|
const link = dialog.querySelector(`#subdomainnavbar-search-result-${activeDescendant} a`);
|
|
@@ -215,15 +235,17 @@ const SearchInternal = ({ active, title, searchResults, searchTerm, handlerFn, o
|
|
|
215
235
|
setListboxActive(search);
|
|
216
236
|
searchLiveRegion();
|
|
217
237
|
}, [searchResults, searchTerm, searchLiveRegion]);
|
|
218
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: clsx(styles['SubdomainNavBar-search-trigger']), children: _jsx("button", { "aria-label": "search", className: styles['SubdomainNavBar-search-button'], onClick: handlerFn, "data-testid": "toggle-search", children: _jsx(SearchIcon, {}) }) }), active && (_jsxs("div", { ref: dialogRef, role: "dialog", "aria-label": `Search ${title}`, "aria-modal": "true", tabIndex: -1, className: clsx(styles['SubdomainNavBar-search-dialog']), children: [_jsxs("div", { className: clsx(styles['SubdomainNavBar-search-dialog-control-area']), children: [_jsx("form", { className: clsx(styles['SubdomainNavBar-search-form']), onSubmit: onSubmit, role: "search", children: _jsxs(FormControl, { fullWidth: true, size: "medium", children: [_jsx(FormControl.Label, { visuallyHidden: true, children: "Search" }), _jsx(TextInput, { ref: ref, className: clsx(styles['SubdomainNavBar-search-text-input']), name: "search", role: "combobox", "aria-expanded": listboxActive, "aria-controls": "listbox-search-results", placeholder: `Search ${title}`, onChange: onChange, defaultValue: searchTerm, invisible: true, leadingVisual: _jsx(SearchIcon, { size: 16 }), "aria-activedescendant": activeDescendant === -1
|
|
238
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: clsx(styles['SubdomainNavBar-search-trigger']), children: _jsx("button", { "aria-label": "search", className: styles['SubdomainNavBar-search-button'], onClick: handlerFn, "data-testid": "toggle-search", children: _jsx(SearchIcon, {}) }) }), active && (_jsxs("div", { ref: dialogRef, role: "dialog", "aria-label": `Search ${title}`, "aria-modal": "true", tabIndex: -1, className: clsx(styles['SubdomainNavBar-search-dialog']), children: [_jsxs("div", { className: clsx(styles['SubdomainNavBar-search-dialog-control-area']), children: [_jsx("form", { className: clsx(styles['SubdomainNavBar-search-form']), onSubmit: onSubmit, role: "search", children: _jsxs(FormControl, { fullWidth: true, size: "medium", children: [_jsx(FormControl.Label, { visuallyHidden: true, children: "Search" }), _jsx(TextInput, { ref: ref, className: clsx(styles['SubdomainNavBar-search-text-input']), name: "search", role: "combobox", "aria-expanded": listboxActive, "aria-controls": "listbox-search-results", placeholder: `Search ${title}`, onChange: onChange, defaultValue: searchTerm, invisible: true, leadingVisual: _jsx(SearchIcon, { size: 16 }), "aria-activedescendant": activeDescendant === -1
|
|
239
|
+
? undefined
|
|
240
|
+
: `subdomainnavbar-search-result-${activeDescendant}`, onKeyDown: handleAriaFocus })] }) }), _jsx("button", { "aria-label": "Close", className: clsx(styles['SubdomainNavBar-menu-button'], styles['SubdomainNavBar-menu-button--close']), onClick: handleClose, children: _jsx(XIcon, { size: 24 }) })] }), _jsxs("div", { id: "listbox-search-results", children: [listboxActive && (_jsxs("div", { className: clsx(styles['SubdomainNavBar-search-results-container']), children: [_jsxs(Text, { id: "subdomainnavbar-search-results-heading", className: styles['SubdomainNavBar-search-results-heading'], children: ["Results for \u201C", searchTerm, "\u201D"] }), _jsx("ul", { role: "listbox", tabIndex: 0, "aria-labelledby": "subdomainnavbar-search-results-heading", className: clsx(styles['SubdomainNavBar-search-results']), children: searchResults?.map((result, index) => (_jsxs("li", { id: `subdomainnavbar-search-result-${index}`, className: styles['SubdomainNavBar-search-result-item'], role: "option", "aria-selected": index === activeDescendant, children: [_jsx("div", { className: styles['SubdomainNavBar-search-result-item-container'], children: _jsx("a", { href: result.url, children: result.title }) }), _jsx(Text, { as: "p", size: "200", id: `subdomainnavbar-search-result-item-desc${index}`, className: styles['SubdomainNavBar-search-result-item-desc'], children: result.description }), _jsxs("div", { children: [_jsx(Text, { size: "100", className: styles['SubdomainNavBar-search-result-item-desc'], children: result.date }), result.category && (_jsxs(_Fragment, { children: [_jsxs(Text, { size: "100", className: styles['SubdomainNavBar-search-result-item-desc'], children: [' ', "\u2022", ' '] }), _jsx(Text, { size: "100", className: styles['SubdomainNavBar-search-result-item-desc'], children: result.category })] }))] })] }, `${result.title}-${index}`))) })] })), _jsxs("div", { "aria-live": "polite", "aria-atomic": "true", "data-testid": testIds.liveRegion, className: "visually-hidden", children: [`${searchResults?.length} suggestions.`, liveRegion && _jsx("span", { children: "\u00A0" })] })] })] }))] }));
|
|
219
241
|
};
|
|
220
242
|
const Search = forwardRef(SearchInternal);
|
|
221
243
|
function PrimaryAction({ children, ...rest }) {
|
|
222
|
-
const { hasArrow = false, size =
|
|
244
|
+
const { hasArrow = false, size = 'small' } = rest;
|
|
223
245
|
return (_jsx(Button, { as: "a", href: "javascript: return false;", className: clsx(styles['SubdomainNavBar-cta-button']), variant: "primary", size: size, hasArrow: hasArrow, ...rest, children: children }));
|
|
224
246
|
}
|
|
225
247
|
function SecondaryAction({ children, ...rest }) {
|
|
226
|
-
const { hasArrow = false, size =
|
|
248
|
+
const { hasArrow = false, size = 'small' } = rest;
|
|
227
249
|
return (_jsx(Button, { as: "a", href: "javascript: return false;", className: clsx(styles['SubdomainNavBar-cta-button'], styles['SubdomainNavBar-cta-button--secondary']), size: size, hasArrow: hasArrow, ...rest, children: children }));
|
|
228
250
|
}
|
|
229
251
|
export const SubdomainNavBar = Object.assign(Root, {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/*
|
|
6
6
|
* Main styles for the subdomain navigation bar.
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
.SubdomainNavBar {
|
|
9
9
|
position: relative;
|
|
10
10
|
z-index: 90;
|
|
11
11
|
font-weight: 550;
|
|
@@ -13,8 +13,11 @@
|
|
|
13
13
|
-webkit-backdrop-filter: blur(16px);
|
|
14
14
|
backdrop-filter: blur(16px);
|
|
15
15
|
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
16
|
-
transition:
|
|
17
|
-
|
|
16
|
+
transition:
|
|
17
|
+
background-color var(--brand-animation-duration-fast)
|
|
18
|
+
var(--brand-animation-easing-default),
|
|
19
|
+
border-color var(--brand-animation-duration-fast)
|
|
20
|
+
var(--brand-animation-easing-default);
|
|
18
21
|
height: 75px;
|
|
19
22
|
}
|
|
20
23
|
|
|
@@ -79,7 +82,9 @@
|
|
|
79
82
|
position: absolute;
|
|
80
83
|
left: calc(-32px + 5px);
|
|
81
84
|
opacity: 0;
|
|
82
|
-
transition:
|
|
85
|
+
transition:
|
|
86
|
+
opacity var(--brand-animation-duration-fast),
|
|
87
|
+
transform var(--brand-animation-duration-fast) ease;
|
|
83
88
|
transform: translateX(5px);
|
|
84
89
|
color: var(--brand-color-text-muted);
|
|
85
90
|
}
|
|
@@ -251,7 +256,8 @@
|
|
|
251
256
|
font-weight: var(--base-text-weight-normal);
|
|
252
257
|
font-size: var(--base-size-20);
|
|
253
258
|
line-height: var(--base-size-20);
|
|
254
|
-
padding: var(--base-size-8) var(--base-size-16) var(--base-size-16)
|
|
259
|
+
padding: var(--base-size-8) var(--base-size-16) var(--base-size-16)
|
|
260
|
+
var(--base-size-28);
|
|
255
261
|
text-decoration: none;
|
|
256
262
|
}
|
|
257
263
|
|
|
@@ -291,7 +297,9 @@
|
|
|
291
297
|
height: 2px;
|
|
292
298
|
background-color: var(--brand-SubdomainNavBar-border-nav-default);
|
|
293
299
|
opacity: 0;
|
|
294
|
-
transition:
|
|
300
|
+
transition:
|
|
301
|
+
opacity var(--brand-animation-duration-fast),
|
|
302
|
+
transform var(--brand-animation-duration-fast);
|
|
295
303
|
opacity: 1;
|
|
296
304
|
transform: scale(0);
|
|
297
305
|
transform-origin: center;
|
|
@@ -357,7 +365,9 @@
|
|
|
357
365
|
top: var(--base-size-48);
|
|
358
366
|
background-color: var(--base-color-scale-white-0);
|
|
359
367
|
border-radius: var(--brand-borderRadius-large);
|
|
360
|
-
animation:
|
|
368
|
+
animation:
|
|
369
|
+
fade-in-down 0.25s,
|
|
370
|
+
enlarge-shadow 250ms forwards;
|
|
361
371
|
animation-timing-function: var(--brand-animation-easing-default);
|
|
362
372
|
box-shadow: 0px 8px 24px rgba(1, 4, 9, 0.15);
|
|
363
373
|
overflow: hidden;
|
|
@@ -398,7 +408,9 @@
|
|
|
398
408
|
display: flex;
|
|
399
409
|
align-items: center;
|
|
400
410
|
justify-content: center;
|
|
401
|
-
transition:
|
|
411
|
+
transition:
|
|
412
|
+
border 250ms var(--brand-animation-easing-default),
|
|
413
|
+
box-shadow 250ms ease;
|
|
402
414
|
border-radius: var(--brand-borderRadius-medium);
|
|
403
415
|
box-shadow: 0 0 0 2px transparent;
|
|
404
416
|
}
|
|
@@ -439,23 +451,27 @@
|
|
|
439
451
|
transform-origin: top right;
|
|
440
452
|
}
|
|
441
453
|
|
|
442
|
-
.SubdomainNavBar-menu-button--close
|
|
454
|
+
.SubdomainNavBar-menu-button--close
|
|
455
|
+
.SubdomainNavBar-menu-button-bar:nth-of-type(1) {
|
|
443
456
|
transform: rotate(-45deg) translateY(-3px);
|
|
444
457
|
}
|
|
445
458
|
|
|
446
|
-
.SubdomainNavBar-menu-button--close
|
|
459
|
+
.SubdomainNavBar-menu-button--close
|
|
460
|
+
.SubdomainNavBar-menu-button-bar:nth-of-type(2) {
|
|
447
461
|
opacity: 0;
|
|
448
462
|
transform: scale(0);
|
|
449
463
|
}
|
|
450
464
|
|
|
451
|
-
.SubdomainNavBar-menu-button--close
|
|
465
|
+
.SubdomainNavBar-menu-button--close
|
|
466
|
+
.SubdomainNavBar-menu-button-bar:nth-of-type(3) {
|
|
452
467
|
transform: rotate(45deg) translateY(3px);
|
|
453
468
|
}
|
|
454
469
|
|
|
455
470
|
@media screen and (min-width: 48rem) {
|
|
456
471
|
.SubdomainNavBar-search-button:hover,
|
|
457
472
|
.SubdomainNavBar-menu-button:hover {
|
|
458
|
-
border: var(--brand-borderWidth-thick) solid
|
|
473
|
+
border: var(--brand-borderWidth-thick) solid
|
|
474
|
+
var(--brand-SubdomainNavBar-border-button-hover);
|
|
459
475
|
}
|
|
460
476
|
|
|
461
477
|
.SubdomainNavBar-search-button:active,
|
|
@@ -509,7 +525,8 @@
|
|
|
509
525
|
animation-timing-function: var(--brand-animation-easing-default);
|
|
510
526
|
}
|
|
511
527
|
|
|
512
|
-
.SubdomainNavBar-inner-container--search-open
|
|
528
|
+
.SubdomainNavBar-inner-container--search-open
|
|
529
|
+
.SubdomainNavBar-button-area--visible {
|
|
513
530
|
display: none;
|
|
514
531
|
}
|
|
515
532
|
|
|
@@ -572,7 +589,9 @@
|
|
|
572
589
|
}
|
|
573
590
|
}
|
|
574
591
|
|
|
575
|
-
.SubdomainNavBar-search-dialog
|
|
592
|
+
.SubdomainNavBar-search-dialog
|
|
593
|
+
.SubdomainNavBar-search-trigger
|
|
594
|
+
.SubdomainNavBar-search-button {
|
|
576
595
|
margin-right: 0;
|
|
577
596
|
}
|
|
578
597
|
|
|
@@ -3,15 +3,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
|
-
import { Heading, Text } from
|
|
7
|
-
import { Box } from
|
|
6
|
+
import { Heading, Text } from '@primer/react';
|
|
7
|
+
import { Box } from '@datalayer/primer-addons';
|
|
8
8
|
export const NbGradesDetails = (props) => {
|
|
9
9
|
const { studentItem } = props;
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}) }), _jsx(Box, { mt: 3, children: _jsx(Heading, { sx: { fontSize: 1 }, children: "Total" }) }), _jsxs(Box, { mt: 3, children: [studentItem?.nbgradesTotalScore, " / ", studentItem?.nbgradesTotalPoints] })] })
|
|
14
|
-
:
|
|
15
|
-
_jsxs(Box, { children: [_jsx(Box, { children: _jsx(Heading, { sx: { fontSize: 1 }, children: "Grades" }) }), _jsx(Box, { mt: 3, children: "Please grade your assignment." })] }));
|
|
10
|
+
return studentItem && studentItem?.nbgrades ? (_jsxs(Box, { children: [_jsx(Box, { children: _jsx(Heading, { sx: { fontSize: 1 }, children: "Grades" }) }), _jsx(Box, { mt: 3, children: studentItem?.nbgrades.map(nb => {
|
|
11
|
+
return (_jsx(Box, { children: _jsxs(Text, { sx: { fontSize: 'small' }, children: [nb.grade_id_s, ": ", nb.score_f] }) }));
|
|
12
|
+
}) }), _jsx(Box, { mt: 3, children: _jsx(Heading, { sx: { fontSize: 1 }, children: "Total" }) }), _jsxs(Box, { mt: 3, children: [studentItem?.nbgradesTotalScore, " / ", studentItem?.nbgradesTotalPoints] })] })) : (_jsxs(Box, { children: [_jsx(Box, { children: _jsx(Heading, { sx: { fontSize: 1 }, children: "Grades" }) }), _jsx(Box, { mt: 3, children: "Please grade your assignment." })] }));
|
|
16
13
|
};
|
|
17
14
|
export default NbGradesDetails;
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
|
-
import { Box } from
|
|
6
|
+
import { Box } from '@datalayer/primer-addons';
|
|
7
7
|
import { Lumino } from '@datalayer/jupyter-react';
|
|
8
8
|
export const JupyterNotebook = (props) => {
|
|
9
9
|
const { boxPanel, height } = props;
|
|
@@ -12,22 +12,22 @@ export const JupyterNotebook = (props) => {
|
|
|
12
12
|
'& .dla-Jupyter-Notebook': {
|
|
13
13
|
height,
|
|
14
14
|
maxHeight: 1000,
|
|
15
|
-
width: '100%'
|
|
15
|
+
width: '100%',
|
|
16
16
|
},
|
|
17
17
|
'& .jp-MainAreaWidget': {
|
|
18
18
|
width: '100%',
|
|
19
19
|
height,
|
|
20
20
|
},
|
|
21
21
|
'& .jp-Toolbar': {
|
|
22
|
-
width: '100% !important'
|
|
22
|
+
width: '100% !important',
|
|
23
23
|
},
|
|
24
24
|
'& .jp-NotebookPanel-notebook': {
|
|
25
25
|
width: '100% !important',
|
|
26
26
|
height,
|
|
27
27
|
},
|
|
28
28
|
'& .lm-mod-hidden': {
|
|
29
|
-
display: 'unset !important'
|
|
30
|
-
}
|
|
29
|
+
display: 'unset !important',
|
|
30
|
+
},
|
|
31
31
|
}, children: _jsx(Lumino, { children: boxPanel }) }) }));
|
|
32
32
|
};
|
|
33
33
|
JupyterNotebook.defaultProps = {
|
|
@@ -3,10 +3,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
|
-
import { CircleCurrentColorIcon, CircleGreenIcon, CircleOrangeIcon } from '@datalayer/icons-react';
|
|
6
|
+
import { CircleCurrentColorIcon, CircleGreenIcon, CircleOrangeIcon, } from '@datalayer/icons-react';
|
|
7
7
|
import { Text } from '@primer/react';
|
|
8
|
-
import { Box } from
|
|
9
|
-
import { Sparklines, SparklinesBars, SparklinesLine, SparklinesReferenceLine } from 'react-sparklines';
|
|
8
|
+
import { Box } from '@datalayer/primer-addons';
|
|
9
|
+
import { Sparklines, SparklinesBars, SparklinesLine, SparklinesReferenceLine, } from 'react-sparklines';
|
|
10
10
|
import { DatalayerThemeProvider } from '../../theme';
|
|
11
11
|
function boxMullerRandom() {
|
|
12
12
|
let phase = false;
|
|
@@ -3,7 +3,7 @@ import { AnimateProps } from '@primer/react-brand';
|
|
|
3
3
|
/**
|
|
4
4
|
* Layout
|
|
5
5
|
*/
|
|
6
|
-
export declare const Container: ({ children, style }: {
|
|
6
|
+
export declare const Container: ({ children, style, }: {
|
|
7
7
|
children: React.ReactElement[] | React.ReactElement;
|
|
8
8
|
style?: React.CSSProperties;
|
|
9
9
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,18 +2,20 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
/**
|
|
3
3
|
* Layout
|
|
4
4
|
*/
|
|
5
|
-
export const Container = ({ children, style }) => _jsx("div", { style: { maxWidth: 1024, margin: '0 auto', ...style }, children: children });
|
|
5
|
+
export const Container = ({ children, style, }) => (_jsx("div", { style: { maxWidth: 1024, margin: '0 auto', ...style }, children: children }));
|
|
6
6
|
export function RedlineBackground({ height, hasBorder = true, ...rest }) {
|
|
7
7
|
return (_jsx("div", { style: {
|
|
8
8
|
display: 'flex',
|
|
9
9
|
overflow: 'hidden',
|
|
10
|
-
border: hasBorder
|
|
10
|
+
border: hasBorder
|
|
11
|
+
? '1px solid var(--base-color-scale-red-2)'
|
|
12
|
+
: undefined,
|
|
11
13
|
backgroundImage: 'linear-gradient(45deg, var(--base-color-scale-red-0) 12.5%, hsla(var(--base-color-scale-red-2-hsl) / 50%) 12.5%, hsla(var(--base-color-scale-red-2-hsl) / 50%) 50%, var(--base-color-scale-red-0) 50%, var(--base-color-scale-red-0) 62.5%, hsla(var(--base-color-scale-red-2-hsl) / 50%) 62.5%, hsla(var(--base-color-scale-red-2-hsl) / 50%) 100%)',
|
|
12
14
|
backgroundSize: '5.66px 5.66px',
|
|
13
15
|
WebkitBoxPack: 'center',
|
|
14
16
|
justifyContent: 'center',
|
|
15
17
|
alignItems: 'center',
|
|
16
18
|
width: '100%',
|
|
17
|
-
height
|
|
19
|
+
height,
|
|
18
20
|
}, ...rest }));
|
|
19
21
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
import { registerPortalRoot } from
|
|
5
|
+
import { registerPortalRoot } from '@primer/react';
|
|
6
6
|
// import { render } from 'react-dom';
|
|
7
7
|
// import { Styles } from './Styles';
|
|
8
8
|
const PRIMER_PORTAL_ROOT_ID = '__primerPortalRoot__';
|
|
9
|
-
import
|
|
9
|
+
import '@primer/react-brand/lib/css/main.css';
|
|
10
10
|
/**
|
|
11
11
|
* Ensure we define a root for Primer portal root.
|
|
12
12
|
*
|
|
@@ -6,6 +6,6 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
6
6
|
import { ThemeProvider, BaseStyles } from '@primer/react';
|
|
7
7
|
import { jupyterLabTheme } from '@datalayer/jupyter-react';
|
|
8
8
|
export const Styles = () => {
|
|
9
|
-
return _jsx(_Fragment, { children: _jsx(ThemeProvider, { theme: jupyterLabTheme, children: _jsx(BaseStyles, {}) }) });
|
|
9
|
+
return (_jsx(_Fragment, { children: _jsx(ThemeProvider, { theme: jupyterLabTheme, children: _jsx(BaseStyles, {}) }) }));
|
|
10
10
|
};
|
|
11
11
|
export default Styles;
|
|
@@ -5,7 +5,7 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
5
5
|
*/
|
|
6
6
|
import { useEffect, useMemo, useState } from 'react';
|
|
7
7
|
import { ProgressBar, Tooltip, Button } from '@primer/react';
|
|
8
|
-
import { Box } from
|
|
8
|
+
import { Box } from '@datalayer/primer-addons';
|
|
9
9
|
import { useInterval } from 'usehooks-ts';
|
|
10
10
|
const CRITICAL_LEVEL = 90;
|
|
11
11
|
const WARNING_LEVEL = 75;
|
|
@@ -13,7 +13,7 @@ const WARNING_LEVEL = 75;
|
|
|
13
13
|
* Consumption progress bar
|
|
14
14
|
*/
|
|
15
15
|
export function ConsumptionBar(props) {
|
|
16
|
-
const { expiredAt, startedAt, burningRate, onClick, onUpdate, refreshInterval = 2000, style } = props;
|
|
16
|
+
const { expiredAt, startedAt, burningRate, onClick, onUpdate, refreshInterval = 2000, style, } = props;
|
|
17
17
|
const duration = useMemo(() => (expiredAt ? expiredAt - startedAt : Date.now() / 1000 - startedAt), [expiredAt, startedAt]);
|
|
18
18
|
const [progress, setProgress] = useState(expiredAt
|
|
19
19
|
? Math.min(Math.max(0, ((Date.now() / 1000 - startedAt) / duration) * 100), 100)
|
|
@@ -3,9 +3,9 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
3
3
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
|
-
import { useState, useEffect } from
|
|
7
|
-
import { Box } from
|
|
8
|
-
import { ConsumptionBar } from
|
|
6
|
+
import { useState, useEffect } from 'react';
|
|
7
|
+
import { Box } from '@datalayer/primer-addons';
|
|
8
|
+
import { ConsumptionBar } from '../../components/progress';
|
|
9
9
|
/**
|
|
10
10
|
* Credits indicator component.
|
|
11
11
|
*/
|
|
@@ -17,8 +17,5 @@ export function CreditsIndicator(props) {
|
|
|
17
17
|
setModel(model);
|
|
18
18
|
});
|
|
19
19
|
}, [kernelId, serviceManager]);
|
|
20
|
-
return model ?
|
|
21
|
-
_jsx(Box, { display: "flex", style: { alignItems: 'center' }, children: _jsx(ConsumptionBar, { startedAt: parseFloat(model.started_at), expiredAt: model.expired_at ? parseFloat(model.expired_at) : undefined, burningRate: model.burning_rate, onClick: onClick, onUpdate: onUpdate, style: { cursor: 'pointer' } }) })
|
|
22
|
-
:
|
|
23
|
-
_jsx(_Fragment, {});
|
|
20
|
+
return model ? (_jsx(Box, { display: "flex", style: { alignItems: 'center' }, children: _jsx(ConsumptionBar, { startedAt: parseFloat(model.started_at), expiredAt: model.expired_at ? parseFloat(model.expired_at) : undefined, burningRate: model.burning_rate, onClick: onClick, onUpdate: onUpdate, style: { cursor: 'pointer' } }) })) : (_jsx(_Fragment, {}));
|
|
24
21
|
}
|
|
@@ -12,7 +12,7 @@ function Item(props) {
|
|
|
12
12
|
transformOrigin: '50% 50%',
|
|
13
13
|
transform: 'rotate(-90deg)',
|
|
14
14
|
transition: 'all 0.2s ease-in-out',
|
|
15
|
-
strokeDasharray: `${(PROGRESS_SEGMENTS * props.progress) / 100}px ${PROGRESS_SEGMENTS}px
|
|
15
|
+
strokeDasharray: `${(PROGRESS_SEGMENTS * props.progress) / 100}px ${PROGRESS_SEGMENTS}px`,
|
|
16
16
|
}, cx: "8px", cy: "8px", r: "7px" }));
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
@@ -25,7 +25,7 @@ export function ProgressRing(props) {
|
|
|
25
25
|
return (_jsxs("svg", { className: "dla-progress-ring", viewBox: "0 0 16 16", role: "progressbar", "aria-valuenow": props.progress, "aria-valuemin": 0, "aria-valuemax": 100, ...others, children: [title && _jsx("title", { children: title }), _jsx("circle", { className: "background", cx: "8px", cy: "8px", r: "7px", style: {
|
|
26
26
|
stroke: 'var(--control-bgColor-rest)',
|
|
27
27
|
fill: 'none',
|
|
28
|
-
strokeWidth: '2px'
|
|
28
|
+
strokeWidth: '2px',
|
|
29
29
|
} }), children ?? _jsx(Item, { progress: progress, color: color })] }));
|
|
30
30
|
}
|
|
31
31
|
ProgressRing.Item = Item;
|
|
@@ -7,12 +7,12 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
|
7
7
|
import { nullTranslator } from '@jupyterlab/translation';
|
|
8
8
|
import { JSONExt } from '@lumino/coreutils';
|
|
9
9
|
import { Autocomplete, FormControl, TextInputWithTokens } from '@primer/react';
|
|
10
|
-
import { Box } from
|
|
10
|
+
import { Box } from '@datalayer/primer-addons';
|
|
11
11
|
/**
|
|
12
12
|
* Kernel variables picker
|
|
13
13
|
*/
|
|
14
14
|
export function KernelCellVariables(props) {
|
|
15
|
-
const { getInputOptions, inputs, setInputs, getOutputOptions, output, setOutput, translator } = props;
|
|
15
|
+
const { getInputOptions, inputs, setInputs, getOutputOptions, output, setOutput, translator, } = props;
|
|
16
16
|
const trans = useMemo(() => (translator ?? nullTranslator).load('jupyterlab'), [translator]);
|
|
17
17
|
const inputForOutputRef = useRef(null);
|
|
18
18
|
const [willSaveOutput, setWillSaveOutput] = useState(false);
|
|
@@ -26,7 +26,7 @@ export function KernelCellVariables(props) {
|
|
|
26
26
|
if (candidates.length) {
|
|
27
27
|
setInputsState([
|
|
28
28
|
...inputsState,
|
|
29
|
-
...candidates.map(text => ({ id: text, text, selected: true }))
|
|
29
|
+
...candidates.map(text => ({ id: text, text, selected: true })),
|
|
30
30
|
]);
|
|
31
31
|
}
|
|
32
32
|
}, [inputs]);
|
|
@@ -55,8 +55,8 @@ export function KernelCellVariables(props) {
|
|
|
55
55
|
.map(text => ({
|
|
56
56
|
id: text,
|
|
57
57
|
text,
|
|
58
|
-
selected: false
|
|
59
|
-
}))
|
|
58
|
+
selected: false,
|
|
59
|
+
})),
|
|
60
60
|
]);
|
|
61
61
|
setInputLoading(false);
|
|
62
62
|
});
|
|
@@ -87,7 +87,7 @@ export function KernelCellVariables(props) {
|
|
|
87
87
|
.map(text => ({
|
|
88
88
|
id: text,
|
|
89
89
|
text,
|
|
90
|
-
selected: false
|
|
90
|
+
selected: false,
|
|
91
91
|
})));
|
|
92
92
|
})
|
|
93
93
|
.catch(err => {
|
|
@@ -111,7 +111,7 @@ export function KernelCellVariables(props) {
|
|
|
111
111
|
setInputsState([
|
|
112
112
|
...inputsState.map(localItem => selectedIds.includes(localItem.id)
|
|
113
113
|
? Object.assign(localItem, { selected: true })
|
|
114
|
-
: Object.assign(localItem, { selected: false }))
|
|
114
|
+
: Object.assign(localItem, { selected: false })),
|
|
115
115
|
]);
|
|
116
116
|
}, [inputsState]);
|
|
117
117
|
const onItemSelect = useCallback((item) => {
|
|
@@ -160,10 +160,10 @@ export function KernelCellVariables(props) {
|
|
|
160
160
|
onItemSelect({
|
|
161
161
|
...item,
|
|
162
162
|
text: filterVal,
|
|
163
|
-
selected: true
|
|
163
|
+
selected: true,
|
|
164
164
|
});
|
|
165
165
|
setFilterVal('');
|
|
166
|
-
}
|
|
166
|
+
},
|
|
167
167
|
}
|
|
168
168
|
: undefined, items: inputsState, selectedItemIds: inputsState
|
|
169
169
|
.filter(item => item.selected)
|
|
@@ -88,14 +88,14 @@ export function RuntimeCellVariablesDialog(props) {
|
|
|
88
88
|
{
|
|
89
89
|
buttonType: 'default',
|
|
90
90
|
content: trans.__('Cancel'),
|
|
91
|
-
onClick: onClose
|
|
91
|
+
onClick: onClose,
|
|
92
92
|
},
|
|
93
93
|
{
|
|
94
94
|
buttonType: 'primary',
|
|
95
95
|
content: trans.__('Set variables'),
|
|
96
96
|
onClick: setVariables,
|
|
97
|
-
autoFocus: true
|
|
98
|
-
}
|
|
97
|
+
autoFocus: true,
|
|
98
|
+
},
|
|
99
99
|
], children: _jsx(KernelCellVariables, { inputs: inputs, getInputOptions: sessionContext ? getInputCandidates : undefined, setInputs: setInputs, output: output ?? undefined, getOutputOptions: getOutputCandidates, setOutput: setOutput, translator: translator }) }));
|
|
100
100
|
}
|
|
101
101
|
export default RuntimeCellVariablesDialog;
|