@plurid/plurid-ui-components-react 0.0.0-18 → 0.0.0-19

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.
@@ -2729,6 +2729,7 @@ const StyledNotification = styled.div`
2729
2729
  color: ${props => props.theme.colorPrimary};
2730
2730
  box-shadow: ${props => props.theme.boxShadowUmbra};
2731
2731
  animation: ${translateUp} 750ms ease-in-out forwards;
2732
+ transition: opacity 400ms;
2732
2733
 
2733
2734
  a {
2734
2735
  text-decoration: none;
@@ -2757,12 +2758,16 @@ const StyledNotificationClose = styled.div`
2757
2758
  const Notification = properties => {
2758
2759
  const {data: data, theme: theme, remove: remove, elements: elements, style: style, className: className} = properties;
2759
2760
  const {id: id, text: text, html: html, react: react, timeout: timeout, wordBreak: wordBreak} = data;
2760
- const resolvedWordBreak = wordBreak === false ? "normal" : "break-all";
2761
+ const resolvedWordBreak = wordBreak === true ? "break-all" : "normal";
2762
+ const [prepareForRemoval, setPrepareForRemoval] = useState(false);
2761
2763
  const notificationTimeout = useRef(null);
2762
2764
  useEffect((() => {
2763
2765
  if (timeout) {
2764
2766
  notificationTimeout.current = setTimeout((() => {
2765
- remove(id);
2767
+ setPrepareForRemoval(true);
2768
+ setTimeout((() => {
2769
+ remove(id);
2770
+ }), 400);
2766
2771
  }), timeout);
2767
2772
  }
2768
2773
  return () => {
@@ -2788,7 +2793,9 @@ const Notification = properties => {
2788
2793
  const content = resolveRender();
2789
2794
  return React.createElement(StyledNotification, {
2790
2795
  theme: theme,
2791
- style: Object.assign({}, style),
2796
+ style: Object.assign(Object.assign({}, style), {
2797
+ opacity: prepareForRemoval ? 0 : undefined
2798
+ }),
2792
2799
  className: className
2793
2800
  }, content, React.createElement(StyledNotificationClose, null, React.createElement(PluridIconDelete, {
2794
2801
  atClick: () => remove(id)