@loomhq/lens 10.54.1 → 10.55.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/components/icon/available-icons/book.d.ts +2 -0
- package/dist/components/icon/available-icons/book.js +6 -0
- package/dist/components/icon/available-icons/index.d.ts +1 -0
- package/dist/components/icon/available-icons/index.js +1 -0
- package/dist/components/tooltip/tooltip.js +16 -5
- package/package.json +1 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
function SvgBook(props) {
|
|
3
|
+
return (React.createElement("svg", Object.assign({ viewBox: "0 0 24 24", fill: "none" }, props),
|
|
4
|
+
React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M2 2C1.44772 2 1 2.44772 1 3V18C1 18.5523 1.44772 19 2 19H9C9.53043 19 10.0391 19.2107 10.4142 19.5858C10.7893 19.9609 11 20.4696 11 21C11 21.5523 11.4477 22 12 22C12.5523 22 13 21.5523 13 21C13 20.4696 13.2107 19.9609 13.5858 19.5858C13.9609 19.2107 14.4696 19 15 19H22C22.5523 19 23 18.5523 23 18V3C23 2.44772 22.5523 2 22 2H16C14.6739 2 13.4021 2.52678 12.4645 3.46447C12.2962 3.63275 12.1411 3.81178 12 3.99997C11.8589 3.81178 11.7038 3.63275 11.5355 3.46447C10.5979 2.52678 9.32608 2 8 2H2ZM13 17.5359C13.6029 17.1878 14.2918 17 15 17H21V4H16C15.2044 4 14.4413 4.31607 13.8787 4.87868C13.3161 5.44129 13 6.20435 13 7V17.5359ZM11 17.5359V7C11 6.20435 10.6839 5.44129 10.1213 4.87868C9.55871 4.31607 8.79565 4 8 4H3V17H9C9.70823 17 10.3971 17.1878 11 17.5359Z", fill: "currentColor" })));
|
|
5
|
+
}
|
|
6
|
+
export default SvgBook;
|
|
@@ -23,6 +23,7 @@ export { default as SvgForward5 } from "./forward-5.js";
|
|
|
23
23
|
export { default as SvgBarChart } from "./bar-chart.js";
|
|
24
24
|
export { default as SvgBell } from "./bell.js";
|
|
25
25
|
export { default as SvgBellOff } from "./bell-off.js";
|
|
26
|
+
export { default as SvgBook } from "./book.js";
|
|
26
27
|
export { default as SvgBlur } from "./blur.js";
|
|
27
28
|
export { default as SvgBorderColor } from "./border-color.js";
|
|
28
29
|
export { default as SvgBulb } from "./bulb.js";
|
|
@@ -23,6 +23,7 @@ export { default as SvgForward5 } from './forward-5.js';
|
|
|
23
23
|
export { default as SvgBarChart } from './bar-chart.js';
|
|
24
24
|
export { default as SvgBell } from './bell.js';
|
|
25
25
|
export { default as SvgBellOff } from './bell-off.js';
|
|
26
|
+
export { default as SvgBook } from './book.js';
|
|
26
27
|
export { default as SvgBlur } from './blur.js';
|
|
27
28
|
export { default as SvgBorderColor } from './border-color.js';
|
|
28
29
|
export { default as SvgBulb } from './bulb.js';
|
|
@@ -71,22 +71,33 @@ const Tooltip = (_a) => {
|
|
|
71
71
|
const [isOverTooltip, setIsOverTooltip] = useState(false);
|
|
72
72
|
const [isOpen, setIsOpen] = useState(false);
|
|
73
73
|
const focusRef = useRef();
|
|
74
|
+
const isTooltipDisabled = !content || isDisabled;
|
|
74
75
|
// show the tooltip if a user has focused or hovered on it AND it is not disabled
|
|
75
76
|
useEffect(() => {
|
|
76
|
-
const
|
|
77
|
+
const keepTooltipOpenOnHover = isOverTooltip && keepOpen;
|
|
77
78
|
if (isTooltipDisabled) {
|
|
78
79
|
return;
|
|
79
80
|
}
|
|
80
|
-
if (show ||
|
|
81
|
+
if (show || keepTooltipOpenOnHover) {
|
|
81
82
|
setIsOpen(true);
|
|
82
83
|
}
|
|
83
84
|
// We have to watch this separately since hover and focus are managed separately. So, an element can be keyboard focused while another element is mouse hovered.
|
|
84
85
|
if (!show) {
|
|
85
86
|
setIsOpen(false);
|
|
86
87
|
}
|
|
87
|
-
}, [
|
|
88
|
+
}, [
|
|
89
|
+
content,
|
|
90
|
+
isDisabled,
|
|
91
|
+
isOverTooltip,
|
|
92
|
+
isTooltipDisabled,
|
|
93
|
+
keepOpen,
|
|
94
|
+
setIsOpen,
|
|
95
|
+
show,
|
|
96
|
+
]);
|
|
88
97
|
const handleFocus = () => {
|
|
89
|
-
|
|
98
|
+
if (!isTooltipDisabled) {
|
|
99
|
+
setIsOpen(true);
|
|
100
|
+
}
|
|
90
101
|
};
|
|
91
102
|
const handleBlur = () => {
|
|
92
103
|
setIsOpen(false);
|
|
@@ -115,7 +126,7 @@ const Tooltip = (_a) => {
|
|
|
115
126
|
auto: true,
|
|
116
127
|
});
|
|
117
128
|
return (React.createElement(React.Fragment, null,
|
|
118
|
-
React.createElement(TooltipChildren, Object.assign({}, triggerProps, hoverProps, { onFocus: handleFocus, onBlur: handleBlur, isInline: isInline, verticalAlign: verticalAlign, tabIndex:
|
|
129
|
+
React.createElement(TooltipChildren, Object.assign({}, triggerProps, hoverProps, { onFocus: handleFocus, onBlur: handleBlur, isInline: isInline, verticalAlign: verticalAlign, tabIndex: isTooltipDisabled ? -1 : tabIndex, ref: mergeRefs(triggerProps.ref, focusRef) }), children),
|
|
119
130
|
isOpen &&
|
|
120
131
|
renderLayer(React.createElement("div", Object.assign({}, layerProps, { style: Object.assign(Object.assign({}, layerProps.style), { zIndex }) }),
|
|
121
132
|
React.createElement(TooltipBox, Object.assign({ maxWidth: maxWidth, onMouseEnter: () => setIsOverTooltip(true), onMouseLeave: () => setIsOverTooltip(false) }, rest), content)))));
|