orcs-design-system 3.3.9 → 3.3.11
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.
|
@@ -10,19 +10,20 @@ const FloatingPanels = _ref => {
|
|
|
10
10
|
position = {
|
|
11
11
|
right: 20,
|
|
12
12
|
top: 20
|
|
13
|
-
}
|
|
13
|
+
},
|
|
14
|
+
onClick = () => {}
|
|
14
15
|
} = _ref;
|
|
15
16
|
const [expandedPanelId, setExpandedPanelId] = useState(null);
|
|
16
|
-
|
|
17
|
-
// Set the default expanded panel on component mount
|
|
18
17
|
useEffect(() => {
|
|
19
|
-
const
|
|
20
|
-
if (
|
|
21
|
-
setExpandedPanelId(
|
|
18
|
+
const expandedPanel = panels.find(panel => panel.expanded);
|
|
19
|
+
if (expandedPanel?.id) {
|
|
20
|
+
setExpandedPanelId(expandedPanel.id);
|
|
22
21
|
}
|
|
23
22
|
}, [panels]);
|
|
24
23
|
const togglePanel = panelId => {
|
|
25
|
-
|
|
24
|
+
const selectedPanelId = expandedPanelId === panelId ? null : panelId;
|
|
25
|
+
onClick(selectedPanelId);
|
|
26
|
+
setExpandedPanelId(selectedPanelId);
|
|
26
27
|
};
|
|
27
28
|
return /*#__PURE__*/_jsxs(ComponentContainer, {
|
|
28
29
|
containerHeight: containerHeight,
|
|
@@ -59,7 +60,8 @@ FloatingPanels.propTypes = {
|
|
|
59
60
|
right: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
60
61
|
bottom: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
61
62
|
left: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
62
|
-
})
|
|
63
|
+
}),
|
|
64
|
+
onClick: PropTypes.func
|
|
63
65
|
};
|
|
64
66
|
FloatingPanels.defaultProps = {
|
|
65
67
|
position: {
|
|
@@ -121,6 +123,17 @@ FloatingPanels.__docgenInfo = {
|
|
|
121
123
|
},
|
|
122
124
|
"required": false
|
|
123
125
|
},
|
|
126
|
+
"onClick": {
|
|
127
|
+
"defaultValue": {
|
|
128
|
+
"value": "() => {}",
|
|
129
|
+
"computed": false
|
|
130
|
+
},
|
|
131
|
+
"description": "",
|
|
132
|
+
"type": {
|
|
133
|
+
"name": "func"
|
|
134
|
+
},
|
|
135
|
+
"required": false
|
|
136
|
+
},
|
|
124
137
|
"panels": {
|
|
125
138
|
"description": "",
|
|
126
139
|
"type": {
|