@robosystems/core 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/auth-components/AppSwitcher.js +2 -3
- package/auth-components/LoginRedirector.js +24 -12
- package/auth-core/client.d.ts +2 -2
- package/auth-core/client.js +4 -4
- package/auth-core/login-home.d.ts +6 -0
- package/auth-core/login-home.js +11 -2
- package/auth-core/sso.d.ts +28 -4
- package/auth-core/sso.js +94 -62
- package/components/EntitySelector.js +1 -1
- package/components/RepositoryGuard.js +1 -1
- package/components/console/ConsoleContent.d.ts +1 -0
- package/components/console/ConsoleContent.js +13 -4
- package/components/report-chat/ReportChat.d.ts +13 -0
- package/components/report-chat/ReportChat.js +1 -1
- package/components/repositories/ActiveSubscriptions.js +1 -1
- package/components/repositories/BrowseRepositories.js +1 -1
- package/components/search/SearchBar.js +1 -1
- package/components/search/SearchContent.js +1 -1
- package/components/search/SearchHitCard.js +1 -1
- package/components/search/SearchPagination.js +1 -1
- package/hooks/use-toast.d.ts +1 -1
- package/hooks/use-toast.js +2 -2
- package/library/components/ElementBrowser.js +1 -1
- package/library/components/ElementDetail.js +1 -1
- package/library/components/LibraryHierarchy.js +1 -1
- package/library/components/TaxonomySidebar.js +1 -1
- package/package.json +2 -2
- package/styles/forms.css +478 -0
- package/styles/palette.css +265 -0
- package/theme/flowbite-theme.d.ts +638 -638
- package/theme/flowbite-theme.js +16 -21
- package/ui/Alert.d.ts +66 -0
- package/ui/Alert.js +24 -0
- package/ui/Badge.d.ts +50 -0
- package/ui/Badge.js +21 -0
- package/ui/Breadcrumb.d.ts +10 -0
- package/ui/Breadcrumb.js +31 -0
- package/ui/Button.d.ts +76 -0
- package/ui/Button.js +26 -0
- package/ui/Card.d.ts +32 -0
- package/ui/Card.js +26 -0
- package/ui/Checkbox.d.ts +33 -0
- package/ui/Checkbox.js +21 -0
- package/ui/Dropdown.d.ts +67 -0
- package/ui/Dropdown.js +134 -0
- package/ui/FileInput.d.ts +23 -0
- package/ui/FileInput.js +21 -0
- package/ui/Floating.d.ts +96 -0
- package/ui/Floating.js +92 -0
- package/ui/HelperText.d.ts +19 -0
- package/ui/HelperText.js +21 -0
- package/ui/Label.d.ts +21 -0
- package/ui/Label.js +21 -0
- package/ui/Modal.d.ts +85 -0
- package/ui/Modal.js +73 -0
- package/ui/Navbar.d.ts +14 -0
- package/ui/Navbar.js +35 -0
- package/ui/Progress.d.ts +40 -0
- package/ui/Progress.js +26 -0
- package/ui/Radio.d.ts +31 -0
- package/ui/Radio.js +21 -0
- package/ui/Select.d.ts +49 -0
- package/ui/Select.js +21 -0
- package/ui/Sidebar.d.ts +114 -0
- package/ui/Sidebar.js +76 -0
- package/ui/Spinner.d.ts +60 -0
- package/ui/Spinner.js +22 -0
- package/ui/Table.d.ts +23 -0
- package/ui/Table.js +57 -0
- package/ui/Tabs.d.ts +78 -0
- package/ui/Tabs.js +64 -0
- package/ui/TextInput.d.ts +58 -0
- package/ui/TextInput.js +21 -0
- package/ui/Textarea.d.ts +22 -0
- package/ui/Textarea.js +21 -0
- package/ui/ThemeModeScript.d.ts +21 -0
- package/ui/ThemeModeScript.js +74 -0
- package/ui/Toast.d.ts +24 -0
- package/ui/Toast.js +58 -0
- package/ui/ToggleSwitch.d.ts +54 -0
- package/ui/ToggleSwitch.js +26 -0
- package/ui/Tooltip.d.ts +3 -0
- package/ui/Tooltip.js +19 -0
- package/ui/cn.d.ts +6 -0
- package/ui/cn.js +19 -0
- package/ui/icons.d.ts +8 -0
- package/ui/icons.js +22 -0
- package/ui/index.d.ts +37 -0
- package/ui/index.js +36 -0
- package/ui/merge-theme.d.ts +15 -0
- package/ui/merge-theme.js +26 -0
- package/ui/theme-defaults.d.ts +821 -0
- package/ui/theme-defaults.js +824 -0
- package/ui/theme-mode.d.ts +15 -0
- package/ui/theme-mode.js +92 -0
- package/ui/types.d.ts +6 -0
- package/ui/types.js +1 -0
- package/ui-components/ConfirmModal.js +1 -1
- package/ui-components/StatCard.js +1 -1
- package/ui-components/api-keys/ApiKeyDisplay.d.ts +0 -1
- package/ui-components/api-keys/ApiKeyDisplay.js +3 -3
- package/ui-components/api-keys/CreateApiKeyModal.d.ts +0 -1
- package/ui-components/api-keys/CreateApiKeyModal.js +4 -4
- package/ui-components/api-keys/SecureApiKeyField.js +1 -1
- package/ui-components/chat/ChatInputArea.js +1 -1
- package/ui-components/chat/ChatMessage.js +1 -1
- package/ui-components/chat/DeepResearchToggle.js +1 -1
- package/ui-components/forms/CategoryInput.js +1 -1
- package/ui-components/forms/SettingsCard.d.ts +0 -1
- package/ui-components/forms/SettingsCard.js +3 -3
- package/ui-components/forms/SettingsFormField.d.ts +0 -1
- package/ui-components/forms/SettingsFormField.js +3 -3
- package/ui-components/forms/StatusAlert.d.ts +0 -1
- package/ui-components/forms/StatusAlert.js +3 -3
- package/ui-components/forms/TagInput.d.ts +1 -1
- package/ui-components/forms/TagInput.js +1 -1
- package/ui-components/layout/CoreNavbar.js +7 -8
- package/ui-components/layout/CoreSidebar.js +12 -13
- package/ui-components/layout/ThemeToggle.js +1 -1
- package/ui-components/settings/GeneralInformationCard.d.ts +0 -1
- package/ui-components/settings/GeneralInformationCard.js +3 -3
- package/ui-components/settings/PasswordInformationCard.d.ts +0 -1
- package/ui-components/settings/PasswordInformationCard.js +4 -4
- package/ui-components/settings/SettingsPageHeader.js +1 -1
- package/ui-components/support/SupportModal.js +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type FC } from 'react';
|
|
2
|
+
import { type ThemeMode } from './ThemeModeScript';
|
|
3
|
+
/** Reads and sets the color scheme, synced across tabs and with the system preference. */
|
|
4
|
+
export declare function useThemeMode(): {
|
|
5
|
+
mode: ThemeMode;
|
|
6
|
+
computedMode: ThemeMode;
|
|
7
|
+
setMode: (next: ThemeMode) => void;
|
|
8
|
+
toggleMode: () => void;
|
|
9
|
+
clearMode: () => void;
|
|
10
|
+
};
|
|
11
|
+
export interface DarkThemeToggleProps extends ComponentPropsWithoutRef<'button'> {
|
|
12
|
+
iconDark?: FC<ComponentPropsWithoutRef<'svg'>>;
|
|
13
|
+
iconLight?: FC<ComponentPropsWithoutRef<'svg'>>;
|
|
14
|
+
}
|
|
15
|
+
export declare const DarkThemeToggle: import("react").ForwardRefExoticComponent<DarkThemeToggleProps & import("react").RefAttributes<HTMLButtonElement>>;
|
package/ui/theme-mode.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { forwardRef, useEffect, useState, } from 'react';
|
|
15
|
+
import { cn } from './cn';
|
|
16
|
+
import { MoonIcon, SunIcon } from './icons';
|
|
17
|
+
import { themeDefaults } from './theme-defaults';
|
|
18
|
+
import { DEFAULT_THEME_MODE, THEME_MODE_STORAGE_KEY, } from './ThemeModeScript';
|
|
19
|
+
const SYNC_THEME_MODE = 'flowbite-theme-mode-sync';
|
|
20
|
+
const isClient = () => typeof window !== 'undefined';
|
|
21
|
+
function validateMode(mode) {
|
|
22
|
+
return mode === 'light' || mode === 'dark' || mode === 'auto'
|
|
23
|
+
? mode
|
|
24
|
+
: DEFAULT_THEME_MODE;
|
|
25
|
+
}
|
|
26
|
+
function prefersColorScheme() {
|
|
27
|
+
var _a;
|
|
28
|
+
return ((_a = window.matchMedia) === null || _a === void 0 ? void 0 : _a.call(window, '(prefers-color-scheme: dark)').matches)
|
|
29
|
+
? 'dark'
|
|
30
|
+
: 'light';
|
|
31
|
+
}
|
|
32
|
+
function computeModeValue(mode) {
|
|
33
|
+
if (!isClient())
|
|
34
|
+
return DEFAULT_THEME_MODE;
|
|
35
|
+
return mode === 'auto' ? prefersColorScheme() : mode;
|
|
36
|
+
}
|
|
37
|
+
function getInitialMode() {
|
|
38
|
+
if (!isClient())
|
|
39
|
+
return DEFAULT_THEME_MODE;
|
|
40
|
+
return validateMode(localStorage.getItem(THEME_MODE_STORAGE_KEY));
|
|
41
|
+
}
|
|
42
|
+
function setModeInDOM(mode) {
|
|
43
|
+
if (computeModeValue(mode) === 'dark')
|
|
44
|
+
document.documentElement.classList.add('dark');
|
|
45
|
+
else
|
|
46
|
+
document.documentElement.classList.remove('dark');
|
|
47
|
+
}
|
|
48
|
+
/** Reads and sets the color scheme, synced across tabs and with the system preference. */
|
|
49
|
+
export function useThemeMode() {
|
|
50
|
+
const [mode, setMode] = useState(getInitialMode);
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
function handleStorage({ key, newValue }) {
|
|
53
|
+
if (key === THEME_MODE_STORAGE_KEY)
|
|
54
|
+
setMode(validateMode(newValue));
|
|
55
|
+
}
|
|
56
|
+
function handleSync(e) {
|
|
57
|
+
setMode(e.detail);
|
|
58
|
+
}
|
|
59
|
+
window.addEventListener('storage', handleStorage);
|
|
60
|
+
document.addEventListener(SYNC_THEME_MODE, handleSync);
|
|
61
|
+
return () => {
|
|
62
|
+
window.removeEventListener('storage', handleStorage);
|
|
63
|
+
document.removeEventListener(SYNC_THEME_MODE, handleSync);
|
|
64
|
+
};
|
|
65
|
+
}, []);
|
|
66
|
+
function handleSetMode(next) {
|
|
67
|
+
setMode(next);
|
|
68
|
+
localStorage.setItem(THEME_MODE_STORAGE_KEY, next);
|
|
69
|
+
setModeInDOM(next);
|
|
70
|
+
document.dispatchEvent(new CustomEvent(SYNC_THEME_MODE, { detail: next }));
|
|
71
|
+
}
|
|
72
|
+
function toggleMode() {
|
|
73
|
+
const current = mode === 'auto' ? computeModeValue(mode) : mode;
|
|
74
|
+
handleSetMode(current === 'dark' ? 'light' : 'dark');
|
|
75
|
+
}
|
|
76
|
+
function clearMode() {
|
|
77
|
+
handleSetMode(mode !== null && mode !== void 0 ? mode : DEFAULT_THEME_MODE);
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
mode,
|
|
81
|
+
computedMode: computeModeValue(mode),
|
|
82
|
+
setMode: handleSetMode,
|
|
83
|
+
toggleMode,
|
|
84
|
+
clearMode,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const t = themeDefaults.darkThemeToggle;
|
|
88
|
+
export const DarkThemeToggle = forwardRef(function DarkThemeToggle(_a, ref) {
|
|
89
|
+
var { className, iconDark: IconDark = SunIcon, iconLight: IconLight = MoonIcon } = _a, rest = __rest(_a, ["className", "iconDark", "iconLight"]);
|
|
90
|
+
const { toggleMode } = useThemeMode();
|
|
91
|
+
return (_jsxs("button", Object.assign({ ref: ref, type: "button", "aria-label": "Toggle dark mode", "data-testid": "dark-theme-toggle", className: cn(t.root.base, className), onClick: toggleMode }, rest, { children: [_jsx(IconDark, { "aria-label": "Currently dark mode", className: cn(t.root.icon.base, t.root.icon.dark) }), _jsx(IconLight, { "aria-label": "Currently light mode", className: cn(t.root.icon.base, t.root.icon.light) })] })));
|
|
92
|
+
});
|
package/ui/types.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A known theme key with autocomplete, or any other string: flowbite-react typed
|
|
3
|
+
* its color/size props this way, so a value the theme does not know renders
|
|
4
|
+
* without that class group instead of failing to compile.
|
|
5
|
+
*/
|
|
6
|
+
export type DynamicStringEnumKeysOf<T extends object> = keyof T | (string & {});
|
package/ui/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Modal, ModalBody, ModalFooter, ModalHeader
|
|
2
|
+
import { Button, Modal, ModalBody, ModalFooter, ModalHeader } from '../ui';
|
|
3
3
|
import { Spinner } from './Spinner';
|
|
4
4
|
/**
|
|
5
5
|
* A confirmation dialog for a single irreversible action (delete, etc.). Owns
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Card } from '
|
|
2
|
+
import { Card } from '../ui';
|
|
3
3
|
/**
|
|
4
4
|
* A dashboard stat tile: a muted label over a large bold value, in a Card.
|
|
5
5
|
* Drop several into a `grid` to form a metrics row. Pass an `icon` to get the
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Label } from '
|
|
3
|
+
import { Label } from '../../ui';
|
|
4
4
|
import { SecureApiKeyField } from './SecureApiKeyField';
|
|
5
|
-
export const ApiKeyDisplay = ({ label, value, keyId = 'api-key',
|
|
6
|
-
return (_jsxs("div", { className: className, children: [_jsx(Label, {
|
|
5
|
+
export const ApiKeyDisplay = ({ label, value, keyId = 'api-key', className = '', onCopy, onReveal, onDownload, }) => {
|
|
6
|
+
return (_jsxs("div", { className: className, children: [_jsx(Label, { htmlFor: `display-${label}`, className: "text-base font-bold", children: label }), _jsx("div", { className: "mt-2", children: _jsx(SecureApiKeyField, { apiKey: value, keyId: keyId, keyName: label, onCopy: onCopy, onReveal: onReveal, onDownload: onDownload }) })] }));
|
|
7
7
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { Button, Label, Modal, ModalBody, ModalFooter, ModalHeader, Select, } from 'flowbite-react';
|
|
4
3
|
import { useState } from 'react';
|
|
4
|
+
import { Button, Label, Modal, ModalBody, ModalFooter, ModalHeader, Select, } from '../../ui';
|
|
5
5
|
import { Spinner } from '../Spinner';
|
|
6
6
|
import { SettingsFormField } from '../forms/SettingsFormField';
|
|
7
7
|
import { StatusAlert } from '../forms/StatusAlert';
|
|
8
8
|
import { ApiKeyDisplay } from './ApiKeyDisplay';
|
|
9
|
-
export const CreateApiKeyModal = ({ isOpen, onClose, onCreateKey,
|
|
9
|
+
export const CreateApiKeyModal = ({ isOpen, onClose, onCreateKey, graphs, }) => {
|
|
10
10
|
var _a;
|
|
11
11
|
const [isCreating, setIsCreating] = useState(false);
|
|
12
12
|
const [newApiKey, setNewApiKey] = useState(null);
|
|
@@ -47,7 +47,7 @@ export const CreateApiKeyModal = ({ isOpen, onClose, onCreateKey, theme, graphs,
|
|
|
47
47
|
day: 'numeric',
|
|
48
48
|
});
|
|
49
49
|
};
|
|
50
|
-
return (_jsxs(Modal, {
|
|
50
|
+
return (_jsxs(Modal, { show: isOpen, onClose: handleCloseModal, children: [_jsx(ModalHeader, { children: "Create API Key" }), _jsx(ModalBody, { children: newApiKey ? (_jsxs("div", { children: [_jsx(StatusAlert, { type: "success", message: "Your API key has been created." }), _jsxs("div", { className: "mb-4 space-y-4", children: [_jsx(ApiKeyDisplay, { label: "ROBOSYSTEMS_API_KEY", value: newApiKey.key, keyId: newApiKey.id }), _jsx("p", { className: "text-sm font-medium text-red-600 dark:text-red-400", children: "\u26A0\uFE0F Important: Save this API key somewhere safe. For security reasons, you cannot view it again after closing this dialog." })] }), _jsxs("div", { className: "mb-2", children: [_jsx(Label, { htmlFor: "keyDetails", children: "Key Details" }), _jsxs("div", { className: "mt-2 space-y-2 rounded-lg border border-zinc-200 bg-zinc-50 p-3 dark:border-zinc-700 dark:bg-zinc-800", children: [_jsxs("div", { className: "flex justify-between", children: [_jsx("span", { className: "text-sm font-medium text-zinc-500 dark:text-zinc-400", children: "Name:" }), _jsx("span", { className: "text-sm font-semibold text-zinc-900 dark:text-zinc-100", children: newApiKey.name })] }), _jsxs("div", { className: "flex justify-between", children: [_jsx("span", { className: "text-sm font-medium text-zinc-500 dark:text-zinc-400", children: "Scope:" }), _jsx("span", { className: "text-sm font-semibold text-zinc-900 dark:text-zinc-100", children: (_a = newApiKey.graphId) !== null && _a !== void 0 ? _a : 'Account-wide' })] }), _jsxs("div", { className: "flex justify-between", children: [_jsx("span", { className: "text-sm font-medium text-zinc-500 dark:text-zinc-400", children: "Created:" }), _jsx("span", { className: "text-sm font-semibold text-zinc-900 dark:text-zinc-100", children: formatDate(newApiKey.createdAt) })] }), _jsxs("div", { className: "flex justify-between", children: [_jsx("span", { className: "text-sm font-medium text-zinc-500 dark:text-zinc-400", children: "Status:" }), _jsx("span", { className: "text-sm font-semibold text-zinc-900 dark:text-zinc-100", children: "Active" })] })] })] })] })) : (_jsxs("form", { onSubmit: handleSubmit, className: "space-y-4", children: [_jsx(SettingsFormField, { id: "keyName", label: "API Key Name", placeholder: "My API Key", value: keyName, onChange: (e) => setKeyName(e.target.value), required: true }), _jsx("p", { className: "text-sm text-zinc-500 dark:text-zinc-400", children: "Give your API key a memorable name to identify it later" }), graphs && graphs.length > 0 && (_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "keyScope", children: "Scope" }), _jsxs(Select, { id: "keyScope", value: scopeGraphId, onChange: (e) => setScopeGraphId(e.target.value), children: [_jsx("option", { value: "", children: "Account-wide (all graphs)" }), graphs.map((graph) => (_jsxs("option", { value: graph.graphId, children: [graph.graphName, " (", graph.graphId, ")"] }, graph.graphId)))] }), _jsx("p", { className: "text-sm text-zinc-500 dark:text-zinc-400", children: scopeGraphId
|
|
51
51
|
? 'Graph-scoped: works only for this graph (and its subgraphs), and is the only kind of key accepted inside an MCP connector URL.'
|
|
52
|
-
: 'Account-wide: works for every graph via the X-API-Key header and the SDKs. Not accepted inside MCP connector URLs — pick a graph scope for that, or use the Connect page.' })] })), _jsx("div", { className: "bg-primary-50 dark:bg-primary-900/30 rounded-lg p-3", children: _jsxs("p", { className: "text-primary-800 dark:text-primary-300 text-sm", children: [_jsx("strong", { children: "Note:" }), " API keys do not expire by date. Keys that haven't been used for 90 days will be automatically deactivated for security."] }) }), error &&
|
|
52
|
+
: 'Account-wide: works for every graph via the X-API-Key header and the SDKs. Not accepted inside MCP connector URLs — pick a graph scope for that, or use the Connect page.' })] })), _jsx("div", { className: "bg-primary-50 dark:bg-primary-900/30 rounded-lg p-3", children: _jsxs("p", { className: "text-primary-800 dark:text-primary-300 text-sm", children: [_jsx("strong", { children: "Note:" }), " API keys do not expire by date. Keys that haven't been used for 90 days will be automatically deactivated for security."] }) }), error && _jsx(StatusAlert, { type: "error", message: error })] })) }), _jsx(ModalFooter, { children: newApiKey ? (_jsx(Button, { color: "blue", onClick: handleCloseModal, children: "Done" })) : (_jsxs(_Fragment, { children: [_jsx(Button, { color: "gray", onClick: handleCloseModal, children: "Cancel" }), _jsx(Button, { color: "primary", onClick: handleSubmit, disabled: isCreating || !keyName, children: isCreating ? (_jsx(Spinner, { size: "sm", className: "text-white" })) : ('Create API Key') })] })) })] }));
|
|
53
53
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Button, TextInput, Tooltip } from 'flowbite-react';
|
|
4
3
|
import { useState } from 'react';
|
|
5
4
|
import { HiCheckCircle, HiClipboardCopy, HiDownload, HiEye, HiEyeOff, } from 'react-icons/hi';
|
|
5
|
+
import { Button, TextInput, Tooltip } from '../../ui';
|
|
6
6
|
export const SecureApiKeyField = ({ apiKey, keyId, keyName = 'API Key', className = '', showLabel = false, label = 'API Key', onCopy, onReveal, onDownload, }) => {
|
|
7
7
|
const [isRevealed, setIsRevealed] = useState(false);
|
|
8
8
|
const [copyStatus, setCopyStatus] = useState('idle');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Textarea } from 'flowbite-react';
|
|
3
2
|
import { IoSend } from 'react-icons/io5';
|
|
3
|
+
import { Button, Textarea } from '../../ui';
|
|
4
4
|
import { DeepResearchToggle } from './DeepResearchToggle';
|
|
5
5
|
export const ChatInputArea = ({ input, loading, dots, forceDeepResearch, textareaRef, placeholder = 'Type your message...', deepResearchTooltip, onInputChange, onKeyDown, onSendMessage, onToggleDeepResearch, }) => {
|
|
6
6
|
return (_jsx("div", { className: "border-t border-gray-200 p-4 dark:border-gray-700", children: _jsxs("div", { className: "flex items-end gap-2", children: [_jsxs("div", { className: "relative flex-1", children: [_jsx(DeepResearchToggle, { isEnabled: forceDeepResearch, onToggle: onToggleDeepResearch, tooltipContent: deepResearchTooltip }), _jsx(Textarea, { ref: textareaRef, className: "focus:border-secondary-500 focus:ring-secondary-500 min-h-[52px] w-full resize-none rounded-lg border-gray-200 bg-white pl-10 text-gray-900 placeholder:text-gray-500 dark:border-gray-700 dark:bg-zinc-800 dark:text-gray-100 dark:placeholder:text-gray-400", value: loading
|
|
@@ -10,9 +10,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { Card, Progress } from 'flowbite-react';
|
|
14
13
|
import { FaClock, FaSpinner } from 'react-icons/fa';
|
|
15
14
|
import ReactMarkdown from 'react-markdown';
|
|
15
|
+
import { Card, Progress } from '../../ui';
|
|
16
16
|
export const ChatMessage = ({ message }) => (_jsx("div", { className: `flex ${message.user === 'You' ? 'justify-end' : 'justify-start'}`, children: _jsxs(Card, { className: `max-w-[80%] ${message.user === 'You'
|
|
17
17
|
? 'bg-secondary-500 dark:bg-secondary-600 text-white'
|
|
18
18
|
: 'bg-gray-50 text-gray-900 dark:bg-zinc-700 dark:text-gray-100'}`, children: [_jsxs("div", { className: "mb-0.5 flex items-center justify-between text-sm font-semibold opacity-75", children: [_jsx("span", { children: message.user }), message.isPartial && (_jsxs("div", { className: "flex items-center gap-1", children: [_jsx(FaSpinner, { className: "h-3 w-3 animate-spin" }), _jsx("span", { className: "text-xs", children: "Analyzing..." })] })), message.taskId && !message.isPartial && (_jsxs("div", { className: "flex items-center gap-1", children: [_jsx(FaClock, { className: "h-3 w-3" }), _jsx("span", { className: "text-xs", children: "Deep research" })] }))] }), _jsx(ReactMarkdown, { components: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Tooltip } from 'flowbite-react';
|
|
3
2
|
import { FaLightbulb } from 'react-icons/fa';
|
|
3
|
+
import { Tooltip } from '../../ui';
|
|
4
4
|
export const DeepResearchToggle = ({ isEnabled, onToggle, tooltipContent = 'Deep Research: Enables comprehensive analysis with up to 12 tool calls', }) => {
|
|
5
5
|
return (_jsx("div", { className: "absolute top-3 left-3 z-10", children: _jsx(Tooltip, { content: tooltipContent, placement: "top", children: _jsx("div", { className: `cursor-pointer transition-all duration-200 ${isEnabled
|
|
6
6
|
? 'text-yellow-500 hover:text-yellow-400'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { TextInput } from 'flowbite-react';
|
|
4
3
|
import { useState } from 'react';
|
|
4
|
+
import { TextInput } from '../../ui';
|
|
5
5
|
const MAX_VISIBLE_SUGGESTIONS = 8;
|
|
6
6
|
/**
|
|
7
7
|
* Freeform combobox for single-value categorization (document folder,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Card } from '
|
|
3
|
-
export const SettingsCard = ({ title, description, icon: Icon, children,
|
|
4
|
-
return (_jsxs(Card, {
|
|
2
|
+
import { Card } from '../../ui';
|
|
3
|
+
export const SettingsCard = ({ title, description, icon: Icon, children, className = '', }) => {
|
|
4
|
+
return (_jsxs(Card, { className: className, children: [_jsxs("div", { className: "mb-6", children: [Icon && (_jsxs("div", { className: "mb-4 flex items-start gap-3", children: [_jsx("div", { className: "rounded-lg bg-zinc-100 p-2 dark:bg-zinc-800", children: _jsx(Icon, { className: "h-5 w-5 text-zinc-600 dark:text-zinc-400" }) }), _jsxs("div", { className: "flex-1", children: [_jsx("h3", { className: "font-heading text-lg font-semibold text-zinc-900 dark:text-zinc-100", children: title }), description && (_jsx("p", { className: "mt-1 text-sm text-zinc-600 dark:text-zinc-400", children: description }))] })] })), !Icon && (_jsxs(_Fragment, { children: [_jsx("h3", { className: "font-heading text-lg font-semibold text-zinc-900 dark:text-zinc-100", children: title }), description && (_jsx("p", { className: "mt-1 text-sm text-zinc-600 dark:text-zinc-400", children: description }))] }))] }), children] }));
|
|
5
5
|
};
|
|
@@ -10,8 +10,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { Label, TextInput } from '
|
|
13
|
+
import { Label, TextInput } from '../../ui';
|
|
14
14
|
export const SettingsFormField = (_a) => {
|
|
15
|
-
var { id, label, name = id, type = 'text', placeholder, defaultValue, value, required = false, disabled = false,
|
|
16
|
-
return (_jsxs("div", { className: `grid grid-cols-1 gap-y-3 ${className}`, children: [_jsx(Label, {
|
|
15
|
+
var { id, label, name = id, type = 'text', placeholder, defaultValue, value, required = false, disabled = false, className = '', onChange, min, max } = _a, props = __rest(_a, ["id", "label", "name", "type", "placeholder", "defaultValue", "value", "required", "disabled", "className", "onChange", "min", "max"]);
|
|
16
|
+
return (_jsxs("div", { className: `grid grid-cols-1 gap-y-3 ${className}`, children: [_jsx(Label, { htmlFor: id, children: label }), _jsx(TextInput, Object.assign({ id: id, name: name, type: type, placeholder: placeholder, defaultValue: defaultValue, value: value, required: required, disabled: disabled, onChange: onChange, min: min, max: max }, props))] }));
|
|
17
17
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Alert } from 'flowbite-react';
|
|
3
2
|
import { HiCheckCircle, HiExclamationCircle } from 'react-icons/hi';
|
|
4
|
-
|
|
3
|
+
import { Alert } from '../../ui';
|
|
4
|
+
export const StatusAlert = ({ type, message, className = 'mb-4', }) => {
|
|
5
5
|
const isSuccess = type === 'success';
|
|
6
|
-
return (_jsx(Alert, {
|
|
6
|
+
return (_jsx(Alert, { color: isSuccess ? 'success' : 'failure', className: `${className} relative z-10 w-full`, children: _jsxs("div", { className: "flex items-center", children: [isSuccess ? (_jsx(HiCheckCircle, { className: "mr-2 h-4 w-4 shrink-0" })) : (_jsx(HiExclamationCircle, { className: "mr-2 h-4 w-4 shrink-0" })), _jsx("span", { className: "font-medium", children: isSuccess ? 'Success!' : 'Error!' }), _jsx("span", { className: "ml-1", children: message })] }) }));
|
|
7
7
|
};
|
|
@@ -7,7 +7,7 @@ export interface TagInputProps {
|
|
|
7
7
|
* case-insensitively against the draft input, minus already-added tags.
|
|
8
8
|
*/
|
|
9
9
|
suggestions?: string[];
|
|
10
|
-
/**
|
|
10
|
+
/** Badge color for the tag chips. */
|
|
11
11
|
badgeColor?: string;
|
|
12
12
|
placeholder?: string;
|
|
13
13
|
id?: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Badge, TextInput } from 'flowbite-react';
|
|
4
3
|
import { useState } from 'react';
|
|
5
4
|
import { HiX } from 'react-icons/hi';
|
|
5
|
+
import { Badge, TextInput } from '../../ui';
|
|
6
6
|
const MAX_VISIBLE_SUGGESTIONS = 8;
|
|
7
7
|
/**
|
|
8
8
|
* Chips-style tag editor. Enter or comma commits the draft (trimmed,
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { DarkThemeToggle, Dropdown, DropdownDivider, DropdownHeader, DropdownItem, Navbar as FlowbiteNavbar, NavbarBrand, Tooltip, } from 'flowbite-react';
|
|
4
3
|
import Link from 'next/link';
|
|
5
4
|
import { HiExternalLink, HiMenuAlt1, HiUserCircle, HiX } from 'react-icons/hi';
|
|
6
5
|
import { AppSwitcher } from '../../auth-components';
|
|
7
6
|
import { useAuth } from '../../auth-components/AuthProvider';
|
|
8
7
|
import { useSidebarContext } from '../../contexts';
|
|
9
8
|
import { useMediaQuery, useUser } from '../../hooks';
|
|
10
|
-
import {
|
|
9
|
+
import { Navbar as BaseNavbar, DarkThemeToggle, Dropdown, DropdownDivider, DropdownHeader, DropdownItem, NavbarBrand, Tooltip, } from '../../ui';
|
|
11
10
|
import { LogoBadge } from '../Logo';
|
|
12
11
|
import { useAccountSettingsLink } from './account-settings';
|
|
13
12
|
import { ThemeToggle } from './ThemeToggle';
|
|
@@ -41,21 +40,21 @@ export function CoreNavbar({ appName, currentApp, apiUrl = process.env.NEXT_PUBL
|
|
|
41
40
|
if (useCustomThemeToggle) {
|
|
42
41
|
return _jsx(ThemeToggle, {});
|
|
43
42
|
}
|
|
44
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "hidden dark:block", children: _jsx(Tooltip, { content: "Toggle light mode",
|
|
43
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "hidden dark:block", children: _jsx(Tooltip, { content: "Toggle light mode", children: _jsx(DarkThemeToggle, {}) }) }), _jsx("div", { className: "dark:hidden", children: _jsx(Tooltip, { content: "Toggle dark mode", children: _jsx(DarkThemeToggle, {}) }) })] }));
|
|
45
44
|
};
|
|
46
|
-
const renderAppSwitcher = () => (_jsx(Tooltip, { content: "Switch apps",
|
|
47
|
-
return (_jsx(
|
|
45
|
+
const renderAppSwitcher = () => (_jsx(Tooltip, { content: "Switch apps", children: _jsx(AppSwitcher, { apiUrl: apiUrl, currentApp: currentApp }) }));
|
|
46
|
+
return (_jsx(BaseNavbar, { fluid: true, className: `fixed top-0 z-30 w-full border-b border-gray-200 p-0 ${borderColorClass} bg-white sm:p-0 dark:bg-black ${className}`, children: _jsx("div", { className: "w-full p-3 pr-4", children: _jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsxs("div", { className: "flex min-w-0 items-center", children: [_jsxs("button", { onClick: handleToggleSidebar, className: "mr-1 shrink-0 cursor-pointer rounded-sm p-2 text-gray-600 hover:bg-zinc-100 hover:text-gray-900 sm:mr-3 dark:text-gray-400 dark:hover:bg-zinc-700 dark:hover:text-white", children: [_jsx("span", { className: "sr-only", children: "Toggle sidebar" }), _jsx("div", { className: "lg:hidden", children: sidebar.mobile.isOpen ? (_jsx(HiX, { className: "h-6 w-6" })) : (_jsx(HiMenuAlt1, { className: "h-6 w-6" })) }), _jsx("div", { className: "hidden lg:block", children: _jsx(HiMenuAlt1, { className: "h-6 w-6" }) })] }), _jsxs(NavbarBrand, { as: Link, href: homeHref, className: "min-w-0 lg:mr-14", children: [_jsx(LogoBadge, { app: currentApp, animate: "once", className: "mr-1.5 h-8 w-8 shrink-0 sm:mr-2 sm:h-10 sm:w-10" }), _jsx("span", { className: "font-heading mt-1 self-center truncate text-base font-semibold text-gray-900 sm:mt-2 sm:ml-1 sm:text-2xl dark:text-white", children: appName })] })] }), _jsx("div", { className: "flex shrink-0 items-center lg:gap-3", children: _jsxs("div", { className: "flex items-center", children: [additionalComponents && (_jsx("div", { className: "mr-2 hidden md:block", children: additionalComponents })), _jsxs("div", { className: "flex items-center space-x-2", children: [showAppSwitcherFirst && renderAppSwitcher(), renderThemeToggle(), !showAppSwitcherFirst && renderAppSwitcher(), _jsx(UserDropdown, { user: user, apiUrl: apiUrl, docsHref: docsHref, onLogout: handleLogout })] })] }) })] }) }) }));
|
|
48
47
|
}
|
|
49
48
|
function UserDropdown({ user, apiUrl, docsHref, onLogout }) {
|
|
50
49
|
const settings = useAccountSettingsLink(apiUrl);
|
|
51
|
-
return (_jsx("div", { className: "relative", children: _jsxs(Dropdown, {
|
|
50
|
+
return (_jsx("div", { className: "relative", children: _jsxs(Dropdown, { className: "z-50! w-64", arrowIcon: false, inline: true, label: _jsxs("span", { className: "inline-flex h-10 w-10 items-center justify-center rounded-lg text-sm text-gray-500 hover:bg-zinc-100 focus:ring-2 focus:ring-gray-200 focus:outline-hidden dark:text-gray-400 dark:hover:bg-zinc-700 dark:focus:ring-gray-600", children: [_jsx("span", { className: "sr-only", children: "User menu" }), _jsx(HiUserCircle, { className: "h-6 w-6" })] }), children: [_jsxs(DropdownHeader, { className: "px-4 py-3", children: [_jsx("div", { className: "block text-sm font-medium text-gray-900 dark:text-white", children: (user === null || user === void 0 ? void 0 : user.name) || 'User' }), (user === null || user === void 0 ? void 0 : user.email) && (_jsx("div", { className: "block truncate text-sm text-gray-500 dark:text-gray-400", children: user.email }))] }), settings.isCrossApp ? (_jsxs(DropdownItem, { onClick: () => {
|
|
52
51
|
void settings.open();
|
|
53
|
-
}, title: settings.description, className: "flex w-full items-center justify-between p-3", children: [_jsx("span", { children: "User Settings" }), _jsx(HiExternalLink, { "aria-hidden": "true", className: "ml-3 h-4 w-4 shrink-0 text-gray-400 dark:text-gray-500" }), _jsx("span", { className: "sr-only", children: ` (opens ${settings.hostAppName} in a new tab)` })] })) : (_jsx(DropdownItem, {
|
|
52
|
+
}, title: settings.description, className: "flex w-full items-center justify-between p-3", children: [_jsx("span", { children: "User Settings" }), _jsx(HiExternalLink, { "aria-hidden": "true", className: "ml-3 h-4 w-4 shrink-0 text-gray-400 dark:text-gray-500" }), _jsx("span", { className: "sr-only", children: ` (opens ${settings.hostAppName} in a new tab)` })] })) : (_jsx(DropdownItem, { as: Link, href: settings.href, className: "flex w-full items-center space-x-3 p-3", children: "User Settings" })), docsHref && (
|
|
54
53
|
// The docs wear the public site's chrome, so they open in a new tab and
|
|
55
54
|
// the app keeps its place. This is the app's only global route to them:
|
|
56
55
|
// a signed-in visitor to / is sent to /home and never sees the public
|
|
57
56
|
// header's links.
|
|
58
|
-
_jsxs(DropdownItem, {
|
|
57
|
+
_jsxs(DropdownItem, { as: Link, href: docsHref, target: "_blank", rel: "noopener noreferrer", className: "flex w-full items-center justify-between p-3", children: [_jsx("span", { children: "Documentation" }), _jsx(HiExternalLink, { "aria-hidden": "true", className: "ml-3 h-4 w-4 shrink-0 text-gray-400 dark:text-gray-500" }), _jsx("span", { className: "sr-only", children: " (opens in a new tab)" })] })), _jsx(DropdownDivider, {}), _jsx(DropdownItem, { onClick: () => {
|
|
59
58
|
onLogout();
|
|
60
59
|
}, className: "flex w-full items-center space-x-3 p-3", children: "Sign out" })] }) }));
|
|
61
60
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Button, Sidebar, SidebarCollapse, SidebarItem, SidebarItemGroup, SidebarItems, Tooltip, } from 'flowbite-react';
|
|
4
3
|
import Link from 'next/link';
|
|
5
4
|
import { usePathname } from 'next/navigation';
|
|
6
5
|
import { HiCog, HiOfficeBuilding } from 'react-icons/hi';
|
|
7
6
|
import { twMerge } from 'tailwind-merge';
|
|
8
7
|
import { useOrg, useSidebarContext } from '../../contexts';
|
|
9
|
-
import {
|
|
8
|
+
import { Button, Sidebar, SidebarCollapse, SidebarItem, SidebarItemGroup, SidebarItems, Tooltip, } from '../../ui';
|
|
10
9
|
import { useAccountSettingsLink } from './account-settings';
|
|
11
10
|
export function CoreSidebar({ navigationItems, features = {}, bottomMenuActions = [], additionalMobileComponents, className = '', borderColorClass = 'dark:border-gray-700', }) {
|
|
12
11
|
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "lg:hidden", children: _jsx(MobileSidebar, { navigationItems: navigationItems, features: features, bottomMenuActions: bottomMenuActions, additionalMobileComponents: additionalMobileComponents, borderColorClass: borderColorClass }) }), _jsx("div", { className: `hidden lg:block ${className}`, children: _jsx(DesktopSidebar, { navigationItems: navigationItems, features: features, bottomMenuActions: bottomMenuActions, borderColorClass: borderColorClass }) })] }));
|
|
@@ -14,14 +13,14 @@ export function CoreSidebar({ navigationItems, features = {}, bottomMenuActions
|
|
|
14
13
|
function DesktopSidebar({ navigationItems, features, bottomMenuActions, borderColorClass, }) {
|
|
15
14
|
const pathname = usePathname();
|
|
16
15
|
const { isCollapsed } = useSidebarContext().desktop;
|
|
17
|
-
return (_jsx(Sidebar, { "aria-label": "Sidebar with multi-level dropdown example",
|
|
16
|
+
return (_jsx(Sidebar, { "aria-label": "Sidebar with multi-level dropdown example", collapsed: isCollapsed, className: twMerge(`fixed inset-y-0 left-0 z-20 flex h-full shrink-0 flex-col border-r border-gray-200 pt-16 duration-75 ${borderColorClass} lg:flex`), id: "sidebar", children: _jsxs("div", { className: "flex h-full flex-col justify-between", children: [_jsx("div", { className: "py-2", children: _jsxs(SidebarItems, { children: [_jsx(OrgSection, { isCollapsed: isCollapsed, showOrgSection: features.showOrgSection }), _jsx(SidebarItemGroup, { className: "mt-0 border-t-0 pt-2 pb-1", children: navigationItems.map((item) => (_jsx(CustomSidebarItem, Object.assign({}, item, { pathname: pathname }), item.label))) })] }) }), _jsx(BottomMenu, { isCollapsed: isCollapsed, features: features, bottomMenuActions: bottomMenuActions })] }) }));
|
|
18
17
|
}
|
|
19
18
|
function MobileSidebar({ navigationItems, features, bottomMenuActions, additionalMobileComponents, borderColorClass, }) {
|
|
20
19
|
const pathname = usePathname();
|
|
21
20
|
const { isOpen, close } = useSidebarContext().mobile;
|
|
22
21
|
if (!isOpen)
|
|
23
22
|
return null;
|
|
24
|
-
return (_jsxs(_Fragment, { children: [_jsx(Sidebar, { "aria-label": "Sidebar with multi-level dropdown example",
|
|
23
|
+
return (_jsxs(_Fragment, { children: [_jsx(Sidebar, { "aria-label": "Sidebar with multi-level dropdown example", className: twMerge(`fixed inset-y-0 left-0 z-20 hidden h-full shrink-0 flex-col border-r border-gray-200 pt-16 ${borderColorClass} lg:flex`, isOpen && 'flex'), id: "sidebar", children: _jsxs("div", { className: "flex h-full flex-col justify-between", children: [_jsxs("div", { className: "py-2", children: [additionalMobileComponents && (_jsx("div", { className: "hidden pb-2 max-md:block", children: additionalMobileComponents })), _jsxs(SidebarItems, { children: [_jsx(OrgSection, { isCollapsed: false, showOrgSection: features.showOrgSection }), _jsx(SidebarItemGroup, { className: "mt-0 border-t-0 pt-2 pb-1", children: navigationItems.map((item) => (_jsx(CustomSidebarItem, Object.assign({}, item, { pathname: pathname }), item.label))) })] })] }), _jsx(BottomMenu, { isCollapsed: false, features: features, bottomMenuActions: bottomMenuActions })] }) }), _jsx("div", { onClick: close, "aria-hidden": "true", className: "fixed inset-0 z-10 h-full w-full bg-zinc-900/50 pt-16 dark:bg-zinc-900/90" })] }));
|
|
25
24
|
}
|
|
26
25
|
// SidebarItem renders an <a> for an href and forwards these, but its props are typed
|
|
27
26
|
// as a div's, so they are spread rather than written as attributes. A link that opens a
|
|
@@ -39,23 +38,23 @@ function CustomSidebarItem({ href, target, icon: Icon, label, items, badge, path
|
|
|
39
38
|
if (!(items === null || items === void 0 ? void 0 : items.length)) {
|
|
40
39
|
const isExternal = target === '_blank' || (href === null || href === void 0 ? void 0 : href.startsWith('http'));
|
|
41
40
|
if (isExternal) {
|
|
42
|
-
return (_jsx(SidebarItem, Object.assign({ href: href || '#' }, newTabProps(target), { icon: Icon, active: pathname === href,
|
|
41
|
+
return (_jsx(SidebarItem, Object.assign({ href: href || '#' }, newTabProps(target), { icon: Icon, active: pathname === href, className: pathname === href
|
|
43
42
|
? 'bg-primary-50 text-primary-700 dark:bg-primary-200 dark:text-primary-800'
|
|
44
43
|
: '', children: label })));
|
|
45
44
|
}
|
|
46
|
-
return (_jsx(SidebarItem, { as: Link, href: href || '#', icon: Icon, active: pathname === href,
|
|
45
|
+
return (_jsx(SidebarItem, { as: Link, href: href || '#', icon: Icon, active: pathname === href, className: pathname === href
|
|
47
46
|
? 'bg-zinc-100 text-gray-900 dark:bg-zinc-800 dark:text-gray-200'
|
|
48
47
|
: '', children: label }));
|
|
49
48
|
}
|
|
50
|
-
return (_jsx(SidebarCollapse, { icon: Icon, label: label,
|
|
49
|
+
return (_jsx(SidebarCollapse, { icon: Icon, label: label, open: items.some((item) => pathname === item.href), children: items.map((item) => {
|
|
51
50
|
var _a;
|
|
52
51
|
const isExternal = item.target === '_blank' || ((_a = item.href) === null || _a === void 0 ? void 0 : _a.startsWith('http'));
|
|
53
52
|
if (isExternal) {
|
|
54
|
-
return (_jsx(SidebarItem, Object.assign({ href: item.href || '#' }, newTabProps(item.target), { active: pathname === item.href,
|
|
53
|
+
return (_jsx(SidebarItem, Object.assign({ href: item.href || '#' }, newTabProps(item.target), { active: pathname === item.href, className: pathname === item.href
|
|
55
54
|
? 'bg-primary-50 text-primary-700 dark:bg-primary-200 dark:text-primary-800'
|
|
56
55
|
: '', children: item.label }), item.label));
|
|
57
56
|
}
|
|
58
|
-
return (_jsx(SidebarItem, { as: Link, href: item.href || '#', active: pathname === item.href,
|
|
57
|
+
return (_jsx(SidebarItem, { as: Link, href: item.href || '#', active: pathname === item.href, className: pathname === item.href
|
|
59
58
|
? 'bg-primary-50 text-primary-700 dark:bg-primary-200 dark:text-primary-800'
|
|
60
59
|
: '', children: item.label }, item.label));
|
|
61
60
|
}) }));
|
|
@@ -66,7 +65,7 @@ function OrgSection({ isCollapsed, showOrgSection = true, }) {
|
|
|
66
65
|
const isActive = pathname === '/organization';
|
|
67
66
|
if (!showOrgSection || !currentOrg)
|
|
68
67
|
return null;
|
|
69
|
-
return (_jsx(SidebarItemGroup, { className: "border-b border-gray-200 pb-2 dark:border-gray-700", children: _jsx(SidebarItem, { as: Link, href: "/organization", icon: HiOfficeBuilding, active: isActive,
|
|
68
|
+
return (_jsx(SidebarItemGroup, { className: "border-b border-gray-200 pb-2 dark:border-gray-700", children: _jsx(SidebarItem, { as: Link, href: "/organization", icon: HiOfficeBuilding, active: isActive, className: isActive
|
|
70
69
|
? 'bg-zinc-100 text-gray-900 dark:bg-zinc-800 dark:text-gray-200'
|
|
71
70
|
: '', children: _jsx("span", { className: "truncate text-sm", children: currentOrg.name }) }) }));
|
|
72
71
|
}
|
|
@@ -77,12 +76,12 @@ function OrgSection({ isCollapsed, showOrgSection = true, }) {
|
|
|
77
76
|
function SettingsButton() {
|
|
78
77
|
const settings = useAccountSettingsLink();
|
|
79
78
|
if (!settings.isCrossApp) {
|
|
80
|
-
return (_jsx(Tooltip, { content: settings.description,
|
|
79
|
+
return (_jsx(Tooltip, { content: settings.description, children: _jsx(Button, { as: Link, href: settings.href, color: "ghost", className: "rounded-lg p-2 hover:bg-gray-100 dark:hover:bg-gray-700", children: _jsx(HiCog, { className: "text-lg text-gray-500 dark:text-gray-400" }) }) }));
|
|
81
80
|
}
|
|
82
|
-
return (_jsx(Tooltip, { content: settings.description,
|
|
81
|
+
return (_jsx(Tooltip, { content: settings.description, children: _jsx(Button, { onClick: () => {
|
|
83
82
|
void settings.open();
|
|
84
83
|
}, disabled: settings.isOpening, color: "ghost", "aria-label": settings.description, className: "rounded-lg p-2 hover:bg-gray-100 disabled:opacity-50 dark:hover:bg-gray-700", children: _jsx(HiCog, { className: "text-lg text-gray-500 dark:text-gray-400" }) }) }));
|
|
85
84
|
}
|
|
86
85
|
function BottomMenu({ isCollapsed, features, bottomMenuActions, }) {
|
|
87
|
-
return (_jsxs("div", { className: `flex items-center justify-center border-t border-gray-200 px-4 py-4 dark:border-gray-700 ${isCollapsed ? 'flex-col gap-y-2' : 'gap-x-5'}`, children: [_jsx(SettingsButton, {}), bottomMenuActions.map((action, index) => (_jsx(Tooltip, { content: action.tooltip,
|
|
86
|
+
return (_jsxs("div", { className: `flex items-center justify-center border-t border-gray-200 px-4 py-4 dark:border-gray-700 ${isCollapsed ? 'flex-col gap-y-2' : 'gap-x-5'}`, children: [_jsx(SettingsButton, {}), bottomMenuActions.map((action, index) => (_jsx(Tooltip, { content: action.tooltip, children: _jsx(Button, { onClick: action.onClick, color: "ghost", className: "rounded-lg p-2 hover:bg-gray-100 dark:hover:bg-gray-700", children: _jsx(action.icon, { className: "text-lg text-gray-500 dark:text-gray-400" }) }) }, index)))] }));
|
|
88
87
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { DarkThemeToggle, Tooltip } from '
|
|
3
|
+
import { DarkThemeToggle, Tooltip } from '../../ui';
|
|
4
4
|
export function ThemeToggle({ className = '' }) {
|
|
5
5
|
return (_jsxs("div", { className: className, children: [_jsx("div", { className: "hidden dark:block", children: _jsx(Tooltip, { content: "Toggle light mode", children: _jsx(DarkThemeToggle, {}) }) }), _jsx("div", { className: "dark:hidden", children: _jsx(Tooltip, { content: "Toggle dark mode", children: _jsx(DarkThemeToggle, {}) }) })] }));
|
|
6
6
|
}
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import type { AuthUser, UserUpdateData } from '../types';
|
|
3
3
|
export interface GeneralInformationCardProps {
|
|
4
4
|
user: AuthUser;
|
|
5
|
-
theme?: any;
|
|
6
5
|
onUpdate?: (data: UserUpdateData) => Promise<void>;
|
|
7
6
|
onRefresh?: () => Promise<void>;
|
|
8
7
|
onSuccess?: (message: string) => void;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as SDK from '@robosystems/client';
|
|
4
|
-
import { Button } from 'flowbite-react';
|
|
5
4
|
import { useState } from 'react';
|
|
6
5
|
import { HiUser } from 'react-icons/hi';
|
|
6
|
+
import { Button } from '../../ui';
|
|
7
7
|
import { Spinner } from '../Spinner';
|
|
8
8
|
import { SettingsCard } from '../forms/SettingsCard';
|
|
9
9
|
import { SettingsFormField } from '../forms/SettingsFormField';
|
|
10
10
|
import { StatusAlert } from '../forms/StatusAlert';
|
|
11
|
-
export const GeneralInformationCard = ({ user,
|
|
11
|
+
export const GeneralInformationCard = ({ user, onUpdate = undefined, onRefresh = undefined, onSuccess = undefined, onError = undefined, className = '', }) => {
|
|
12
12
|
const [isLoading, setIsLoading] = useState(false);
|
|
13
13
|
const [error, setError] = useState(null);
|
|
14
14
|
const [success, setSuccess] = useState(false);
|
|
@@ -68,5 +68,5 @@ export const GeneralInformationCard = ({ user, theme, onUpdate = undefined, onRe
|
|
|
68
68
|
setIsLoading(false);
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
|
-
return (_jsxs(SettingsCard, { title: "General information", description: "Update your account details", icon: HiUser,
|
|
71
|
+
return (_jsxs(SettingsCard, { title: "General information", description: "Update your account details", icon: HiUser, className: className, children: [_jsxs("div", { className: "space-y-4", children: [error && _jsx(StatusAlert, { type: "error", message: error }), success && (_jsx(StatusAlert, { type: "success", message: "Profile updated successfully." }))] }), _jsx("form", { onSubmit: handleSubmit, children: _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [_jsx(SettingsFormField, { id: "username", label: "Username", placeholder: "Username", defaultValue: user.name, required: true }), _jsx(SettingsFormField, { id: "email", label: "Email", type: "email", placeholder: "Email", defaultValue: user.email, required: true })] }), _jsx("div", { className: "flex justify-end pt-2", children: _jsx(Button, { color: "blue", type: "submit", disabled: isLoading, children: isLoading ? (_jsx(Spinner, { size: "sm", className: "text-white" })) : ('Save Changes') }) })] }) })] }));
|
|
72
72
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { PasswordUpdateData } from '../types';
|
|
3
3
|
export interface PasswordInformationCardProps {
|
|
4
|
-
theme?: any;
|
|
5
4
|
onUpdate?: (data: PasswordUpdateData) => Promise<void>;
|
|
6
5
|
onSuccess?: (message: string) => void;
|
|
7
6
|
onError?: (message: string) => void;
|