@cognizant-ai-lab/ui-common 1.14.0 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Theme/Palettes.d.ts +1 -0
- package/dist/Theme/Palettes.js +13 -0
- package/dist/Theme/sheen.d.ts +172 -0
- package/dist/Theme/sheen.js +219 -0
- package/dist/components/AgentChat/ChatCommon/ChatCommon.js +111 -32
- package/dist/components/AgentChat/ChatCommon/ChatHistory.js +4 -3
- package/dist/components/AgentChat/ChatCommon/ControlButtons.js +27 -1
- package/dist/components/AgentChat/ChatCommon/Conversation.d.ts +2 -0
- package/dist/components/AgentChat/ChatCommon/Conversation.js +174 -18
- package/dist/components/AgentChat/ChatCommon/FormattedMarkdown.d.ts +12 -1
- package/dist/components/AgentChat/ChatCommon/FormattedMarkdown.js +20 -9
- package/dist/components/AgentChat/ChatCommon/SampleQueries.d.ts +1 -1
- package/dist/components/AgentChat/ChatCommon/SampleQueries.js +74 -17
- package/dist/components/AgentChat/ChatCommon/SendButton.js +32 -1
- package/dist/components/AgentChat/ChatCommon/SyntaxHighlighterThemes.d.ts +6 -0
- package/dist/components/AgentChat/ChatCommon/SyntaxHighlighterThemes.js +4 -1
- package/dist/components/AgentChat/Common/LlmChatButton.js +4 -2
- package/dist/components/AgentChat/VoiceChat/MicrophoneButton.js +5 -0
- package/dist/components/ChatBot/ChatBot.js +79 -25
- package/dist/components/CommandPalette/CommandPalette.d.ts +21 -0
- package/dist/components/CommandPalette/CommandPalette.js +411 -0
- package/dist/components/Common/ConfirmationModal.d.ts +2 -0
- package/dist/components/Common/ConfirmationModal.js +2 -2
- package/dist/components/Common/Footer.d.ts +2 -2
- package/dist/components/Common/Footer.js +86 -32
- package/dist/components/Common/LoadingSpinner.d.ts +2 -1
- package/dist/components/Common/LoadingSpinner.js +24 -3
- package/dist/components/Common/MUIDialog.js +1 -1
- package/dist/components/Common/Navbar.d.ts +4 -1
- package/dist/components/Common/Navbar.js +235 -43
- package/dist/components/Common/Snackbar.d.ts +1 -1
- package/dist/components/Common/Snackbar.js +81 -48
- package/dist/components/Common/Spotlight.d.ts +31 -0
- package/dist/components/Common/Spotlight.js +76 -0
- package/dist/components/ErrorPage/ErrorPage.js +1 -1
- package/dist/components/MultiAgentAccelerator/AgentFlow/AgentFlow.d.ts +14 -0
- package/dist/components/MultiAgentAccelerator/AgentFlow/AgentFlow.js +169 -96
- package/dist/components/MultiAgentAccelerator/AgentFlow/AgentNode.js +100 -23
- package/dist/components/MultiAgentAccelerator/AgentFlow/NetworkHud.d.ts +19 -0
- package/dist/components/MultiAgentAccelerator/AgentFlow/NetworkHud.js +128 -0
- package/dist/components/MultiAgentAccelerator/Editor/Const.d.ts +2 -1
- package/dist/components/MultiAgentAccelerator/Editor/Const.js +4 -2
- package/dist/components/MultiAgentAccelerator/Editor/NetworkEditorDock.js +62 -33
- package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.d.ts +2 -0
- package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.js +279 -72
- package/dist/components/MultiAgentAccelerator/NeuroSanStudioCallout.js +38 -22
- package/dist/components/MultiAgentAccelerator/PanelSeparator.d.ts +7 -1
- package/dist/components/MultiAgentAccelerator/PanelSeparator.js +44 -36
- package/dist/components/MultiAgentAccelerator/Publish/Publish.d.ts +30 -10
- package/dist/components/MultiAgentAccelerator/Publish/Publish.js +137 -42
- package/dist/components/MultiAgentAccelerator/Publish/PublishButton.d.ts +5 -2
- package/dist/components/MultiAgentAccelerator/Publish/PublishButton.js +45 -19
- package/dist/components/MultiAgentAccelerator/Publish/PublishConfirmation.d.ts +8 -2
- package/dist/components/MultiAgentAccelerator/Publish/PublishConfirmation.js +31 -4
- package/dist/components/MultiAgentAccelerator/Publish/PublishIconButton.d.ts +4 -2
- package/dist/components/MultiAgentAccelerator/Publish/PublishIconButton.js +17 -16
- package/dist/components/MultiAgentAccelerator/Publish/PublishPanel.d.ts +4 -2
- package/dist/components/MultiAgentAccelerator/Publish/PublishPanel.js +32 -2
- package/dist/components/MultiAgentAccelerator/Publish/PublishedNetworkUrl.js +3 -2
- package/dist/components/MultiAgentAccelerator/Publish/usePublishTarget.d.ts +2 -2
- package/dist/components/MultiAgentAccelerator/Publish/usePublishTarget.js +14 -7
- package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.js +81 -53
- package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.js +40 -20
- package/dist/components/MultiAgentAccelerator/ThoughtBubbles/ThoughtBubbleOverlay.d.ts +4 -0
- package/dist/components/MultiAgentAccelerator/ThoughtBubbles/ThoughtBubbleOverlay.js +49 -28
- package/dist/components/MultiAgentAccelerator/Workspace/FloatingPanel.d.ts +21 -0
- package/dist/components/MultiAgentAccelerator/Workspace/FloatingPanel.js +57 -0
- package/dist/components/Settings/ApiKeyErrorBanner.d.ts +1 -0
- package/dist/components/Settings/ApiKeyErrorBanner.js +1 -1
- package/dist/components/Settings/ApiKeyInput.d.ts +2 -1
- package/dist/components/Settings/ApiKeyInput.js +31 -4
- package/dist/components/Settings/Byok/ByokInputs.d.ts +1 -1
- package/dist/components/Settings/Byok/ByokInputs.js +3 -1
- package/dist/components/Settings/Byok/ByokStorageTooltip.js +3 -2
- package/dist/components/Settings/Byok/ByokUnsavedChangesModal.d.ts +4 -0
- package/dist/components/Settings/Byok/ByokUnsavedChangesModal.js +3 -2
- package/dist/components/Settings/Byok/useByokKeyManager.d.ts +3 -2
- package/dist/components/Settings/Byok/useByokKeyManager.js +97 -27
- package/dist/components/Settings/FadingCheckmark.js +1 -1
- package/dist/components/Settings/PublishSettings.d.ts +4 -4
- package/dist/components/Settings/PublishSettings.js +33 -44
- package/dist/components/Settings/SettingsDialog.js +95 -41
- package/dist/components/Settings/SettingsLayout.d.ts +1 -3
- package/dist/components/Settings/SettingsLayout.js +41 -12
- package/dist/components/Settings/SettingsNav.d.ts +14 -0
- package/dist/components/Settings/SettingsNav.js +229 -0
- package/dist/components/Settings/SettingsRow.js +4 -1
- package/dist/controller/llm/Providers.d.ts +1 -0
- package/dist/controller/llm/Providers.js +4 -0
- package/dist/controller/publish/Publish.d.ts +34 -9
- package/dist/controller/publish/Publish.js +83 -23
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/state/Publish.d.ts +25 -11
- package/dist/state/Publish.js +38 -3
- package/dist/state/Settings.d.ts +5 -79
- package/dist/state/Settings.js +36 -6
- package/dist/state/TemporaryNetworks.d.ts +12 -1
- package/dist/state/TemporaryNetworks.js +15 -8
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +6 -4
|
@@ -16,15 +16,20 @@ limitations under the License.
|
|
|
16
16
|
*/
|
|
17
17
|
import ContactSupportIcon from "@mui/icons-material/ContactSupport";
|
|
18
18
|
import Box from "@mui/material/Box";
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
19
|
+
import { useTheme } from "@mui/material/styles";
|
|
20
|
+
import { AnimatePresence, motion, useMotionValue, useReducedMotion, useSpring } from "motion/react";
|
|
21
21
|
import { useState } from "react";
|
|
22
22
|
import { CHATBOT_ENDPOINT } from "../../controller/llm/endpoints.js";
|
|
23
|
-
import {
|
|
23
|
+
import { getSheen, glassSurface, glowShadow, gradientBorder, SHEEN_EASE, SHEEN_RADIUS_SURFACE, sheenConic, sheenGradient, } from "../../Theme/sheen.js";
|
|
24
24
|
import { useAuthentication } from "../../utils/Authentication.js";
|
|
25
25
|
import { getZIndex } from "../../utils/zIndexLayers.js";
|
|
26
26
|
import { ChatCommon } from "../AgentChat/ChatCommon/ChatCommon.js";
|
|
27
27
|
import { LegacyAgentType } from "../AgentChat/Common/Types.js";
|
|
28
|
+
// How far (px) the launcher orb leans toward the pointer, and the spring that drives it
|
|
29
|
+
const MAGNET_PULL = 0.35;
|
|
30
|
+
const MAGNET_SPRING = { stiffness: 320, damping: 18, mass: 0.5 };
|
|
31
|
+
// Spring for the chat window growing out of the orb
|
|
32
|
+
const WINDOW_SPRING = { type: "spring", stiffness: 340, damping: 30, mass: 0.9 };
|
|
28
33
|
/**
|
|
29
34
|
* Site-wide Chatbot component.
|
|
30
35
|
*/
|
|
@@ -33,37 +38,70 @@ export const ChatBot = ({ id, pageContext }) => {
|
|
|
33
38
|
const [chatOpen, setChatOpen] = useState(false);
|
|
34
39
|
const [isAwaitingLlm, setIsAwaitingLlm] = useState(false);
|
|
35
40
|
const { user: { name: currentUser }, } = useAuthentication().data;
|
|
36
|
-
// MUI theme
|
|
41
|
+
// MUI theme
|
|
37
42
|
const theme = useTheme();
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
const reduceMotion = useReducedMotion();
|
|
44
|
+
// Magnetic launcher: the orb is pulled toward the pointer while hovered and springs back on leave
|
|
45
|
+
const magnetX = useSpring(useMotionValue(0), MAGNET_SPRING);
|
|
46
|
+
const magnetY = useSpring(useMotionValue(0), MAGNET_SPRING);
|
|
47
|
+
const onOrbPointerMove = (event) => {
|
|
48
|
+
if (reduceMotion)
|
|
49
|
+
return;
|
|
50
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
51
|
+
magnetX.set((event.clientX - (rect.left + rect.width / 2)) * MAGNET_PULL);
|
|
52
|
+
magnetY.set((event.clientY - (rect.top + rect.height / 2)) * MAGNET_PULL);
|
|
53
|
+
};
|
|
54
|
+
const onOrbPointerLeave = () => {
|
|
55
|
+
magnetX.set(0);
|
|
56
|
+
magnetY.set(0);
|
|
57
|
+
};
|
|
58
|
+
return (_jsxs(_Fragment, { children: [_jsx(AnimatePresence, { children: chatOpen && (_jsx(motion.div, { animate: { opacity: 1, scale: 1, x: 0, y: 0, filter: "blur(0px)" }, exit: {
|
|
59
|
+
opacity: 0,
|
|
60
|
+
scale: reduceMotion ? 1 : 0.1,
|
|
61
|
+
x: reduceMotion ? 0 : 12,
|
|
62
|
+
y: reduceMotion ? 0 : 30,
|
|
63
|
+
filter: "blur(6px)",
|
|
64
|
+
transition: { duration: 0.22, ease: "easeIn" },
|
|
65
|
+
}, id: `chatbot-window-animation-${id}`, initial: reduceMotion ? { opacity: 0 } : { opacity: 0, scale: 0.1, x: 12, y: 30, filter: "blur(8px)" },
|
|
66
|
+
// Grow out of the launcher orb, which sits at the bottom right
|
|
67
|
+
style: {
|
|
44
68
|
bottom: 50,
|
|
69
|
+
position: "fixed",
|
|
45
70
|
right: "2rem",
|
|
46
71
|
height: "60%",
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
boxShadow: `0 0px 2px 0 rgba(${shadowColor}, 0.15)`,
|
|
50
|
-
borderRadius: "var(--bs-border-radius)",
|
|
51
|
-
borderWidth: 1,
|
|
52
|
-
borderColor: darkMode ? "var(--bs-white)" : "var(--bs-gray-light)",
|
|
72
|
+
// Orb center sits 36px in from the bottom-right corner; the window is inset 2rem / 50px
|
|
73
|
+
transformOrigin: "calc(100% - 4px) calc(100% + 14px)",
|
|
53
74
|
zIndex: getZIndex(2, theme),
|
|
54
|
-
},
|
|
75
|
+
}, transition: reduceMotion ? { duration: 0.2 } : WINDOW_SPRING, children: _jsx(Box, { id: id, sx: {
|
|
76
|
+
// Frosted-glass floating panel with an iridescent hairline; colors follow the active
|
|
77
|
+
// color scheme via palette tokens
|
|
78
|
+
...glassSurface(theme, SHEEN_RADIUS_SURFACE),
|
|
79
|
+
...gradientBorder(theme, SHEEN_RADIUS_SURFACE, 1, 0.6),
|
|
80
|
+
height: "100%",
|
|
81
|
+
maxWidth: 400,
|
|
82
|
+
boxShadow: [
|
|
83
|
+
`inset 0 1px 0 ${getSheen(theme).highlight}`,
|
|
84
|
+
`0 30px 80px -24px ${getSheen(theme).glow}`,
|
|
85
|
+
"0 24px 60px -20px rgba(0, 0, 0, 0.55)",
|
|
86
|
+
].join(", "),
|
|
87
|
+
overflow: "hidden",
|
|
88
|
+
}, children: _jsx(ChatCommon, { id: "chatbot-window", currentUser: currentUser, setIsAwaitingLlm: setIsAwaitingLlm, isAwaitingLlm: isAwaitingLlm, selectedNetwork: LegacyAgentType.ChatBot, legacyAgentEndpoint: CHATBOT_ENDPOINT, extraParams: { pageContext },
|
|
89
|
+
// Let the glass panel show through
|
|
90
|
+
backgroundColor: "transparent", title: "Cognizant Neuro AI Assistant", onClose: () => setChatOpen(false) }) }) }, "chatbot-window"
|
|
91
|
+
// Grow out of the launcher orb, which sits at the bottom right
|
|
92
|
+
)) }), !chatOpen && (_jsx(Box, { component: motion.div, id: `chatbot-icon-${id}`, onPointerLeave: onOrbPointerLeave, onPointerMove: onOrbPointerMove, style: { x: magnetX, y: magnetY }, whileHover: reduceMotion ? undefined : { scale: 1.1 }, whileTap: reduceMotion ? undefined : { scale: 0.92 }, sx: {
|
|
55
93
|
display: "flex",
|
|
56
94
|
alignItems: "center",
|
|
57
|
-
|
|
95
|
+
// Glossy gradient orb (specular highlight over the signature gradient) with a spinning,
|
|
96
|
+
// blurred conic halo around it and an accent glow
|
|
97
|
+
backgroundImage: [
|
|
98
|
+
"radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.55), transparent 42%)",
|
|
99
|
+
sheenGradient(theme),
|
|
100
|
+
].join(", "),
|
|
58
101
|
borderRadius: "50%",
|
|
59
102
|
bottom: 16,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
boxShadow: `
|
|
63
|
-
0px 2px 4px -1px rgba(${shadowColor}, 0.2),
|
|
64
|
-
0px 4px 5px 0px rgba(${shadowColor}, 0.14),
|
|
65
|
-
0px 1px 10px 0px rgba(${shadowColor}, 0.12)
|
|
66
|
-
`,
|
|
103
|
+
boxShadow: `inset 0 1px 0 rgba(255, 255, 255, 0.45), ${glowShadow(theme)}`,
|
|
104
|
+
color: "primary.contrastText",
|
|
67
105
|
cursor: "pointer",
|
|
68
106
|
height: 40,
|
|
69
107
|
justifyContent: "center",
|
|
@@ -71,5 +109,21 @@ export const ChatBot = ({ id, pageContext }) => {
|
|
|
71
109
|
padding: "1rem",
|
|
72
110
|
position: "fixed",
|
|
73
111
|
right: 16,
|
|
112
|
+
transition: `box-shadow 0.35s ${SHEEN_EASE}`,
|
|
113
|
+
"&::before": {
|
|
114
|
+
content: '""',
|
|
115
|
+
position: "absolute",
|
|
116
|
+
inset: -5,
|
|
117
|
+
borderRadius: "50%",
|
|
118
|
+
background: sheenConic(theme),
|
|
119
|
+
filter: "blur(4px)",
|
|
120
|
+
// Only the ring outside the orb, so the halo never washes over its glossy face
|
|
121
|
+
WebkitMask: "radial-gradient(closest-side, transparent calc(100% - 9px), #000 calc(100% - 6px))",
|
|
122
|
+
mask: "radial-gradient(closest-side, transparent calc(100% - 9px), #000 calc(100% - 6px))",
|
|
123
|
+
opacity: 0.85,
|
|
124
|
+
animation: "sheenSpin 3.5s linear infinite",
|
|
125
|
+
pointerEvents: "none",
|
|
126
|
+
},
|
|
127
|
+
"&:hover": { boxShadow: glowShadow(theme, 48) },
|
|
74
128
|
}, onClick: () => setChatOpen(true), children: _jsx(ContactSupportIcon, { id: `chatbot-icon-${id}` }) }))] }));
|
|
75
129
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const OPEN_COMMAND_PALETTE_EVENT_NAME = "neuro-san-open-command-palette";
|
|
2
|
+
/**
|
|
3
|
+
* Opens the command palette, wherever it is mounted.
|
|
4
|
+
*/
|
|
5
|
+
export declare const openCommandPalette: () => void;
|
|
6
|
+
/**
|
|
7
|
+
* Label of the platform's command modifier key: ⌘ on Apple platforms, Ctrl elsewhere. Resolved after mount so that
|
|
8
|
+
* server and client markup match.
|
|
9
|
+
*/
|
|
10
|
+
export declare const useModifierKeyLabel: () => string;
|
|
11
|
+
export interface CommandPaletteProps {
|
|
12
|
+
readonly onNavigate: (path: string) => void;
|
|
13
|
+
readonly onStartTour?: () => void;
|
|
14
|
+
readonly supportEmailAddress?: string;
|
|
15
|
+
readonly logoServiceToken?: string;
|
|
16
|
+
readonly pathname?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The command palette. Mount once near the app root; opens with ⌘K / Ctrl+K or `openCommandPalette()`.
|
|
20
|
+
*/
|
|
21
|
+
export declare const CommandPalette: ({ logoServiceToken, onNavigate, onStartTour, pathname, supportEmailAddress, }: CommandPaletteProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2025 Cognizant Technology Solutions Corp, www.cognizant.com.
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Global command palette (⌘K / Ctrl+K): a centered frosted-glass panel that springs in over a blurred backdrop, with
|
|
19
|
+
* a large search field and grouped, keyboard-navigable actions built on cmdk. Only wires up capabilities the app
|
|
20
|
+
* already has: navigation, color scheme, settings, the guided tour, external docs and contacting support.
|
|
21
|
+
*/
|
|
22
|
+
import ArrowForwardRoundedIcon from "@mui/icons-material/ArrowForwardRounded";
|
|
23
|
+
import DarkModeRoundedIcon from "@mui/icons-material/DarkModeRounded";
|
|
24
|
+
import ExploreRoundedIcon from "@mui/icons-material/ExploreRounded";
|
|
25
|
+
import HomeRoundedIcon from "@mui/icons-material/HomeRounded";
|
|
26
|
+
import HubRoundedIcon from "@mui/icons-material/HubRounded";
|
|
27
|
+
import LightModeRoundedIcon from "@mui/icons-material/LightModeRounded";
|
|
28
|
+
import MailOutlineRoundedIcon from "@mui/icons-material/MailOutlineRounded";
|
|
29
|
+
import MenuBookRoundedIcon from "@mui/icons-material/MenuBookRounded";
|
|
30
|
+
import OpenInNewRoundedIcon from "@mui/icons-material/OpenInNewRounded";
|
|
31
|
+
import SearchRoundedIcon from "@mui/icons-material/SearchRounded";
|
|
32
|
+
import SettingsRoundedIcon from "@mui/icons-material/SettingsRounded";
|
|
33
|
+
import Box from "@mui/material/Box";
|
|
34
|
+
import Modal from "@mui/material/Modal";
|
|
35
|
+
import { useColorScheme, useTheme } from "@mui/material/styles";
|
|
36
|
+
import { Command, useCommandState } from "cmdk";
|
|
37
|
+
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
38
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
39
|
+
import { useSettingsStore } from "../../state/Settings.js";
|
|
40
|
+
import { getSheen, glassSurface, gradientBorder, gradientText, SHEEN_EASE, SHEEN_FONT_DISPLAY, SHEEN_FONT_MONO, SHEEN_RADIUS, SHEEN_RADIUS_SURFACE, sheenGradient, } from "../../Theme/sheen.js";
|
|
41
|
+
import { isDarkMode } from "../../Theme/Theme.js";
|
|
42
|
+
import { navigateToUrl } from "../../utils/BrowserNavigation.js";
|
|
43
|
+
import { spotlightStyles, useSpotlight } from "../Common/Spotlight.js";
|
|
44
|
+
import { SettingsDialog } from "../Settings/SettingsDialog.js";
|
|
45
|
+
// Window event that opens the palette from anywhere (e.g. the Navbar search pill)
|
|
46
|
+
export const OPEN_COMMAND_PALETTE_EVENT_NAME = "neuro-san-open-command-palette";
|
|
47
|
+
/**
|
|
48
|
+
* Opens the command palette, wherever it is mounted.
|
|
49
|
+
*/
|
|
50
|
+
export const openCommandPalette = () => {
|
|
51
|
+
window.dispatchEvent(new CustomEvent(OPEN_COMMAND_PALETTE_EVENT_NAME));
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Label of the platform's command modifier key: ⌘ on Apple platforms, Ctrl elsewhere. Resolved after mount so that
|
|
55
|
+
* server and client markup match.
|
|
56
|
+
*/
|
|
57
|
+
export const useModifierKeyLabel = () => {
|
|
58
|
+
const [label, setLabel] = useState("Ctrl");
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (/Mac|iPhone|iPad|iPod/u.test(navigator.userAgent)) {
|
|
61
|
+
setLabel("⌘");
|
|
62
|
+
}
|
|
63
|
+
}, []);
|
|
64
|
+
return label;
|
|
65
|
+
};
|
|
66
|
+
const PANEL_SPRING = { type: "spring", stiffness: 420, damping: 32, mass: 0.9 };
|
|
67
|
+
const HIGHLIGHT_SPRING = { type: "spring", stiffness: 520, damping: 40 };
|
|
68
|
+
// Small keycap
|
|
69
|
+
const Kbd = ({ children }) => (_jsx(Box, { component: "kbd", sx: (theme) => ({
|
|
70
|
+
alignItems: "center",
|
|
71
|
+
backgroundColor: getSheen(theme).highlight,
|
|
72
|
+
border: `1px solid ${getSheen(theme).glassBorder}`,
|
|
73
|
+
borderRadius: "6px",
|
|
74
|
+
boxShadow: `inset 0 -1px 0 ${getSheen(theme).glassBorder}`,
|
|
75
|
+
color: "text.secondary",
|
|
76
|
+
display: "inline-flex",
|
|
77
|
+
fontFamily: SHEEN_FONT_MONO,
|
|
78
|
+
fontSize: "0.7rem",
|
|
79
|
+
height: 20,
|
|
80
|
+
justifyContent: "center",
|
|
81
|
+
lineHeight: 1,
|
|
82
|
+
minWidth: 20,
|
|
83
|
+
px: "5px",
|
|
84
|
+
}), children: children }));
|
|
85
|
+
/**
|
|
86
|
+
* One palette row. Reads the active (keyboard/pointer highlighted) item from cmdk so the tinted highlight and its
|
|
87
|
+
* gradient bar can glide between rows as a single shared-layout element.
|
|
88
|
+
*/
|
|
89
|
+
const PaletteItem = ({ action }) => {
|
|
90
|
+
const selected = useCommandState((state) => state.value === action.label);
|
|
91
|
+
const reduceMotion = useReducedMotion();
|
|
92
|
+
return (_jsxs(Command.Item, { disabled: action.disabled, id: `command-palette-item-${action.id}`, keywords: action.keywords, onSelect: action.handleSelect, value: action.label, children: [selected && (_jsx(motion.span, { "aria-hidden": true, className: "command-palette-highlight", layoutId: "command-palette-highlight", transition: reduceMotion ? { duration: 0 } : HIGHLIGHT_SPRING })), _jsx("span", { className: "command-palette-item-icon", children: action.icon }), _jsxs("span", { className: "command-palette-item-text", children: [_jsx("span", { className: "command-palette-item-label", children: action.label }), action.hint && _jsx("span", { className: "command-palette-item-hint", children: action.hint })] }), action.current && _jsx("span", { className: "command-palette-item-badge", children: "Current" }), action.external && (_jsx(OpenInNewRoundedIcon, { className: "command-palette-item-trailing", sx: { fontSize: "0.95rem" } })), selected && !action.external && (_jsx(ArrowForwardRoundedIcon, { className: "command-palette-item-trailing", sx: { fontSize: "1rem" } }))] }));
|
|
93
|
+
};
|
|
94
|
+
const getPanelSx = (theme) => {
|
|
95
|
+
const sheen = getSheen(theme);
|
|
96
|
+
const palette = (theme.vars ?? theme).palette;
|
|
97
|
+
return {
|
|
98
|
+
...glassSurface(theme, SHEEN_RADIUS_SURFACE),
|
|
99
|
+
...gradientBorder(theme, SHEEN_RADIUS_SURFACE, 1, 0.75),
|
|
100
|
+
...spotlightStyles(theme, 340),
|
|
101
|
+
border: 0,
|
|
102
|
+
boxShadow: [
|
|
103
|
+
`inset 0 1px 0 ${sheen.highlight}`,
|
|
104
|
+
`0 40px 120px -30px ${sheen.glow}`,
|
|
105
|
+
"0 30px 80px -24px rgba(0, 0, 0, 0.6)",
|
|
106
|
+
].join(", "),
|
|
107
|
+
color: palette.text.primary,
|
|
108
|
+
overflow: "hidden",
|
|
109
|
+
width: "min(640px, calc(100vw - 32px))",
|
|
110
|
+
"& [cmdk-root]": { outline: "none" },
|
|
111
|
+
// Search field
|
|
112
|
+
"& [cmdk-input]": {
|
|
113
|
+
background: "transparent",
|
|
114
|
+
border: 0,
|
|
115
|
+
color: palette.text.primary,
|
|
116
|
+
flex: 1,
|
|
117
|
+
fontFamily: SHEEN_FONT_DISPLAY,
|
|
118
|
+
fontSize: "1.55rem",
|
|
119
|
+
fontWeight: 400,
|
|
120
|
+
letterSpacing: "-0.015em",
|
|
121
|
+
minWidth: 0,
|
|
122
|
+
outline: "none",
|
|
123
|
+
padding: 0,
|
|
124
|
+
"&::placeholder": { color: palette.text.secondary, opacity: 0.7 },
|
|
125
|
+
},
|
|
126
|
+
// Results list, animating its height with cmdk's measured list height
|
|
127
|
+
"& [cmdk-list]": {
|
|
128
|
+
height: "min(var(--cmdk-list-height, auto), 52vh)",
|
|
129
|
+
maxHeight: "52vh",
|
|
130
|
+
overflowY: "auto",
|
|
131
|
+
overscrollBehavior: "contain",
|
|
132
|
+
padding: "6px 8px 8px",
|
|
133
|
+
scrollPaddingBlock: "8px",
|
|
134
|
+
transition: `height 0.25s ${SHEEN_EASE}`,
|
|
135
|
+
},
|
|
136
|
+
"& [cmdk-group-heading]": {
|
|
137
|
+
color: palette.text.secondary,
|
|
138
|
+
fontSize: "0.68rem",
|
|
139
|
+
fontWeight: 600,
|
|
140
|
+
letterSpacing: "0.12em",
|
|
141
|
+
padding: "12px 12px 6px",
|
|
142
|
+
textTransform: "uppercase",
|
|
143
|
+
},
|
|
144
|
+
"& [cmdk-item]": {
|
|
145
|
+
alignItems: "center",
|
|
146
|
+
borderRadius: `${SHEEN_RADIUS}px`,
|
|
147
|
+
cursor: "pointer",
|
|
148
|
+
display: "flex",
|
|
149
|
+
gap: "12px",
|
|
150
|
+
minHeight: 48,
|
|
151
|
+
padding: "8px 12px",
|
|
152
|
+
position: "relative",
|
|
153
|
+
transition: "color 0.2s ease",
|
|
154
|
+
userSelect: "none",
|
|
155
|
+
"& > :not(.command-palette-highlight)": { position: "relative", zIndex: 1 },
|
|
156
|
+
},
|
|
157
|
+
"& [cmdk-item][data-disabled='true']": { cursor: "not-allowed", opacity: 0.45 },
|
|
158
|
+
// Shared highlight: sheen tint wash with a glowing gradient bar at its left edge
|
|
159
|
+
"& .command-palette-highlight": {
|
|
160
|
+
backgroundColor: sheen.tint,
|
|
161
|
+
backgroundImage: `linear-gradient(90deg, ${sheen.highlight}, transparent 70%)`,
|
|
162
|
+
borderRadius: `${SHEEN_RADIUS}px`,
|
|
163
|
+
boxShadow: `inset 0 0 0 1px ${sheen.glassBorder}`,
|
|
164
|
+
inset: 0,
|
|
165
|
+
position: "absolute",
|
|
166
|
+
zIndex: 0,
|
|
167
|
+
"&::before": {
|
|
168
|
+
backgroundImage: sheenGradient(theme, 180),
|
|
169
|
+
borderRadius: 3,
|
|
170
|
+
bottom: 10,
|
|
171
|
+
boxShadow: `0 0 12px ${sheen.glow}`,
|
|
172
|
+
content: '""',
|
|
173
|
+
left: 0,
|
|
174
|
+
position: "absolute",
|
|
175
|
+
top: 10,
|
|
176
|
+
width: 3,
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
"& .command-palette-item-icon": {
|
|
180
|
+
alignItems: "center",
|
|
181
|
+
backgroundColor: sheen.highlight,
|
|
182
|
+
border: `1px solid ${sheen.glassBorder}`,
|
|
183
|
+
borderRadius: "10px",
|
|
184
|
+
color: palette.text.secondary,
|
|
185
|
+
display: "inline-flex",
|
|
186
|
+
flexShrink: 0,
|
|
187
|
+
height: 32,
|
|
188
|
+
justifyContent: "center",
|
|
189
|
+
transition: `color 0.2s ease, box-shadow 0.3s ${SHEEN_EASE}, transform 0.3s ${SHEEN_EASE}`,
|
|
190
|
+
width: 32,
|
|
191
|
+
"& svg": { fontSize: "1.1rem" },
|
|
192
|
+
},
|
|
193
|
+
"& [cmdk-item][data-selected='true'] .command-palette-item-icon": {
|
|
194
|
+
boxShadow: `0 0 18px -4px ${sheen.glow}`,
|
|
195
|
+
color: palette.primary.main,
|
|
196
|
+
transform: "scale(1.06)",
|
|
197
|
+
},
|
|
198
|
+
"& .command-palette-item-text": { display: "flex", flex: 1, flexDirection: "column", minWidth: 0 },
|
|
199
|
+
"& .command-palette-item-label": { fontSize: "0.95rem", fontWeight: 500 },
|
|
200
|
+
"& .command-palette-item-hint": {
|
|
201
|
+
color: palette.text.secondary,
|
|
202
|
+
fontSize: "0.78rem",
|
|
203
|
+
overflow: "hidden",
|
|
204
|
+
textOverflow: "ellipsis",
|
|
205
|
+
whiteSpace: "nowrap",
|
|
206
|
+
},
|
|
207
|
+
"& .command-palette-item-badge": {
|
|
208
|
+
...gradientText(theme),
|
|
209
|
+
fontSize: "0.68rem",
|
|
210
|
+
fontWeight: 700,
|
|
211
|
+
letterSpacing: "0.08em",
|
|
212
|
+
textTransform: "uppercase",
|
|
213
|
+
},
|
|
214
|
+
"& .command-palette-item-trailing": { color: palette.text.secondary },
|
|
215
|
+
"& [cmdk-empty]": {
|
|
216
|
+
color: palette.text.secondary,
|
|
217
|
+
fontSize: "0.9rem",
|
|
218
|
+
padding: "28px 12px",
|
|
219
|
+
textAlign: "center",
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* The command palette. Mount once near the app root; opens with ⌘K / Ctrl+K or `openCommandPalette()`.
|
|
225
|
+
*/
|
|
226
|
+
export const CommandPalette = ({ logoServiceToken, onNavigate, onStartTour, pathname, supportEmailAddress, }) => {
|
|
227
|
+
const theme = useTheme();
|
|
228
|
+
const reduceMotion = useReducedMotion();
|
|
229
|
+
const modifierKey = useModifierKeyLabel();
|
|
230
|
+
const spotlight = useSpotlight();
|
|
231
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
232
|
+
const [search, setSearch] = useState("");
|
|
233
|
+
const [settingsOpen, setSettingsOpen] = useState(false);
|
|
234
|
+
const { mode, setMode, systemMode } = useColorScheme();
|
|
235
|
+
const darkMode = isDarkMode(mode, systemMode);
|
|
236
|
+
// Same rule as the Navbar toggle: the color scheme is locked while customer branding is active
|
|
237
|
+
const customer = useSettingsStore((state) => state.settings.branding.customer);
|
|
238
|
+
const hasCustomer = customer?.trim().length > 0;
|
|
239
|
+
const closePalette = useCallback(() => setIsOpen(false), []);
|
|
240
|
+
// ⌘K / Ctrl+K toggles; the window event opens
|
|
241
|
+
useEffect(() => {
|
|
242
|
+
const onKeyDown = (event) => {
|
|
243
|
+
if ((event.metaKey || event.ctrlKey) && !event.altKey && event.key.toLowerCase() === "k") {
|
|
244
|
+
event.preventDefault();
|
|
245
|
+
setIsOpen((wasOpen) => !wasOpen);
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
const onOpenEvent = () => setIsOpen(true);
|
|
249
|
+
window.addEventListener("keydown", onKeyDown);
|
|
250
|
+
window.addEventListener(OPEN_COMMAND_PALETTE_EVENT_NAME, onOpenEvent);
|
|
251
|
+
return () => {
|
|
252
|
+
window.removeEventListener("keydown", onKeyDown);
|
|
253
|
+
window.removeEventListener(OPEN_COMMAND_PALETTE_EVENT_NAME, onOpenEvent);
|
|
254
|
+
};
|
|
255
|
+
}, []);
|
|
256
|
+
// Fresh search every time it opens
|
|
257
|
+
useEffect(() => {
|
|
258
|
+
if (isOpen) {
|
|
259
|
+
setSearch("");
|
|
260
|
+
}
|
|
261
|
+
}, [isOpen]);
|
|
262
|
+
// Close the palette first, then perform the action
|
|
263
|
+
const run = useCallback((perform) => () => {
|
|
264
|
+
setIsOpen(false);
|
|
265
|
+
perform();
|
|
266
|
+
}, []);
|
|
267
|
+
const groups = useMemo(() => {
|
|
268
|
+
const navigate = [
|
|
269
|
+
{ id: "home", label: "Home", hint: "Back to the start", path: "/", icon: _jsx(HomeRoundedIcon, {}) },
|
|
270
|
+
{
|
|
271
|
+
id: "multi-agent-accelerator",
|
|
272
|
+
label: "Multi-Agent Accelerator",
|
|
273
|
+
hint: "Explore, chat with and design agent networks",
|
|
274
|
+
path: "/multiAgentAccelerator",
|
|
275
|
+
icon: _jsx(HubRoundedIcon, {}),
|
|
276
|
+
keywords: ["maa", "agents", "network", "chat"],
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
id: "user-guide",
|
|
280
|
+
label: "User Guide",
|
|
281
|
+
hint: "Documentation and how-tos",
|
|
282
|
+
path: "/UserGuide",
|
|
283
|
+
icon: _jsx(MenuBookRoundedIcon, {}),
|
|
284
|
+
keywords: ["help", "docs", "documentation"],
|
|
285
|
+
},
|
|
286
|
+
].map(({ path, ...action }) => ({
|
|
287
|
+
...action,
|
|
288
|
+
current: pathname === path,
|
|
289
|
+
handleSelect: run(() => onNavigate(path)),
|
|
290
|
+
}));
|
|
291
|
+
const preferences = [
|
|
292
|
+
{
|
|
293
|
+
id: "toggle-theme",
|
|
294
|
+
label: darkMode ? "Switch to light mode" : "Switch to dark mode",
|
|
295
|
+
hint: hasCustomer ? "Unavailable while customer branding is active" : "Toggle the color scheme",
|
|
296
|
+
icon: darkMode ? _jsx(LightModeRoundedIcon, {}) : _jsx(DarkModeRoundedIcon, {}),
|
|
297
|
+
keywords: ["theme", "dark", "light", "appearance", "color"],
|
|
298
|
+
disabled: hasCustomer,
|
|
299
|
+
handleSelect: run(() => setMode(darkMode ? "light" : "dark")),
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
id: "settings",
|
|
303
|
+
label: "Open settings",
|
|
304
|
+
hint: "Appearance, branding and API keys",
|
|
305
|
+
icon: _jsx(SettingsRoundedIcon, {}),
|
|
306
|
+
keywords: ["preferences", "branding", "keys", "byok"],
|
|
307
|
+
handleSelect: run(() => setSettingsOpen(true)),
|
|
308
|
+
},
|
|
309
|
+
];
|
|
310
|
+
const help = [
|
|
311
|
+
...(onStartTour
|
|
312
|
+
? [
|
|
313
|
+
{
|
|
314
|
+
id: "tour",
|
|
315
|
+
label: "Take a tour",
|
|
316
|
+
hint: "A guided walkthrough of the app",
|
|
317
|
+
icon: _jsx(ExploreRoundedIcon, {}),
|
|
318
|
+
keywords: ["onboarding", "walkthrough", "help"],
|
|
319
|
+
handleSelect: run(onStartTour),
|
|
320
|
+
},
|
|
321
|
+
]
|
|
322
|
+
: []),
|
|
323
|
+
...(supportEmailAddress
|
|
324
|
+
? [
|
|
325
|
+
{
|
|
326
|
+
id: "contact-support",
|
|
327
|
+
label: "Contact support",
|
|
328
|
+
hint: supportEmailAddress,
|
|
329
|
+
icon: _jsx(MailOutlineRoundedIcon, {}),
|
|
330
|
+
keywords: ["email", "help", "contact us"],
|
|
331
|
+
handleSelect: run(() => navigateToUrl(`mailto:${supportEmailAddress}`)),
|
|
332
|
+
},
|
|
333
|
+
]
|
|
334
|
+
: []),
|
|
335
|
+
{
|
|
336
|
+
id: "neuro-san-studio",
|
|
337
|
+
label: "Neuro-san studio (examples)",
|
|
338
|
+
hint: "github.com/cognizant-ai-lab/neuro-san-studio",
|
|
339
|
+
icon: _jsx(OpenInNewRoundedIcon, {}),
|
|
340
|
+
keywords: ["github", "examples", "explore"],
|
|
341
|
+
external: true,
|
|
342
|
+
handleSelect: run(() => window.open("https://github.com/cognizant-ai-lab/neuro-san-studio", "_blank", "noopener")),
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
id: "neuro-san",
|
|
346
|
+
label: "Neuro-san (core)",
|
|
347
|
+
hint: "github.com/cognizant-ai-lab/neuro-san",
|
|
348
|
+
icon: _jsx(OpenInNewRoundedIcon, {}),
|
|
349
|
+
keywords: ["github", "core", "explore"],
|
|
350
|
+
external: true,
|
|
351
|
+
handleSelect: run(() => window.open("https://github.com/cognizant-ai-lab/neuro-san", "_blank", "noopener")),
|
|
352
|
+
},
|
|
353
|
+
];
|
|
354
|
+
return [
|
|
355
|
+
{ heading: "Navigate", actions: navigate },
|
|
356
|
+
{ heading: "Preferences", actions: preferences },
|
|
357
|
+
{ heading: "Help & resources", actions: help },
|
|
358
|
+
];
|
|
359
|
+
}, [darkMode, hasCustomer, onNavigate, onStartTour, pathname, run, setMode, supportEmailAddress]);
|
|
360
|
+
const panelSx = useMemo(() => getPanelSx(theme), [theme]);
|
|
361
|
+
return (_jsxs(_Fragment, { children: [_jsx(AnimatePresence, { children: isOpen && (_jsx(Modal, { open: true, onClose: closePalette, hideBackdrop: true,
|
|
362
|
+
// Keep the palette above dialogs, menus and the chat window
|
|
363
|
+
sx: { zIndex: theme.zIndex.modal + 10 }, children: _jsxs(Box, { "aria-label": "Command palette", "aria-modal": true, id: "command-palette", role: "dialog", sx: {
|
|
364
|
+
alignItems: "flex-start",
|
|
365
|
+
display: "flex",
|
|
366
|
+
inset: 0,
|
|
367
|
+
justifyContent: "center",
|
|
368
|
+
outline: "none",
|
|
369
|
+
paddingTop: "min(16vh, 140px)",
|
|
370
|
+
position: "fixed",
|
|
371
|
+
}, children: [_jsx(motion.div, { animate: { opacity: 1 }, "data-testid": "command-palette-backdrop", exit: { opacity: 0 }, initial: { opacity: 0 }, onClick: closePalette, style: {
|
|
372
|
+
backgroundColor: "rgba(6, 6, 12, 0.6)",
|
|
373
|
+
inset: 0,
|
|
374
|
+
position: "fixed",
|
|
375
|
+
}, transition: { duration: 0.22, ease: "easeOut" } }), _jsx(motion.div, { animate: { opacity: 1, scale: 1, y: 0, filter: "blur(0px)" }, exit: {
|
|
376
|
+
opacity: 0,
|
|
377
|
+
scale: reduceMotion ? 1 : 0.97,
|
|
378
|
+
y: reduceMotion ? 0 : -6,
|
|
379
|
+
filter: "blur(4px)",
|
|
380
|
+
transition: { duration: 0.16, ease: "easeIn" },
|
|
381
|
+
}, initial: {
|
|
382
|
+
opacity: 0,
|
|
383
|
+
scale: reduceMotion ? 1 : 0.92,
|
|
384
|
+
y: reduceMotion ? 0 : -14,
|
|
385
|
+
filter: reduceMotion ? "blur(0px)" : "blur(10px)",
|
|
386
|
+
}, style: { position: "relative", transformOrigin: "50% 0%" }, transition: reduceMotion ? { duration: 0.15 } : PANEL_SPRING, children: _jsx(Box, { ...spotlight, sx: panelSx, children: _jsxs(Command, { label: "Command palette", loop: true, children: [_jsxs(Box, { sx: {
|
|
387
|
+
alignItems: "center",
|
|
388
|
+
borderBottom: `1px solid ${getSheen(theme).glassBorder}`,
|
|
389
|
+
display: "flex",
|
|
390
|
+
gap: "14px",
|
|
391
|
+
padding: "18px 20px",
|
|
392
|
+
}, children: [_jsx(SearchRoundedIcon, { sx: {
|
|
393
|
+
color: "primary.main",
|
|
394
|
+
filter: `drop-shadow(0 0 8px ${getSheen(theme).glow})`,
|
|
395
|
+
fontSize: "1.6rem",
|
|
396
|
+
} }), _jsx(Command.Input, { autoFocus: true, id: "command-palette-input", onValueChange: setSearch, placeholder: "Search pages and actions\u2026", value: search }), _jsx(Kbd, { children: "esc" })] }), _jsxs(Command.List, { label: "Actions", children: [_jsxs(Command.Empty, { children: ["No results for \u201C", _jsx("strong", { children: search }), "\u201D"] }), groups.map((group) => (_jsx(Command.Group, { heading: group.heading, children: group.actions.map((action) => (_jsx(PaletteItem, { action: action }, action.id))) }, group.heading)))] }), _jsxs(Box, { sx: {
|
|
397
|
+
alignItems: "center",
|
|
398
|
+
borderTop: `1px solid ${getSheen(theme).glassBorder}`,
|
|
399
|
+
color: "text.secondary",
|
|
400
|
+
display: "flex",
|
|
401
|
+
fontSize: "0.72rem",
|
|
402
|
+
gap: "14px",
|
|
403
|
+
padding: "10px 18px",
|
|
404
|
+
"& > span": { alignItems: "center", display: "inline-flex", gap: "6px" },
|
|
405
|
+
}, children: [_jsxs("span", { children: [_jsx(Kbd, { children: "\u2191" }), _jsx(Kbd, { children: "\u2193" }), "navigate"] }), _jsxs("span", { children: [_jsx(Kbd, { children: "\u21B5" }), "select"] }), _jsxs("span", { children: [_jsx(Kbd, { children: modifierKey }), _jsx(Kbd, { children: "K" }), "toggle"] }), _jsx(Box, { component: "span", sx: {
|
|
406
|
+
...gradientText(theme),
|
|
407
|
+
fontFamily: SHEEN_FONT_DISPLAY,
|
|
408
|
+
fontSize: "0.9rem",
|
|
409
|
+
marginLeft: "auto",
|
|
410
|
+
}, children: "Neuro\u00AE AI" })] })] }) }) })] }) }, "command-palette")) }), settingsOpen && (_jsx(SettingsDialog, { id: "command-palette-settings-dialog", isOpen: settingsOpen, logoServiceToken: logoServiceToken, onClose: () => setSettingsOpen(false) }))] }));
|
|
411
|
+
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ButtonProps } from "@mui/material/Button";
|
|
2
|
+
import { SxProps } from "@mui/material/styles";
|
|
2
3
|
import { ComponentType, FC, ReactNode } from "react";
|
|
3
4
|
export declare const StyledButton: ComponentType<ButtonProps>;
|
|
4
5
|
interface ConfirmationModalProps {
|
|
5
6
|
cancelBtnLabel?: string;
|
|
6
7
|
closeable?: boolean;
|
|
7
8
|
content: ReactNode;
|
|
9
|
+
dialogSx?: SxProps;
|
|
8
10
|
handleCancel?: () => void;
|
|
9
11
|
handleOk?: () => void;
|
|
10
12
|
id: string;
|
|
@@ -25,7 +25,7 @@ export const StyledButton = styled(Button)({
|
|
|
25
25
|
padding: "0px 7px",
|
|
26
26
|
});
|
|
27
27
|
// #endregion: Types
|
|
28
|
-
export const ConfirmationModal = ({ cancelBtnLabel, closeable = true, content = "", handleCancel = null, handleOk = null, id = "", maskCloseable = false, okBtnLabel, title = "", }) => {
|
|
28
|
+
export const ConfirmationModal = ({ cancelBtnLabel, closeable = true, content = "", dialogSx, handleCancel = null, handleOk = null, id = "", maskCloseable = false, okBtnLabel, title = "", }) => {
|
|
29
29
|
const [modalOpen, setModalOpen] = useState(true);
|
|
30
30
|
const [isLoading, setIsLoading] = useState(false);
|
|
31
31
|
const handleCloseWrapper = (_event, reason) => {
|
|
@@ -58,5 +58,5 @@ export const ConfirmationModal = ({ cancelBtnLabel, closeable = true, content =
|
|
|
58
58
|
, {
|
|
59
59
|
// This ID needs to be dynamic because there can be several instances of this on the page
|
|
60
60
|
id: `${id}-confirm-ok-btn`, disabled: isLoading, onClick: () => handleOKWrapper(), variant: "contained", children: okBtnLabel ?? "Confirm" }, "confirm-ok")] }));
|
|
61
|
-
return (_jsx(MUIDialog, { closeable: closeable, contentSx: { fontSize: "0.8rem", minWidth: "550px", paddingTop: "0" }, footer: Footer, id: `${id}-confirm-main`, isOpen: modalOpen, onClose: (_event, reason) => handleCloseWrapper(_event, reason), title: title, children: _jsx(Box, { id: `${id}-confirm-content`, sx: { marginTop: "15px" }, children: content }) }));
|
|
61
|
+
return (_jsx(MUIDialog, { closeable: closeable, contentSx: { fontSize: "0.8rem", minWidth: "550px", paddingTop: "0" }, dialogSx: dialogSx, footer: Footer, id: `${id}-confirm-main`, isOpen: modalOpen, onClose: (_event, reason) => handleCloseWrapper(_event, reason), title: title, children: _jsx(Box, { id: `${id}-confirm-content`, sx: { marginTop: "15px" }, children: content }) }));
|
|
62
62
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { SxProps } from "@mui/material/styles";
|
|
1
|
+
import { SxProps, Theme } from "@mui/material/styles";
|
|
2
2
|
import { FC } from "react";
|
|
3
3
|
interface FooterProps {
|
|
4
4
|
readonly logoUrl: string;
|
|
5
5
|
readonly logoLinkUrl: string;
|
|
6
6
|
readonly supportEmailAddress: string;
|
|
7
|
-
readonly sx?: SxProps
|
|
7
|
+
readonly sx?: SxProps<Theme>;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* Footer for all pages, contains additional links and contact information
|