@mtes-mct/monitor-ui 21.0.1 → 21.1.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 CHANGED
@@ -1,3 +1,34 @@
1
+ ## [21.1.0](https://github.com/MTES-MCT/monitor-ui/compare/v21.0.1...v21.1.0) (2024-08-20)
2
+
3
+
4
+ ### ⚠ BREAKING CHANGES
5
+
6
+ * **elements:** pass style to wrapper
7
+
8
+ ### Features
9
+
10
+ * **elements:** pass class name to icon button ([23251d7](https://github.com/MTES-MCT/monitor-ui/commit/23251d73759d427dbe3d4946e758e4cb93d036cc))
11
+ * **elements:** pass style to wrapper ([c3ce3f2](https://github.com/MTES-MCT/monitor-ui/commit/c3ce3f2466d835f98a7a5bcbfbe471e55816bbf4))
12
+
13
+
14
+ ### Buid System & Dependencies
15
+
16
+ * **deps:** bump axios from 1.6.7 to 1.7.4 ([e960cd3](https://github.com/MTES-MCT/monitor-ui/commit/e960cd35947623f89866aa05fd17950a888cf17f))
17
+ * **dev-deps:** bump the all-non-major-dependencies group ([9ff22e4](https://github.com/MTES-MCT/monitor-ui/commit/9ff22e4ef28c13cf5e6f27e5d501dc1eb8f59519))
18
+ * **dev-deps:** bump vite-tsconfig-paths in /e2e/release/sample ([b2c5e80](https://github.com/MTES-MCT/monitor-ui/commit/b2c5e808c2b2346d213e7ab3408174ad3dfaaa66))
19
+
20
+ ## [21.0.1](https://github.com/MTES-MCT/monitor-ui/compare/v21.0.0...v21.0.1) (2024-08-14)
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * **cypress:** allow string id in cy.getTableRowById() command ([b97fa08](https://github.com/MTES-MCT/monitor-ui/commit/b97fa086760c912466e73e226170f4d0809a8367))
26
+
27
+
28
+ ### Buid System & Dependencies
29
+
30
+ * bump yarn from v4.0.2 to v4.4.0 ([be8e50d](https://github.com/MTES-MCT/monitor-ui/commit/be8e50da1787e8329a4013b304169b2751620fb6))
31
+
1
32
  ## [21.0.0](https://github.com/MTES-MCT/monitor-ui/compare/v20.0.0...v21.0.0) (2024-08-12)
2
33
 
3
34
 
@@ -13,8 +13,9 @@ export type IconButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'chi
13
13
  /** Remove button border and padding. */
14
14
  isCompact?: boolean | undefined;
15
15
  size?: Size | undefined;
16
+ style?: React.CSSProperties | undefined;
16
17
  /** Prevent onClick event propagation. */
17
18
  withUnpropagatedClick?: boolean | undefined;
18
19
  };
19
- export declare function IconButton({ accent, badgeBackgroundColor, badgeColor, badgeNumber, className, color, Icon, iconSize, isCompact, onClick, size, type, withUnpropagatedClick, ...nativeProps }: IconButtonProps): import("react/jsx-runtime").JSX.Element;
20
+ export declare function IconButton({ accent, badgeBackgroundColor, badgeColor, badgeNumber, className, color, Icon, iconSize, isCompact, onClick, size, style, type, withUnpropagatedClick, ...nativeProps }: IconButtonProps): import("react/jsx-runtime").JSX.Element;
20
21
  //# sourceMappingURL=IconButton.d.ts.map
@@ -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,oBAAoB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACzC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,WAAW,CAAC,EAAE,MAAM,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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,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAA;IACvC,yCAAyC;IACzC,qBAAqB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC5C,CAAA;AACD,wBAAgB,UAAU,CAAC,EACzB,MAAuB,EACvB,oBAAoB,EACpB,UAAU,EACV,WAAW,EACX,SAAS,EACT,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,OAAO,EACP,IAAkB,EAClB,KAAK,EACL,IAAe,EACf,qBAA6B,EAC7B,GAAG,WAAW,EACf,EAAE,eAAe,2CAmFjB"}
package/index.js CHANGED
@@ -53566,7 +53566,7 @@ const ICON_SIZE_IN_PX = {
53566
53566
  [Size.NORMAL]: 20,
53567
53567
  [Size.SMALL]: 14
53568
53568
  };
53569
- function IconButton({ accent = Accent.PRIMARY, badgeBackgroundColor, badgeColor, badgeNumber, className, color, Icon, iconSize, isCompact, onClick, size = Size.NORMAL, type = 'button', withUnpropagatedClick = false, ...nativeProps }) {
53569
+ function IconButton({ accent = Accent.PRIMARY, badgeBackgroundColor, badgeColor, badgeNumber, className, color, Icon, iconSize, isCompact, onClick, size = Size.NORMAL, style, type = 'button', withUnpropagatedClick = false, ...nativeProps }) {
53570
53570
  const handleClick = useCallback((event)=>{
53571
53571
  if (withUnpropagatedClick) {
53572
53572
  stopMouseEventPropagation(event);
@@ -53587,68 +53587,92 @@ function IconButton({ accent = Accent.PRIMARY, badgeBackgroundColor, badgeColor,
53587
53587
  iconSize,
53588
53588
  size
53589
53589
  ]);
53590
- const commonProps = useMemo(()=>({
53590
+ const buttonProps = useMemo(()=>({
53591
53591
  children: commonChildren,
53592
- className: classnames('Element-IconButton', className),
53592
+ className: badgeNumber === undefined ? classnames('Element-IconButton', className) : classnames('Element-IconButton'),
53593
53593
  isCompact,
53594
53594
  onClick: handleClick,
53595
53595
  size,
53596
+ style: badgeNumber === undefined ? style : undefined,
53596
53597
  type,
53597
53598
  ...nativeProps
53598
53599
  }), [
53600
+ badgeNumber,
53599
53601
  className,
53600
53602
  commonChildren,
53601
53603
  handleClick,
53602
53604
  isCompact,
53603
53605
  nativeProps,
53604
53606
  size,
53605
- type
53607
+ type,
53608
+ style
53606
53609
  ]);
53607
53610
  switch(accent){
53608
53611
  case Accent.SECONDARY:
53609
- return /*#__PURE__*/ jsxs(Wrapper$2, {
53610
- children: [
53611
- !!badgeNumber && /*#__PURE__*/ jsx(BadgeNumber, {
53612
- backgroundColor: badgeBackgroundColor,
53613
- color: badgeColor,
53614
- size: size,
53615
- children: badgeNumber
53616
- }),
53617
- /*#__PURE__*/ jsx(SecondaryButton, {
53618
- as: StyledButton,
53619
- ...commonProps
53620
- })
53621
- ]
53612
+ return /*#__PURE__*/ jsx(Fragment, {
53613
+ children: badgeNumber === undefined ? /*#__PURE__*/ jsx(SecondaryButton, {
53614
+ as: StyledButton,
53615
+ ...buttonProps
53616
+ }) : /*#__PURE__*/ jsxs(Wrapper$2, {
53617
+ className: className,
53618
+ style: style,
53619
+ children: [
53620
+ /*#__PURE__*/ jsx(BadgeNumber, {
53621
+ backgroundColor: badgeBackgroundColor,
53622
+ color: badgeColor,
53623
+ size: size,
53624
+ children: badgeNumber
53625
+ }),
53626
+ /*#__PURE__*/ jsx(SecondaryButton, {
53627
+ as: StyledButton,
53628
+ ...buttonProps
53629
+ })
53630
+ ]
53631
+ })
53622
53632
  });
53623
53633
  case Accent.TERTIARY:
53624
- return /*#__PURE__*/ jsxs(Wrapper$2, {
53625
- children: [
53626
- !!badgeNumber && /*#__PURE__*/ jsx(BadgeNumber, {
53627
- backgroundColor: badgeBackgroundColor,
53628
- color: badgeColor,
53629
- size: size,
53630
- children: badgeNumber
53631
- }),
53632
- /*#__PURE__*/ jsx(TertiaryButton, {
53633
- as: StyledButton,
53634
- ...commonProps
53635
- })
53636
- ]
53634
+ return /*#__PURE__*/ jsx(Fragment, {
53635
+ children: badgeNumber === undefined ? /*#__PURE__*/ jsx(TertiaryButton, {
53636
+ as: StyledButton,
53637
+ ...buttonProps
53638
+ }) : /*#__PURE__*/ jsxs(Wrapper$2, {
53639
+ className: className,
53640
+ style: style,
53641
+ children: [
53642
+ /*#__PURE__*/ jsx(BadgeNumber, {
53643
+ backgroundColor: badgeBackgroundColor,
53644
+ color: badgeColor,
53645
+ size: size,
53646
+ children: badgeNumber
53647
+ }),
53648
+ /*#__PURE__*/ jsx(TertiaryButton, {
53649
+ as: StyledButton,
53650
+ ...buttonProps
53651
+ })
53652
+ ]
53653
+ })
53637
53654
  });
53638
53655
  default:
53639
- return /*#__PURE__*/ jsxs(Wrapper$2, {
53640
- children: [
53641
- !!badgeNumber && /*#__PURE__*/ jsx(BadgeNumber, {
53642
- backgroundColor: badgeBackgroundColor,
53643
- color: badgeColor,
53644
- size: size,
53645
- children: badgeNumber
53646
- }),
53647
- /*#__PURE__*/ jsx(PrimaryButton, {
53648
- as: StyledButton,
53649
- ...commonProps
53650
- })
53651
- ]
53656
+ return /*#__PURE__*/ jsx(Fragment, {
53657
+ children: badgeNumber === undefined ? /*#__PURE__*/ jsx(PrimaryButton, {
53658
+ as: StyledButton,
53659
+ ...buttonProps
53660
+ }) : /*#__PURE__*/ jsxs(Wrapper$2, {
53661
+ className: className,
53662
+ style: style,
53663
+ children: [
53664
+ /*#__PURE__*/ jsx(BadgeNumber, {
53665
+ backgroundColor: badgeBackgroundColor,
53666
+ color: badgeColor,
53667
+ size: size,
53668
+ children: badgeNumber
53669
+ }),
53670
+ /*#__PURE__*/ jsx(PrimaryButton, {
53671
+ as: StyledButton,
53672
+ ...buttonProps
53673
+ })
53674
+ ]
53675
+ })
53652
53676
  });
53653
53677
  }
53654
53678
  }
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": "21.0.1",
4
+ "version": "21.1.1",
5
5
  "license": "AGPL-3.0",
6
6
  "type": "module",
7
7
  "engines": {