@mtes-mct/monitor-ui 5.9.1 → 5.9.2
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 +7 -0
- package/elements/Button.d.ts +1 -1
- package/elements/IconButton.d.ts +1 -1
- package/index.js +6 -19
- package/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [5.9.1](https://github.com/MTES-MCT/monitor-ui/compare/v5.9.0...v5.9.1) (2023-05-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **components:** add default class name to Dialog ([b74ea15](https://github.com/MTES-MCT/monitor-ui/commit/b74ea15a9ae9d629e99eb2917a2acc3b88936736))
|
|
7
|
+
|
|
1
8
|
# [5.9.0](https://github.com/MTES-MCT/monitor-ui/compare/v5.8.1...v5.9.0) (2023-05-05)
|
|
2
9
|
|
|
3
10
|
|
package/elements/Button.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type ButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'childre
|
|
|
8
8
|
isFullWidth?: boolean | undefined;
|
|
9
9
|
size?: Size | undefined;
|
|
10
10
|
};
|
|
11
|
-
export declare function Button({ accent, children, Icon, isFullWidth,
|
|
11
|
+
export declare function Button({ accent, children, Icon, isFullWidth, size, type, ...nativeProps }: ButtonProps): JSX.Element;
|
|
12
12
|
export declare const PrimaryButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
|
|
13
13
|
export declare const SecondaryButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
|
|
14
14
|
export declare const TertiaryButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
|
package/elements/IconButton.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ export type IconButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'chi
|
|
|
9
9
|
iconSize?: number | undefined;
|
|
10
10
|
size?: Size | undefined;
|
|
11
11
|
};
|
|
12
|
-
export declare function IconButton({ accent, color, Icon, iconSize,
|
|
12
|
+
export declare function IconButton({ accent, color, Icon, iconSize, size, type, ...nativeProps }: IconButtonProps): JSX.Element;
|
package/index.js
CHANGED
|
@@ -2709,23 +2709,16 @@ const ICON_SIZE = {
|
|
|
2709
2709
|
[Size.NORMAL]: 20,
|
|
2710
2710
|
[Size.SMALL]: 12
|
|
2711
2711
|
};
|
|
2712
|
-
function Button({ accent = Accent.PRIMARY, children, Icon, isFullWidth = false,
|
|
2712
|
+
function Button({ accent = Accent.PRIMARY, children, Icon, isFullWidth = false, size = Size.NORMAL, type = 'button', ...nativeProps }) {
|
|
2713
2713
|
const commonChildren = useMemo(() => (jsxs(Fragment, { children: [Icon && jsx(Icon, { size: ICON_SIZE[size] }), children && jsx(ButtonLabel, { children: children })] })), [children, Icon, size]);
|
|
2714
|
-
const handleClick = useCallback((event) => {
|
|
2715
|
-
stopMouseEventPropagation(event);
|
|
2716
|
-
if (onClick) {
|
|
2717
|
-
onClick(event);
|
|
2718
|
-
}
|
|
2719
|
-
}, [onClick]);
|
|
2720
2714
|
const commonProps = useMemo(() => ({
|
|
2721
2715
|
as: StyledButton$1,
|
|
2722
2716
|
children: commonChildren,
|
|
2723
2717
|
isFullWidth,
|
|
2724
|
-
onClick: handleClick,
|
|
2725
2718
|
size,
|
|
2726
2719
|
type,
|
|
2727
2720
|
...nativeProps
|
|
2728
|
-
}), [commonChildren, isFullWidth,
|
|
2721
|
+
}), [commonChildren, isFullWidth, nativeProps, size, type]);
|
|
2729
2722
|
switch (accent) {
|
|
2730
2723
|
case Accent.SECONDARY:
|
|
2731
2724
|
return jsx(SecondaryButton, { ...commonProps });
|
|
@@ -2851,7 +2844,7 @@ const ICON_SIZE_IN_PX = {
|
|
|
2851
2844
|
[Size.NORMAL]: 20,
|
|
2852
2845
|
[Size.SMALL]: 14
|
|
2853
2846
|
};
|
|
2854
|
-
function IconButton({ accent = Accent.PRIMARY, color, Icon, iconSize,
|
|
2847
|
+
function IconButton({ accent = Accent.PRIMARY, color, Icon, iconSize, size = Size.NORMAL, type = 'button', ...nativeProps }) {
|
|
2855
2848
|
const children = useMemo(() => jsx(Icon, { color: color, size: iconSize || ICON_SIZE_IN_PX[size] }), [color, Icon, iconSize, size]);
|
|
2856
2849
|
const commonProps = useMemo(() => ({
|
|
2857
2850
|
children,
|
|
@@ -2859,19 +2852,13 @@ function IconButton({ accent = Accent.PRIMARY, color, Icon, iconSize, onClick, s
|
|
|
2859
2852
|
type,
|
|
2860
2853
|
...nativeProps
|
|
2861
2854
|
}), [children, nativeProps, size, type]);
|
|
2862
|
-
const handleClick = useCallback((event) => {
|
|
2863
|
-
stopMouseEventPropagation(event);
|
|
2864
|
-
if (onClick) {
|
|
2865
|
-
onClick(event);
|
|
2866
|
-
}
|
|
2867
|
-
}, [onClick]);
|
|
2868
2855
|
switch (accent) {
|
|
2869
2856
|
case Accent.SECONDARY:
|
|
2870
|
-
return jsx(SecondaryButton, { as: StyledButton,
|
|
2857
|
+
return jsx(SecondaryButton, { as: StyledButton, ...commonProps });
|
|
2871
2858
|
case Accent.TERTIARY:
|
|
2872
|
-
return jsx(TertiaryButton, { as: StyledButton,
|
|
2859
|
+
return jsx(TertiaryButton, { as: StyledButton, ...commonProps });
|
|
2873
2860
|
default:
|
|
2874
|
-
return jsx(PrimaryButton, { as: StyledButton,
|
|
2861
|
+
return jsx(PrimaryButton, { as: StyledButton, ...commonProps });
|
|
2875
2862
|
}
|
|
2876
2863
|
}
|
|
2877
2864
|
const PADDING = {
|