@groupeactual/ui-kit 1.8.3 → 1.8.5
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { MouseEvent } from 'react';
|
|
2
2
|
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
3
3
|
import { ChipProps as ChipPropsMUI } from '@mui/material';
|
|
4
|
+
import { Placement } from '@/components/Tooltip/tooltip.interface';
|
|
4
5
|
interface Props extends Omit<ChipPropsMUI, 'suffix' | 'prefix' | 'onDelete' | 'onDeleteIcon' | 'variant'> {
|
|
5
6
|
variant: 'filled' | 'outlined' | 'status' | 'statusFilled';
|
|
6
7
|
label: string;
|
|
@@ -8,9 +9,11 @@ interface Props extends Omit<ChipPropsMUI, 'suffix' | 'prefix' | 'onDelete' | 'o
|
|
|
8
9
|
suffixIcon?: IconDefinition;
|
|
9
10
|
suffixAction?: (_e: MouseEvent) => void;
|
|
10
11
|
suffixTooltip?: string;
|
|
12
|
+
suffixTooltipPlacement?: Placement;
|
|
11
13
|
tooltip?: string;
|
|
14
|
+
tooltipPlacement?: Placement;
|
|
12
15
|
maxWidth?: string | number;
|
|
13
16
|
maxLength?: number;
|
|
14
17
|
}
|
|
15
|
-
declare const Chip: ({ variant, label, prefixIcon, suffixIcon, suffixTooltip, suffixAction, tooltip, maxWidth, ...props }: Props) => React.JSX.Element;
|
|
18
|
+
declare const Chip: ({ variant, label, prefixIcon, suffixIcon, suffixTooltip, suffixTooltipPlacement, suffixAction, tooltip, tooltipPlacement, maxWidth, ...props }: Props) => React.JSX.Element;
|
|
16
19
|
export default Chip;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@groupeactual/ui-kit",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A simple template for a custom React component library",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@mui/x-date-pickers": "7.15.0",
|
|
34
34
|
"@mui/x-date-pickers-pro": "7.15.0",
|
|
35
35
|
"styled-components": "^6.1.13",
|
|
36
|
-
"@groupeactual/design-tokens": "1.8.
|
|
36
|
+
"@groupeactual/design-tokens": "1.8.5"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "rollup -c",
|
|
@@ -6,12 +6,13 @@ import {
|
|
|
6
6
|
Box,
|
|
7
7
|
Chip as ChipMUI,
|
|
8
8
|
ChipProps as ChipPropsMUI,
|
|
9
|
-
Tooltip,
|
|
10
9
|
styled,
|
|
11
10
|
useTheme,
|
|
12
11
|
} from '@mui/material';
|
|
13
12
|
|
|
14
13
|
import IconProvider from '@/components/IconProvider';
|
|
14
|
+
import Tooltip from '@/components/Tooltip';
|
|
15
|
+
import { Placement } from '@/components/Tooltip/tooltip.interface';
|
|
15
16
|
|
|
16
17
|
interface Props
|
|
17
18
|
extends Omit<
|
|
@@ -24,7 +25,9 @@ interface Props
|
|
|
24
25
|
suffixIcon?: IconDefinition;
|
|
25
26
|
suffixAction?: (_e: MouseEvent) => void;
|
|
26
27
|
suffixTooltip?: string;
|
|
28
|
+
suffixTooltipPlacement?: Placement;
|
|
27
29
|
tooltip?: string;
|
|
30
|
+
tooltipPlacement?: Placement;
|
|
28
31
|
maxWidth?: string | number;
|
|
29
32
|
maxLength?: number;
|
|
30
33
|
}
|
|
@@ -35,8 +38,10 @@ const Chip = ({
|
|
|
35
38
|
prefixIcon,
|
|
36
39
|
suffixIcon,
|
|
37
40
|
suffixTooltip,
|
|
41
|
+
suffixTooltipPlacement = 'bottom-end',
|
|
38
42
|
suffixAction,
|
|
39
43
|
tooltip,
|
|
44
|
+
tooltipPlacement = 'right-start',
|
|
40
45
|
maxWidth = '100%',
|
|
41
46
|
...props
|
|
42
47
|
}: Props) => {
|
|
@@ -64,7 +69,7 @@ const Chip = ({
|
|
|
64
69
|
}
|
|
65
70
|
|
|
66
71
|
return (
|
|
67
|
-
<Tooltip title={tooltip} placement=
|
|
72
|
+
<Tooltip title={tooltip} placement={tooltipPlacement} open={isTooltipOpen}>
|
|
68
73
|
<Box
|
|
69
74
|
maxWidth="fit-content"
|
|
70
75
|
onMouseEnter={() => setIsTooltipOpen(true)}
|
|
@@ -73,7 +78,7 @@ const Chip = ({
|
|
|
73
78
|
<Tooltip
|
|
74
79
|
title={suffixTooltip}
|
|
75
80
|
open={isSuffixTooltipOpen}
|
|
76
|
-
placement=
|
|
81
|
+
placement={suffixTooltipPlacement}
|
|
77
82
|
sx={{ cursor: suffixAction ? 'pointer !important' : 'default' }}
|
|
78
83
|
>
|
|
79
84
|
<StyledChip
|