aefis-core-ui 3.0.0-rc113 → 3.0.0-rc115

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.
@@ -6536,38 +6536,10 @@ const useStyles$u = makeStyles(theme => ({
6536
6536
  paddingBottom: theme.spacing(2)
6537
6537
  }
6538
6538
  },
6539
- imageContainer: {
6540
- display: "block",
6541
- backgroundSize: "cover",
6542
- backgroundRepeat: "no-repeat",
6543
- backgroundPosition: "center",
6544
- position: "relative"
6545
- },
6546
6539
  showOverflow: {
6547
6540
  overflow: "visible"
6548
6541
  }
6549
6542
  }));
6550
- const titleProps = {
6551
- color: "textPrimary",
6552
- variant: "h6",
6553
- style: {
6554
- fontSize: "1.1rem",
6555
- fontWeight: 500,
6556
- lineHeight: 1.43,
6557
- letterSpacing: "0.01071em"
6558
- }
6559
- };
6560
- const subtitleProps = {
6561
- color: "textSecondary",
6562
- variant: "body1",
6563
- style: {
6564
- fontSize: "0.775rem",
6565
- fontWeight: "bolder",
6566
- display: "inline-flex",
6567
- verticalAlign: "middle",
6568
- alignItems: "center"
6569
- }
6570
- };
6571
6543
  const getGradientBackgroundColorArray = arrayIndex => {
6572
6544
  const color1Array = [blue[100], indigo[100], purple[100], cyan[100], teal[100], green[100], blue[300], cyan[200], lime[200], indigo[300]];
6573
6545
  const color2Array = [blue[600], indigo[600], purple[600], cyan[600], teal[600], green[600], blue[600], cyan[600], lime[600], indigo[600]];
@@ -6586,18 +6558,77 @@ const handleSingleMenuItemClick = (action, data) => {
6586
6558
 
6587
6559
  /** Displays AEFIS content box similar to MUI Card. */
6588
6560
 
6589
- const ContentBox = props => {
6590
- var _props$menu, _props$menu2;
6561
+ const ContentBox = ({
6562
+ children,
6563
+ menu,
6564
+ renderFullMenu: _renderFullMenu = true,
6565
+ titleContent,
6566
+ data,
6567
+ formatContent: _formatContent = true,
6568
+ header,
6569
+ headerAction,
6570
+ headerMenu,
6571
+ subtitle,
6572
+ title,
6573
+ wrapTitle: _wrapTitle = false,
6574
+ wrapSubtitle: _wrapSubtitle = false,
6575
+ titleBadge,
6576
+ titleComponent: _titleComponent = "div",
6577
+ avatar,
6578
+ description,
6579
+ actions,
6580
+ afterActionContent,
6581
+ displayType: _displayType = "default",
6582
+ tag,
6583
+ image,
6584
+ imageHeight: _imageHeight = 150,
6585
+ imageContent,
6586
+ imageBackgroundColor: _imageBackgroundColor = "transparent",
6587
+ gradientColorHeaderImageId,
6588
+ hasGutter: _hasGutter = true,
6589
+ cardStyle,
6590
+ containerStyle,
6591
+ sx,
6592
+ cardContentSx,
6593
+ dense: _dense = false,
6594
+ collapsible: _collapsible = false,
6595
+ headerBorder: _headerBorder = false,
6596
+ footerBorder: _footerBorder = false,
6597
+ headerBackgroundColor,
6598
+ titleStyles,
6599
+ subTitleStyles
6600
+ }) => {
6591
6601
  const classes = useStyles$u();
6592
6602
  const [invisible, setInvisible] = useState(true);
6603
+ const titleProps = {
6604
+ color: "textPrimary",
6605
+ variant: "h6",
6606
+ style: _extends({
6607
+ fontSize: "1.1rem",
6608
+ fontWeight: 500,
6609
+ lineHeight: 1.43,
6610
+ letterSpacing: "0.01071em"
6611
+ }, titleStyles)
6612
+ };
6613
+ const subtitleProps = {
6614
+ color: "textSecondary",
6615
+ variant: "body1",
6616
+ style: _extends({
6617
+ fontSize: "0.775rem",
6618
+ fontWeight: "bolder",
6619
+ display: "inline-flex",
6620
+ verticalAlign: "middle",
6621
+ alignItems: "center"
6622
+ }, subTitleStyles)
6623
+ };
6593
6624
  useEffect(() => {
6594
- props.titleBadge && setInvisible(false);
6595
- }, [props.titleBadge]);
6625
+ titleBadge && setInvisible(false);
6626
+ }, [titleBadge]);
6596
6627
  const renderChildren = () => {
6597
- return props.children ? /*#__PURE__*/React__default.cloneElement(props.children) : "";
6628
+ returnchildren ? /*#__PURE__*/React__default.cloneElement(children) : "";
6598
6629
  };
6599
- titleProps.component = props.titleComponent;
6600
- if (!props.wrapTitle) {
6630
+ titleProps.component = _titleComponent;
6631
+ if (!_wrapTitle) {
6601
6632
  titleProps["style"] = _extends({}, titleProps.style, {
6602
6633
  whiteSpace: "nowrap",
6603
6634
  overflow: "hidden",
@@ -6610,7 +6641,7 @@ const ContentBox = props => {
6610
6641
  textOverflow: "unset"
6611
6642
  });
6612
6643
  }
6613
- if (props.wrapSubtitle) {
6644
+ if (_wrapSubtitle) {
6614
6645
  titleProps["noWrap"] = true;
6615
6646
  titleProps["style"] = _extends({}, titleProps.style, {
6616
6647
  whiteSpace: "nowrap",
@@ -6619,20 +6650,20 @@ const ContentBox = props => {
6619
6650
  });
6620
6651
  }
6621
6652
  const headerProps = {
6622
- title: props.title,
6653
+ title: title,
6623
6654
  disableTypography: false,
6624
6655
  titleTypographyProps: titleProps
6625
6656
  };
6626
- if (props.titleContent) {
6657
+ if (titleContent) {
6627
6658
  headerProps.action = /*#__PURE__*/jsx(Box$2, {
6628
6659
  sx: {
6629
6660
  display: "flex",
6630
6661
  justifyContent: "flex-end"
6631
6662
  },
6632
- children: props.titleContent
6663
+ children: titleContent
6633
6664
  });
6634
6665
  }
6635
- if (props.collapsible) {
6666
+ if (_collapsible) {
6636
6667
  headerProps.action = /*#__PURE__*/jsx(Box$2, {
6637
6668
  sx: {
6638
6669
  display: "flex",
@@ -6641,80 +6672,80 @@ const ContentBox = props => {
6641
6672
  children: /*#__PURE__*/jsx(CollapsibleContentButtonContainer, {})
6642
6673
  });
6643
6674
  }
6644
- if (((_props$menu = props.menu) == null ? void 0 : _props$menu.length) > 1 || props.menu && props.renderFullMenu) {
6675
+ if ((menu == null ? void 0 : menu.length) > 1 || menu && _renderFullMenu) {
6645
6676
  headerProps.action = /*#__PURE__*/jsxs(Box$2, {
6646
6677
  sx: {
6647
6678
  display: "flex",
6648
6679
  alignItems: "center",
6649
6680
  justifyContent: "flex-end"
6650
6681
  },
6651
- children: [props.titleContent && /*#__PURE__*/jsx(Box$2, {
6682
+ children: [titleContent && /*#__PURE__*/jsx(Box$2, {
6652
6683
  sx: {
6653
6684
  display: "flex",
6654
6685
  justifyContent: "flex-end",
6655
6686
  mr: 2
6656
6687
  },
6657
- children: props.titleContent
6688
+ children: titleContent
6658
6689
  }), /*#__PURE__*/jsx(MenuButton, {
6659
- name: props.title,
6660
- menuConfiguration: props.menu,
6661
- data: props.data || undefined,
6690
+ name: title,
6691
+ menuConfiguration: menu,
6692
+ data: data || undefined,
6662
6693
  displayType: "icon"
6663
6694
  })]
6664
6695
  });
6665
6696
  }
6666
- if (props.menu && !props.renderFullMenu && ((_props$menu2 = props.menu) == null ? void 0 : _props$menu2.length) === 1) {
6697
+ if (menu && !_renderFullMenu && (menu == null ? void 0 : menu.length) === 1) {
6667
6698
  headerProps.action = /*#__PURE__*/jsxs(Box$2, {
6668
6699
  sx: {
6669
6700
  display: "flex",
6670
6701
  alignItems: "center",
6671
6702
  justifyContent: "flex-end"
6672
6703
  },
6673
- children: [props.titleContent && /*#__PURE__*/jsx(Box$2, {
6704
+ children: [titleContent && /*#__PURE__*/jsx(Box$2, {
6674
6705
  sx: {
6675
6706
  display: "flex",
6676
6707
  justifyContent: "flex-end",
6677
6708
  mr: 2
6678
6709
  },
6679
- children: props.titleContent
6710
+ children: titleContent
6680
6711
  }), /*#__PURE__*/jsx(IconButton, {
6681
- name: props.menu[0].name,
6712
+ name: menu[0].name,
6682
6713
  size: "small",
6683
- onClick: () => handleSingleMenuItemClick(props.menu[0].onClick, props.data),
6714
+ onClick: () => handleSingleMenuItemClick(menu[0].onClick, data),
6684
6715
  showTooltip: true,
6685
- children: props.menu[0].icon
6716
+ children: menu[0].icon
6686
6717
  })]
6687
6718
  });
6688
6719
  }
6689
- if (typeof props.subtitle === "string" && props.subtitle !== undefined) {
6720
+ if (typeof subtitle === "string" && subtitle !== undefined) {
6690
6721
  headerProps.subheaderTypographyProps = subtitleProps;
6691
- headerProps.subheader = props.subtitle;
6722
+ headerProps.subheader = subtitle;
6692
6723
  }
6693
- if (typeof props.subtitle !== "string" && props.subtitle !== undefined) {
6724
+ if (typeof subtitle !== "string" && subtitle !== undefined) {
6694
6725
  headerProps.title = /*#__PURE__*/jsx(Typography, {
6695
6726
  variant: "h6",
6696
- component: props.titleComponent,
6727
+ component: _titleComponent,
6697
6728
  style: titleProps.style,
6698
6729
  display: "flex",
6699
- noWrap: props.wrapTitle,
6700
- children: props.title
6730
+ noWrap: _wrapTitle,
6731
+ children: title
6701
6732
  });
6702
6733
  headerProps.disableTypography = true;
6703
- headerProps.subheader = props.subtitle;
6734
+ headerProps.subheader = subtitle;
6704
6735
  }
6705
- if (props.titleBadge) {
6736
+ if (titleBadge) {
6706
6737
  headerProps.title = /*#__PURE__*/jsx(Box$2, {
6707
6738
  children: /*#__PURE__*/jsx(StyledBadge, {
6708
- badgeContent: props.titleBadge,
6739
+ badgeContent: titleBadge,
6709
6740
  invisible: invisible,
6710
6741
  color: "secondary",
6711
6742
  children: /*#__PURE__*/jsx(Typography, {
6712
6743
  variant: "h6",
6713
- component: props.titleComponent,
6744
+ component: _titleComponent,
6714
6745
  style: titleProps.style,
6715
6746
  display: "block",
6716
6747
  noWrap: true,
6717
- children: props.title
6748
+ children: title
6718
6749
  })
6719
6750
  })
6720
6751
  });
@@ -6725,11 +6756,11 @@ const ContentBox = props => {
6725
6756
  headerProps.classes = {
6726
6757
  content: classes.showOverflow
6727
6758
  };
6728
- if (props.subtitle) {
6759
+ if (subtitle) {
6729
6760
  headerProps.subheader = /*#__PURE__*/jsx(Typography, {
6730
6761
  variant: "body1",
6731
6762
  component: "span",
6732
- noWrap: props.wrapSubtitle,
6763
+ noWrap: _wrapSubtitle,
6733
6764
  color: "textSecondary",
6734
6765
  style: {
6735
6766
  fontSize: "0.775rem",
@@ -6738,32 +6769,32 @@ const ContentBox = props => {
6738
6769
  verticalAlign: "middle",
6739
6770
  alignItems: "center"
6740
6771
  },
6741
- children: props.subtitle
6772
+ children: subtitle
6742
6773
  });
6743
6774
  }
6744
6775
  }
6745
- if (props.avatar) {
6746
- headerProps.avatar = props.avatar;
6776
+ if (avatar) {
6777
+ headerProps.avatar = avatar;
6747
6778
  }
6748
- const cardStyle = _extends({
6749
- marginBottom: props.hasGutter ? 8 : 0,
6779
+ const cardStyles = _extends({
6780
+ marginBottom: _hasGutter ? 8 : 0,
6750
6781
  borderRadius: 16,
6751
6782
  transition: "border 100ms ease-out",
6752
- boxShadow: props.displayType === "outlined" ? "none" : "rgb(58 53 65 / 10%) 0px 2px 10px 0px"
6753
- }, props.cardStyle);
6754
- if (props.displayType === "outlined") {
6755
- cardStyle.border = "2px solid #dddddd";
6783
+ boxShadow: _displayType === "outlined" ? "none" : "rgb(58 53 65 / 10%) 0px 2px 10px 0px"
6784
+ }, cardStyle);
6785
+ if (_displayType === "outlined") {
6786
+ cardStyles.border = "2px solid #dddddd";
6756
6787
  }
6757
6788
  // eslint-disable-next-line
6758
- const tag = props.tag ? useTag(props.tag) : {};
6759
- const useHeaderImage = props.image !== undefined && typeof props.image === "string" || props.gradientColorHeaderImageId !== undefined ? true : false;
6760
- const useLocalHeaderImage = props.image !== undefined && typeof props.image !== "string" ? true : false;
6761
- const imageDivStyle = props.image !== undefined || props.gradientColorHeaderImageId !== undefined ? {
6762
- backgroundImage: props.gradientColorHeaderImageId !== undefined ? "linear-gradient(135deg," + getGradientBackgroundColorArray(props.gradientColorHeaderImageId)[0] + " 10%," + getGradientBackgroundColorArray(props.gradientColorHeaderImageId)[1] + ")" : "url(" + props.image + ")",
6763
- height: props.imageHeight,
6764
- backgroundColor: props.imageBackgroundColor ? props.imageBackgroundColor : "transparent"
6789
+ const newTag = tag ? useTag(tag) : {};
6790
+ const useHeaderImage = image !== undefined && typeof image === "string" || gradientColorHeaderImageId !== undefined ? true : false;
6791
+ const useLocalHeaderImage = image !== undefined && typeof image !== "string" ? true : false;
6792
+ const imageDivStyle = image !== undefined || gradientColorHeaderImageId !== undefined ? {
6793
+ backgroundImage: gradientColorHeaderImageId !== undefined ? "linear-gradient(135deg," + getGradientBackgroundColorArray(gradientColorHeaderImageId)[0] + " 10%," + getGradientBackgroundColorArray(gradientColorHeaderImageId)[1] + ")" : "url(" + image + ")",
6794
+ height: _imageHeight,
6795
+ backgroundColor: _imageBackgroundColor ? _imageBackgroundColor : "transparent"
6765
6796
  } : {};
6766
- const otherSx = !props.children && !props.description ? {
6797
+ const otherSx = !children && !description ? {
6767
6798
  display: "none",
6768
6799
  visibility: "hidden"
6769
6800
  } : undefined;
@@ -6772,100 +6803,91 @@ const ContentBox = props => {
6772
6803
  open: true
6773
6804
  },
6774
6805
  children: /*#__PURE__*/jsxs(Box$2, {
6775
- sx: props.sx,
6776
- style: props.containerStyle,
6777
- children: [props.header && /*#__PURE__*/jsx(ContentBoxHeader, {
6778
- header: props.header,
6779
- headerMenu: props.headerMenu,
6780
- title: props.title,
6781
- data: props.data,
6782
- headerAction: props.headerAction
6806
+ sx: sx,
6807
+ style: containerStyle,
6808
+ children: [header && /*#__PURE__*/jsx(ContentBoxHeader, {
6809
+ header: header,
6810
+ headerMenu: headerMenu,
6811
+ title: title,
6812
+ data: data,
6813
+ headerAction: headerAction
6783
6814
  }), /*#__PURE__*/jsxs(Card, {
6784
- style: cardStyle,
6785
- className: tag.tag,
6815
+ style: cardStyles,
6816
+ className: newTag.tag,
6786
6817
  children: [useHeaderImage && /*#__PURE__*/jsx(Box$2, {
6787
6818
  style: imageDivStyle,
6788
- className: classes.imageContainer,
6789
- title: props.title,
6790
- children: props.imageContent
6819
+ sx: {
6820
+ display: "block",
6821
+ backgroundSize: "cover",
6822
+ backgroundRepeat: "no-repeat",
6823
+ backgroundPosition: "center",
6824
+ position: "relative"
6825
+ },
6826
+ title: title,
6827
+ children: imageContent
6791
6828
  }), useLocalHeaderImage && /*#__PURE__*/jsx(CardMedia, {
6792
- height: props.imageHeight,
6829
+ height: _imageHeight,
6793
6830
  component: "img",
6794
6831
  alt: "",
6795
- image: props.image
6796
- }), props.title && /*#__PURE__*/jsx(CardHeader, _extends({}, headerProps, {
6832
+ image: image
6833
+ }), title && /*#__PURE__*/jsx(CardHeader, _extends({}, headerProps, {
6797
6834
  sx: {
6798
- backgroundColor: props.headerBackgroundColor || "#ffffff",
6799
- padding: props.dense ? 1 : 2,
6800
- borderBottom: props.headerBorder ? "1px solid #dddddd" : "none",
6801
- ".MuiCardHeader-content": _extends({}, !props.wrapTitle && {
6835
+ backgroundColor: headerBackgroundColor || "#ffffff",
6836
+ padding: _dense ? 1 : 2,
6837
+ borderBottom: _headerBorder ? "1px solid #dddddd" : "none",
6838
+ ".MuiCardHeader-content": _extends({}, !_wrapTitle && {
6802
6839
  overflow: "hidden"
6803
6840
  })
6804
6841
  }
6805
- })), props.formatContent && /*#__PURE__*/jsx(CardContent, {
6806
- className: !props.title ? classes.cardContentWithoutTitle : classes.cardContent,
6842
+ })), _formatContent && /*#__PURE__*/jsx(CardContent, {
6843
+ className: !title ? classes.cardContentWithoutTitle : classes.cardContent,
6807
6844
  sx: _extends({
6808
- padding: props.dense ? 1 : 2
6809
- }, otherSx, props.cardContentSx),
6810
- children: props.collapsible ? /*#__PURE__*/jsxs(CollapsibleContentContainer, {
6811
- children: [props.description && /*#__PURE__*/jsx(Typography, {
6845
+ padding: _dense ? 1 : 2
6846
+ }, otherSx, cardContentSx),
6847
+ children: _collapsible ? /*#__PURE__*/jsxs(CollapsibleContentContainer, {
6848
+ children: [description && /*#__PURE__*/jsx(Typography, {
6812
6849
  variant: "body2",
6813
6850
  sx: {
6814
6851
  color: "text.secondary"
6815
6852
  },
6816
6853
  component: "p",
6817
- children: props.description
6818
- }), React__default.Children.map(props.children || null, child => {
6854
+ children: description
6855
+ }), React__default.Children.map(children || null, child => {
6819
6856
  return child;
6820
6857
  })]
6821
6858
  }) : /*#__PURE__*/jsxs(React__default.Fragment, {
6822
- children: [props.description && /*#__PURE__*/jsx(Typography, {
6859
+ children: [description && /*#__PURE__*/jsx(Typography, {
6823
6860
  variant: "body2",
6824
6861
  sx: {
6825
6862
  color: "text.secondary"
6826
6863
  },
6827
6864
  component: "p",
6828
- children: props.description
6829
- }), React__default.Children.map(props.children || null, child => {
6865
+ children: description
6866
+ }), React__default.Children.map(children || null, child => {
6830
6867
  return child;
6831
6868
  })]
6832
6869
  })
6833
- }), !props.formatContent && /*#__PURE__*/jsxs(React__default.Fragment, {
6834
- children: [props.description && /*#__PURE__*/jsx(Typography, {
6870
+ }), !_formatContent && /*#__PURE__*/jsxs(React__default.Fragment, {
6871
+ children: [description && /*#__PURE__*/jsx(Typography, {
6835
6872
  variant: "body2",
6836
6873
  sx: {
6837
6874
  color: "text.secondary"
6838
6875
  },
6839
6876
  component: "p",
6840
- children: props.description
6877
+ children: description
6841
6878
  }), renderChildren()]
6842
- }), props.actions && /*#__PURE__*/jsx(CardActions, {
6879
+ }), actions && /*#__PURE__*/jsx(CardActions, {
6843
6880
  disableSpacing: true,
6844
6881
  sx: {
6845
- paddingTop: props.dense ? 0 : 1,
6846
- borderTop: props.footerBorder === true ? "1px solid #dddddd" : "none"
6882
+ paddingTop: _dense ? 0 : 1,
6883
+ borderTop: _footerBorder === true ? "1px solid #dddddd" : "none"
6847
6884
  },
6848
- children: props.actions
6849
- }), props.afterActionContent]
6885
+ children: actions
6886
+ }), afterActionContent]
6850
6887
  })]
6851
6888
  })
6852
6889
  });
6853
6890
  };
6854
- ContentBox.defaultProps = {
6855
- formatContent: true,
6856
- displayType: "default",
6857
- imageHeight: 150,
6858
- hasGutter: true,
6859
- imageBackgroundColor: "transparent",
6860
- titleComponent: "div",
6861
- wrapTitle: false,
6862
- wrapSubtitle: false,
6863
- dense: false,
6864
- collapsible: false,
6865
- renderFullMenu: true,
6866
- headerBorder: false,
6867
- footerBorder: false
6868
- };
6869
6891
  ContentBox.propTypes = {
6870
6892
  /** Content of the content box */
6871
6893
  children: PropTypes.any,
@@ -6958,7 +6980,13 @@ ContentBox.propTypes = {
6958
6980
  /** show border on footer */
6959
6981
  footerBorder: PropTypes.bool,
6960
6982
  /** additional header styles */
6961
- headerBackgroundColor: PropTypes.string
6983
+ headerBackgroundColor: PropTypes.string,
6984
+ /** additional title styles */
6985
+ titleStyles: PropTypes.object,
6986
+ /** additional subtitle styles */
6987
+ subTitleStyles: PropTypes.object,
6988
+ /** function to execute when title is clicked */
6989
+ onTitleClick: PropTypes.func
6962
6990
  };
6963
6991
 
6964
6992
  // Copyright (c) 2022 HelioCampus Inc., all rights reserved.
@@ -26729,6 +26757,9 @@ const Widget = ({
26729
26757
  }
26730
26758
  })
26731
26759
  }) : undefined;
26760
+ const titleStyles = {
26761
+ fontSize: "1.25rem"
26762
+ };
26732
26763
  return /*#__PURE__*/jsx(Box$2, {
26733
26764
  component: "article",
26734
26765
  sx: containerStyle,
@@ -26739,6 +26770,7 @@ const Widget = ({
26739
26770
  },
26740
26771
  children: /*#__PURE__*/jsx(ContentBox, _extends({
26741
26772
  title: title,
26773
+ titleStyles: titleStyles,
26742
26774
  subtitle: subtitle,
26743
26775
  avatar: avatar,
26744
26776
  titleComponent: _titleComponent,