@mtes-mct/monitor-ui 14.3.1 → 15.0.1
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 +33 -0
- package/components/Message/constants.d.ts +6 -0
- package/components/Message/constants.d.ts.map +1 -0
- package/components/Message/index.d.ts +11 -0
- package/components/Message/index.d.ts.map +1 -0
- package/components/Message/utils.d.ts +7 -0
- package/components/Message/utils.d.ts.map +1 -0
- package/elements/IconButton.d.ts +1 -0
- package/elements/IconButton.d.ts.map +1 -1
- package/index.js +82 -64
- package/package.json +1 -1
- package/components/Message.d.ts +0 -8
- package/components/Message.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
|
+
## [15.0.0](https://github.com/MTES-MCT/monitor-ui/compare/v14.3.1...v15.0.0) (2024-04-28)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### ⚠ BREAKING CHANGES
|
|
5
|
+
|
|
6
|
+
* **components:** The default `Message.level` is now "INFO" instead of "WARNING".
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **components:** add Icon & iconColor props to Message ([e8d1520](https://github.com/MTES-MCT/monitor-ui/commit/e8d1520db170594c767300a28fe355b3d2002483))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **fields:** prevent textarea from being horizontally reduced ([76d3057](https://github.com/MTES-MCT/monitor-ui/commit/76d305748fa6afc09254efe3e77b66af4dd9ddbe))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Code Refactoring
|
|
19
|
+
|
|
20
|
+
* **elements:** start cleaning & simplifying IconButton logic ([afffc00](https://github.com/MTES-MCT/monitor-ui/commit/afffc00a65218f9f8645de252ab476764baf0881))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Buid System & Dependencies
|
|
24
|
+
|
|
25
|
+
* **dev-deps:** bunp storybook from 8.0.0-beta.4 to 8.0.9 ([b1b9aa1](https://github.com/MTES-MCT/monitor-ui/commit/b1b9aa113e4497c11ccdad057573747333d2632c))
|
|
26
|
+
|
|
27
|
+
## [14.3.1](https://github.com/MTES-MCT/monitor-ui/compare/v14.3.0...v14.3.1) (2024-04-22)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* **component:** display hide text in red when level isError in banner component ([1e10ef2](https://github.com/MTES-MCT/monitor-ui/commit/1e10ef2ea7fd0b1e7d07ef616980306aee416099))
|
|
33
|
+
|
|
1
34
|
## [14.3.0](https://github.com/MTES-MCT/monitor-ui/compare/v14.2.0...v14.3.0) (2024-04-19)
|
|
2
35
|
|
|
3
36
|
|
|
@@ -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, className, 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":"AACA,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,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,KAAkB,EAAE,GAAG,WAAW,EAAE,EAAE,YAAY,2CAWjH"}
|
|
@@ -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"}
|
package/elements/IconButton.d.ts
CHANGED
|
@@ -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,MAAM,sBAAsB,CAAA;AASrD,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC,GAAG;IACxF,IAAI,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAA;IAClC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,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,CA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Ae,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:
|
|
53348
|
+
border-color: transparent;
|
|
53369
53349
|
color: ${(p)=>p.theme.color.charcoal};
|
|
53370
53350
|
|
|
53371
|
-
|
|
53351
|
+
&:hover,
|
|
53372
53352
|
&._hover {
|
|
53373
53353
|
background-color: transparent;
|
|
53374
|
-
border:
|
|
53354
|
+
border-color: transparent;
|
|
53375
53355
|
color: ${(p)=>p.theme.color.blueYonder};
|
|
53376
53356
|
}
|
|
53377
53357
|
|
|
53378
|
-
|
|
53358
|
+
&:active,
|
|
53379
53359
|
&._active {
|
|
53380
53360
|
background-color: transparent;
|
|
53381
|
-
border:
|
|
53361
|
+
border-color: transparent;
|
|
53382
53362
|
color: ${(p)=>p.theme.color.blueGray};
|
|
53383
53363
|
}
|
|
53384
53364
|
|
|
53385
|
-
|
|
53365
|
+
&:disabled,
|
|
53386
53366
|
&._disabled {
|
|
53387
53367
|
background-color: transparent;
|
|
53388
|
-
border:
|
|
53368
|
+
border-color: transparent;
|
|
53389
53369
|
color: ${(p)=>p.theme.color.lightGray};
|
|
53390
53370
|
}
|
|
53391
53371
|
`;
|
|
@@ -53614,37 +53594,73 @@ const MapMenuDialog = {
|
|
|
53614
53594
|
VisibilityButton
|
|
53615
53595
|
};
|
|
53616
53596
|
|
|
53617
|
-
|
|
53618
|
-
|
|
53619
|
-
|
|
53620
|
-
|
|
53621
|
-
|
|
53622
|
-
|
|
53623
|
-
|
|
53624
|
-
|
|
53625
|
-
|
|
53626
|
-
|
|
53627
|
-
|
|
53628
|
-
|
|
53629
|
-
|
|
53630
|
-
|
|
53631
|
-
|
|
53632
|
-
|
|
53633
|
-
|
|
53634
|
-
|
|
53635
|
-
|
|
53636
|
-
|
|
53637
|
-
|
|
53638
|
-
|
|
53639
|
-
|
|
53640
|
-
|
|
53641
|
-
|
|
53642
|
-
|
|
53643
|
-
|
|
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, className, Icon, iconColor, level = Level.INFO, ...nativeProps }) {
|
|
53648
|
+
const controlledClassName = classnames('Component-Message>', className);
|
|
53649
|
+
const ControlledIcon = Icon ?? DEFAUT_ICON[level];
|
|
53650
|
+
const controlledIconColor = iconColor ?? DEFAULT_ICON_COLOR[level];
|
|
53651
|
+
return /*#__PURE__*/ jsxs(Box$c, {
|
|
53652
|
+
$level: level,
|
|
53653
|
+
className: controlledClassName,
|
|
53654
|
+
...nativeProps,
|
|
53655
|
+
children: [
|
|
53656
|
+
/*#__PURE__*/ jsx(ControlledIcon, {
|
|
53657
|
+
color: controlledIconColor
|
|
53658
|
+
}),
|
|
53659
|
+
/*#__PURE__*/ jsx(ChildrenContainer, {
|
|
53660
|
+
children: children
|
|
53661
|
+
})
|
|
53662
|
+
]
|
|
53663
|
+
});
|
|
53648
53664
|
}
|
|
53649
53665
|
const ChildrenContainer = styled.div`
|
|
53650
53666
|
margin-left: 8px;
|
|
@@ -53652,13 +53668,14 @@ const ChildrenContainer = styled.div`
|
|
|
53652
53668
|
flex-direction: column;
|
|
53653
53669
|
flex: 1;
|
|
53654
53670
|
`;
|
|
53655
|
-
const Box$c = styled.
|
|
53656
|
-
|
|
53657
|
-
|
|
53658
|
-
|
|
53659
|
-
display: flex;
|
|
53671
|
+
const Box$c = styled.div`
|
|
53672
|
+
${getStyledCssFromLevel()}
|
|
53673
|
+
|
|
53674
|
+
border-width: 1px;
|
|
53660
53675
|
border-radius: 2px;
|
|
53676
|
+
display: flex;
|
|
53661
53677
|
font-size: 13px;
|
|
53678
|
+
padding: 16px;
|
|
53662
53679
|
`;
|
|
53663
53680
|
|
|
53664
53681
|
const FONT_SIZE = {
|
|
@@ -68598,6 +68615,7 @@ const StyledRsuiteInput = styled(Input)`
|
|
|
68598
68615
|
font-weight: 500;
|
|
68599
68616
|
padding: 7px 8px;
|
|
68600
68617
|
width: 100%;
|
|
68618
|
+
min-width: 100%;
|
|
68601
68619
|
max-width: 100%;
|
|
68602
68620
|
|
|
68603
68621
|
&::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": "
|
|
4
|
+
"version": "15.0.1",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
package/components/Message.d.ts
DELETED
|
@@ -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"}
|