@mtes-mct/monitor-ui 16.0.0 → 16.2.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,35 @@
1
+ ## [16.1.0](https://github.com/MTES-MCT/monitor-ui/compare/v16.0.0...v16.1.0) (2024-04-28)
2
+
3
+
4
+ ### Features
5
+
6
+ * **components:** add isFixed prop to Banner ([4830f91](https://github.com/MTES-MCT/monitor-ui/commit/4830f913fcde74b6d5c7520423ef5bb46d1b6305))
7
+ * **components:** make isClosable, isCollapsible & isHiddenByDefault Banner props optional ([bbf07db](https://github.com/MTES-MCT/monitor-ui/commit/bbf07db7d7e2054ff37f4c40b439346f47d6363e))
8
+ * **components:** make style prop transparent in Banner ([30beabd](https://github.com/MTES-MCT/monitor-ui/commit/30beabdb52a5119b86fc2efdfdb14223f6223360))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **components:** remove position typo in Banner ([17143e1](https://github.com/MTES-MCT/monitor-ui/commit/17143e1e54004f9b2b7bf863f287c67d7c5b54d7))
14
+ * **elements:** fix non-transparent border in tertiary IconButton ([a4ce7b4](https://github.com/MTES-MCT/monitor-ui/commit/a4ce7b4a7c0dd731e035c0631f3196d06ea9d242))
15
+
16
+ ## [16.0.0](https://github.com/MTES-MCT/monitor-ui/compare/v15.0.1...v16.0.0) (2024-04-28)
17
+
18
+
19
+ ### ⚠ BREAKING CHANGES
20
+
21
+ * **entities:** `isEmailSubscriptionContact` & `isSmsSubscriptionContact` props are added to `ControlUnit.ControlUnitContact`.
22
+
23
+ ### Features
24
+
25
+ * **entities:** add new ControlUnitContact props ([437eb37](https://github.com/MTES-MCT/monitor-ui/commit/437eb37ebd5c5dc531514dcc9bbdafebb87cd987))
26
+
27
+
28
+ ### Styles
29
+
30
+ * **components:** specify solid border in Message ([78d2f40](https://github.com/MTES-MCT/monitor-ui/commit/78d2f4001cc67b77694ea8ae3d97167e091c5cd8))
31
+ * **elements:** specify solid border in IconButton ([f7deba3](https://github.com/MTES-MCT/monitor-ui/commit/f7deba3abae79bf9f0de6c289b1999fba93fd1d9))
32
+
1
33
  ## [15.0.1](https://github.com/MTES-MCT/monitor-ui/compare/v15.0.0...v15.0.1) (2024-04-28)
2
34
 
3
35
 
@@ -1,19 +1,23 @@
1
1
  import { type ReactNode } from 'react';
2
+ import { type CSSProperties } from 'styled-components';
2
3
  import { Level } from '../../constants';
4
+ import type { Promisable } from 'type-fest';
3
5
  export type BannerProps = {
4
6
  children: string | ReactNode;
5
7
  className?: string | undefined;
6
8
  closingDelay?: number;
7
- isClosable: boolean;
8
- isCollapsible: boolean;
9
- isHiddenByDefault: boolean | undefined;
9
+ isClosable?: boolean | undefined;
10
+ isCollapsible?: boolean | undefined;
11
+ isFixed?: boolean | undefined;
12
+ isHiddenByDefault?: boolean | undefined;
10
13
  level: Level;
14
+ onAutoClose?: (() => Promisable<void>) | undefined;
15
+ style?: CSSProperties | undefined;
11
16
  top: string;
12
- withAutomaticClosing?: boolean;
17
+ withAutomaticClosing?: boolean | undefined;
13
18
  };
14
- declare function Banner({ children, className, closingDelay, isClosable, isCollapsible, isHiddenByDefault, level, top, withAutomaticClosing }: Readonly<BannerProps>): import("react/jsx-runtime").JSX.Element;
15
- declare namespace Banner {
19
+ export declare function Banner({ children, className, closingDelay, isClosable, isCollapsible, isFixed, isHiddenByDefault, level, onAutoClose, style, top, withAutomaticClosing }: Readonly<BannerProps>): import("react/jsx-runtime").JSX.Element;
20
+ export declare namespace Banner {
16
21
  var displayName: string;
17
22
  }
18
- export { Banner };
19
23
  //# sourceMappingURL=index.d.ts.map
@@ -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;AAIhF,OAAO,EAAgB,KAAK,EAAQ,MAAM,iBAAiB,CAAA;AAE3D,MAA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AE,OAAO,GAAG,SAAS,CAAA;IACvC,KAAK,EAAE,KAAK,CAAA;IACZ,WAAW,CAAC,EAAE,CAAC,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAA;IAClD,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,KAAK,EACL,GAAG,EACH,oBAA4B,EAC7B,EAAE,QAAQ,CAAC,WAAW,CAAC,2CA6EvB;yBA1Fe,MAAM"}
package/index.js CHANGED
@@ -53338,7 +53338,7 @@ const PADDING$1 = {
53338
53338
  // We can't use $-prefixed props here for some reason (maybe because the `as` prop exclude them?).
53339
53339
  const StyledButton = styled.button`
53340
53340
  align-items: center;
53341
- border: solid ${(p)=>p.isCompact ? 0 : 1}px !important;
53341
+ border: solid ${(p)=>p.isCompact ? 0 : 1}px;
53342
53342
  display: flex;
53343
53343
  justify-content: center;
53344
53344
  padding: ${(p)=>p.isCompact ? 0 : PADDING$1[p.size]};
@@ -53765,7 +53765,7 @@ const getBannerPalette = (level)=>{
53765
53765
  };
53766
53766
  };
53767
53767
 
53768
- function Banner({ children, className = undefined, closingDelay = 3000, isClosable, isCollapsible, isHiddenByDefault, level, top, withAutomaticClosing = false }) {
53768
+ function Banner({ children, className = undefined, closingDelay = 3000, isClosable = false, isCollapsible = false, isFixed = false, isHiddenByDefault = false, level, onAutoClose, 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);
@@ -53799,6 +53799,7 @@ function Banner({ children, className = undefined, closingDelay = 3000, isClosab
53799
53799
  if (withAutomaticClosing) {
53800
53800
  const timeoutId = setTimeout(()=>{
53801
53801
  onClickAction();
53802
+ onAutoClose?.();
53802
53803
  }, closingDelay);
53803
53804
  timeoutIdRef.current = timeoutId;
53804
53805
  }
@@ -53806,17 +53807,20 @@ function Banner({ children, className = undefined, closingDelay = 3000, isClosab
53806
53807
  }, [
53807
53808
  closingDelay,
53808
53809
  onClickAction,
53810
+ onAutoClose,
53809
53811
  withAutomaticClosing
53810
53812
  ]);
53811
53813
  return /*#__PURE__*/ jsx(Wrapper, {
53812
53814
  $isCollapsed: isCollapsed,
53813
53815
  $isCollapsible: isCollapsible,
53816
+ $isFixed: isFixed,
53814
53817
  $isHidden: isHidden,
53815
53818
  $level: level,
53816
53819
  $top: top,
53817
53820
  className: controlledClassName,
53818
53821
  onMouseEnter: enterHover,
53819
53822
  onMouseLeave: leaveHover,
53823
+ style: style,
53820
53824
  children: !isHidden && !isCollapsed && /*#__PURE__*/ jsxs(Fragment, {
53821
53825
  children: [
53822
53826
  /*#__PURE__*/ jsx(ContentWrapper, {
@@ -53851,30 +53855,31 @@ function Banner({ children, className = undefined, closingDelay = 3000, isClosab
53851
53855
  });
53852
53856
  }
53853
53857
  const Wrapper = styled.div`
53858
+ align-items: center;
53859
+ background-color: ${(p)=>getBannerPalette(p.$level).backgroundColor};
53860
+ border-bottom: ${(p)=>p.$isCollapsible ? `4px solid ${getBannerPalette(p.$level).borderColor}` : 'none'};
53861
+ box-shadow: ${(p)=>p.$isCollapsible ? 'none' : '0px 3px 4px #7077854D'};
53854
53862
  display: ${(p)=>p.$isHidden ? 'none' : 'flex'};
53855
53863
  flex-direction: row;
53864
+ height: ${(p)=>!p.$isHidden && p.$isCollapsed ? '10px' : '50px'};
53856
53865
  justify-content: space-between;
53857
- align-items: center;
53858
- position: absolute;
53859
- background-color: ${(p)=>getBannerPalette(p.$level).backgroundColor};
53860
- width: 100%;
53861
- min-width: 100%;
53866
+ left: 0;
53862
53867
  max-width: 100%;
53868
+ min-width: 100%;
53863
53869
  padding: 0 2rem;
53870
+ position: ${(p)=>p.$isFixed ? 'fixed' : 'absolute'};
53864
53871
  top: ${(p)=>`${p.$top}`};
53865
- z-index: 1000;
53866
- height: ${(p)=>!p.$isHidden && p.$isCollapsed ? '10px' : '50px'};
53867
- border-bottom: ${({ $isCollapsible, $level })=>$isCollapsible ? `4px solid ${getBannerPalette($level).borderColor}` : 'none'};
53868
- box-shadow: ${({ $isCollapsible })=>$isCollapsible ? 'none' : '0px 3px 4px #7077854D'};
53869
53872
  transition: height 0.3s ease;
53873
+ width: 100%;
53874
+ z-index: 1000;
53870
53875
  `;
53871
53876
  const ContentWrapper = styled.div`
53872
- color: ${(p)=>getBannerPalette(p.$level).color};
53873
53877
  align-self: center;
53878
+ color: ${(p)=>getBannerPalette(p.$level).color};
53874
53879
  flex-grow: 2;
53875
- text-align: center;
53876
53880
  font-size: 16px;
53877
53881
  font-weight: 500;
53882
+ text-align: center;
53878
53883
  `;
53879
53884
  const ButtonWrapper = styled.div`
53880
53885
  align-self: center;
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.0.0",
4
+ "version": "16.2.0",
5
5
  "license": "AGPL-3.0",
6
6
  "type": "module",
7
7
  "engines": {