@mtes-mct/monitor-ui 16.1.0 → 16.3.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,30 @@
1
+ ## [16.2.0](https://github.com/MTES-MCT/monitor-ui/compare/v16.1.0...v16.2.0) (2024-04-28)
2
+
3
+
4
+ ### Features
5
+
6
+ * **components:** add onAutoClose prop to Banner ([a28e5fc](https://github.com/MTES-MCT/monitor-ui/commit/a28e5fc82e6c72c0f21de80a3d731fd70bfb5a20))
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **components:** set left position to 0 in Banner ([1a91c7f](https://github.com/MTES-MCT/monitor-ui/commit/1a91c7f1494379677e54900172f7cab3b688741b))
12
+
13
+ ## [16.1.0](https://github.com/MTES-MCT/monitor-ui/compare/v16.0.0...v16.1.0) (2024-04-28)
14
+
15
+
16
+ ### Features
17
+
18
+ * **components:** add isFixed prop to Banner ([4830f91](https://github.com/MTES-MCT/monitor-ui/commit/4830f913fcde74b6d5c7520423ef5bb46d1b6305))
19
+ * **components:** make isClosable, isCollapsible & isHiddenByDefault Banner props optional ([bbf07db](https://github.com/MTES-MCT/monitor-ui/commit/bbf07db7d7e2054ff37f4c40b439346f47d6363e))
20
+ * **components:** make style prop transparent in Banner ([30beabd](https://github.com/MTES-MCT/monitor-ui/commit/30beabdb52a5119b86fc2efdfdb14223f6223360))
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * **components:** remove position typo in Banner ([17143e1](https://github.com/MTES-MCT/monitor-ui/commit/17143e1e54004f9b2b7bf863f287c67d7c5b54d7))
26
+ * **elements:** fix non-transparent border in tertiary IconButton ([a4ce7b4](https://github.com/MTES-MCT/monitor-ui/commit/a4ce7b4a7c0dd731e035c0631f3196d06ea9d242))
27
+
1
28
  ## [16.0.0](https://github.com/MTES-MCT/monitor-ui/compare/v15.0.1...v16.0.0) (2024-04-28)
2
29
 
3
30
 
@@ -1,6 +1,7 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import { type CSSProperties } from 'styled-components';
3
3
  import { Level } from '../../constants';
4
+ import type { Promisable } from 'type-fest';
4
5
  export type BannerProps = {
5
6
  children: string | ReactNode;
6
7
  className?: string | undefined;
@@ -10,11 +11,13 @@ export type BannerProps = {
10
11
  isFixed?: boolean | undefined;
11
12
  isHiddenByDefault?: boolean | undefined;
12
13
  level: Level;
14
+ onAutoClose?: (() => Promisable<void>) | undefined;
15
+ onClose?: (() => Promisable<void>) | undefined;
13
16
  style?: CSSProperties | undefined;
14
17
  top: string;
15
18
  withAutomaticClosing?: boolean | undefined;
16
19
  };
17
- export declare function Banner({ children, className, closingDelay, isClosable, isCollapsible, isFixed, isHiddenByDefault, level, style, top, withAutomaticClosing }: Readonly<BannerProps>): import("react/jsx-runtime").JSX.Element;
20
+ export declare function Banner({ children, className, closingDelay, isClosable, isCollapsible, isFixed, isHiddenByDefault, level, onAutoClose, onClose, style, top, withAutomaticClosing }: Readonly<BannerProps>): import("react/jsx-runtime").JSX.Element;
18
21
  export declare namespace Banner {
19
22
  var displayName: string;
20
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Banner/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAA4C,MAAM,OAAO,CAAA;AAChF,OAAe,EAAO,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAGnE,OAAO,EAAgB,KAAK,EAAQ,MAAM,iBAAiB,CAAA;AAE3D,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAChC,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACnC,OAAO,CAAC,E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AG,SAAS,CAAA;IAClD,OAAO,CAAC,EAAE,CAAC,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAA;IAC9C,KAAK,CAAC,EAAE,aAAa,GAAG,SAAS,CAAA;IACjC,GAAG,EAAE,MAAM,CAAA;IACX,oBAAoB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC3C,CAAA;AAED,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,SAAqB,EACrB,YAAmB,EACnB,UAAkB,EAClB,aAAqB,EACrB,OAAe,EACf,iBAAyB,EACzB,KAAK,EACL,WAAW,EACX,OAAO,EACP,KAAK,EACL,GAAG,EACH,oBAA4B,EAC7B,EAAE,QAAQ,CAAC,WAAW,CAAC,2CAgFvB;yBA9Fe,MAAM"}
package/index.js CHANGED
@@ -53765,7 +53765,7 @@ const getBannerPalette = (level)=>{
53765
53765
  };
53766
53766
  };
53767
53767
 
53768
- function Banner({ children, className = undefined, closingDelay = 3000, isClosable = false, isCollapsible = false, isFixed = false, isHiddenByDefault = false, level, style, top, withAutomaticClosing = false }) {
53768
+ function Banner({ children, className = undefined, closingDelay = 3000, isClosable = false, isCollapsible = false, isFixed = false, isHiddenByDefault = false, level, onAutoClose, onClose, style, top, withAutomaticClosing = false }) {
53769
53769
  const timeoutIdRef = useRef(undefined);
53770
53770
  const controlledClassName = classnames('Component-Banner', className);
53771
53771
  const [isHidden, setIsHidden] = useState(!!isHiddenByDefault);
@@ -53786,6 +53786,7 @@ function Banner({ children, className = undefined, closingDelay = 3000, isClosab
53786
53786
  const onClickAction = useCallback(()=>{
53787
53787
  if (isClosable) {
53788
53788
  setIsHidden(true);
53789
+ onClose?.();
53789
53790
  } else if (isCollapsible) {
53790
53791
  setIsCollapsing(true);
53791
53792
  setIsCollapsed(true);
@@ -53793,12 +53794,14 @@ function Banner({ children, className = undefined, closingDelay = 3000, isClosab
53793
53794
  }
53794
53795
  }, [
53795
53796
  isClosable,
53796
- isCollapsible
53797
+ isCollapsible,
53798
+ onClose
53797
53799
  ]);
53798
53800
  useEffect(()=>{
53799
53801
  if (withAutomaticClosing) {
53800
53802
  const timeoutId = setTimeout(()=>{
53801
53803
  onClickAction();
53804
+ onAutoClose?.();
53802
53805
  }, closingDelay);
53803
53806
  timeoutIdRef.current = timeoutId;
53804
53807
  }
@@ -53806,6 +53809,7 @@ function Banner({ children, className = undefined, closingDelay = 3000, isClosab
53806
53809
  }, [
53807
53810
  closingDelay,
53808
53811
  onClickAction,
53812
+ onAutoClose,
53809
53813
  withAutomaticClosing
53810
53814
  ]);
53811
53815
  return /*#__PURE__*/ jsx(Wrapper, {
@@ -53861,6 +53865,7 @@ const Wrapper = styled.div`
53861
53865
  flex-direction: row;
53862
53866
  height: ${(p)=>!p.$isHidden && p.$isCollapsed ? '10px' : '50px'};
53863
53867
  justify-content: space-between;
53868
+ left: 0;
53864
53869
  max-width: 100%;
53865
53870
  min-width: 100%;
53866
53871
  padding: 0 2rem;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mtes-mct/monitor-ui",
3
3
  "description": "Common React components, hooks, utilities and CSS stylesheets for MonitorFish, MonitorEnv and RapportNav.",
4
- "version": "16.1.0",
4
+ "version": "16.3.0",
5
5
  "license": "AGPL-3.0",
6
6
  "type": "module",
7
7
  "engines": {