@mtes-mct/monitor-ui 14.3.0 → 15.0.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,17 @@
1
+ ## [14.3.1](https://github.com/MTES-MCT/monitor-ui/compare/v14.3.0...v14.3.1) (2024-04-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **component:** display hide text in red when level isError in banner component ([1e10ef2](https://github.com/MTES-MCT/monitor-ui/commit/1e10ef2ea7fd0b1e7d07ef616980306aee416099))
7
+
8
+ ## [14.3.0](https://github.com/MTES-MCT/monitor-ui/compare/v14.2.0...v14.3.0) (2024-04-19)
9
+
10
+
11
+ ### Features
12
+
13
+ * **components:** add automatic closing ([759c131](https://github.com/MTES-MCT/monitor-ui/commit/759c13101f048ecd7745480d775c6953d2a31229))
14
+
1
15
  ## [14.2.0](https://github.com/MTES-MCT/monitor-ui/compare/v14.1.0...v14.2.0) (2024-04-18)
2
16
 
3
17
 
@@ -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,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,EAAE,OAAO,CAAA;IACnB,aAAa,EAAE,OAAO,CAAA;IACtB,iBAAiB,EAAE,OAAO,GAAG,SAAS,CAAA;IACtC,KAAK,EAAE,KAAK,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B,CAAA;AAUD,iBAAS,MAAM,CAAC,EACd,QAAQ,EACR,SAAqB,EACrB,YAAmB,EACnB,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,KAAK,EACL,GAAG,EACH,oBAA4B,EAC7B,EAAE,QAAQ,CAAC,WAAW,CAAC,2CAsEvB;kBAhFQ,MAAM;;;AAwHf,OAAO,EAAE,MAAM,EAAE,CAAA"}
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,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,EAAE,OAAO,CAAA;IACnB,aAAa,EAAE,OAAO,CAAA;IACtB,iBAAiB,EAAE,OAAO,GAAG,SAAS,CAAA;IACtC,KAAK,EAAE,KAAK,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B,CAAA;AAUD,iBAAS,MAAM,CAAC,EACd,QAAQ,EACR,SAAqB,EACrB,YAAmB,EACnB,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,KAAK,EACL,GAAG,EACH,oBAA4B,EAC7B,EAAE,QAAQ,CAAC,WAAW,CAAC,2CA0EvB;kBApFQ,MAAM;;;AAoIf,OAAO,EAAE,MAAM,EAAE,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { Level } from '../../constants';
2
+ import type { IconProps } from '@types_/definitions';
3
+ import type { FunctionComponent } from 'react';
4
+ export declare const DEFAULT_ICON_COLOR: Record<Level, string>;
5
+ export declare const DEFAUT_ICON: Record<Level, FunctionComponent<IconProps>>;
6
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/Message/constants.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAGvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAG9C,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAKpD,CAAA;AAGD,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,KAAK,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAKnE,CAAA"}
@@ -0,0 +1,11 @@
1
+ import { type FunctionComponent, type HTMLAttributes, type ReactNode } from 'react';
2
+ import { Level } from '../../constants';
3
+ import type { IconProps } from '@types_/definitions';
4
+ export type MessageProps = HTMLAttributes<HTMLDivElement> & {
5
+ Icon?: FunctionComponent<IconProps> | undefined;
6
+ children: ReactNode | string;
7
+ iconColor?: Level | undefined;
8
+ level?: Level | undefined;
9
+ };
10
+ export declare function Message({ children, Icon, iconColor, level, ...nativeProps }: MessageProps): import("react/jsx-runtime").JSX.Element;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Message/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAKnF,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAEvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAEpD,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC1D,IAAI,CAAC,EAAE,iBAAiB,CAAC,SAAS,CAAC,GAAG,SAAS,CAAA;IAC/C,QAAQ,EAAE,SAAS,GAAG,MAAM,CAAA;IAC5B,SAAS,CAAC,EAAE,KAAK,GAAG,SAAS,CAAA;IAC7B,KAAK,CAAC,EAAE,KAAK,GAAG,SAAS,CAAA;CAC1B,CAAA;AACD,wBAAgB,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,KAAkB,EAAE,GAAG,WAAW,EAAE,EAAE,YAAY,2CAUtG"}
@@ -0,0 +1,7 @@
1
+ import { Level } from '../../constants';
2
+ import { THEME } from '../../theme';
3
+ export declare function getStyledCssFromLevel(): (props: {
4
+ $level: Level;
5
+ theme: typeof THEME;
6
+ }) => string;
7
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/Message/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAGnC,wBAAgB,qBAAqB,YACpB;IAAE,MAAM,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,YAAY,CAAA;CAAE,YAmCtD"}
@@ -4,6 +4,7 @@ import { type IconProps } from '../types/definitions';
4
4
  export type IconButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> & {
5
5
  Icon: FunctionComponent<IconProps>;
6
6
  accent?: Accent | undefined;
7
+ badge?: string | undefined;
7
8
  color?: string | undefined;
8
9
  /** In pixels, override `size` prop default values. */
9
10
  iconSize?: number | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../src/elements/IconButton.tsx"],"names":[],"mappings":"AACA,OAAO,EAA4B,KAAK,oBAAoB,EAAE,KAAK,iBAAiB,EAAe,MAAM,OAAO,CAAA;AAIhH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,KAAK,SAAS,EAAE,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C1B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,wCAAwC;IACxC,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC/B,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,CAAA;IACvB,yCAAyC;IACzC,qBAAqB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC5C,CAAA;AACD,wBAAgB,UAAU,CAAC,EACzB,MAAuB,EACvB,SAAS,EACT,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,OAAO,EACP,IAAkB,EAClB,IAAe,EACf,qBAA6B,EAC7B,GAAG,WAAW,EACf,EAAE,eAAe,2CA0CjB"}
package/index.js CHANGED
@@ -53338,54 +53338,34 @@ 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-width: ${(p)=>p.isCompact ? 0 : 1}px !important;
53341
53342
  display: flex;
53342
53343
  justify-content: center;
53343
53344
  padding: ${(p)=>p.isCompact ? 0 : PADDING$1[p.size]};
53344
-
53345
- ${(p)=>p.isCompact && css`
53346
- border: 0;
53347
-
53348
- :hover,
53349
- &._hover {
53350
- border: 0;
53351
- }
53352
- border: 0;
53353
-
53354
- :active,
53355
- &._active {
53356
- border: 0;
53357
- }
53358
- border: 0;
53359
-
53360
- :disabled,
53361
- &._disabled {
53362
- border: 0;
53363
- }
53364
- `}
53365
53345
  `;
53366
53346
  const TertiaryButton = styled.button`
53367
53347
  background-color: transparent;
53368
- border: ${(p)=>p.isCompact ? 0 : '1px solid transparent'};
53348
+ border-color: transparent;
53369
53349
  color: ${(p)=>p.theme.color.charcoal};
53370
53350
 
53371
- :hover,
53351
+ &:hover,
53372
53352
  &._hover {
53373
53353
  background-color: transparent;
53374
- border: ${(p)=>p.isCompact ? 0 : '1px solid transparent'};
53354
+ border-color: transparent;
53375
53355
  color: ${(p)=>p.theme.color.blueYonder};
53376
53356
  }
53377
53357
 
53378
- :active,
53358
+ &:active,
53379
53359
  &._active {
53380
53360
  background-color: transparent;
53381
- border: ${(p)=>p.isCompact ? 0 : '1px solid transparent'};
53361
+ border-color: transparent;
53382
53362
  color: ${(p)=>p.theme.color.blueGray};
53383
53363
  }
53384
53364
 
53385
- :disabled,
53365
+ &:disabled,
53386
53366
  &._disabled {
53387
53367
  background-color: transparent;
53388
- border: ${(p)=>p.isCompact ? 0 : '1px solid transparent'};
53368
+ border-color: transparent;
53389
53369
  color: ${(p)=>p.theme.color.lightGray};
53390
53370
  }
53391
53371
  `;
@@ -53614,37 +53594,71 @@ const MapMenuDialog = {
53614
53594
  VisibilityButton
53615
53595
  };
53616
53596
 
53617
- function Message({ children, level = Level.WARNING, ...nativeProps }) {
53618
- switch(level){
53619
- case Level.WARNING:
53620
- return /*#__PURE__*/ jsxs(Box$c, {
53621
- backgroundColor: THEME.color.goldenPoppy25,
53622
- color: THEME.color.slateGray,
53623
- ...nativeProps,
53624
- children: [
53625
- /*#__PURE__*/ jsx(AttentionFilled, {
53626
- color: THEME.color.goldenPoppy
53627
- }),
53628
- /*#__PURE__*/ jsx(ChildrenContainer, {
53629
- children: children
53630
- })
53631
- ]
53632
- });
53633
- default:
53634
- return /*#__PURE__*/ jsxs(Box$c, {
53635
- backgroundColor: THEME.color.goldenPoppy25,
53636
- color: THEME.color.slateGray,
53637
- ...nativeProps,
53638
- children: [
53639
- /*#__PURE__*/ jsx(AttentionFilled, {
53640
- color: THEME.color.goldenPoppy
53641
- }),
53642
- /*#__PURE__*/ jsx(ChildrenContainer, {
53643
- children: children
53644
- })
53645
- ]
53646
- });
53647
- }
53597
+ // TODO Check default icon color with Adeline.
53598
+ const DEFAULT_ICON_COLOR = {
53599
+ [Level.ERROR]: THEME.color.maximumRed,
53600
+ [Level.INFO]: THEME.color.blueGray,
53601
+ [Level.SUCCESS]: THEME.color.mediumSeaGreen,
53602
+ [Level.WARNING]: THEME.color.goldenPoppy
53603
+ };
53604
+ // TODO Check default icons with Adeline.
53605
+ const DEFAUT_ICON = {
53606
+ [Level.ERROR]: AttentionFilled,
53607
+ [Level.INFO]: Info,
53608
+ [Level.SUCCESS]: Check,
53609
+ [Level.WARNING]: AttentionFilled
53610
+ };
53611
+
53612
+ /* istanbul ignore next */ function getStyledCssFromLevel() {
53613
+ return (props)=>{
53614
+ switch(true){
53615
+ // TODO Check with Adeline.
53616
+ case props.$level === Level.ERROR:
53617
+ return `
53618
+ background-color: ${props.theme.color.maximumRed15};
53619
+ border-color: ${props.theme.color.maximumRed};
53620
+ color: ${props.theme.color.gunMetal};
53621
+ `;
53622
+ // TODO Check with Adeline.
53623
+ case props.$level === Level.SUCCESS:
53624
+ return `
53625
+ background-color: ${props.theme.color.mediumSeaGreen25};
53626
+ border-color: ${props.theme.color.mediumSeaGreen};
53627
+ color: ${props.theme.color.gunMetal};
53628
+ `;
53629
+ case props.$level === Level.WARNING:
53630
+ return `
53631
+ background-color: ${props.theme.color.goldenPoppy25};
53632
+ border-color: ${props.theme.color.goldenPoppy};
53633
+ color: ${props.theme.color.slateGray};
53634
+ `;
53635
+ // TODO Check `border-color` with Adeline.
53636
+ case props.$level === Level.INFO:
53637
+ default:
53638
+ return `
53639
+ background-color: ${props.theme.color.blueGray25};
53640
+ border-color: #BCD9F2;
53641
+ color: ${props.theme.color.gunMetal};
53642
+ `;
53643
+ }
53644
+ };
53645
+ }
53646
+
53647
+ function Message({ children, Icon, iconColor, level = Level.INFO, ...nativeProps }) {
53648
+ const ControlledIcon = Icon ?? DEFAUT_ICON[level];
53649
+ const controlledIconColor = iconColor ?? DEFAULT_ICON_COLOR[level];
53650
+ return /*#__PURE__*/ jsxs(Box$c, {
53651
+ $level: level,
53652
+ ...nativeProps,
53653
+ children: [
53654
+ /*#__PURE__*/ jsx(ControlledIcon, {
53655
+ color: controlledIconColor
53656
+ }),
53657
+ /*#__PURE__*/ jsx(ChildrenContainer, {
53658
+ children: children
53659
+ })
53660
+ ]
53661
+ });
53648
53662
  }
53649
53663
  const ChildrenContainer = styled.div`
53650
53664
  margin-left: 8px;
@@ -53653,12 +53667,13 @@ const ChildrenContainer = styled.div`
53653
53667
  flex: 1;
53654
53668
  `;
53655
53669
  const Box$c = styled.span`
53656
- background: ${(p)=>p.backgroundColor ?? p.theme.color.goldenPoppy25};
53657
- color: ${(p)=>p.color ?? p.theme.color.slateGray};
53658
- padding: 16px;
53659
- display: flex;
53670
+ ${getStyledCssFromLevel()}
53671
+
53672
+ border-width: 1px;
53660
53673
  border-radius: 2px;
53674
+ display: flex;
53661
53675
  font-size: 13px;
53676
+ padding: 16px;
53662
53677
  `;
53663
53678
 
53664
53679
  const FONT_SIZE = {
@@ -53822,7 +53837,10 @@ function Banner({ children, className = undefined, closingDelay = 3000, isClosab
53822
53837
  }),
53823
53838
  !isClosable && isCollapsible && /*#__PURE__*/ jsx(LinkButton, {
53824
53839
  size: Size.LARGE,
53825
- children: "Masquer"
53840
+ children: /*#__PURE__*/ jsx(HideText, {
53841
+ $level: level,
53842
+ children: "Masquer"
53843
+ })
53826
53844
  })
53827
53845
  ]
53828
53846
  })
@@ -53859,6 +53877,12 @@ const ContentWrapper = styled.div`
53859
53877
  const ButtonWrapper = styled.div`
53860
53878
  align-self: center;
53861
53879
  `;
53880
+ const HideText = styled.span`
53881
+ ${(p)=>p.$level === Level.ERROR ? css`
53882
+ color: ${getBannerPalette(p.$level).color};
53883
+ text-decoration: ${getBannerPalette(p.$level).color} underline;
53884
+ ` : ''}
53885
+ `;
53862
53886
  Banner.displayName = 'Banner';
53863
53887
 
53864
53888
  const Field$2 = styled.div.attrs((props)=>({
@@ -68589,6 +68613,7 @@ const StyledRsuiteInput = styled(Input)`
68589
68613
  font-weight: 500;
68590
68614
  padding: 7px 8px;
68591
68615
  width: 100%;
68616
+ min-width: 100%;
68592
68617
  max-width: 100%;
68593
68618
 
68594
68619
  &::placeholder {
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": "14.3.0",
4
+ "version": "15.0.0",
5
5
  "license": "AGPL-3.0",
6
6
  "type": "module",
7
7
  "engines": {
@@ -1,8 +0,0 @@
1
- import { type HTMLAttributes, type ReactNode } from 'react';
2
- import { Level } from '../constants';
3
- export type MessageProps = HTMLAttributes<HTMLDivElement> & {
4
- children: ReactNode | string;
5
- level?: Level | undefined;
6
- };
7
- export declare function Message({ children, level, ...nativeProps }: MessageProps): import("react/jsx-runtime").JSX.Element;
8
- //# sourceMappingURL=Message.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../src/components/Message.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAG3D,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAGpC,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC1D,QAAQ,EAAE,SAAS,GAAG,MAAM,CAAA;IAC5B,KAAK,CAAC,EAAE,KAAK,GAAG,SAAS,CAAA;CAC1B,CAAA;AACD,wBAAgB,OAAO,CAAC,EAAE,QAAQ,EAAE,KAAqB,EAAE,GAAG,WAAW,EAAE,EAAE,YAAY,2CAkBxF"}