sevago-sso-fe 1.0.82 → 1.0.84

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.
@@ -0,0 +1,12 @@
1
+ import { default as React } from 'react';
2
+ import { AppInfo } from '../../common/constant/apps.data';
3
+ export interface AppGridItemProps {
4
+ app: AppInfo;
5
+ iconSize: number;
6
+ iconRadius: number;
7
+ titleVariant?: 'subtitle1' | 'body1' | 'caption';
8
+ titleColor?: string;
9
+ showNameApps?: boolean;
10
+ direction?: 'row' | 'column';
11
+ }
12
+ export declare const AppGridItem: React.FC<AppGridItemProps>;
@@ -1 +1,2 @@
1
1
  export { AppGrid } from './app-grid.component';
2
+ export { AppGridItem } from './app-grid-item.component';
@@ -4,5 +4,7 @@ export interface SystemMonitorSidebarPartProps {
4
4
  blacklist?: string[];
5
5
  env: Environment;
6
6
  onClickApp: (appInfo: AppInfo) => void;
7
+ showNameApps?: boolean;
8
+ direction?: 'row' | 'column';
7
9
  }
8
10
  export declare const SystemMonitorSidebarPart: React.FC<SystemMonitorSidebarPartProps>;
package/dist/index.cjs.js CHANGED
@@ -4,10 +4,10 @@ const dayjs = require("dayjs");
4
4
  const jsxRuntime = require("react/jsx-runtime");
5
5
  const material = require("@mui/material");
6
6
  const React = require("react");
7
+ const framerMotion = require("framer-motion");
7
8
  const system = require("@mui/system");
8
9
  const styled$2 = require("@emotion/styled");
9
10
  require("@emotion/react");
10
- const framerMotion = require("framer-motion");
11
11
  const reactRouterDom = require("react-router-dom");
12
12
  const formik = require("formik");
13
13
  function _interopNamespaceDefault(e) {
@@ -6688,6 +6688,98 @@ const IconRight = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "20"
6688
6688
  strokeLinejoin: "round"
6689
6689
  }
6690
6690
  ) });
6691
+ const animationPresets = {
6692
+ fadeInUp: {
6693
+ initial: { opacity: 0, y: 50 },
6694
+ animate: { opacity: 1, y: 0 },
6695
+ transition: { duration: 0.2, ease: "easeOut" }
6696
+ },
6697
+ fadeInDown: {
6698
+ initial: { opacity: 0, y: -50 },
6699
+ animate: { opacity: 1, y: 0 },
6700
+ transition: { duration: 0.3, ease: "easeOut" }
6701
+ },
6702
+ fadeInLeft: {
6703
+ initial: { opacity: 0, x: -50 },
6704
+ animate: { opacity: 1, x: 0 },
6705
+ transition: { duration: 0.3, ease: "easeOut" }
6706
+ },
6707
+ fadeInRight: {
6708
+ initial: { opacity: 0, x: 50 },
6709
+ animate: { opacity: 1, x: 0 },
6710
+ transition: { duration: 0.3, ease: "easeOut" }
6711
+ },
6712
+ scaleIn: {
6713
+ initial: { opacity: 0, scale: 0.9 },
6714
+ animate: { opacity: 1, scale: 1 },
6715
+ transition: { duration: 0.3, ease: "easeOut" }
6716
+ },
6717
+ slideInUp: {
6718
+ initial: { opacity: 0, y: 20 },
6719
+ animate: { opacity: 1, y: 0 },
6720
+ transition: { duration: 0.4, ease: "easeOut" }
6721
+ },
6722
+ staggerItem: {
6723
+ initial: { opacity: 0, y: 30, scale: 0.9 },
6724
+ animate: { opacity: 1, y: 0, scale: 1 },
6725
+ transition: { duration: 0.4, delay: 0, ease: "easeOut" }
6726
+ },
6727
+ tabContent: {
6728
+ initial: { opacity: 0, y: 20 },
6729
+ animate: { opacity: 1, y: 0 },
6730
+ transition: { duration: 0.4, ease: "easeOut" }
6731
+ },
6732
+ tabUnderline: {
6733
+ initial: { scaleX: 0, opacity: 0 },
6734
+ animate: { scaleX: 1, opacity: 1 },
6735
+ exit: { scaleX: 0, opacity: 0 },
6736
+ transition: { duration: 0.3, ease: "easeInOut" }
6737
+ }
6738
+ };
6739
+ const MotionBox = ({
6740
+ children,
6741
+ sx,
6742
+ onClick,
6743
+ preset = "fadeInUp",
6744
+ delay,
6745
+ index,
6746
+ hover = false,
6747
+ ...motionProps
6748
+ }) => {
6749
+ const getAnimationProps = () => {
6750
+ if (preset) {
6751
+ const presetConfig = animationPresets[preset];
6752
+ if (preset === "staggerItem" && index !== void 0) {
6753
+ return {
6754
+ ...presetConfig,
6755
+ transition: {
6756
+ ...presetConfig.transition,
6757
+ delay: index * 0.05 + (delay || 0)
6758
+ }
6759
+ };
6760
+ }
6761
+ if (delay !== void 0) {
6762
+ return {
6763
+ ...presetConfig,
6764
+ transition: {
6765
+ ...presetConfig.transition,
6766
+ delay
6767
+ }
6768
+ };
6769
+ }
6770
+ return presetConfig;
6771
+ }
6772
+ return {};
6773
+ };
6774
+ const hoverProps = hover ? {
6775
+ whileHover: {
6776
+ y: -4,
6777
+ scale: 1.05,
6778
+ transition: { duration: 0.2 }
6779
+ }
6780
+ } : {};
6781
+ return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.motion.div, { ...motionProps, ...getAnimationProps(), ...hoverProps, onClick, style: { ...sx }, children });
6782
+ };
6691
6783
  const StackRow = styled(material.Stack)(() => ({
6692
6784
  flexDirection: "row"
6693
6785
  }));
@@ -6860,98 +6952,6 @@ const ImageElement = ({
6860
6952
  )
6861
6953
  ] });
6862
6954
  };
6863
- const animationPresets = {
6864
- fadeInUp: {
6865
- initial: { opacity: 0, y: 50 },
6866
- animate: { opacity: 1, y: 0 },
6867
- transition: { duration: 0.2, ease: "easeOut" }
6868
- },
6869
- fadeInDown: {
6870
- initial: { opacity: 0, y: -50 },
6871
- animate: { opacity: 1, y: 0 },
6872
- transition: { duration: 0.3, ease: "easeOut" }
6873
- },
6874
- fadeInLeft: {
6875
- initial: { opacity: 0, x: -50 },
6876
- animate: { opacity: 1, x: 0 },
6877
- transition: { duration: 0.3, ease: "easeOut" }
6878
- },
6879
- fadeInRight: {
6880
- initial: { opacity: 0, x: 50 },
6881
- animate: { opacity: 1, x: 0 },
6882
- transition: { duration: 0.3, ease: "easeOut" }
6883
- },
6884
- scaleIn: {
6885
- initial: { opacity: 0, scale: 0.9 },
6886
- animate: { opacity: 1, scale: 1 },
6887
- transition: { duration: 0.3, ease: "easeOut" }
6888
- },
6889
- slideInUp: {
6890
- initial: { opacity: 0, y: 20 },
6891
- animate: { opacity: 1, y: 0 },
6892
- transition: { duration: 0.4, ease: "easeOut" }
6893
- },
6894
- staggerItem: {
6895
- initial: { opacity: 0, y: 30, scale: 0.9 },
6896
- animate: { opacity: 1, y: 0, scale: 1 },
6897
- transition: { duration: 0.4, delay: 0, ease: "easeOut" }
6898
- },
6899
- tabContent: {
6900
- initial: { opacity: 0, y: 20 },
6901
- animate: { opacity: 1, y: 0 },
6902
- transition: { duration: 0.4, ease: "easeOut" }
6903
- },
6904
- tabUnderline: {
6905
- initial: { scaleX: 0, opacity: 0 },
6906
- animate: { scaleX: 1, opacity: 1 },
6907
- exit: { scaleX: 0, opacity: 0 },
6908
- transition: { duration: 0.3, ease: "easeInOut" }
6909
- }
6910
- };
6911
- const MotionBox = ({
6912
- children,
6913
- sx,
6914
- onClick,
6915
- preset = "fadeInUp",
6916
- delay,
6917
- index,
6918
- hover = false,
6919
- ...motionProps
6920
- }) => {
6921
- const getAnimationProps = () => {
6922
- if (preset) {
6923
- const presetConfig = animationPresets[preset];
6924
- if (preset === "staggerItem" && index !== void 0) {
6925
- return {
6926
- ...presetConfig,
6927
- transition: {
6928
- ...presetConfig.transition,
6929
- delay: index * 0.05 + (delay || 0)
6930
- }
6931
- };
6932
- }
6933
- if (delay !== void 0) {
6934
- return {
6935
- ...presetConfig,
6936
- transition: {
6937
- ...presetConfig.transition,
6938
- delay
6939
- }
6940
- };
6941
- }
6942
- return presetConfig;
6943
- }
6944
- return {};
6945
- };
6946
- const hoverProps = hover ? {
6947
- whileHover: {
6948
- y: -4,
6949
- scale: 1.05,
6950
- transition: { duration: 0.2 }
6951
- }
6952
- } : {};
6953
- return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.motion.div, { ...motionProps, ...getAnimationProps(), ...hoverProps, onClick, style: { ...sx }, children });
6954
- };
6955
6955
  const ImageBrand = styled(ImageElement)(({ theme }) => ({
6956
6956
  height: HEIGHT_ELEMENT_OTHER,
6957
6957
  border: `1px solid ${theme.palette.divider}`,
@@ -7213,6 +7213,39 @@ const TypographyFilter = material.styled(material.Typography)(({ theme }) => ({
7213
7213
  textWrap: "nowrap",
7214
7214
  padding: `0px ${PADDING_GAP_LAYOUT}`
7215
7215
  }));
7216
+ const AppGridItem = ({
7217
+ app,
7218
+ iconSize,
7219
+ iconRadius,
7220
+ titleVariant = "subtitle1",
7221
+ titleColor,
7222
+ showNameApps = true,
7223
+ direction = "column"
7224
+ }) => {
7225
+ return /* @__PURE__ */ jsxRuntime.jsxs(system.Stack, { sx: { flexDirection: direction }, children: [
7226
+ /* @__PURE__ */ jsxRuntime.jsx(
7227
+ StackRowAlignJustCenter,
7228
+ {
7229
+ sx: {
7230
+ width: iconSize,
7231
+ height: iconSize,
7232
+ borderRadius: iconRadius,
7233
+ mb: 1.5,
7234
+ background: app.color
7235
+ },
7236
+ children: /* @__PURE__ */ jsxRuntime.jsx(
7237
+ ImageElement,
7238
+ {
7239
+ sx: { width: iconSize * 0.56, height: iconSize * 0.56 },
7240
+ url: app.icon,
7241
+ sizeType: ImageSizeType.SQUARE
7242
+ }
7243
+ )
7244
+ }
7245
+ ),
7246
+ showNameApps && /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: titleVariant, sx: { color: titleColor }, children: app.content })
7247
+ ] });
7248
+ };
7216
7249
  const AppGrid = ({
7217
7250
  apps,
7218
7251
  columns = 5,
@@ -7249,7 +7282,7 @@ const AppGrid = ({
7249
7282
  },
7250
7283
  children: [
7251
7284
  visibleApps.map((app, index) => {
7252
- return /* @__PURE__ */ jsxRuntime.jsxs(
7285
+ return /* @__PURE__ */ jsxRuntime.jsx(
7253
7286
  MotionBox,
7254
7287
  {
7255
7288
  preset: "staggerItem",
@@ -7263,29 +7296,16 @@ const AppGrid = ({
7263
7296
  flexDirection: "column"
7264
7297
  },
7265
7298
  onClick: () => onClickApp(app),
7266
- children: [
7267
- /* @__PURE__ */ jsxRuntime.jsx(
7268
- StackRowAlignJustCenter,
7269
- {
7270
- sx: {
7271
- width: iconSize,
7272
- height: iconSize,
7273
- borderRadius: iconRadius,
7274
- mb: 1.5,
7275
- background: app.color
7276
- },
7277
- children: /* @__PURE__ */ jsxRuntime.jsx(
7278
- ImageElement,
7279
- {
7280
- sx: { width: iconSize * 0.56, height: iconSize * 0.56 },
7281
- url: app.icon,
7282
- sizeType: ImageSizeType.SQUARE
7283
- }
7284
- )
7285
- }
7286
- ),
7287
- /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: titleVariant, sx: { color: titleColor ?? theme.palette.common.white }, children: app.content })
7288
- ]
7299
+ children: /* @__PURE__ */ jsxRuntime.jsx(
7300
+ AppGridItem,
7301
+ {
7302
+ app,
7303
+ iconSize,
7304
+ iconRadius,
7305
+ titleVariant,
7306
+ titleColor: titleColor ?? theme.palette.common.white
7307
+ }
7308
+ )
7289
7309
  },
7290
7310
  index
7291
7311
  );
@@ -9769,11 +9789,24 @@ const SystemMonitorSidebarPart = ({
9769
9789
  position,
9770
9790
  blacklist,
9771
9791
  env,
9772
- onClickApp
9792
+ onClickApp,
9793
+ showNameApps = false,
9794
+ direction = "row"
9773
9795
  }) => {
9774
9796
  const [open, setOpen] = React.useState(false);
9797
+ const [currentApp, setCurrentApp] = React.useState(null);
9798
+ React.useEffect(() => {
9799
+ const href = window.location.href;
9800
+ const matchedKey = Object.keys(APP_OBJ).find((key) => {
9801
+ const app = APP_OBJ[key];
9802
+ const target = app.path[env];
9803
+ return !!target && href.startsWith(target);
9804
+ });
9805
+ setCurrentApp(matchedKey ? APP_OBJ[matchedKey] : null);
9806
+ }, [window.location.href]);
9775
9807
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9776
9808
  /* @__PURE__ */ jsxRuntime.jsx(ImageElement, { url: IconAppsSidebar, onClick: () => setOpen(true), sizeType: ImageSizeType.SQUARE }),
9809
+ currentApp && /* @__PURE__ */ jsxRuntime.jsx(AppGridItem, { app: currentApp, iconSize: 32, iconRadius: 6, showNameApps, direction }),
9777
9810
  /* @__PURE__ */ jsxRuntime.jsx(
9778
9811
  AppsSidebar,
9779
9812
  {
@@ -9790,6 +9823,13 @@ const SystemMonitorSidebarPart = ({
9790
9823
  const SystemMonitorScreen = ({ blacklist, env, onClickApp }) => {
9791
9824
  const theme = useTheme();
9792
9825
  const [tab, setTab] = React.useState(AppGroup.ALL);
9826
+ const getAppsForGroup = (group) => Object.keys(APP_OBJ).filter((key) => {
9827
+ const e = APP_OBJ[key];
9828
+ const isBlacklisted = !!blacklist?.includes(key);
9829
+ const isInSelectedGroup = group === AppGroup.ALL ? true : e.group === group;
9830
+ return !isBlacklisted && isInSelectedGroup;
9831
+ }).map((key) => APP_OBJ[key]);
9832
+ const appsForCurrentTab = getAppsForGroup(tab);
9793
9833
  return /* @__PURE__ */ jsxRuntime.jsx(
9794
9834
  MotionBox,
9795
9835
  {
@@ -9821,28 +9861,29 @@ const SystemMonitorScreen = ({ blacklist, env, onClickApp }) => {
9821
9861
  width: "100%",
9822
9862
  justifyContent: "flex-start"
9823
9863
  },
9824
- children: Object.values(AppGroup).map((g) => /* @__PURE__ */ jsxRuntime.jsx(MotionBox, { sx: { position: "relative" }, preset: "tabUnderline", children: /* @__PURE__ */ jsxRuntime.jsx(
9825
- material.Typography,
9826
- {
9827
- onClick: () => setTab(g),
9828
- sx: {
9829
- cursor: "pointer",
9830
- color: tab === g ? theme.palette.common.white : theme.palette.grey[300]
9831
- },
9832
- children: g
9864
+ children: Object.values(AppGroup).map((g) => {
9865
+ const appsForGroup = getAppsForGroup(g);
9866
+ if (appsForGroup.length === 0) {
9867
+ return null;
9833
9868
  }
9834
- ) }, g))
9869
+ return /* @__PURE__ */ jsxRuntime.jsx(MotionBox, { sx: { position: "relative" }, preset: "tabUnderline", children: /* @__PURE__ */ jsxRuntime.jsx(
9870
+ material.Typography,
9871
+ {
9872
+ onClick: () => setTab(g),
9873
+ sx: {
9874
+ cursor: "pointer",
9875
+ color: tab === g ? theme.palette.common.white : theme.palette.grey[300]
9876
+ },
9877
+ children: g
9878
+ }
9879
+ ) }, g);
9880
+ })
9835
9881
  }
9836
9882
  ),
9837
9883
  /* @__PURE__ */ jsxRuntime.jsx(MotionBox, { preset: "tabContent", children: /* @__PURE__ */ jsxRuntime.jsx(
9838
9884
  AppGrid,
9839
9885
  {
9840
- apps: Object.keys(APP_OBJ).filter((key) => {
9841
- const e = APP_OBJ[key];
9842
- const isBlacklisted = !!blacklist?.includes(key);
9843
- const isInSelectedGroup = tab === AppGroup.ALL ? true : e.group === tab;
9844
- return !isBlacklisted && isInSelectedGroup;
9845
- }).map((key) => APP_OBJ[key]),
9886
+ apps: appsForCurrentTab,
9846
9887
  iconSize: 80,
9847
9888
  iconRadius: 7,
9848
9889
  gap: PADDING_GAP_TAB,
@@ -9859,6 +9900,7 @@ const SystemMonitorScreen = ({ blacklist, env, onClickApp }) => {
9859
9900
  exports.APP_GROUP_COLOR = APP_GROUP_COLOR;
9860
9901
  exports.APP_OBJ = APP_OBJ;
9861
9902
  exports.AppGrid = AppGrid;
9903
+ exports.AppGridItem = AppGridItem;
9862
9904
  exports.AppGroup = AppGroup;
9863
9905
  exports.AppType = AppType;
9864
9906
  exports.AppsSidebar = AppsSidebar;