bianic-ui 2.2.0-beta.1 → 2.2.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/dist/cjs/index.js +14 -12
- package/dist/cjs/lib.css +1 -1
- package/dist/cjs/types/components/Popover/index.d.ts +10 -2
- package/dist/cjs/types/components/Tooltip/PropsInterface.d.ts +2 -6
- package/dist/esm/index.js +14 -12
- package/dist/esm/lib.css +1 -1
- package/dist/esm/types/components/Popover/index.d.ts +10 -2
- package/dist/esm/types/components/Tooltip/PropsInterface.d.ts +2 -6
- package/dist/index.d.ts +5 -10
- package/package.json +45 -7
- package/dist/cjs/types/components/Popover/PropInterface.d.ts +0 -21
- package/dist/esm/types/components/Popover/PropInterface.d.ts +0 -21
package/dist/cjs/index.js
CHANGED
|
@@ -1989,15 +1989,15 @@ MenuItem.defaultProps = {
|
|
|
1989
1989
|
};
|
|
1990
1990
|
|
|
1991
1991
|
function Tooltip(props) {
|
|
1992
|
-
var children = props.children, content = props.content, delay = props.delay, _a = props.direction, direction = _a === void 0 ? 'top' : _a, _b = props.maxWidth, maxWidth = _b === void 0 ? undefined : _b
|
|
1992
|
+
var children = props.children, content = props.content, delay = props.delay, _a = props.direction, direction = _a === void 0 ? 'top' : _a, _b = props.maxWidth, maxWidth = _b === void 0 ? undefined : _b;
|
|
1993
1993
|
var timeout;
|
|
1994
|
-
var
|
|
1994
|
+
var _c = React.useState(false), active = _c[0], setActive = _c[1];
|
|
1995
1995
|
var anchorRef = React.useRef(null);
|
|
1996
1996
|
var tooltipContainerRef = React.useRef(null);
|
|
1997
|
-
var
|
|
1997
|
+
var _d = React.useState({
|
|
1998
1998
|
maxWidth: maxWidth + 'px',
|
|
1999
1999
|
whiteSpace: 'nowrap',
|
|
2000
|
-
}), tooltipContainerStyle =
|
|
2000
|
+
}), tooltipContainerStyle = _d[0], setTooltipContainerStyle = _d[1];
|
|
2001
2001
|
var showTip = function () {
|
|
2002
2002
|
timeout = setTimeout(function () {
|
|
2003
2003
|
setActive(true);
|
|
@@ -2041,12 +2041,12 @@ function Tooltip(props) {
|
|
|
2041
2041
|
}, [content, maxWidth, scrollWidth, offsetHeight]);
|
|
2042
2042
|
return (React.createElement("div", { className: "tooltip-wrapper relative inline-flex h-fit w-fit flex-col", onMouseEnter: showTip, onMouseLeave: hideTip, ref: anchorRef },
|
|
2043
2043
|
children,
|
|
2044
|
-
active && (React.createElement(TooltipItem, { anchorRef: anchorRef, direction: direction, content: content, tooltipContainerRef: tooltipContainerRef, tooltipContainerStyle: tooltipContainerStyle
|
|
2044
|
+
active && (React.createElement(TooltipItem, { anchorRef: anchorRef, direction: direction, content: content, tooltipContainerRef: tooltipContainerRef, tooltipContainerStyle: tooltipContainerStyle }))));
|
|
2045
2045
|
}
|
|
2046
2046
|
var TooltipItem = function (_a) {
|
|
2047
|
-
var anchorRef = _a.anchorRef,
|
|
2047
|
+
var anchorRef = _a.anchorRef, direction = _a.direction, content = _a.content, tooltipContainerRef = _a.tooltipContainerRef, tooltipContainerStyle = _a.tooltipContainerStyle;
|
|
2048
2048
|
var positionStyle = usePopupPosition(anchorRef, tooltipContainerRef, direction)[0];
|
|
2049
|
-
return reactDom.createPortal(React.createElement("div", { className: "tooltip-container break-word absolute inline-block break-all rounded-[4px] bg-primary-black px-[7px] py-[4px] text-size-sm text-primary-white
|
|
2049
|
+
return reactDom.createPortal(React.createElement("div", { className: "tooltip-container break-word absolute z-50 inline-block break-all rounded-[4px] bg-primary-black px-[7px] py-[4px] text-size-sm text-primary-white", style: __assign(__assign({}, positionStyle), tooltipContainerStyle), ref: tooltipContainerRef }, content), document.body);
|
|
2050
2050
|
};
|
|
2051
2051
|
Tooltip.defaultProps = {
|
|
2052
2052
|
delay: 400,
|
|
@@ -3709,19 +3709,20 @@ var classConfig = {
|
|
|
3709
3709
|
};
|
|
3710
3710
|
|
|
3711
3711
|
function Popover(_a) {
|
|
3712
|
-
var
|
|
3712
|
+
var children = _a.children, content = _a.content; _a.delay; var _c = _a.direction, direction = _c === void 0 ? 'bottom' : _c, _d = _a.title, title = _d === void 0 ? '' : _d; _a.maxWidth;
|
|
3713
3713
|
var wrapperRef = React.useRef(null);
|
|
3714
|
-
|
|
3714
|
+
React.useRef(null);
|
|
3715
|
+
var _e = useDetectOutsideClick(wrapperRef, false), isOpen = _e[0], setIsOpen = _e[1];
|
|
3715
3716
|
return (React.createElement("div", { className: "Bianic-popover-Wrapper relative block h-fit w-fit", role: "button", ref: wrapperRef, onClick: function () { return setIsOpen(true); } },
|
|
3716
3717
|
children,
|
|
3717
|
-
isOpen && (React.createElement(PopoverItem, { title: title, content: content, anchorRef: wrapperRef, direction: direction
|
|
3718
|
+
isOpen && (React.createElement(PopoverItem, { title: title, content: content, anchorRef: wrapperRef, direction: direction }))));
|
|
3718
3719
|
}
|
|
3719
3720
|
var PopoverItem = function (_a) {
|
|
3720
|
-
var title = _a.title, content = _a.content, anchorRef = _a.anchorRef, direction = _a.direction
|
|
3721
|
+
var title = _a.title, content = _a.content, anchorRef = _a.anchorRef, direction = _a.direction;
|
|
3721
3722
|
var popoverRef = React.useRef(null);
|
|
3722
3723
|
var positionStyle = usePopupPosition(anchorRef, popoverRef, direction)[0];
|
|
3723
3724
|
var _b = classConfig[direction], triangleContainer = _b.triangleContainer, triangleShape = _b.triangleShape;
|
|
3724
|
-
return reactDom.createPortal(React.createElement("div", { ref: popoverRef, style:
|
|
3725
|
+
return reactDom.createPortal(React.createElement("div", { ref: popoverRef, style: positionStyle, className: "Bianic-popover-Tip text-bia-sm absolute z-50 w-[245px] space-y-[5px] rounded-[4px] bg-primary-black px-[20px] py-[17.5px] text-primary-white" },
|
|
3725
3726
|
React.createElement("div", { className: "flex flex-col" },
|
|
3726
3727
|
React.createElement("div", { className: "mb-[5px] font-humnst777 text-[16px] font-bold leading-[19.42px]" }, title),
|
|
3727
3728
|
React.createElement("div", { className: "break-words font-segoe text-[12px] font-normal" }, content)),
|
|
@@ -3729,6 +3730,7 @@ var PopoverItem = function (_a) {
|
|
|
3729
3730
|
React.createElement("div", { className: "h-0 w-0 ".concat(triangleShape) }))), document.body);
|
|
3730
3731
|
};
|
|
3731
3732
|
Popover.defaultProps = {
|
|
3733
|
+
delay: 400,
|
|
3732
3734
|
direction: 'top',
|
|
3733
3735
|
title: '',
|
|
3734
3736
|
};
|