@gofreego/tsutils 0.1.19 → 0.1.20
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/index.d.mts +19 -1
- package/dist/index.d.ts +19 -1
- package/dist/index.js +51 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +51 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -262,6 +262,10 @@ interface SidebarLayoutProps {
|
|
|
262
262
|
menuItems: MenuItem[];
|
|
263
263
|
/** Width of the sidebar */
|
|
264
264
|
sidebarWidth?: string | number;
|
|
265
|
+
/** Header component to display at the top of the sidebar */
|
|
266
|
+
header?: ReactNode;
|
|
267
|
+
/** Footer component to display at the bottom of the sidebar */
|
|
268
|
+
footer?: ReactNode;
|
|
265
269
|
/** Additional CSS class for container */
|
|
266
270
|
className?: string;
|
|
267
271
|
/** Default selected menu item ID (for non-router mode) */
|
|
@@ -446,6 +450,20 @@ interface ConfirmDialogProps {
|
|
|
446
450
|
}
|
|
447
451
|
declare const ConfirmDialog: ({ open, title, message, confirmText, cancelText, confirmColor, onConfirm, onCancel, }: ConfirmDialogProps) => react_jsx_runtime.JSX.Element;
|
|
448
452
|
|
|
453
|
+
interface SidebarHeaderProps {
|
|
454
|
+
/** The text to display in the header */
|
|
455
|
+
title: string;
|
|
456
|
+
/** Path for the home button redirection (defaults to "/") */
|
|
457
|
+
homePath?: string;
|
|
458
|
+
/** Whether to show the home button */
|
|
459
|
+
showHome?: boolean;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* A standardized header component to be used with SidebarLayout.
|
|
463
|
+
* It includes a title and an optional home button that redirects to a specified path.
|
|
464
|
+
*/
|
|
465
|
+
declare const SidebarHeader: React__default.FC<SidebarHeaderProps>;
|
|
466
|
+
|
|
449
467
|
/**
|
|
450
468
|
* Theme mode options
|
|
451
469
|
* - 'light': Always use light theme
|
|
@@ -799,4 +817,4 @@ declare class LocalStorage {
|
|
|
799
817
|
|
|
800
818
|
declare const getHighlighter: () => Promise<Highlighter>;
|
|
801
819
|
|
|
802
|
-
export { AuthService, ConfirmDialog, type ConfirmDialogProps, type ErrorData, type GenerateLoginTokenRequest, type GenerateLoginTokenResponse, HttpClient, type HttpClientConfig, type HttpError, type HttpResponse, type IAuthService, type ISessionManager, LocalStorage, LoginCallbackPage, type LoginCallbackPageProps, type LogoutRequest, type LogoutResponse, type MenuItem, NotFoundPage, type Notification, type NotificationContextType, NotificationProvider, type NotificationProviderProps, ProtectedRoute, type ProtectedRouteProps, ReadmeViewer, type RefreshTokenRequest, type RefreshTokenResponse, type RequestConfig, type ResolvedThemeMode, SessionManager, SidebarLayout, type SidebarLayoutProps, type SignInMetadata, type SignInRequest, type SignInResponse, type SignInWithLoginTokenRequest, type Theme, type ThemeContextValue, type ThemeMode, ThemeProvider, ThemeToggle, type User, borderRadius, cn, darkTheme, debounce, elevation, extractErrorMessage, fontSize, fontWeight, formatDate, getHighlighter, lightTheme, lineHeight, spacing, throttle, tokens, transition, useNotification, useTheme, zIndex };
|
|
820
|
+
export { AuthService, ConfirmDialog, type ConfirmDialogProps, type ErrorData, type GenerateLoginTokenRequest, type GenerateLoginTokenResponse, HttpClient, type HttpClientConfig, type HttpError, type HttpResponse, type IAuthService, type ISessionManager, LocalStorage, LoginCallbackPage, type LoginCallbackPageProps, type LogoutRequest, type LogoutResponse, type MenuItem, NotFoundPage, type Notification, type NotificationContextType, NotificationProvider, type NotificationProviderProps, ProtectedRoute, type ProtectedRouteProps, ReadmeViewer, type RefreshTokenRequest, type RefreshTokenResponse, type RequestConfig, type ResolvedThemeMode, SessionManager, SidebarHeader, type SidebarHeaderProps, SidebarLayout, type SidebarLayoutProps, type SignInMetadata, type SignInRequest, type SignInResponse, type SignInWithLoginTokenRequest, type Theme, type ThemeContextValue, type ThemeMode, ThemeProvider, ThemeToggle, type User, borderRadius, cn, darkTheme, debounce, elevation, extractErrorMessage, fontSize, fontWeight, formatDate, getHighlighter, lightTheme, lineHeight, spacing, throttle, tokens, transition, useNotification, useTheme, zIndex };
|
package/dist/index.d.ts
CHANGED
|
@@ -262,6 +262,10 @@ interface SidebarLayoutProps {
|
|
|
262
262
|
menuItems: MenuItem[];
|
|
263
263
|
/** Width of the sidebar */
|
|
264
264
|
sidebarWidth?: string | number;
|
|
265
|
+
/** Header component to display at the top of the sidebar */
|
|
266
|
+
header?: ReactNode;
|
|
267
|
+
/** Footer component to display at the bottom of the sidebar */
|
|
268
|
+
footer?: ReactNode;
|
|
265
269
|
/** Additional CSS class for container */
|
|
266
270
|
className?: string;
|
|
267
271
|
/** Default selected menu item ID (for non-router mode) */
|
|
@@ -446,6 +450,20 @@ interface ConfirmDialogProps {
|
|
|
446
450
|
}
|
|
447
451
|
declare const ConfirmDialog: ({ open, title, message, confirmText, cancelText, confirmColor, onConfirm, onCancel, }: ConfirmDialogProps) => react_jsx_runtime.JSX.Element;
|
|
448
452
|
|
|
453
|
+
interface SidebarHeaderProps {
|
|
454
|
+
/** The text to display in the header */
|
|
455
|
+
title: string;
|
|
456
|
+
/** Path for the home button redirection (defaults to "/") */
|
|
457
|
+
homePath?: string;
|
|
458
|
+
/** Whether to show the home button */
|
|
459
|
+
showHome?: boolean;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* A standardized header component to be used with SidebarLayout.
|
|
463
|
+
* It includes a title and an optional home button that redirects to a specified path.
|
|
464
|
+
*/
|
|
465
|
+
declare const SidebarHeader: React__default.FC<SidebarHeaderProps>;
|
|
466
|
+
|
|
449
467
|
/**
|
|
450
468
|
* Theme mode options
|
|
451
469
|
* - 'light': Always use light theme
|
|
@@ -799,4 +817,4 @@ declare class LocalStorage {
|
|
|
799
817
|
|
|
800
818
|
declare const getHighlighter: () => Promise<Highlighter>;
|
|
801
819
|
|
|
802
|
-
export { AuthService, ConfirmDialog, type ConfirmDialogProps, type ErrorData, type GenerateLoginTokenRequest, type GenerateLoginTokenResponse, HttpClient, type HttpClientConfig, type HttpError, type HttpResponse, type IAuthService, type ISessionManager, LocalStorage, LoginCallbackPage, type LoginCallbackPageProps, type LogoutRequest, type LogoutResponse, type MenuItem, NotFoundPage, type Notification, type NotificationContextType, NotificationProvider, type NotificationProviderProps, ProtectedRoute, type ProtectedRouteProps, ReadmeViewer, type RefreshTokenRequest, type RefreshTokenResponse, type RequestConfig, type ResolvedThemeMode, SessionManager, SidebarLayout, type SidebarLayoutProps, type SignInMetadata, type SignInRequest, type SignInResponse, type SignInWithLoginTokenRequest, type Theme, type ThemeContextValue, type ThemeMode, ThemeProvider, ThemeToggle, type User, borderRadius, cn, darkTheme, debounce, elevation, extractErrorMessage, fontSize, fontWeight, formatDate, getHighlighter, lightTheme, lineHeight, spacing, throttle, tokens, transition, useNotification, useTheme, zIndex };
|
|
820
|
+
export { AuthService, ConfirmDialog, type ConfirmDialogProps, type ErrorData, type GenerateLoginTokenRequest, type GenerateLoginTokenResponse, HttpClient, type HttpClientConfig, type HttpError, type HttpResponse, type IAuthService, type ISessionManager, LocalStorage, LoginCallbackPage, type LoginCallbackPageProps, type LogoutRequest, type LogoutResponse, type MenuItem, NotFoundPage, type Notification, type NotificationContextType, NotificationProvider, type NotificationProviderProps, ProtectedRoute, type ProtectedRouteProps, ReadmeViewer, type RefreshTokenRequest, type RefreshTokenResponse, type RequestConfig, type ResolvedThemeMode, SessionManager, SidebarHeader, type SidebarHeaderProps, SidebarLayout, type SidebarLayoutProps, type SignInMetadata, type SignInRequest, type SignInResponse, type SignInWithLoginTokenRequest, type Theme, type ThemeContextValue, type ThemeMode, ThemeProvider, ThemeToggle, type User, borderRadius, cn, darkTheme, debounce, elevation, extractErrorMessage, fontSize, fontWeight, formatDate, getHighlighter, lightTheme, lineHeight, spacing, throttle, tokens, transition, useNotification, useTheme, zIndex };
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var ContentCopyIcon = require('@mui/icons-material/ContentCopy');
|
|
|
14
14
|
var CheckIcon = require('@mui/icons-material/Check');
|
|
15
15
|
var shiki = require('shiki');
|
|
16
16
|
var WarningAmberIcon = require('@mui/icons-material/WarningAmber');
|
|
17
|
+
var HomeIcon = require('@mui/icons-material/Home');
|
|
17
18
|
|
|
18
19
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
20
|
|
|
@@ -24,6 +25,7 @@ var rehypeKatex__default = /*#__PURE__*/_interopDefault(rehypeKatex);
|
|
|
24
25
|
var ContentCopyIcon__default = /*#__PURE__*/_interopDefault(ContentCopyIcon);
|
|
25
26
|
var CheckIcon__default = /*#__PURE__*/_interopDefault(CheckIcon);
|
|
26
27
|
var WarningAmberIcon__default = /*#__PURE__*/_interopDefault(WarningAmberIcon);
|
|
28
|
+
var HomeIcon__default = /*#__PURE__*/_interopDefault(HomeIcon);
|
|
27
29
|
|
|
28
30
|
var __defProp = Object.defineProperty;
|
|
29
31
|
var __export = (target, all) => {
|
|
@@ -814,6 +816,8 @@ var flattenMenuRoutes = (items) => {
|
|
|
814
816
|
var SidebarLayoutRouterInner = ({
|
|
815
817
|
menuItems,
|
|
816
818
|
sidebarWidth = 250,
|
|
819
|
+
header,
|
|
820
|
+
footer,
|
|
817
821
|
className = "",
|
|
818
822
|
onMenuChange,
|
|
819
823
|
style,
|
|
@@ -869,7 +873,7 @@ var SidebarLayoutRouterInner = ({
|
|
|
869
873
|
...style
|
|
870
874
|
},
|
|
871
875
|
children: [
|
|
872
|
-
/* @__PURE__ */ jsxRuntime.
|
|
876
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
873
877
|
material.Drawer,
|
|
874
878
|
{
|
|
875
879
|
variant: "permanent",
|
|
@@ -882,18 +886,24 @@ var SidebarLayoutRouterInner = ({
|
|
|
882
886
|
position: "relative",
|
|
883
887
|
borderRight: "1px solid",
|
|
884
888
|
borderColor: "divider",
|
|
889
|
+
display: "flex",
|
|
890
|
+
flexDirection: "column",
|
|
885
891
|
...sidebarStyle
|
|
886
892
|
}
|
|
887
893
|
},
|
|
888
|
-
children:
|
|
889
|
-
|
|
890
|
-
{
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
894
|
+
children: [
|
|
895
|
+
header && /* @__PURE__ */ jsxRuntime.jsx(material.Box, { className: "sidebar-header", children: header }),
|
|
896
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.List, { sx: { p: 0, flexGrow: 1, overflowY: "auto" }, children: menuItems.filter((item) => item.label).map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
897
|
+
RouterMenuItem,
|
|
898
|
+
{
|
|
899
|
+
item,
|
|
900
|
+
expanded,
|
|
901
|
+
onToggle: handleToggle
|
|
902
|
+
},
|
|
903
|
+
item.id
|
|
904
|
+
)) }),
|
|
905
|
+
footer && /* @__PURE__ */ jsxRuntime.jsx(material.Box, { className: "sidebar-footer", children: footer })
|
|
906
|
+
]
|
|
897
907
|
}
|
|
898
908
|
),
|
|
899
909
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -997,6 +1007,8 @@ var StateMenuItem = ({ item, selectedId, depth = 0, expanded, onToggle, onClick
|
|
|
997
1007
|
var SidebarLayoutWithState = ({
|
|
998
1008
|
menuItems,
|
|
999
1009
|
sidebarWidth = 250,
|
|
1010
|
+
header,
|
|
1011
|
+
footer,
|
|
1000
1012
|
className = "",
|
|
1001
1013
|
defaultSelected,
|
|
1002
1014
|
onMenuChange,
|
|
@@ -1048,7 +1060,7 @@ var SidebarLayoutWithState = ({
|
|
|
1048
1060
|
...style
|
|
1049
1061
|
},
|
|
1050
1062
|
children: [
|
|
1051
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1063
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1052
1064
|
material.Drawer,
|
|
1053
1065
|
{
|
|
1054
1066
|
variant: "permanent",
|
|
@@ -1061,20 +1073,26 @@ var SidebarLayoutWithState = ({
|
|
|
1061
1073
|
position: "relative",
|
|
1062
1074
|
borderRight: "1px solid",
|
|
1063
1075
|
borderColor: "divider",
|
|
1076
|
+
display: "flex",
|
|
1077
|
+
flexDirection: "column",
|
|
1064
1078
|
...sidebarStyle
|
|
1065
1079
|
}
|
|
1066
1080
|
},
|
|
1067
|
-
children:
|
|
1068
|
-
|
|
1069
|
-
{
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1081
|
+
children: [
|
|
1082
|
+
header && /* @__PURE__ */ jsxRuntime.jsx(material.Box, { className: "sidebar-header", children: header }),
|
|
1083
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.List, { sx: { p: 0, flexGrow: 1, overflowY: "auto" }, children: menuItems.filter((item) => item.label).map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1084
|
+
StateMenuItem,
|
|
1085
|
+
{
|
|
1086
|
+
item,
|
|
1087
|
+
selectedId,
|
|
1088
|
+
expanded,
|
|
1089
|
+
onToggle: handleToggle,
|
|
1090
|
+
onClick: handleMenuClick
|
|
1091
|
+
},
|
|
1092
|
+
item.id
|
|
1093
|
+
)) }),
|
|
1094
|
+
footer && /* @__PURE__ */ jsxRuntime.jsx(material.Box, { className: "sidebar-footer", children: footer })
|
|
1095
|
+
]
|
|
1078
1096
|
}
|
|
1079
1097
|
),
|
|
1080
1098
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1332,6 +1350,16 @@ var ConfirmDialog = ({
|
|
|
1332
1350
|
] })
|
|
1333
1351
|
] });
|
|
1334
1352
|
};
|
|
1353
|
+
var SidebarHeader = ({
|
|
1354
|
+
title,
|
|
1355
|
+
homePath = "/",
|
|
1356
|
+
showHome = true
|
|
1357
|
+
}) => {
|
|
1358
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { padding: "16px", display: "flex", alignItems: "center", borderBottom: "1px solid rgba(255, 255, 255, 0.12)", gap: "8px" }, children: [
|
|
1359
|
+
showHome && /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { component: reactRouterDom.Link, to: homePath, size: "small", sx: { color: "text.primary", ml: -1 }, children: /* @__PURE__ */ jsxRuntime.jsx(HomeIcon__default.default, {}) }),
|
|
1360
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "h6", sx: { fontWeight: "bold", color: "primary.main" }, children: title })
|
|
1361
|
+
] });
|
|
1362
|
+
};
|
|
1335
1363
|
|
|
1336
1364
|
// src/utils/cn.ts
|
|
1337
1365
|
function cn(...classes) {
|
|
@@ -1538,6 +1566,7 @@ exports.NotificationProvider = NotificationProvider;
|
|
|
1538
1566
|
exports.ProtectedRoute = ProtectedRoute;
|
|
1539
1567
|
exports.ReadmeViewer = ReadmeViewer_default;
|
|
1540
1568
|
exports.SessionManager = SessionManager;
|
|
1569
|
+
exports.SidebarHeader = SidebarHeader;
|
|
1541
1570
|
exports.SidebarLayout = SidebarLayout;
|
|
1542
1571
|
exports.ThemeProvider = ThemeProvider;
|
|
1543
1572
|
exports.ThemeToggle = ThemeToggle;
|