@televet/kibble-ui 1.11.0 → 1.12.0
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/build/components/Overlay/Tooltip/tooltip.types.d.ts +3 -0
- package/build/components/Typography/TruncatedText/index.d.ts +1 -0
- package/build/components/Typography/TruncatedText/truncatedText.component.d.ts +8 -0
- package/build/components/Typography/index.d.ts +1 -0
- package/build/index.js +27 -0
- package/build/index.js.map +1 -1
- package/build/theme/tokens/zIndeces.d.ts +1 -0
- package/package.json +1 -1
|
@@ -2,5 +2,8 @@ import { AdaptiveColor } from '../../../theme/tokens';
|
|
|
2
2
|
import { Placement } from '@chakra-ui/react';
|
|
3
3
|
export interface TooltipStyleConfig {
|
|
4
4
|
color: AdaptiveColor;
|
|
5
|
+
baseStyle: {
|
|
6
|
+
zIndex: string;
|
|
7
|
+
};
|
|
5
8
|
}
|
|
6
9
|
export declare const tooltipPlacementOptions: Placement[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './truncatedText.component';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PlacementWithLogical, TextProps as ChakraTextProps } from '@chakra-ui/react';
|
|
2
|
+
import { TypographyProps as ChakraTypographyProps } from '@chakra-ui/system';
|
|
3
|
+
export interface TruncatedTextProps extends ChakraTextProps, ChakraTypographyProps {
|
|
4
|
+
noOfLines?: number;
|
|
5
|
+
textContent: string;
|
|
6
|
+
placement?: PlacementWithLogical;
|
|
7
|
+
}
|
|
8
|
+
export declare const TruncatedText: ({ noOfLines, textContent, placement, ...rest }: TruncatedTextProps) => JSX.Element;
|
package/build/index.js
CHANGED
|
@@ -500,6 +500,7 @@ var zIndices = {
|
|
|
500
500
|
skipLink: 1600,
|
|
501
501
|
toast: 1700,
|
|
502
502
|
tooltip: 1800,
|
|
503
|
+
tooltipExtra: 10000,
|
|
503
504
|
};
|
|
504
505
|
|
|
505
506
|
var TagConfig = {
|
|
@@ -1648,6 +1649,9 @@ var TooltipGlobalStyle = {
|
|
|
1648
1649
|
};
|
|
1649
1650
|
var TooltipConfig = {
|
|
1650
1651
|
color: { light: semanticColors.background.dark, dark: semanticColors.background.light },
|
|
1652
|
+
baseStyle: {
|
|
1653
|
+
zIndex: 'tooltipExtra',
|
|
1654
|
+
},
|
|
1651
1655
|
};
|
|
1652
1656
|
|
|
1653
1657
|
exports.AvatarVariant = void 0;
|
|
@@ -4127,6 +4131,28 @@ var TextConfig = {
|
|
|
4127
4131
|
},
|
|
4128
4132
|
};
|
|
4129
4133
|
|
|
4134
|
+
var TruncatedText = function (_a) {
|
|
4135
|
+
var _b = _a.noOfLines, noOfLines = _b === void 0 ? 1 : _b, textContent = _a.textContent, placement = _a.placement, rest = __rest(_a, ["noOfLines", "textContent", "placement"]);
|
|
4136
|
+
var _c = __read(React.useState(false), 2), isTextOverFlowing = _c[0], setIsTextOverFlowing = _c[1];
|
|
4137
|
+
var containerRef = React.useRef(null);
|
|
4138
|
+
var onCheckTextOverFlowing = React.useCallback(function (containerRefValue) {
|
|
4139
|
+
var _a, _b;
|
|
4140
|
+
if (containerRefValue && containerRefValue.current) {
|
|
4141
|
+
var textScrollHeight = ((_a = containerRefValue.current) === null || _a === void 0 ? void 0 : _a.children[0].scrollHeight) || 0;
|
|
4142
|
+
var containerOffsetHeight = ((_b = containerRefValue.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 0;
|
|
4143
|
+
return textScrollHeight > containerOffsetHeight;
|
|
4144
|
+
}
|
|
4145
|
+
return false;
|
|
4146
|
+
}, []);
|
|
4147
|
+
React.useEffect(function () {
|
|
4148
|
+
var checkValue = onCheckTextOverFlowing(containerRef);
|
|
4149
|
+
setIsTextOverFlowing(checkValue);
|
|
4150
|
+
}, [containerRef, onCheckTextOverFlowing]);
|
|
4151
|
+
return (React__default["default"].createElement(react.Box, { ref: containerRef },
|
|
4152
|
+
React__default["default"].createElement(Tooltip, { label: textContent || '', isDisabled: !isTextOverFlowing, placement: placement },
|
|
4153
|
+
React__default["default"].createElement(react.Text, __assign({ noOfLines: noOfLines, as: "p" }, rest), textContent))));
|
|
4154
|
+
};
|
|
4155
|
+
|
|
4130
4156
|
var RatingDots = function (_a) {
|
|
4131
4157
|
var minValue = _a.minValue, maxValue = _a.maxValue, isDisabled = _a.isDisabled, isInteractive = _a.isInteractive, onClick = _a.onClick, selected = _a.selected;
|
|
4132
4158
|
var _b = __read(React.useState(), 2), selectedValue = _b[0], setSelectedValue = _b[1];
|
|
@@ -9709,6 +9735,7 @@ exports.TextareaConfig = TextareaConfig;
|
|
|
9709
9735
|
exports.Tooltip = Tooltip;
|
|
9710
9736
|
exports.TooltipConfig = TooltipConfig;
|
|
9711
9737
|
exports.TooltipGlobalStyle = TooltipGlobalStyle;
|
|
9738
|
+
exports.TruncatedText = TruncatedText;
|
|
9712
9739
|
exports.theme = theme;
|
|
9713
9740
|
exports.tooltipPlacementOptions = tooltipPlacementOptions;
|
|
9714
9741
|
exports.useMenuContext = useMenuContext;
|