@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,9 +3,9 @@ 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 { useMemo } from
|
|
7
|
-
import { useTheme, Tooltip, Button } from
|
|
8
|
-
import { Box } from
|
|
6
|
+
import { useMemo } from 'react';
|
|
7
|
+
import { useTheme, Tooltip, Button } from '@primer/react';
|
|
8
|
+
import { Box } from '@datalayer/primer-addons';
|
|
9
9
|
const getExercisePoints = (studentItem) => {
|
|
10
10
|
if (studentItem && studentItem.points) {
|
|
11
11
|
return studentItem.points;
|
|
@@ -19,25 +19,44 @@ export const StudentItemStatus = (props) => {
|
|
|
19
19
|
const nokColor = useMemo(() => theme?.colorSchemes.light.colors.severe.muted, []);
|
|
20
20
|
if (student && studentItem) {
|
|
21
21
|
switch (studentItem.itemType) {
|
|
22
|
-
case
|
|
22
|
+
case 'dataset': {
|
|
23
23
|
const datasetColor = studentItem?.completed ? okColor : nokColor;
|
|
24
|
-
return _jsx(Box, { sx: {
|
|
24
|
+
return (_jsx(Box, { sx: {
|
|
25
|
+
backgroundColor: datasetColor,
|
|
26
|
+
width: '14px',
|
|
27
|
+
height: '14px',
|
|
28
|
+
borderRadius: 3,
|
|
29
|
+
}, ml: 1 }));
|
|
25
30
|
}
|
|
26
|
-
case
|
|
31
|
+
case 'lesson': {
|
|
27
32
|
const lessonColor = studentItem?.completed ? okColor : nokColor;
|
|
28
|
-
return _jsx(Box, { sx: {
|
|
33
|
+
return (_jsx(Box, { sx: {
|
|
34
|
+
backgroundColor: lessonColor,
|
|
35
|
+
width: '14px',
|
|
36
|
+
height: '14px',
|
|
37
|
+
borderRadius: 3,
|
|
38
|
+
}, ml: 1 }));
|
|
29
39
|
}
|
|
30
|
-
case
|
|
40
|
+
case 'exercise': {
|
|
31
41
|
const exerciseColor = getExercisePoints(studentItem) > 0 ? okColor : nokColor;
|
|
32
|
-
return _jsx(Box, { sx: {
|
|
42
|
+
return (_jsx(Box, { sx: {
|
|
43
|
+
backgroundColor: exerciseColor,
|
|
44
|
+
width: '14px',
|
|
45
|
+
height: '14px',
|
|
46
|
+
borderRadius: 3,
|
|
47
|
+
}, ml: 1 }));
|
|
33
48
|
}
|
|
34
|
-
case
|
|
35
|
-
return (_jsxs(Box, { display: "flex", children: [
|
|
36
|
-
_jsxs(Box, { children: [studentItem.nbgradesTotalScore, " /
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
49
|
+
case 'assignment':
|
|
50
|
+
return (_jsxs(Box, { display: "flex", children: [studentItem.nbgradesTotalScore !== undefined &&
|
|
51
|
+
studentItem.nbgradesTotalPoints !== undefined && (_jsxs(Box, { children: [studentItem.nbgradesTotalScore, " /", ' ', studentItem.nbgradesTotalPoints] })), studentItem.nbgrades && (_jsx(Box, { display: "flex", ml: 3, children: studentItem?.nbgrades.map(grade => {
|
|
52
|
+
const gradeColor = grade.score_f === grade.points_f ? okColor : nokColor;
|
|
53
|
+
return (_jsx(Tooltip, { text: grade.grade_id_s, children: _jsx(Button, { variant: "invisible", children: _jsx(Box, { sx: {
|
|
54
|
+
backgroundColor: gradeColor,
|
|
55
|
+
width: '14px',
|
|
56
|
+
height: '14px',
|
|
57
|
+
borderRadius: 3,
|
|
58
|
+
}, ml: 1 }) }) }));
|
|
59
|
+
}) }))] }));
|
|
41
60
|
default:
|
|
42
61
|
return _jsx(_Fragment, {});
|
|
43
62
|
}
|
|
@@ -65,7 +65,7 @@ export declare const SubNav: React.NamedExoticComponent<{
|
|
|
65
65
|
} & BaseProps<HTMLElement> & {
|
|
66
66
|
children?: ReactNode | undefined;
|
|
67
67
|
}> & {
|
|
68
|
-
readonly type: ({ id, children, className, "data-testid": testId, fullWidth, hasShadow }: SubNavProps) => import("react/jsx-runtime").JSX.Element;
|
|
68
|
+
readonly type: ({ id, children, className, "data-testid": testId, fullWidth, hasShadow, }: SubNavProps) => import("react/jsx-runtime").JSX.Element;
|
|
69
69
|
} & {
|
|
70
70
|
Heading: ({ href, children, className, "data-testid": testID, ...props }: SubNavHeadingProps) => import("react/jsx-runtime").JSX.Element;
|
|
71
71
|
Link: React.ForwardRefExoticComponent<Omit<SubNavLinkProps, "ref"> & React.RefAttributes<HTMLDivElement | HTMLAnchorElement>>;
|
|
@@ -5,11 +5,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
*/
|
|
6
6
|
import React, { Children, createContext, forwardRef, isValidElement, memo, useCallback, useContext, useEffect, useMemo, useRef, useState, } from 'react';
|
|
7
7
|
import { createPortal } from 'react-dom';
|
|
8
|
-
import { Button, ButtonGroup, Text, ThemeProvider, useWindowSize } from '@primer/react-brand';
|
|
8
|
+
import { Button, ButtonGroup, Text, ThemeProvider, useWindowSize, } from '@primer/react-brand';
|
|
9
9
|
import { ChevronDownIcon, ChevronUpIcon } from '@primer/octicons-react';
|
|
10
10
|
import { default as clsx } from 'clsx';
|
|
11
11
|
import { useId } from '../../hooks';
|
|
12
|
-
import { useKeyboardEscape, useOnClickOutside, useProvidedRefOrCreate, useContainsFocus } from '../../hooks';
|
|
12
|
+
import { useKeyboardEscape, useOnClickOutside, useProvidedRefOrCreate, useContainsFocus, } from '../../hooks';
|
|
13
13
|
/**
|
|
14
14
|
* Design tokens
|
|
15
15
|
*/
|
|
@@ -69,7 +69,7 @@ function SubNavProvider({ children }) {
|
|
|
69
69
|
}, []);
|
|
70
70
|
return (_jsxs(SubNavContext.Provider, { value: value, children: [children, _jsx("div", { className: styles['SubNav__anchor-menu-outer-container'], ref: anchoredNavOuterPortalRef, children: _jsx("div", { className: clsx(styles['SubNav__anchor-menu-container']), ref: anchoredNavPortalRef }) })] }));
|
|
71
71
|
}
|
|
72
|
-
const _SubNavRoot = memo(({ id, children, className, 'data-testid': testId, fullWidth, hasShadow }) => {
|
|
72
|
+
const _SubNavRoot = memo(({ id, children, className, 'data-testid': testId, fullWidth, hasShadow, }) => {
|
|
73
73
|
const rootRef = React.useRef(null);
|
|
74
74
|
const navRef = React.useRef(null);
|
|
75
75
|
const overlayRef = React.useRef(null);
|
|
@@ -125,12 +125,16 @@ const _SubNavRoot = memo(({ id, children, className, 'data-testid': testId, full
|
|
|
125
125
|
if (subMenu?.props?.variant === 'anchor') {
|
|
126
126
|
acc.links.push(React.cloneElement(child, {
|
|
127
127
|
children: [link],
|
|
128
|
-
onClick: child.props['aria-current']
|
|
128
|
+
onClick: child.props['aria-current']
|
|
129
|
+
? closeMenuCallback
|
|
130
|
+
: child.props.onClick,
|
|
129
131
|
}));
|
|
130
132
|
}
|
|
131
133
|
else {
|
|
132
134
|
acc.links.push(React.cloneElement(child, {
|
|
133
|
-
onClick: child.props['aria-current']
|
|
135
|
+
onClick: child.props['aria-current']
|
|
136
|
+
? closeMenuCallback
|
|
137
|
+
: child.props.onClick,
|
|
134
138
|
}));
|
|
135
139
|
}
|
|
136
140
|
}
|
|
@@ -140,13 +144,16 @@ const _SubNavRoot = memo(({ id, children, className, 'data-testid': testId, full
|
|
|
140
144
|
}
|
|
141
145
|
return acc;
|
|
142
146
|
}, { heading: undefined, links: [], action: undefined });
|
|
143
|
-
const activeLinklabel = typeof activeLink?.props.children === 'string'
|
|
147
|
+
const activeLinklabel = typeof activeLink?.props.children === 'string'
|
|
148
|
+
? activeLink.props.children
|
|
149
|
+
: activeLink?.props.children[0];
|
|
144
150
|
// needed to prevent rendering of anchor subnav inside the narrow <Button variant="invisible"> element
|
|
145
|
-
const MaybeSubNav = activeLink?.props.children?.[1]?.props?.variant === 'anchor' &&
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
151
|
+
const MaybeSubNav = activeLink?.props.children?.[1]?.props?.variant === 'anchor' &&
|
|
152
|
+
activeLink.props.children?.[1];
|
|
153
|
+
return (_jsx("div", { className: clsx(styles['SubNav__container'], hasAnchoredNav && styles['SubNav__container--with-anchor-nav']), children: _jsx(SubNavProvider, { children: _jsx("nav", { ref: navRef, id: id, className: clsx(styles.SubNav, isOpenAtNarrow && styles['SubNav--open'], hasShadow && styles['SubNav--has-shadow'], fullWidth && styles['SubNav--full-width'], className), "data-testid": testId || testIds.root, children: _jsxs("div", { ref: rootRef, className: styles['SubNav--header-container-outer'], children: [_jsxs("div", { className: styles['SubNav__header-container'], children: [HeadingChild && (_jsx("div", { className: styles['SubNav__heading-container'], children: HeadingChild })), !isLarge && (_jsxs("button", { className: clsx(styles['SubNav__overlay-toggle'], isOpenAtNarrow && styles['SubNav__overlay-toggle--open']), "data-testid": testIds.button, onClick: isOpenAtNarrow ? closeMenuCallback : handleMenuToggle, "aria-expanded": isOpenAtNarrow ? 'true' : 'false', "aria-controls": idForLinkContainer, children: [activeLinklabel && (_jsxs("span", { className: "visually-hidden", children: ["Navigation menu. Current page:", ' '] })), _jsxs("span", { className: clsx(styles['SubNav__overlay-toggle-content'], !activeLinklabel &&
|
|
154
|
+
styles['SubNav__overlay-toggle-content--end']), children: [activeLinklabel && (_jsx(Text, { as: "span", size: "200", children: activeLinklabel })), isOpenAtNarrow ? (_jsx(ChevronUpIcon, { className: styles['SubNav__overlay-toggle-icon'], size: 24 })) : (_jsx(ChevronDownIcon, { className: styles['SubNav__overlay-toggle-icon'], size: 24 }))] })] })), MaybeSubNav && MaybeSubNav] }), LinkChildren.length && (_jsxs("ul", { ref: overlayRef, id: idForLinkContainer, className: clsx(styles['SubNav__links-overlay'], isOpenAtNarrow && styles['SubNav__links-overlay--open']), "data-testid": testIds.overlay, children: [ActionChild ? (_jsx("li", { className: styles['SubNav__action-container'], children: ActionChild })) : (_jsx("li", { className: styles['SubNav__action-container'] })), LinkChildren, _jsx(ButtonGroup, { buttonSize: "small", children: _jsx(Button, { href: "#", onClick: e => {
|
|
155
|
+
window.location.assign('https://datalayer.app');
|
|
156
|
+
}, hasArrow: true, variant: "subtle", children: "Login" }) })] }))] }) }) }) }));
|
|
150
157
|
});
|
|
151
158
|
const SubNavHeading = ({ href, children, className, 'data-testid': testID, ...props }) => {
|
|
152
159
|
return (_jsx("a", { href: href, className: clsx(styles['SubNav__heading'], className), "data-testid": testIds.heading || testID, ...props, children: children }));
|
|
@@ -170,7 +177,9 @@ const SubNavLinkWithSubmenu = forwardRef(({ children, href, 'aria-current': aria
|
|
|
170
177
|
* onFocus and onBlur need to be defined to keep the jsx-a11y/mouse-events-have-key-events
|
|
171
178
|
* eslint rule happy. The focus/blur behaviour is handled by useContainsFocus
|
|
172
179
|
*/
|
|
173
|
-
onFocus: () => null, onBlur: () => null, children: [_jsx("a", { href: href, className: clsx(styles['SubNav__link'], ariaCurrent && styles['SubNav__link--active'], className), "aria-current": ariaCurrent, ...props, children: _jsx(Text, { as: "span", size: "200", weight: "semibold", className: styles['SubNav__link-label'], variant: ariaCurrent === 'page' || variant === 'default'
|
|
180
|
+
onFocus: () => null, onBlur: () => null, children: [_jsx("a", { href: href, className: clsx(styles['SubNav__link'], ariaCurrent && styles['SubNav__link--active'], className), "aria-current": ariaCurrent, ...props, children: _jsx(Text, { as: "span", size: "200", weight: "semibold", className: styles['SubNav__link-label'], variant: ariaCurrent === 'page' || variant === 'default'
|
|
181
|
+
? 'default'
|
|
182
|
+
: 'muted', children: label }) }), isLarge && (_jsx("button", { className: styles['SubNav__sub-menu-toggle'], onClick: handleOnClick, "aria-expanded": isExpanded ? 'true' : 'false', "aria-controls": submenuId, "aria-label": `${isExpanded ? 'Close' : 'Open'} submenu`, children: _jsx(ChevronDownIcon, { className: styles['SubNav__sub-menu-icon'], size: 16 }) })), _jsx("div", { id: submenuId, className: styles['SubNav__sub-menu-children'], children: SubMenuChildren })] }));
|
|
174
183
|
});
|
|
175
184
|
const SubNavLink = forwardRef((props, ref) => {
|
|
176
185
|
const [isInView, setIsInView] = useState(false);
|
|
@@ -188,8 +197,12 @@ const SubNavLink = forwardRef((props, ref) => {
|
|
|
188
197
|
if (!target)
|
|
189
198
|
return;
|
|
190
199
|
const topOfWindow = '0px 0px -100%';
|
|
191
|
-
const observerParams = {
|
|
192
|
-
|
|
200
|
+
const observerParams = {
|
|
201
|
+
threshold: 0,
|
|
202
|
+
root: null,
|
|
203
|
+
rootMargin: topOfWindow,
|
|
204
|
+
};
|
|
205
|
+
const handleIntersectionUpdate = ([entry,]) => {
|
|
193
206
|
setIsInView(entry.isIntersecting);
|
|
194
207
|
};
|
|
195
208
|
const observer = new IntersectionObserver(handleIntersectionUpdate, observerParams);
|
|
@@ -205,7 +218,9 @@ const SubNavLink = forwardRef((props, ref) => {
|
|
|
205
218
|
return (_jsx("li", { children: _jsx(SubNavLinkWithSubmenu, { ...props, ref: ref, _subMenuVariant: isAnchorVariantSubMenu ? 'anchor' : undefined }) }));
|
|
206
219
|
}
|
|
207
220
|
const { children, href, 'aria-current': ariaCurrent, 'data-testid': testId, variant, className, ...rest } = props;
|
|
208
|
-
return (_jsx("li", { children: _jsx("a", { href: href, className: clsx(styles['SubNav__link'], ariaCurrent && styles['SubNav__link--active'], isInView && styles['SubNav__link--is-in-view'], className), "aria-current": ariaCurrent, "data-testid": testId || testIds.link, ref: ref, ...rest, children: _jsx(Text, { as: "span", size: "100", weight: "semibold", className: styles['SubNav__link-label'], variant: ariaCurrent === 'page' || variant === 'default'
|
|
221
|
+
return (_jsx("li", { children: _jsx("a", { href: href, className: clsx(styles['SubNav__link'], ariaCurrent && styles['SubNav__link--active'], isInView && styles['SubNav__link--is-in-view'], className), "aria-current": ariaCurrent, "data-testid": testId || testIds.link, ref: ref, ...rest, children: _jsx(Text, { as: "span", size: "100", weight: "semibold", className: styles['SubNav__link-label'], variant: ariaCurrent === 'page' || variant === 'default'
|
|
222
|
+
? 'default'
|
|
223
|
+
: 'muted', children: children }) }) }));
|
|
209
224
|
});
|
|
210
225
|
function SubMenu({ children, className, variant = 'dropdown', ...props }) {
|
|
211
226
|
const context = React.useContext(SubNavContext);
|
|
@@ -104,8 +104,11 @@
|
|
|
104
104
|
opacity: 0;
|
|
105
105
|
background-color: transparent;
|
|
106
106
|
transform: translateY(var(--brand-animation-variant-slideInDown-distance));
|
|
107
|
-
transition:
|
|
108
|
-
|
|
107
|
+
transition:
|
|
108
|
+
opacity var(--brand-animation-duration-default)
|
|
109
|
+
var(--brand-animation-easing-default),
|
|
110
|
+
background-color var(--brand-animation-duration-default)
|
|
111
|
+
var(--brand-animation-easing-default);
|
|
109
112
|
}
|
|
110
113
|
|
|
111
114
|
.SubNav__anchor-menu-outer-container--stuck .SubNav__anchor-menu-container {
|
|
@@ -116,7 +119,8 @@
|
|
|
116
119
|
|
|
117
120
|
.SubNav__anchor-menu-outer-container {
|
|
118
121
|
height: 0;
|
|
119
|
-
transition: height var(--brand-animation-duration-default)
|
|
122
|
+
transition: height var(--brand-animation-duration-default)
|
|
123
|
+
var(--brand-animation-easing-default);
|
|
120
124
|
}
|
|
121
125
|
|
|
122
126
|
.SubNav__anchor-menu-outer-container--stuck {
|
|
@@ -127,9 +131,13 @@
|
|
|
127
131
|
opacity: 0;
|
|
128
132
|
visibility: hidden;
|
|
129
133
|
transform: translateY(var(--brand-animation-variant-slideInDown-distance));
|
|
130
|
-
transition:
|
|
131
|
-
|
|
132
|
-
|
|
134
|
+
transition:
|
|
135
|
+
opacity var(--brand-animation-duration-default)
|
|
136
|
+
var(--brand-animation-easing-default),
|
|
137
|
+
height var(--brand-animation-duration-default)
|
|
138
|
+
var(--brand-animation-easing-default),
|
|
139
|
+
transform var(--brand-animation-duration-default)
|
|
140
|
+
var(--brand-animation-easing-default);
|
|
133
141
|
}
|
|
134
142
|
|
|
135
143
|
.SubNav__anchor-menu-outer-container--stuck .SubNav__sub-menu--anchor {
|
|
@@ -159,7 +167,8 @@
|
|
|
159
167
|
.SubNav__sub-menu--anchor .SubNav__link--is-in-view .SubNav__link-label::after,
|
|
160
168
|
.SubNav__link:hover .SubNav__link-label::after,
|
|
161
169
|
.SubNav__link:focus-visible .SubNav__link-label::after,
|
|
162
|
-
.SubNav__link[aria-current]:not([aria-current='false'])
|
|
170
|
+
.SubNav__link[aria-current]:not([aria-current='false'])
|
|
171
|
+
.SubNav__link-label::after {
|
|
163
172
|
opacity: 1;
|
|
164
173
|
transform: scale(0.8, 1);
|
|
165
174
|
}
|
|
@@ -177,7 +186,9 @@
|
|
|
177
186
|
}
|
|
178
187
|
|
|
179
188
|
.SubNav__link:focus-visible .SubNav__link-label::after,
|
|
180
|
-
.SubNav__sub-menu--anchor
|
|
189
|
+
.SubNav__sub-menu--anchor
|
|
190
|
+
.SubNav__link--is-in-view:focus-visible
|
|
191
|
+
.SubNav__link-label::after {
|
|
181
192
|
opacity: 0;
|
|
182
193
|
}
|
|
183
194
|
|
|
@@ -196,19 +207,23 @@
|
|
|
196
207
|
height: 2px;
|
|
197
208
|
border-width: 2px;
|
|
198
209
|
border-bottom: var(--base-size-2) solid var(--brand-color-text-muted);
|
|
199
|
-
transition:
|
|
210
|
+
transition:
|
|
211
|
+
opacity var(--brand-animation-duration-fast),
|
|
212
|
+
transform var(--brand-animation-duration-fast),
|
|
200
213
|
border-color var(--brand-animation-duration-fast);
|
|
201
214
|
opacity: 1;
|
|
202
215
|
transform: scale(0);
|
|
203
216
|
transform-origin: center;
|
|
204
217
|
}
|
|
205
218
|
|
|
206
|
-
.SubNav__link[aria-current]:not([aria-current='false'])
|
|
219
|
+
.SubNav__link[aria-current]:not([aria-current='false'])
|
|
220
|
+
.SubNav__link-label::after {
|
|
207
221
|
border-color: var(--brand-color-text-default);
|
|
208
222
|
}
|
|
209
223
|
|
|
210
224
|
.SubNav__link:hover .SubNav__link-label {
|
|
211
|
-
transition: color var(--brand-animation-duration-fast)
|
|
225
|
+
transition: color var(--brand-animation-duration-fast)
|
|
226
|
+
var(--brand-animation-easing-default);
|
|
212
227
|
color: var(--brand-SubNav-color-link-active);
|
|
213
228
|
}
|
|
214
229
|
|
|
@@ -254,8 +269,11 @@
|
|
|
254
269
|
.SubNav--open::after {
|
|
255
270
|
opacity: 0.3;
|
|
256
271
|
visibility: visible;
|
|
257
|
-
transition:
|
|
258
|
-
|
|
272
|
+
transition:
|
|
273
|
+
visibility var(--brand-animation-duration-default)
|
|
274
|
+
var(--brand-animation-easing-default),
|
|
275
|
+
opacity var(--brand-animation-duration-default)
|
|
276
|
+
var(--brand-animation-easing-default);
|
|
259
277
|
}
|
|
260
278
|
|
|
261
279
|
.SubNav__heading {
|
|
@@ -287,7 +305,9 @@
|
|
|
287
305
|
z-index: 9998;
|
|
288
306
|
}
|
|
289
307
|
|
|
290
|
-
.SubNav__heading-separator:not(
|
|
308
|
+
.SubNav__heading-separator:not(
|
|
309
|
+
.SubNav__heading-separator--has-adjacent-label
|
|
310
|
+
) {
|
|
291
311
|
display: none;
|
|
292
312
|
}
|
|
293
313
|
|
|
@@ -313,7 +333,9 @@
|
|
|
313
333
|
color: var(--brand-color-text-default);
|
|
314
334
|
}
|
|
315
335
|
|
|
316
|
-
.SubNav__links-overlay--open
|
|
336
|
+
.SubNav__links-overlay--open
|
|
337
|
+
.SubNav__link--has-sub-menu:hover
|
|
338
|
+
.SubNav__link-label {
|
|
317
339
|
color: var(--brand-color-text-muted);
|
|
318
340
|
}
|
|
319
341
|
|
|
@@ -350,7 +372,9 @@
|
|
|
350
372
|
position: relative;
|
|
351
373
|
}
|
|
352
374
|
|
|
353
|
-
.SubNav__links-overlay--open
|
|
375
|
+
.SubNav__links-overlay--open
|
|
376
|
+
.SubNav__link[aria-current]:not([aria-current='false'])
|
|
377
|
+
* {
|
|
354
378
|
color: var(--brand-SubNav-color-link-active);
|
|
355
379
|
}
|
|
356
380
|
|
|
@@ -403,7 +427,11 @@
|
|
|
403
427
|
top: 0;
|
|
404
428
|
bottom: 0;
|
|
405
429
|
width: var(--base-size-32);
|
|
406
|
-
background: linear-gradient(
|
|
430
|
+
background: linear-gradient(
|
|
431
|
+
to left,
|
|
432
|
+
var(--brand-color-canvas-default),
|
|
433
|
+
transparent
|
|
434
|
+
);
|
|
407
435
|
pointer-events: none;
|
|
408
436
|
z-index: 100;
|
|
409
437
|
}
|
|
@@ -444,7 +472,8 @@
|
|
|
444
472
|
|
|
445
473
|
.SubNav__link:hover .SubNav__link-label::after,
|
|
446
474
|
.SubNav__link:focus-visible .SubNav__link-label::after,
|
|
447
|
-
.SubNav__link[aria-current]:not([aria-current='false'])
|
|
475
|
+
.SubNav__link[aria-current]:not([aria-current='false'])
|
|
476
|
+
.SubNav__link-label::after {
|
|
448
477
|
opacity: 1;
|
|
449
478
|
transform: scale(1);
|
|
450
479
|
}
|
|
@@ -566,7 +595,8 @@
|
|
|
566
595
|
.SubNav__sub-menu.SubNav__sub-menu--dropdown {
|
|
567
596
|
background-clip: padding-box;
|
|
568
597
|
background-color: var(--brand-SubNav-color-subMenu-bgColor);
|
|
569
|
-
border: var(--borderWidth-thin, max(1px, 0.0625rem)) solid
|
|
598
|
+
border: var(--borderWidth-thin, max(1px, 0.0625rem)) solid
|
|
599
|
+
var(--borderColor-default, var(--color-border-default));
|
|
570
600
|
border-radius: var(--brand-borderRadius-xlarge, 0.375rem);
|
|
571
601
|
box-shadow: var(--shadow-floating-legacy, var(--color-shadow-large));
|
|
572
602
|
left: 0;
|
|
@@ -636,14 +666,18 @@
|
|
|
636
666
|
}
|
|
637
667
|
|
|
638
668
|
/* Show underline on submenu parent when child has aria-current */
|
|
639
|
-
.SubNav__link--has-sub-menu:has(
|
|
669
|
+
.SubNav__link--has-sub-menu:has(
|
|
670
|
+
.SubNav__link[aria-current]:not([aria-current='false'])
|
|
671
|
+
)
|
|
640
672
|
> .SubNav__link
|
|
641
673
|
.SubNav__link-label::after {
|
|
642
674
|
opacity: 1;
|
|
643
675
|
transform: scale(0.8, 1);
|
|
644
676
|
}
|
|
645
677
|
|
|
646
|
-
.SubNav__link--has-sub-menu
|
|
678
|
+
.SubNav__link--has-sub-menu
|
|
679
|
+
.SubNav__link[aria-current]:not([aria-current='false'])
|
|
680
|
+
.SubNav__link-label::after,
|
|
647
681
|
.SubNav__link--has-sub-menu .SubNav__link:hover .SubNav__link-label::after {
|
|
648
682
|
opacity: 1;
|
|
649
683
|
transform: scale(1);
|
|
@@ -11,9 +11,6 @@ const DataTableDetails = (props) => {
|
|
|
11
11
|
};
|
|
12
12
|
export const DataTable = (props) => {
|
|
13
13
|
const [dialog, setDialog] = useState(false);
|
|
14
|
-
return (_jsxs(_Fragment, { children: [_jsx(Box, { children: dialog ?
|
|
15
|
-
_jsx(Dialog, { sx: { width: "100%", height: '100%' }, onClose: e => setDialog(false), children: _jsx(DataTableDetails, { ...props }) })
|
|
16
|
-
:
|
|
17
|
-
_jsx(DataTableDetails, { ...props }) }), _jsx(Box, { children: _jsx(Button, { onClick: e => setDialog(true), children: "Zoom" }) })] }));
|
|
14
|
+
return (_jsxs(_Fragment, { children: [_jsx(Box, { children: dialog ? (_jsx(Dialog, { sx: { width: '100%', height: '100%' }, onClose: e => setDialog(false), children: _jsx(DataTableDetails, { ...props }) })) : (_jsx(DataTableDetails, { ...props })) }), _jsx(Box, { children: _jsx(Button, { onClick: e => setDialog(true), children: "Zoom" }) })] }));
|
|
18
15
|
};
|
|
19
16
|
export default DataTable;
|
|
@@ -40,10 +40,15 @@ export function TextRevealAnimation({ children, ...rest }) {
|
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
}, [ref]);
|
|
43
|
-
if (typeof children !== 'string' &&
|
|
43
|
+
if (typeof children !== 'string' &&
|
|
44
|
+
(process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test')) {
|
|
44
45
|
console.warn('Children passed to TextRevealAnimation must be a string');
|
|
45
46
|
return null;
|
|
46
47
|
}
|
|
47
48
|
return (_jsx("span", { ref: ref, ...rest, children: lines?.map((line, i) => (_jsxs(React.Fragment, { children: [_jsx("span", { className: clsx(styles.TextRevealAnimation, animationStarted && styles['TextRevealAnimation--visible'], animationStarted &&
|
|
48
|
-
(hasAnimationCompleted
|
|
49
|
+
(hasAnimationCompleted
|
|
50
|
+
? styles['TextRevealAnimation']
|
|
51
|
+
: styles['TextRevealAnimation--animated'])), style: {
|
|
52
|
+
'--animation-delay': `${220 + i * 200}ms`,
|
|
53
|
+
}, onAnimationEnd: () => onLineAnimationEnd(i), children: line }), ' '] }, line))) }));
|
|
49
54
|
}
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
|
|
15
15
|
.TextRevealAnimation {
|
|
16
16
|
opacity: 0;
|
|
17
|
-
transition: opacity var(--brand-animation-duration-default)
|
|
17
|
+
transition: opacity var(--brand-animation-duration-default)
|
|
18
|
+
var(--brand-animation-easing-default);
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
.TextRevealAnimation--visible {
|
|
@@ -38,6 +39,7 @@
|
|
|
38
39
|
height: 100%;
|
|
39
40
|
background-color: var(--brand-color-accent-primary);
|
|
40
41
|
transform-origin: right;
|
|
41
|
-
animation: wipe var(--brand-animation-duration-extended) forwards
|
|
42
|
+
animation: wipe var(--brand-animation-duration-extended) forwards
|
|
43
|
+
var(--brand-animation-easing-default);
|
|
42
44
|
animation-delay: var(--animation-delay);
|
|
43
45
|
}
|
|
@@ -3,15 +3,15 @@ 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 { Token } from
|
|
7
|
-
import { ProjectIcon } from
|
|
8
|
-
import { StudentIcon } from
|
|
6
|
+
import { Token } from '@primer/react';
|
|
7
|
+
import { ProjectIcon } from '@primer/octicons-react';
|
|
8
|
+
import { StudentIcon } from '@datalayer/icons-react';
|
|
9
9
|
export const SpaceVariantToken = (props) => {
|
|
10
10
|
const { variant } = props;
|
|
11
11
|
switch (variant) {
|
|
12
|
-
case
|
|
12
|
+
case 'default':
|
|
13
13
|
return _jsx(Token, { text: "default", leadingVisual: ProjectIcon });
|
|
14
|
-
case
|
|
14
|
+
case 'course':
|
|
15
15
|
return _jsx(Token, { text: "course", leadingVisual: StudentIcon });
|
|
16
16
|
default:
|
|
17
17
|
return _jsx(_Fragment, {});
|
|
@@ -11,8 +11,6 @@ export const AssignmentEditorToolbar = (props) => {
|
|
|
11
11
|
const { notebookId } = props;
|
|
12
12
|
const { grade } = useGradeStore();
|
|
13
13
|
const notebook = notebookStore.getState().selectNotebook(notebookId);
|
|
14
|
-
return (_jsxs(Box, { display: "flex", children: [_jsx(Box, { children: _jsx(Button, { variant: "invisible", size: "small", leadingVisual: RepoPushIcon, onClick: () => grade(new Date()), children: "Grade" }) }), notebook?.kernelStatus !== 'busy' &&
|
|
15
|
-
_jsx(Box, { children: _jsx(Button, { variant: "invisible", size: "small", leadingVisual: PlayIcon, onClick: e => notebookStore.getState().runAll(notebookId), children: "Run all" }) }), notebook?.kernelStatus === 'busy' &&
|
|
16
|
-
_jsx(Box, { children: _jsx(Button, { variant: "danger", size: "small", leadingVisual: StopIcon, onClick: e => notebookStore.getState().interrupt(notebookId), children: "Interrupt" }) })] }));
|
|
14
|
+
return (_jsxs(Box, { display: "flex", children: [_jsx(Box, { children: _jsx(Button, { variant: "invisible", size: "small", leadingVisual: RepoPushIcon, onClick: () => grade(new Date()), children: "Grade" }) }), notebook?.kernelStatus !== 'busy' && (_jsx(Box, { children: _jsx(Button, { variant: "invisible", size: "small", leadingVisual: PlayIcon, onClick: e => notebookStore.getState().runAll(notebookId), children: "Run all" }) })), notebook?.kernelStatus === 'busy' && (_jsx(Box, { children: _jsx(Button, { variant: "danger", size: "small", leadingVisual: StopIcon, onClick: e => notebookStore.getState().interrupt(notebookId), children: "Interrupt" }) }))] }));
|
|
17
15
|
};
|
|
18
16
|
export default AssignmentEditorToolbar;
|
|
@@ -15,4 +15,4 @@ export type IPeersIndicatorProps = {
|
|
|
15
15
|
/**
|
|
16
16
|
* Connected peers indicator
|
|
17
17
|
*/
|
|
18
|
-
export declare function PeersIndicator({ awareness, currentUserHandle }: IPeersIndicatorProps): JSX.Element | null;
|
|
18
|
+
export declare function PeersIndicator({ awareness, currentUserHandle, }: IPeersIndicatorProps): JSX.Element | null;
|
|
@@ -18,7 +18,7 @@ var NotificationType;
|
|
|
18
18
|
const MSG_TO_NOTIFICATION = {
|
|
19
19
|
'-1': NotificationType.ERROR,
|
|
20
20
|
'0': NotificationType.PROGRESS,
|
|
21
|
-
'1': NotificationType.SUCCESS
|
|
21
|
+
'1': NotificationType.SUCCESS,
|
|
22
22
|
};
|
|
23
23
|
function isExpired(timestamp) {
|
|
24
24
|
// Timestamp is expired if older than 10 seconds ago
|
|
@@ -31,7 +31,7 @@ function defaultAvatarSrc(color, text) {
|
|
|
31
31
|
/**
|
|
32
32
|
* Connected peers indicator
|
|
33
33
|
*/
|
|
34
|
-
export function PeersIndicator({ awareness, currentUserHandle }) {
|
|
34
|
+
export function PeersIndicator({ awareness, currentUserHandle, }) {
|
|
35
35
|
const [peers, setPeers] = useState([]);
|
|
36
36
|
useEffect(() => {
|
|
37
37
|
const onAwarenessChange = () => {
|
|
@@ -58,7 +58,7 @@ export function PeersIndicator({ awareness, currentUserHandle }) {
|
|
|
58
58
|
notificationType: notExpiredNotification &&
|
|
59
59
|
peer.notification?.message_type !== undefined
|
|
60
60
|
? MSG_TO_NOTIFICATION[peer.notification?.message_type.toString()]
|
|
61
|
-
: undefined
|
|
61
|
+
: undefined,
|
|
62
62
|
}
|
|
63
63
|
: {
|
|
64
64
|
avatarUrl: user.avatar_url,
|
|
@@ -66,7 +66,7 @@ export function PeersIndicator({ awareness, currentUserHandle }) {
|
|
|
66
66
|
displayName: user.display_name,
|
|
67
67
|
handle: user.name,
|
|
68
68
|
initials: user.initials,
|
|
69
|
-
username: user.username
|
|
69
|
+
username: user.username,
|
|
70
70
|
};
|
|
71
71
|
// Ensure to display a peer only once
|
|
72
72
|
if (!agg.map(p => p.username).includes(newPeer.username)) {
|
|
@@ -92,7 +92,7 @@ export function PeersIndicator({ awareness, currentUserHandle }) {
|
|
|
92
92
|
return (_jsx(Avatar, { sx: {
|
|
93
93
|
border: peer.notificationType
|
|
94
94
|
? `var(--borderWidth-thick) solid ${peer.notificationType}`
|
|
95
|
-
: 'none'
|
|
95
|
+
: 'none',
|
|
96
96
|
}, title: title, src: peer.avatarUrl
|
|
97
97
|
? getAvatarURL(peer.avatarUrl)
|
|
98
98
|
: defaultAvatarSrc(peer.color, peer.initials), size: AVATAR_SIZE }, peer.displayName));
|
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
import { ISignal } from '@lumino/signaling';
|
|
2
2
|
export declare const FORCE_ACTIVATE_RUNTIMES_PLUGINS = false;
|
|
3
|
+
/**
|
|
4
|
+
* Configuration interface for Datalayer platform integration
|
|
5
|
+
*
|
|
6
|
+
* This interface defines the configuration needed to connect to
|
|
7
|
+
* and interact with the Datalayer platform services.
|
|
8
|
+
*/
|
|
3
9
|
export type IDatalayerCoreConfig = {
|
|
10
|
+
/**
|
|
11
|
+
* Datalayer RUN URL.
|
|
12
|
+
* The base URL for the Datalayer platform API.
|
|
13
|
+
* @example "https://prod1.datalayer.run"
|
|
14
|
+
*/
|
|
15
|
+
runUrl: string;
|
|
16
|
+
/**
|
|
17
|
+
* Datalayer API authentication token.
|
|
18
|
+
* Used for authenticating requests to the Datalayer platform.
|
|
19
|
+
*/
|
|
20
|
+
token: string;
|
|
21
|
+
/**
|
|
22
|
+
* Credits limit for kernel usage.
|
|
23
|
+
* Determines the maximum credits that can be consumed by kernels.
|
|
24
|
+
*/
|
|
25
|
+
credits: number;
|
|
26
|
+
/**
|
|
27
|
+
* CPU environment name.
|
|
28
|
+
* Specifies which CPU-based environment to use for kernels.
|
|
29
|
+
* @example "python-cpu-env"
|
|
30
|
+
*/
|
|
31
|
+
cpuEnvironment: string;
|
|
32
|
+
/**
|
|
33
|
+
* GPU environment name.
|
|
34
|
+
* Specifies which GPU-enabled environment to use for kernels.
|
|
35
|
+
* @example "ai-env"
|
|
36
|
+
*/
|
|
37
|
+
gpuEnvironment: string;
|
|
4
38
|
/**
|
|
5
39
|
* Use mock model, useful for e.g. storybooks.
|
|
6
40
|
*/
|
|
@@ -108,4 +142,18 @@ export declare class DatalayerConfiguration {
|
|
|
108
142
|
get configuration(): IDatalayerCoreConfig;
|
|
109
143
|
get configurationChanged(): ISignal<DatalayerConfiguration, IDatalayerCoreConfig>;
|
|
110
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Default configuration values for Datalayer
|
|
147
|
+
*/
|
|
148
|
+
export declare const DEFAULT_DATALAYER_CONFIG: Partial<IDatalayerCoreConfig>;
|
|
149
|
+
/**
|
|
150
|
+
* Type guard to check if a config object is a valid IDatalayerConfig
|
|
151
|
+
*/
|
|
152
|
+
export declare function isDatalayerConfig(config: any): config is IDatalayerCoreConfig;
|
|
153
|
+
/**
|
|
154
|
+
* Helper function to merge partial config with defaults
|
|
155
|
+
* @param config Partial configuration to merge
|
|
156
|
+
* @returns Complete configuration with defaults applied, or undefined if required fields missing
|
|
157
|
+
*/
|
|
158
|
+
export declare function mergeConfigWithDefaults(config?: Partial<IDatalayerCoreConfig>): Partial<IDatalayerCoreConfig> | undefined;
|
|
111
159
|
export default DatalayerConfiguration;
|
|
@@ -22,4 +22,46 @@ export class DatalayerConfiguration {
|
|
|
22
22
|
return this._configurationChanged;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Default configuration values for Datalayer
|
|
27
|
+
*/
|
|
28
|
+
export const DEFAULT_DATALAYER_CONFIG = {
|
|
29
|
+
runUrl: 'https://prod1.datalayer.run',
|
|
30
|
+
credits: 100,
|
|
31
|
+
cpuEnvironment: 'python-cpu-env',
|
|
32
|
+
gpuEnvironment: 'ai-env',
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Type guard to check if a config object is a valid IDatalayerConfig
|
|
36
|
+
*/
|
|
37
|
+
export function isDatalayerConfig(config) {
|
|
38
|
+
return (config &&
|
|
39
|
+
typeof config === 'object' &&
|
|
40
|
+
typeof config.runUrl === 'string' &&
|
|
41
|
+
typeof config.token === 'string' &&
|
|
42
|
+
typeof config.credits === 'number' &&
|
|
43
|
+
typeof config.cpuEnvironment === 'string' &&
|
|
44
|
+
typeof config.gpuEnvironment === 'string');
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Helper function to merge partial config with defaults
|
|
48
|
+
* @param config Partial configuration to merge
|
|
49
|
+
* @returns Complete configuration with defaults applied, or undefined if required fields missing
|
|
50
|
+
*/
|
|
51
|
+
export function mergeConfigWithDefaults(config) {
|
|
52
|
+
if (!config)
|
|
53
|
+
return undefined;
|
|
54
|
+
// If we have required fields (token and runUrl), merge with defaults for optional fields
|
|
55
|
+
if (config.token && config.runUrl) {
|
|
56
|
+
return {
|
|
57
|
+
runUrl: config.runUrl,
|
|
58
|
+
token: config.token,
|
|
59
|
+
credits: config.credits ?? DEFAULT_DATALAYER_CONFIG.credits,
|
|
60
|
+
cpuEnvironment: config.cpuEnvironment ?? DEFAULT_DATALAYER_CONFIG.cpuEnvironment,
|
|
61
|
+
gpuEnvironment: config.gpuEnvironment ?? DEFAULT_DATALAYER_CONFIG.gpuEnvironment,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
// If missing required fields, return undefined
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
25
67
|
export default DatalayerConfiguration;
|