sevago-sso-fe 1.0.83 → 1.0.85

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,38 @@ 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(StackRowAlignJustCenter, { sx: { flexDirection: direction, gap: PADDING_GAP_ITEM }, children: [
7226
+ /* @__PURE__ */ jsxRuntime.jsx(
7227
+ StackRowAlignJustCenter,
7228
+ {
7229
+ sx: {
7230
+ width: iconSize,
7231
+ height: iconSize,
7232
+ borderRadius: iconRadius,
7233
+ background: app.color
7234
+ },
7235
+ children: /* @__PURE__ */ jsxRuntime.jsx(
7236
+ ImageElement,
7237
+ {
7238
+ sx: { width: iconSize * 0.56, height: iconSize * 0.56 },
7239
+ url: app.icon,
7240
+ sizeType: ImageSizeType.SQUARE
7241
+ }
7242
+ )
7243
+ }
7244
+ ),
7245
+ showNameApps && /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: titleVariant, sx: { color: titleColor }, children: app.content })
7246
+ ] });
7247
+ };
7216
7248
  const AppGrid = ({
7217
7249
  apps,
7218
7250
  columns = 5,
@@ -7249,7 +7281,7 @@ const AppGrid = ({
7249
7281
  },
7250
7282
  children: [
7251
7283
  visibleApps.map((app, index) => {
7252
- return /* @__PURE__ */ jsxRuntime.jsxs(
7284
+ return /* @__PURE__ */ jsxRuntime.jsx(
7253
7285
  MotionBox,
7254
7286
  {
7255
7287
  preset: "staggerItem",
@@ -7263,29 +7295,16 @@ const AppGrid = ({
7263
7295
  flexDirection: "column"
7264
7296
  },
7265
7297
  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
- ]
7298
+ children: /* @__PURE__ */ jsxRuntime.jsx(
7299
+ AppGridItem,
7300
+ {
7301
+ app,
7302
+ iconSize,
7303
+ iconRadius,
7304
+ titleVariant,
7305
+ titleColor: titleColor ?? theme.palette.common.white
7306
+ }
7307
+ )
7289
7308
  },
7290
7309
  index
7291
7310
  );
@@ -9769,11 +9788,24 @@ const SystemMonitorSidebarPart = ({
9769
9788
  position,
9770
9789
  blacklist,
9771
9790
  env,
9772
- onClickApp
9791
+ onClickApp,
9792
+ showNameApps = false,
9793
+ direction = "row"
9773
9794
  }) => {
9774
9795
  const [open, setOpen] = React.useState(false);
9796
+ const [currentApp, setCurrentApp] = React.useState(null);
9797
+ React.useEffect(() => {
9798
+ const href = window.location.href;
9799
+ const matchedKey = Object.keys(APP_OBJ).find((key) => {
9800
+ const app = APP_OBJ[key];
9801
+ const target = app.path[env];
9802
+ return !!target && href.startsWith(target);
9803
+ });
9804
+ setCurrentApp(matchedKey ? APP_OBJ[matchedKey] : null);
9805
+ }, [window.location.href]);
9775
9806
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9776
9807
  /* @__PURE__ */ jsxRuntime.jsx(ImageElement, { url: IconAppsSidebar, onClick: () => setOpen(true), sizeType: ImageSizeType.SQUARE }),
9808
+ currentApp && /* @__PURE__ */ jsxRuntime.jsx(AppGridItem, { app: currentApp, iconSize: 32, iconRadius: 6, showNameApps, direction }),
9777
9809
  /* @__PURE__ */ jsxRuntime.jsx(
9778
9810
  AppsSidebar,
9779
9811
  {
@@ -9867,6 +9899,7 @@ const SystemMonitorScreen = ({ blacklist, env, onClickApp }) => {
9867
9899
  exports.APP_GROUP_COLOR = APP_GROUP_COLOR;
9868
9900
  exports.APP_OBJ = APP_OBJ;
9869
9901
  exports.AppGrid = AppGrid;
9902
+ exports.AppGridItem = AppGridItem;
9870
9903
  exports.AppGroup = AppGroup;
9871
9904
  exports.AppType = AppType;
9872
9905
  exports.AppsSidebar = AppsSidebar;