@groupeactual/ui-kit 0.4.26 → 0.4.27
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 +1 -1
- 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/cjs/index.js
CHANGED
|
@@ -55699,6 +55699,7 @@ var faCircleXmark = {
|
|
|
55699
55699
|
iconName: 'circle-xmark',
|
|
55700
55700
|
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"]
|
|
55701
55701
|
};
|
|
55702
|
+
var faTimesCircle = faCircleXmark;
|
|
55702
55703
|
|
|
55703
55704
|
var FontSizes = {
|
|
55704
55705
|
xs: 8,
|
|
@@ -55726,7 +55727,9 @@ var FontAwesomeSvgIcon = React.forwardRef(function (_a, ref) {
|
|
|
55726
55727
|
svgPathData.map(function (d, i) { return (React__default["default"].createElement("path", { style: { opacity: i === 0 ? 0.4 : 1 }, d: d, key: i })); }))));
|
|
55727
55728
|
});
|
|
55728
55729
|
var IconProvider = function (_a) {
|
|
55729
|
-
var _b = _a.variant, variant = _b === void 0 ? 'none' : _b, icon = _a.icon, _c = _a.color, color = _c === void 0 ? '#136cac' : _c,
|
|
55730
|
+
var _b = _a.variant, variant = _b === void 0 ? 'none' : _b, icon = _a.icon, _c = _a.color, color = _c === void 0 ? '#136cac' : _c, // blueClickable
|
|
55731
|
+
_d = _a.size, // blueClickable
|
|
55732
|
+
size = _d === void 0 ? 16 : _d, props = __rest(_a, ["variant", "icon", "color", "size"]);
|
|
55730
55733
|
var getStyles = function () {
|
|
55731
55734
|
var theme = useTheme$1();
|
|
55732
55735
|
var usedColor = theme.palette[color]
|
|
@@ -55839,8 +55842,56 @@ var Select = function (_a) {
|
|
|
55839
55842
|
(error || helperText) && (React__default["default"].createElement(FormHelperText$1, { component: "span", className: error ? 'Mui-error' : '' }, error || helperText)))));
|
|
55840
55843
|
};
|
|
55841
55844
|
|
|
55842
|
-
var Chip = function (
|
|
55843
|
-
|
|
55845
|
+
var Chip = function (_a) {
|
|
55846
|
+
var _b, _c;
|
|
55847
|
+
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"]);
|
|
55848
|
+
var theme = useTheme$1();
|
|
55849
|
+
var _g = React.useState(label), currentLabel = _g[0], setCurrentLabel = _g[1];
|
|
55850
|
+
var _h = React.useState(false), isOpen = _h[0], setIsOpen = _h[1];
|
|
55851
|
+
var ref = React.useRef(null);
|
|
55852
|
+
var backgroundColor = props.color && theme.palette[props.color]
|
|
55853
|
+
? typeof theme.palette[props.color] === 'object'
|
|
55854
|
+
? theme.palette[props.color]['main']
|
|
55855
|
+
: theme.palette[props.color]
|
|
55856
|
+
: (_b = props.color) !== null && _b !== void 0 ? _b : 'white';
|
|
55857
|
+
if (props.variant === 'filled') {
|
|
55858
|
+
// opacity 0.08
|
|
55859
|
+
backgroundColor = "".concat(backgroundColor, "14");
|
|
55860
|
+
}
|
|
55861
|
+
else {
|
|
55862
|
+
backgroundColor = 'white';
|
|
55863
|
+
}
|
|
55864
|
+
var emptyOnDelete = function () {
|
|
55865
|
+
return null;
|
|
55866
|
+
};
|
|
55867
|
+
// use maxwidth props to set the max width of the chip based on the column width
|
|
55868
|
+
// if a chip is in a table, the width should match the width of the column.
|
|
55869
|
+
React.useEffect(function () {
|
|
55870
|
+
var _a, _b, _c, _d;
|
|
55871
|
+
if (((_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) &&
|
|
55872
|
+
((_b = ref === null || ref === void 0 ? void 0 : ref.current) === null || _b === void 0 ? void 0 : _b.offsetWidth) > maxWidth &&
|
|
55873
|
+
"".concat(label.substring(0, maxLength), "...") !== currentLabel) {
|
|
55874
|
+
setCurrentLabel("".concat(label.substring(0, maxLength), "..."));
|
|
55875
|
+
}
|
|
55876
|
+
else if (((_c = ref === null || ref === void 0 ? void 0 : ref.current) === null || _c === void 0 ? void 0 : _c.offsetWidth) &&
|
|
55877
|
+
((_d = ref === null || ref === void 0 ? void 0 : ref.current) === null || _d === void 0 ? void 0 : _d.offsetWidth) <= maxWidth &&
|
|
55878
|
+
label === "".concat(label.substring(0, maxLength), "...")) {
|
|
55879
|
+
setCurrentLabel(label);
|
|
55880
|
+
}
|
|
55881
|
+
}, [(_c = ref === null || ref === void 0 ? void 0 : ref.current) === null || _c === void 0 ? void 0 : _c.offsetWidth]);
|
|
55882
|
+
return (React__default["default"].createElement(TooltipMui, { title: tooltip, placement: "right-start" },
|
|
55883
|
+
React__default["default"].createElement(TooltipMui, { title: suffixTooltip, open: isOpen, placement: "bottom-end", sx: { cursor: suffixAction ? 'pointer !important' : 'default' } },
|
|
55884
|
+
React__default["default"].createElement(ChipMUI, __assign$1({ label: currentLabel, ref: ref, size: size, sx: {
|
|
55885
|
+
backgroundColor: backgroundColor,
|
|
55886
|
+
'&.MuiChip-colorSecondary:hover': suffixIcon &&
|
|
55887
|
+
suffixAction && {
|
|
55888
|
+
backgroundColor: '#004f88 !important'
|
|
55889
|
+
},
|
|
55890
|
+
'&.MuiChip-deleteIconColorPrimary:hover': suffixIcon &&
|
|
55891
|
+
suffixAction && {
|
|
55892
|
+
backgroundColor: '#004f88 !important'
|
|
55893
|
+
}
|
|
55894
|
+
}, avatar: prefixIcon ? React__default["default"].createElement(IconProvider, { icon: prefixIcon, size: "sm" }) : React__default["default"].createElement(React__default["default"].Fragment, null), deleteIcon: suffixIcon ? (React__default["default"].createElement(IconProvider, { icon: suffixIcon, onMouseEnter: function () { return suffixTooltip && setIsOpen(true); }, onMouseLeave: function () { return suffixTooltip && setIsOpen(false); }, size: "sm" })) : (React__default["default"].createElement(React__default["default"].Fragment, null)), onDelete: suffixAction !== null && suffixAction !== void 0 ? suffixAction : emptyOnDelete }, props)))));
|
|
55844
55895
|
};
|
|
55845
55896
|
|
|
55846
55897
|
var MultiSelect = function (_a) {
|
|
@@ -55888,7 +55939,7 @@ var MultiSelect = function (_a) {
|
|
|
55888
55939
|
: {}
|
|
55889
55940
|
}, multiple: true, label: label, placeholder: label === placeholder ? '' : placeholder, notched:
|
|
55890
55941
|
/* eslint-disable-next-line no-undefined */
|
|
55891
|
-
label === placeholder ? undefined : true, value: values, error: !!error, onChange: handleChange, onBlur: onBlur, renderValue: function (selected) { return (React__default["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["default"].createElement(Chip, { key: i, label: getOptionLabel(selectedOption),
|
|
55942
|
+
label === placeholder ? undefined : true, value: values, error: !!error, onChange: handleChange, onBlur: onBlur, renderValue: function (selected) { return (React__default["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["default"].createElement(Chip, { key: i, disabled: props.disabled, variant: "filled", color: "default", label: getOptionLabel(selectedOption), suffixIcon: faTimesCircle, suffixAction: function () {
|
|
55892
55943
|
return !props.disabled && handleDeleteChip(selectedOption);
|
|
55893
55944
|
}, onMouseDown: function (event) {
|
|
55894
55945
|
event.stopPropagation();
|
|
@@ -56042,7 +56093,7 @@ var EmbeddedNotification = function (_a) {
|
|
|
56042
56093
|
|
|
56043
56094
|
var Tooltip = function (_a) {
|
|
56044
56095
|
var title = _a.title, children = _a.children, props = __rest(_a, ["title", "children"]);
|
|
56045
|
-
return (React__default["default"].createElement(TooltipMui, __assign$1({ title: title }, props, { className: "DsTooltip-root" }),
|
|
56096
|
+
return (React__default["default"].createElement(TooltipMui, __assign$1({ title: React__default["default"].createElement(Text, { variant: "body2Regular", color: "white" }, title) }, props, { className: "DsTooltip-root" }),
|
|
56046
56097
|
React__default["default"].createElement(IconButton$1, { sx: {
|
|
56047
56098
|
padding: 0,
|
|
56048
56099
|
'& .MuiBox-root': {
|
|
@@ -56678,18 +56729,6 @@ var SelectCss = function (muiTokens) {
|
|
|
56678
56729
|
MuiFormControl: {
|
|
56679
56730
|
styleOverrides: {
|
|
56680
56731
|
root: {
|
|
56681
|
-
'&.Mui-disabled': {
|
|
56682
|
-
'.MuiChip-deleteIcon': {
|
|
56683
|
-
color: muiTokens.palette.greyMediumInactive
|
|
56684
|
-
},
|
|
56685
|
-
'.MuiChip-root': {
|
|
56686
|
-
border: '1px solid',
|
|
56687
|
-
borderColor: muiTokens.palette.greyLightDefaultBorder
|
|
56688
|
-
},
|
|
56689
|
-
'.MuiSvgIcon-root': {
|
|
56690
|
-
color: muiTokens.palette.greyDark + ' !important'
|
|
56691
|
-
}
|
|
56692
|
-
},
|
|
56693
56732
|
'&.DsSelect': {
|
|
56694
56733
|
'& .MuiSelect-select .notranslate::after': {
|
|
56695
56734
|
fontWeight: 400,
|
|
@@ -56823,9 +56862,28 @@ var ChipCss = function (muiTokens) {
|
|
|
56823
56862
|
return {
|
|
56824
56863
|
MuiChip: {
|
|
56825
56864
|
styleOverrides: {
|
|
56865
|
+
avatar: {
|
|
56866
|
+
marginLeft: '-1px',
|
|
56867
|
+
marginRight: '5px',
|
|
56868
|
+
color: 'initial'
|
|
56869
|
+
},
|
|
56826
56870
|
root: {
|
|
56827
56871
|
'& .MuiChip-deleteIcon': {
|
|
56828
|
-
color: muiTokens.palette.blueClickable
|
|
56872
|
+
color: muiTokens.palette.blueClickable,
|
|
56873
|
+
cursor: 'default',
|
|
56874
|
+
width: 'auto',
|
|
56875
|
+
height: 'auto'
|
|
56876
|
+
},
|
|
56877
|
+
'&.Mui-disabled': {
|
|
56878
|
+
color: muiTokens.palette.greyDark + ' !important',
|
|
56879
|
+
backgroundColor: muiTokens.palette.greyXLight + ' !important',
|
|
56880
|
+
border: '1px solid',
|
|
56881
|
+
fontWeight: muiTokens.palette.fontWeightRegular,
|
|
56882
|
+
borderColor: muiTokens.palette.greyLightDefaultBorder,
|
|
56883
|
+
opacity: 1,
|
|
56884
|
+
'.MuiChip-deleteIcon': {
|
|
56885
|
+
color: muiTokens.palette.greyMediumInactive + ' !important'
|
|
56886
|
+
}
|
|
56829
56887
|
},
|
|
56830
56888
|
color: muiTokens.palette.greyXDark,
|
|
56831
56889
|
backgroundColor: 'transparent',
|
|
@@ -56835,10 +56893,18 @@ var ChipCss = function (muiTokens) {
|
|
|
56835
56893
|
paddingLeft: '8px',
|
|
56836
56894
|
paddingRight: '8px'
|
|
56837
56895
|
},
|
|
56838
|
-
filled: {
|
|
56896
|
+
filled: {
|
|
56897
|
+
border: 'none',
|
|
56898
|
+
fontWeight: 400 + ' !important',
|
|
56899
|
+
color: muiTokens.palette.greyXDark
|
|
56900
|
+
},
|
|
56901
|
+
outlined: {
|
|
56902
|
+
border: '1px solid'
|
|
56903
|
+
},
|
|
56839
56904
|
label: {
|
|
56840
56905
|
padding: 0,
|
|
56841
|
-
lineHeight: '18px'
|
|
56906
|
+
lineHeight: '18px',
|
|
56907
|
+
paddingTop: '1px'
|
|
56842
56908
|
},
|
|
56843
56909
|
sizeSmall: {
|
|
56844
56910
|
height: '24px',
|
|
@@ -56852,49 +56918,75 @@ var ChipCss = function (muiTokens) {
|
|
|
56852
56918
|
width: '12px',
|
|
56853
56919
|
height: '12px',
|
|
56854
56920
|
margin: 0,
|
|
56855
|
-
marginLeft: '8px'
|
|
56921
|
+
marginLeft: '8px',
|
|
56922
|
+
marginRight: '2px'
|
|
56856
56923
|
},
|
|
56857
56924
|
colorDefault: {
|
|
56858
|
-
backgroundColor: muiTokens.palette.greyXLight
|
|
56925
|
+
backgroundColor: muiTokens.palette.greyXLight,
|
|
56926
|
+
border: 'none',
|
|
56927
|
+
color: muiTokens.palette.greyXDark
|
|
56859
56928
|
},
|
|
56860
56929
|
colorPrimary: {
|
|
56861
|
-
|
|
56862
|
-
|
|
56930
|
+
borderColor: muiTokens.palette.greyLightDefaultBorder + ' !important',
|
|
56931
|
+
backgroundColor: muiTokens.palette.white,
|
|
56932
|
+
'&:hover': {
|
|
56933
|
+
color: muiTokens.palette.blueClickableHover
|
|
56934
|
+
}
|
|
56863
56935
|
},
|
|
56864
56936
|
colorSecondary: {
|
|
56865
|
-
border: 'none',
|
|
56866
56937
|
backgroundColor: muiTokens.palette.blueClickable + ' !important',
|
|
56867
|
-
color: muiTokens.palette.white,
|
|
56938
|
+
color: muiTokens.palette.white + ' !important',
|
|
56868
56939
|
'& .MuiChip-deleteIcon': {
|
|
56869
|
-
color: muiTokens.palette.greyXLight + ' !important'
|
|
56870
|
-
'&:hover': {
|
|
56871
|
-
color: muiTokens.palette.blueClickableHover
|
|
56872
|
-
}
|
|
56940
|
+
color: muiTokens.palette.greyXLight + ' !important'
|
|
56873
56941
|
}
|
|
56874
56942
|
},
|
|
56875
56943
|
colorSuccess: {
|
|
56876
56944
|
border: '1px solid',
|
|
56877
56945
|
borderColor: muiTokens.palette.greenSuccess + ' !important',
|
|
56878
|
-
color: muiTokens.palette.greenSuccess
|
|
56879
|
-
fontWeight: muiTokens.typography.fontWeightBold
|
|
56946
|
+
color: muiTokens.palette.greenSuccess,
|
|
56947
|
+
fontWeight: muiTokens.typography.fontWeightBold,
|
|
56948
|
+
'& .MuiChip-avatar': {
|
|
56949
|
+
color: muiTokens.palette.greenSuccess + ' !important'
|
|
56950
|
+
},
|
|
56951
|
+
'& .MuiChip-deleteIcon': {
|
|
56952
|
+
color: muiTokens.palette.blueInfo + ' !important'
|
|
56953
|
+
}
|
|
56880
56954
|
},
|
|
56881
56955
|
colorWarning: {
|
|
56882
56956
|
border: '1px solid',
|
|
56883
56957
|
borderColor: muiTokens.palette.orangeWarning + ' !important',
|
|
56884
|
-
color: muiTokens.palette.orangeWarning
|
|
56885
|
-
fontWeight: muiTokens.typography.fontWeightBold
|
|
56958
|
+
color: muiTokens.palette.orangeWarning,
|
|
56959
|
+
fontWeight: muiTokens.typography.fontWeightBold,
|
|
56960
|
+
'& .MuiChip-avatar': {
|
|
56961
|
+
color: muiTokens.palette.orangeWarning + ' !important'
|
|
56962
|
+
},
|
|
56963
|
+
'& .MuiChip-deleteIcon': {
|
|
56964
|
+
color: muiTokens.palette.blueInfo + ' !important'
|
|
56965
|
+
}
|
|
56886
56966
|
},
|
|
56887
56967
|
colorInfo: {
|
|
56888
56968
|
border: '1px solid',
|
|
56889
56969
|
borderColor: muiTokens.palette.blueInfo + ' !important',
|
|
56890
|
-
color: muiTokens.palette.blueInfo
|
|
56891
|
-
fontWeight: muiTokens.typography.fontWeightBold
|
|
56970
|
+
color: muiTokens.palette.blueInfo,
|
|
56971
|
+
fontWeight: muiTokens.typography.fontWeightBold,
|
|
56972
|
+
'& .MuiChip-avatar': {
|
|
56973
|
+
color: muiTokens.palette.blueInfo + ' !important'
|
|
56974
|
+
},
|
|
56975
|
+
'& .MuiChip-deleteIcon': {
|
|
56976
|
+
color: muiTokens.palette.blueInfo + ' !important'
|
|
56977
|
+
}
|
|
56892
56978
|
},
|
|
56893
56979
|
colorError: {
|
|
56894
56980
|
border: '1px solid',
|
|
56895
56981
|
borderColor: muiTokens.palette.redError + ' !important',
|
|
56896
|
-
color: muiTokens.palette.redError
|
|
56897
|
-
fontWeight: muiTokens.typography.fontWeightBold
|
|
56982
|
+
color: muiTokens.palette.redError,
|
|
56983
|
+
fontWeight: muiTokens.typography.fontWeightBold,
|
|
56984
|
+
'& .MuiChip-avatar': {
|
|
56985
|
+
color: muiTokens.palette.redError + ' !important'
|
|
56986
|
+
},
|
|
56987
|
+
'& .MuiChip-deleteIcon': {
|
|
56988
|
+
color: muiTokens.palette.blueInfo + ' !important'
|
|
56989
|
+
}
|
|
56898
56990
|
}
|
|
56899
56991
|
}
|
|
56900
56992
|
}
|