@festo-ui/react 8.3.0-dev.647 → 9.0.0-dev.653
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.
|
@@ -20,15 +20,18 @@ function Popover(_ref) {
|
|
|
20
20
|
arrow = true
|
|
21
21
|
} = _ref;
|
|
22
22
|
const [showPopper, setShowPopper] = useState(open);
|
|
23
|
-
const referenceElement = useRef(null);
|
|
24
23
|
const [popperElement, setPopperElement] = useState(null);
|
|
25
24
|
const [arrowElement, setArrowElement] = useState(null);
|
|
25
|
+
const referenceElement = useRef(null);
|
|
26
26
|
const popperElRef = useRef(null);
|
|
27
27
|
const combinedRef = useForkRef(popperElRef, setPopperElement);
|
|
28
28
|
const classes = classNames(className);
|
|
29
|
+
const isControlled = onStatusChange !== undefined;
|
|
29
30
|
useEffect(() => {
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
if (isControlled) {
|
|
32
|
+
setShowPopper(open);
|
|
33
|
+
}
|
|
34
|
+
}, [open, isControlled]);
|
|
32
35
|
const {
|
|
33
36
|
styles,
|
|
34
37
|
attributes
|
|
@@ -56,10 +59,10 @@ function Popover(_ref) {
|
|
|
56
59
|
e?.stopPropagation();
|
|
57
60
|
e?.preventDefault();
|
|
58
61
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
onStatusChange(status);
|
|
62
|
+
if (!isControlled) {
|
|
63
|
+
setShowPopper(status);
|
|
62
64
|
}
|
|
65
|
+
onStatusChange?.(status);
|
|
63
66
|
};
|
|
64
67
|
function closePopover(event) {
|
|
65
68
|
handleChange(event, false);
|
|
@@ -29,15 +29,18 @@ function Popover(_ref) {
|
|
|
29
29
|
arrow = true
|
|
30
30
|
} = _ref;
|
|
31
31
|
const [showPopper, setShowPopper] = (0, _react.useState)(open);
|
|
32
|
-
const referenceElement = (0, _react.useRef)(null);
|
|
33
32
|
const [popperElement, setPopperElement] = (0, _react.useState)(null);
|
|
34
33
|
const [arrowElement, setArrowElement] = (0, _react.useState)(null);
|
|
34
|
+
const referenceElement = (0, _react.useRef)(null);
|
|
35
35
|
const popperElRef = (0, _react.useRef)(null);
|
|
36
36
|
const combinedRef = (0, _useForkRef.default)(popperElRef, setPopperElement);
|
|
37
37
|
const classes = (0, _classnames.default)(className);
|
|
38
|
+
const isControlled = onStatusChange !== undefined;
|
|
38
39
|
(0, _react.useEffect)(() => {
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
if (isControlled) {
|
|
41
|
+
setShowPopper(open);
|
|
42
|
+
}
|
|
43
|
+
}, [open, isControlled]);
|
|
41
44
|
const {
|
|
42
45
|
styles,
|
|
43
46
|
attributes
|
|
@@ -65,10 +68,10 @@ function Popover(_ref) {
|
|
|
65
68
|
e?.stopPropagation();
|
|
66
69
|
e?.preventDefault();
|
|
67
70
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
onStatusChange(status);
|
|
71
|
+
if (!isControlled) {
|
|
72
|
+
setShowPopper(status);
|
|
71
73
|
}
|
|
74
|
+
onStatusChange?.(status);
|
|
72
75
|
};
|
|
73
76
|
function closePopover(event) {
|
|
74
77
|
handleChange(event, false);
|
package/package.json
CHANGED