@groupeactual/ui-kit 0.4.26 → 0.4.28
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/dist/cjs/components/Chip/Chip.d.ts +13 -1
- package/dist/cjs/components/Icon/Icon.d.ts +2 -2
- package/dist/cjs/index.js +130 -38
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/Chip/Chip.d.ts +13 -1
- package/dist/esm/components/Icon/Icon.d.ts +2 -2
- package/dist/esm/index.js +130 -38
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +33 -22
- package/package.json +2 -2
- package/src/components/Chip/Chip.tsx +120 -4
- package/src/components/Form/MultiSelect/MultiSelect.tsx +11 -3
- package/src/components/Icon/Icon.tsx +3 -3
- package/src/components/Tooltip/Tooltip.tsx +10 -1
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ChipProps as ChipPropsMUI } from '@mui/material/Chip';
|
|
3
|
-
|
|
3
|
+
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
4
|
+
interface Props extends Omit<ChipPropsMUI, 'suffix' | 'prefix' | 'onDelete' | 'onDeleteIcon'> {
|
|
5
|
+
label: string;
|
|
6
|
+
size?: 'small';
|
|
7
|
+
prefixIcon?: IconDefinition;
|
|
8
|
+
suffixIcon?: IconDefinition;
|
|
9
|
+
suffixAction?: (e: any) => void;
|
|
10
|
+
suffixTooltip?: string;
|
|
11
|
+
tooltip?: string;
|
|
12
|
+
maxWidth?: number;
|
|
13
|
+
maxLength?: number;
|
|
14
|
+
}
|
|
15
|
+
declare const Chip: ({ label, prefixIcon, suffixIcon, suffixTooltip, suffixAction, tooltip, size, maxWidth, maxLength, ...props }: Props) => JSX.Element;
|
|
4
16
|
export default Chip;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
2
|
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
3
3
|
import { BoxProps } from '@mui/material/Box';
|
|
4
4
|
declare const FontSizes: {
|
|
@@ -16,5 +16,5 @@ interface Props {
|
|
|
16
16
|
color?: string;
|
|
17
17
|
size?: number | keyof typeof FontSizes;
|
|
18
18
|
}
|
|
19
|
-
declare const IconProvider: ({ variant, icon, color, size, ...props }: Props & BoxProps) =>
|
|
19
|
+
declare const IconProvider: ({ variant, icon, color, size, ...props }: Props & BoxProps) => ReactElement;
|
|
20
20
|
export default IconProvider;
|
package/dist/esm/index.js
CHANGED
|
@@ -55673,6 +55673,7 @@ var faCircleXmark = {
|
|
|
55673
55673
|
iconName: 'circle-xmark',
|
|
55674
55674
|
icon: [512, 512, [61532, "times-circle", "xmark-circle"], "f057", "M256 512c141.4 0 256-114.6 256-256S397.4 0 256 0S0 114.6 0 256S114.6 512 256 512zM175 175c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"]
|
|
55675
55675
|
};
|
|
55676
|
+
var faTimesCircle = faCircleXmark;
|
|
55676
55677
|
|
|
55677
55678
|
var FontSizes = {
|
|
55678
55679
|
xs: 8,
|
|
@@ -55700,7 +55701,9 @@ var FontAwesomeSvgIcon = forwardRef(function (_a, ref) {
|
|
|
55700
55701
|
svgPathData.map(function (d, i) { return (React__default.createElement("path", { style: { opacity: i === 0 ? 0.4 : 1 }, d: d, key: i })); }))));
|
|
55701
55702
|
});
|
|
55702
55703
|
var IconProvider = function (_a) {
|
|
55703
|
-
var _b = _a.variant, variant = _b === void 0 ? 'none' : _b, icon = _a.icon, _c = _a.color, color = _c === void 0 ? '#136cac' : _c,
|
|
55704
|
+
var _b = _a.variant, variant = _b === void 0 ? 'none' : _b, icon = _a.icon, _c = _a.color, color = _c === void 0 ? '#136cac' : _c, // blueClickable
|
|
55705
|
+
_d = _a.size, // blueClickable
|
|
55706
|
+
size = _d === void 0 ? 16 : _d, props = __rest(_a, ["variant", "icon", "color", "size"]);
|
|
55704
55707
|
var getStyles = function () {
|
|
55705
55708
|
var theme = useTheme$1();
|
|
55706
55709
|
var usedColor = theme.palette[color]
|
|
@@ -55813,8 +55816,56 @@ var Select = function (_a) {
|
|
|
55813
55816
|
(error || helperText) && (React__default.createElement(FormHelperText$1, { component: "span", className: error ? 'Mui-error' : '' }, error || helperText)))));
|
|
55814
55817
|
};
|
|
55815
55818
|
|
|
55816
|
-
var Chip = function (
|
|
55817
|
-
|
|
55819
|
+
var Chip = function (_a) {
|
|
55820
|
+
var _b, _c;
|
|
55821
|
+
var label = _a.label, prefixIcon = _a.prefixIcon, suffixIcon = _a.suffixIcon, suffixTooltip = _a.suffixTooltip, suffixAction = _a.suffixAction, tooltip = _a.tooltip, _d = _a.size, size = _d === void 0 ? 'small' : _d, _e = _a.maxWidth, maxWidth = _e === void 0 ? 300 : _e, _f = _a.maxLength, maxLength = _f === void 0 ? 17 : _f, props = __rest(_a, ["label", "prefixIcon", "suffixIcon", "suffixTooltip", "suffixAction", "tooltip", "size", "maxWidth", "maxLength"]);
|
|
55822
|
+
var theme = useTheme$1();
|
|
55823
|
+
var _g = useState(label), currentLabel = _g[0], setCurrentLabel = _g[1];
|
|
55824
|
+
var _h = useState(false), isOpen = _h[0], setIsOpen = _h[1];
|
|
55825
|
+
var ref = useRef(null);
|
|
55826
|
+
var backgroundColor = props.color && theme.palette[props.color]
|
|
55827
|
+
? typeof theme.palette[props.color] === 'object'
|
|
55828
|
+
? theme.palette[props.color]['main']
|
|
55829
|
+
: theme.palette[props.color]
|
|
55830
|
+
: (_b = props.color) !== null && _b !== void 0 ? _b : 'white';
|
|
55831
|
+
if (props.variant === 'filled') {
|
|
55832
|
+
// opacity 0.08
|
|
55833
|
+
backgroundColor = "".concat(backgroundColor, "14");
|
|
55834
|
+
}
|
|
55835
|
+
else {
|
|
55836
|
+
backgroundColor = 'white';
|
|
55837
|
+
}
|
|
55838
|
+
var emptyOnDelete = function () {
|
|
55839
|
+
return null;
|
|
55840
|
+
};
|
|
55841
|
+
// use maxwidth props to set the max width of the chip based on the column width
|
|
55842
|
+
// if a chip is in a table, the width should match the width of the column.
|
|
55843
|
+
useEffect(function () {
|
|
55844
|
+
var _a, _b, _c, _d;
|
|
55845
|
+
if (((_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) &&
|
|
55846
|
+
((_b = ref === null || ref === void 0 ? void 0 : ref.current) === null || _b === void 0 ? void 0 : _b.offsetWidth) > maxWidth &&
|
|
55847
|
+
"".concat(label.substring(0, maxLength), "...") !== currentLabel) {
|
|
55848
|
+
setCurrentLabel("".concat(label.substring(0, maxLength), "..."));
|
|
55849
|
+
}
|
|
55850
|
+
else if (((_c = ref === null || ref === void 0 ? void 0 : ref.current) === null || _c === void 0 ? void 0 : _c.offsetWidth) &&
|
|
55851
|
+
((_d = ref === null || ref === void 0 ? void 0 : ref.current) === null || _d === void 0 ? void 0 : _d.offsetWidth) <= maxWidth &&
|
|
55852
|
+
label === "".concat(label.substring(0, maxLength), "...")) {
|
|
55853
|
+
setCurrentLabel(label);
|
|
55854
|
+
}
|
|
55855
|
+
}, [(_c = ref === null || ref === void 0 ? void 0 : ref.current) === null || _c === void 0 ? void 0 : _c.offsetWidth]);
|
|
55856
|
+
return (React__default.createElement(TooltipMui, { title: tooltip, placement: "right-start" },
|
|
55857
|
+
React__default.createElement(TooltipMui, { title: suffixTooltip, open: isOpen, placement: "bottom-end", sx: { cursor: suffixAction ? 'pointer !important' : 'default' } },
|
|
55858
|
+
React__default.createElement(ChipMUI, __assign$1({ label: currentLabel, ref: ref, size: size, sx: {
|
|
55859
|
+
backgroundColor: backgroundColor,
|
|
55860
|
+
'&.MuiChip-colorSecondary:hover': suffixIcon &&
|
|
55861
|
+
suffixAction && {
|
|
55862
|
+
backgroundColor: '#004f88 !important'
|
|
55863
|
+
},
|
|
55864
|
+
'&.MuiChip-deleteIconColorPrimary:hover': suffixIcon &&
|
|
55865
|
+
suffixAction && {
|
|
55866
|
+
backgroundColor: '#004f88 !important'
|
|
55867
|
+
}
|
|
55868
|
+
}, avatar: prefixIcon ? React__default.createElement(IconProvider, { icon: prefixIcon, size: "sm" }) : React__default.createElement(React__default.Fragment, null), deleteIcon: suffixIcon ? (React__default.createElement(IconProvider, { icon: suffixIcon, onMouseEnter: function () { return suffixTooltip && setIsOpen(true); }, onMouseLeave: function () { return suffixTooltip && setIsOpen(false); }, size: "sm" })) : (React__default.createElement(React__default.Fragment, null)), onDelete: suffixAction !== null && suffixAction !== void 0 ? suffixAction : emptyOnDelete }, props)))));
|
|
55818
55869
|
};
|
|
55819
55870
|
|
|
55820
55871
|
var MultiSelect = function (_a) {
|
|
@@ -55862,7 +55913,7 @@ var MultiSelect = function (_a) {
|
|
|
55862
55913
|
: {}
|
|
55863
55914
|
}, multiple: true, label: label, placeholder: label === placeholder ? '' : placeholder, notched:
|
|
55864
55915
|
/* eslint-disable-next-line no-undefined */
|
|
55865
|
-
label === placeholder ? undefined : true, value: values, error: !!error, onChange: handleChange, onBlur: onBlur, renderValue: function (selected) { return (React__default.createElement(Box$1, { sx: { display: 'flex', flexWrap: 'nowrap', gap: 0.5 } }, selected === null || selected === void 0 ? void 0 : selected.map(function (selectedOption, i) { return (React__default.createElement(Chip, { key: i, label: getOptionLabel(selectedOption),
|
|
55916
|
+
label === placeholder ? undefined : true, value: values, error: !!error, onChange: handleChange, onBlur: onBlur, renderValue: function (selected) { return (React__default.createElement(Box$1, { sx: { display: 'flex', flexWrap: 'nowrap', gap: 0.5 } }, selected === null || selected === void 0 ? void 0 : selected.map(function (selectedOption, i) { return (React__default.createElement(Chip, { key: i, disabled: props.disabled, variant: "filled", color: "default", label: getOptionLabel(selectedOption), suffixIcon: faTimesCircle, suffixAction: function () {
|
|
55866
55917
|
return !props.disabled && handleDeleteChip(selectedOption);
|
|
55867
55918
|
}, onMouseDown: function (event) {
|
|
55868
55919
|
event.stopPropagation();
|
|
@@ -56016,7 +56067,7 @@ var EmbeddedNotification = function (_a) {
|
|
|
56016
56067
|
|
|
56017
56068
|
var Tooltip = function (_a) {
|
|
56018
56069
|
var title = _a.title, children = _a.children, props = __rest(_a, ["title", "children"]);
|
|
56019
|
-
return (React__default.createElement(TooltipMui, __assign$1({ title: title }, props, { className: "DsTooltip-root" }),
|
|
56070
|
+
return (React__default.createElement(TooltipMui, __assign$1({ title: React__default.createElement(Text, { variant: "body2Regular", color: "white" }, title) }, props, { className: "DsTooltip-root" }),
|
|
56020
56071
|
React__default.createElement(IconButton$1, { sx: {
|
|
56021
56072
|
padding: 0,
|
|
56022
56073
|
'& .MuiBox-root': {
|
|
@@ -56652,18 +56703,6 @@ var SelectCss = function (muiTokens) {
|
|
|
56652
56703
|
MuiFormControl: {
|
|
56653
56704
|
styleOverrides: {
|
|
56654
56705
|
root: {
|
|
56655
|
-
'&.Mui-disabled': {
|
|
56656
|
-
'.MuiChip-deleteIcon': {
|
|
56657
|
-
color: muiTokens.palette.greyMediumInactive
|
|
56658
|
-
},
|
|
56659
|
-
'.MuiChip-root': {
|
|
56660
|
-
border: '1px solid',
|
|
56661
|
-
borderColor: muiTokens.palette.greyLightDefaultBorder
|
|
56662
|
-
},
|
|
56663
|
-
'.MuiSvgIcon-root': {
|
|
56664
|
-
color: muiTokens.palette.greyDark + ' !important'
|
|
56665
|
-
}
|
|
56666
|
-
},
|
|
56667
56706
|
'&.DsSelect': {
|
|
56668
56707
|
'& .MuiSelect-select .notranslate::after': {
|
|
56669
56708
|
fontWeight: 400,
|
|
@@ -56797,9 +56836,28 @@ var ChipCss = function (muiTokens) {
|
|
|
56797
56836
|
return {
|
|
56798
56837
|
MuiChip: {
|
|
56799
56838
|
styleOverrides: {
|
|
56839
|
+
avatar: {
|
|
56840
|
+
marginLeft: '-1px',
|
|
56841
|
+
marginRight: '5px',
|
|
56842
|
+
color: 'initial'
|
|
56843
|
+
},
|
|
56800
56844
|
root: {
|
|
56801
56845
|
'& .MuiChip-deleteIcon': {
|
|
56802
|
-
color: muiTokens.palette.blueClickable
|
|
56846
|
+
color: muiTokens.palette.blueClickable,
|
|
56847
|
+
cursor: 'default',
|
|
56848
|
+
width: 'auto',
|
|
56849
|
+
height: 'auto'
|
|
56850
|
+
},
|
|
56851
|
+
'&.Mui-disabled': {
|
|
56852
|
+
color: muiTokens.palette.greyDark + ' !important',
|
|
56853
|
+
backgroundColor: muiTokens.palette.greyXLight + ' !important',
|
|
56854
|
+
border: '1px solid',
|
|
56855
|
+
fontWeight: muiTokens.palette.fontWeightRegular,
|
|
56856
|
+
borderColor: muiTokens.palette.greyLightDefaultBorder,
|
|
56857
|
+
opacity: 1,
|
|
56858
|
+
'.MuiChip-deleteIcon': {
|
|
56859
|
+
color: muiTokens.palette.greyMediumInactive + ' !important'
|
|
56860
|
+
}
|
|
56803
56861
|
},
|
|
56804
56862
|
color: muiTokens.palette.greyXDark,
|
|
56805
56863
|
backgroundColor: 'transparent',
|
|
@@ -56809,10 +56867,18 @@ var ChipCss = function (muiTokens) {
|
|
|
56809
56867
|
paddingLeft: '8px',
|
|
56810
56868
|
paddingRight: '8px'
|
|
56811
56869
|
},
|
|
56812
|
-
filled: {
|
|
56870
|
+
filled: {
|
|
56871
|
+
border: 'none',
|
|
56872
|
+
fontWeight: 400 + ' !important',
|
|
56873
|
+
color: muiTokens.palette.greyXDark
|
|
56874
|
+
},
|
|
56875
|
+
outlined: {
|
|
56876
|
+
border: '1px solid'
|
|
56877
|
+
},
|
|
56813
56878
|
label: {
|
|
56814
56879
|
padding: 0,
|
|
56815
|
-
lineHeight: '18px'
|
|
56880
|
+
lineHeight: '18px',
|
|
56881
|
+
paddingTop: '1px'
|
|
56816
56882
|
},
|
|
56817
56883
|
sizeSmall: {
|
|
56818
56884
|
height: '24px',
|
|
@@ -56826,49 +56892,75 @@ var ChipCss = function (muiTokens) {
|
|
|
56826
56892
|
width: '12px',
|
|
56827
56893
|
height: '12px',
|
|
56828
56894
|
margin: 0,
|
|
56829
|
-
marginLeft: '8px'
|
|
56895
|
+
marginLeft: '8px',
|
|
56896
|
+
marginRight: '2px'
|
|
56830
56897
|
},
|
|
56831
56898
|
colorDefault: {
|
|
56832
|
-
backgroundColor: muiTokens.palette.greyXLight
|
|
56899
|
+
backgroundColor: muiTokens.palette.greyXLight,
|
|
56900
|
+
border: 'none',
|
|
56901
|
+
color: muiTokens.palette.greyXDark
|
|
56833
56902
|
},
|
|
56834
56903
|
colorPrimary: {
|
|
56835
|
-
|
|
56836
|
-
|
|
56904
|
+
borderColor: muiTokens.palette.greyLightDefaultBorder + ' !important',
|
|
56905
|
+
backgroundColor: muiTokens.palette.white,
|
|
56906
|
+
'&:hover': {
|
|
56907
|
+
color: muiTokens.palette.blueClickableHover
|
|
56908
|
+
}
|
|
56837
56909
|
},
|
|
56838
56910
|
colorSecondary: {
|
|
56839
|
-
border: 'none',
|
|
56840
56911
|
backgroundColor: muiTokens.palette.blueClickable + ' !important',
|
|
56841
|
-
color: muiTokens.palette.white,
|
|
56912
|
+
color: muiTokens.palette.white + ' !important',
|
|
56842
56913
|
'& .MuiChip-deleteIcon': {
|
|
56843
|
-
color: muiTokens.palette.greyXLight + ' !important'
|
|
56844
|
-
'&:hover': {
|
|
56845
|
-
color: muiTokens.palette.blueClickableHover
|
|
56846
|
-
}
|
|
56914
|
+
color: muiTokens.palette.greyXLight + ' !important'
|
|
56847
56915
|
}
|
|
56848
56916
|
},
|
|
56849
56917
|
colorSuccess: {
|
|
56850
56918
|
border: '1px solid',
|
|
56851
56919
|
borderColor: muiTokens.palette.greenSuccess + ' !important',
|
|
56852
|
-
color: muiTokens.palette.greenSuccess
|
|
56853
|
-
fontWeight: muiTokens.typography.fontWeightBold
|
|
56920
|
+
color: muiTokens.palette.greenSuccess,
|
|
56921
|
+
fontWeight: muiTokens.typography.fontWeightBold,
|
|
56922
|
+
'& .MuiChip-avatar': {
|
|
56923
|
+
color: muiTokens.palette.greenSuccess + ' !important'
|
|
56924
|
+
},
|
|
56925
|
+
'& .MuiChip-deleteIcon': {
|
|
56926
|
+
color: muiTokens.palette.blueInfo + ' !important'
|
|
56927
|
+
}
|
|
56854
56928
|
},
|
|
56855
56929
|
colorWarning: {
|
|
56856
56930
|
border: '1px solid',
|
|
56857
56931
|
borderColor: muiTokens.palette.orangeWarning + ' !important',
|
|
56858
|
-
color: muiTokens.palette.orangeWarning
|
|
56859
|
-
fontWeight: muiTokens.typography.fontWeightBold
|
|
56932
|
+
color: muiTokens.palette.orangeWarning,
|
|
56933
|
+
fontWeight: muiTokens.typography.fontWeightBold,
|
|
56934
|
+
'& .MuiChip-avatar': {
|
|
56935
|
+
color: muiTokens.palette.orangeWarning + ' !important'
|
|
56936
|
+
},
|
|
56937
|
+
'& .MuiChip-deleteIcon': {
|
|
56938
|
+
color: muiTokens.palette.blueInfo + ' !important'
|
|
56939
|
+
}
|
|
56860
56940
|
},
|
|
56861
56941
|
colorInfo: {
|
|
56862
56942
|
border: '1px solid',
|
|
56863
56943
|
borderColor: muiTokens.palette.blueInfo + ' !important',
|
|
56864
|
-
color: muiTokens.palette.blueInfo
|
|
56865
|
-
fontWeight: muiTokens.typography.fontWeightBold
|
|
56944
|
+
color: muiTokens.palette.blueInfo,
|
|
56945
|
+
fontWeight: muiTokens.typography.fontWeightBold,
|
|
56946
|
+
'& .MuiChip-avatar': {
|
|
56947
|
+
color: muiTokens.palette.blueInfo + ' !important'
|
|
56948
|
+
},
|
|
56949
|
+
'& .MuiChip-deleteIcon': {
|
|
56950
|
+
color: muiTokens.palette.blueInfo + ' !important'
|
|
56951
|
+
}
|
|
56866
56952
|
},
|
|
56867
56953
|
colorError: {
|
|
56868
56954
|
border: '1px solid',
|
|
56869
56955
|
borderColor: muiTokens.palette.redError + ' !important',
|
|
56870
|
-
color: muiTokens.palette.redError
|
|
56871
|
-
fontWeight: muiTokens.typography.fontWeightBold
|
|
56956
|
+
color: muiTokens.palette.redError,
|
|
56957
|
+
fontWeight: muiTokens.typography.fontWeightBold,
|
|
56958
|
+
'& .MuiChip-avatar': {
|
|
56959
|
+
color: muiTokens.palette.redError + ' !important'
|
|
56960
|
+
},
|
|
56961
|
+
'& .MuiChip-deleteIcon': {
|
|
56962
|
+
color: muiTokens.palette.blueInfo + ' !important'
|
|
56963
|
+
}
|
|
56872
56964
|
}
|
|
56873
56965
|
}
|
|
56874
56966
|
}
|