frst-components 0.20.18 → 0.20.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.js CHANGED
@@ -6818,6 +6818,7 @@ function BannerLxp(props) {
6818
6818
  const [titleText, setTitleText] = React.useState('');
6819
6819
  const [colorTitle, setColorTitle] = React.useState('');
6820
6820
  const [backgroundColor, setBackgroundColor] = React.useState('');
6821
+ // const [oldBgColor, setOldBgColor] = useState("");
6821
6822
  const [backgroundImage, setBackgroundImage] = React.useState('');
6822
6823
  const [fixImage, setFixImage] = React.useState(false);
6823
6824
  const [selectedFile, setSelectedFile] = React.useState({});
@@ -6832,12 +6833,13 @@ function BannerLxp(props) {
6832
6833
  props.onSaveInfo([titleText, disableText, colorTitle, backgroundColor, fixImage]);
6833
6834
  };
6834
6835
  const onCancell = () => {
6835
- setBackgroundColor(props.bgColor ?? '');
6836
- setBackgroundImage(props.bgSrc ?? '');
6837
- setTitleText(props.title ?? '');
6836
+ props.bgColor && setBackgroundColor(props.bgColor ?? '');
6837
+ props.bgSrc && setBackgroundImage(props.bgSrc ?? '');
6838
+ props.title && setTitleText(props.title ?? '');
6838
6839
  setColorTitle(props.titleColor ?? '');
6839
- setDisableText(props.isDisabledTitle ?? false);
6840
+ setDisableText(props.isDisabledTitle);
6840
6841
  setOpenConfig(false);
6842
+ props?.onCancell && props?.onCancell();
6841
6843
  };
6842
6844
  const handleOpenTitleColorPicker = (event) => {
6843
6845
  setDisplayTitleColorPicker(!displayTitleColorPicker);
@@ -6862,21 +6864,32 @@ function BannerLxp(props) {
6862
6864
  setSelectedFile(e.target.result);
6863
6865
  };
6864
6866
  reader.readAsDataURL(file);
6865
- props.handleChangeBanner(file);
6866
- setBackgroundImage(props.bgSrc);
6867
- setColorTitle(props?.titleColor);
6868
6867
  setBackgroundColor('');
6868
+ props.handleChangeBanner(file);
6869
6869
  return file;
6870
6870
  };
6871
6871
  React.useEffect(() => {
6872
- setTitleText(props?.title);
6873
- setDisableText(props?.isDisabledTitle);
6874
- // setBackgroundImage(props?.bgSrc);
6875
- }, []);
6872
+ props?.isDisabledTitle && setDisableText(props?.isDisabledTitle);
6873
+ props?.bgColor && setBackgroundColor(props?.bgColor);
6874
+ // props?.bgColor && setOldBgColor(props?.bgColor);
6875
+ props?.bgSrc && setBackgroundImage(props?.bgSrc);
6876
+ props.isDisabledTitle && setDisableText(props.isDisabledTitle);
6877
+ }, [props]);
6876
6878
  React.useEffect(() => {
6877
6879
  if (props?.bgSrc)
6878
6880
  setBackgroundImage(props?.bgSrc);
6879
6881
  }, [props?.bgSrc]);
6882
+ React.useMemo(() => {
6883
+ if (props?.title) {
6884
+ setTitleText(props?.title);
6885
+ }
6886
+ if (props?.titleColor) {
6887
+ setColorTitle(props?.titleColor);
6888
+ }
6889
+ if (props.isDisabledTitle) {
6890
+ setDisableText(props.isDisabledTitle);
6891
+ }
6892
+ }, [props?.title, props?.titleColor, props.isDisabledTitle]);
6880
6893
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [props?.isLoading ? (jsxRuntime.jsx(LoadingBanner, {})) : (jsxRuntime.jsxs(BannerContainer, { backgroundBanner: props?.bgColor || `url(${props?.bgSrc})`, style: {
6881
6894
  ...props.style,
6882
6895
  objectFit: 'fill'
@@ -22,6 +22,7 @@ interface BannerLxpParams {
22
22
  * @prop {object} onSaveInfo: função de callback que retorna todos as informações do banner no final das alterações. (nesta ordem[Title, isTitledisabled, colorTitle, backgroundColor, fixImage])
23
23
  */
24
24
  onSaveInfo?: ([]: Iterable<any>) => void;
25
+ onCancell?: () => void;
25
26
  }
26
27
  export default function BannerLxp(props: BannerLxpParams): JSX.Element;
27
28
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/LXP/bannerLxp/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAK1D,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM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AAA;CACvB;AAED,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAK,EAAE,eAAe,eA2PvD"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "frst-components",
3
3
  "homepage": "http://FRST-Falconi.github.io/storybook.frstfalconi.com",
4
- "version": "0.20.18",
4
+ "version": "0.20.20",
5
5
  "private": false,
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",