@digital-ai/dot-components 4.15.0 → 4.16.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/index.esm.js +23 -12
- package/package.json +1 -1
- package/src/lib/components/chip/Chip.d.ts +4 -1
package/index.esm.js
CHANGED
|
@@ -3346,9 +3346,15 @@ const StyledMenuList = styled(MenuList)`
|
|
|
3346
3346
|
background: ${hoverGray};
|
|
3347
3347
|
}
|
|
3348
3348
|
|
|
3349
|
-
&.Mui-selected
|
|
3350
|
-
|
|
3351
|
-
|
|
3349
|
+
&.Mui-selected {
|
|
3350
|
+
&,
|
|
3351
|
+
&:hover {
|
|
3352
|
+
background: ${lightSelectedGray};
|
|
3353
|
+
}
|
|
3354
|
+
|
|
3355
|
+
&.Mui-focusVisible {
|
|
3356
|
+
background: ${selectedGray};
|
|
3357
|
+
}
|
|
3352
3358
|
}
|
|
3353
3359
|
|
|
3354
3360
|
&.${listItemWithSubmenuClassName} {
|
|
@@ -6644,19 +6650,24 @@ const DotChip = ({
|
|
|
6644
6650
|
onDelete,
|
|
6645
6651
|
size = 'medium',
|
|
6646
6652
|
startIcon,
|
|
6647
|
-
tabIndex
|
|
6653
|
+
tabIndex,
|
|
6654
|
+
tooltipHoverVisibility = 'overflow'
|
|
6648
6655
|
}) => {
|
|
6649
6656
|
const errorClass = error ? 'Mui-error' : '';
|
|
6650
6657
|
const rootClasses = useStylesWithRootClass(rootClassName$Z, className, errorClass);
|
|
6658
|
+
const isTruncated = charactersLimit > 0 && children.length > charactersLimit;
|
|
6659
|
+
const getChipLabelWithTooltip = label => jsx(DotTooltip, {
|
|
6660
|
+
hoverVisibility: "always",
|
|
6661
|
+
title: children,
|
|
6662
|
+
children: jsx("span", {
|
|
6663
|
+
children: label
|
|
6664
|
+
})
|
|
6665
|
+
});
|
|
6651
6666
|
const getChipLabel = () => {
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
children: jsx("span", {
|
|
6657
|
-
children: label
|
|
6658
|
-
})
|
|
6659
|
-
});
|
|
6667
|
+
const label = isTruncated ? `${children.substring(0, charactersLimit)}...` : children;
|
|
6668
|
+
if (tooltipHoverVisibility === 'always' || isTruncated && tooltipHoverVisibility === 'overflow') {
|
|
6669
|
+
return getChipLabelWithTooltip(label);
|
|
6670
|
+
} else return label;
|
|
6660
6671
|
};
|
|
6661
6672
|
return jsx(StyledChip, {
|
|
6662
6673
|
"aria-label": ariaLabel,
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MouseEvent, ReactElement } from 'react';
|
|
2
|
+
import { TooltipHoverVisibility } from '../tooltip';
|
|
2
3
|
import { CommonProps } from '../CommonProps';
|
|
3
4
|
export type ChipSize = 'medium' | 'small';
|
|
4
5
|
export declare const DEFAULT_CHARACTERS_LIMIT = 32;
|
|
@@ -27,5 +28,7 @@ export interface ChipProps extends CommonProps {
|
|
|
27
28
|
startIcon?: ReactElement;
|
|
28
29
|
/** The tab index of the chip */
|
|
29
30
|
tabIndex?: number;
|
|
31
|
+
/** Tooltip option which governs when the tooltip text should be visible */
|
|
32
|
+
tooltipHoverVisibility?: TooltipHoverVisibility;
|
|
30
33
|
}
|
|
31
|
-
export declare const DotChip: ({ ariaLabel, avatar, charactersLimit, children, className, "data-pendoid": dataPendoId, "data-testid": dataTestId, disabled, error, isClickable, isDeletable, onClick, onDelete, size, startIcon, tabIndex, }: ChipProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare const DotChip: ({ ariaLabel, avatar, charactersLimit, children, className, "data-pendoid": dataPendoId, "data-testid": dataTestId, disabled, error, isClickable, isDeletable, onClick, onDelete, size, startIcon, tabIndex, tooltipHoverVisibility, }: ChipProps) => import("react/jsx-runtime").JSX.Element;
|