@pingux/astro 1.36.3-alpha.1 → 1.37.0-alpha.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/lib/cjs/components/NavBar/NavBar.js +28 -20
- package/lib/cjs/components/NavBar/NavBar.stories.js +84 -18
- package/lib/cjs/components/NavBar/NavBar.test.js +167 -1
- package/lib/cjs/components/NavBarSection/NavBarItem.js +1 -5
- package/lib/cjs/components/NavBarSection/NavBarItemButton.js +2 -6
- package/lib/cjs/components/NavBarSection/NavBarItemHeader.js +28 -5
- package/lib/cjs/components/NavBarSection/NavBarItemLink.js +2 -6
- package/lib/cjs/components/NavBarSection/NavBarSection.js +13 -5
- package/lib/cjs/templates/Nav/Nav.stories.js +9 -9
- package/lib/components/NavBar/NavBar.js +28 -19
- package/lib/components/NavBar/NavBar.stories.js +68 -16
- package/lib/components/NavBar/NavBar.test.js +134 -1
- package/lib/components/NavBarSection/NavBarItem.js +1 -5
- package/lib/components/NavBarSection/NavBarItemButton.js +2 -6
- package/lib/components/NavBarSection/NavBarItemHeader.js +19 -5
- package/lib/components/NavBarSection/NavBarItemLink.js +2 -6
- package/lib/components/NavBarSection/NavBarSection.js +14 -5
- package/lib/templates/Nav/Nav.stories.js +9 -9
- package/package.json +1 -1
@@ -1,4 +1,5 @@
|
|
1
|
-
import
|
1
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
2
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
2
3
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
3
4
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
4
5
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
@@ -73,18 +74,26 @@ var SectionItem = function SectionItem(_ref2) {
|
|
73
74
|
var navBarState = useNavBarContext();
|
74
75
|
var expandedKeys = navBarState.expandedKeys,
|
75
76
|
setExpandedKeys = navBarState.setExpandedKeys;
|
76
|
-
|
77
|
+
|
78
|
+
var isExpanded = _includesInstanceProperty(expandedKeys).call(expandedKeys, key);
|
79
|
+
|
77
80
|
var firstChildKey = children.length ? children[0].key : null;
|
78
81
|
var lastChildKey = children.length ? children[children.length - 1].key : null;
|
79
82
|
|
80
83
|
var onExpandedChange = function onExpandedChange(isOpen) {
|
84
|
+
var newArray;
|
85
|
+
|
81
86
|
if (isOpen) {
|
82
|
-
|
87
|
+
var _context;
|
88
|
+
|
89
|
+
newArray = _concatInstanceProperty(_context = []).call(_context, expandedKeys, [key]);
|
83
90
|
} else {
|
84
|
-
expandedKeys
|
91
|
+
newArray = _filterInstanceProperty(expandedKeys).call(expandedKeys, function (thiskey) {
|
92
|
+
return thiskey !== key;
|
93
|
+
});
|
85
94
|
}
|
86
95
|
|
87
|
-
setExpandedKeys(
|
96
|
+
setExpandedKeys(newArray);
|
88
97
|
};
|
89
98
|
|
90
99
|
var focusManager = useFocusManager();
|
@@ -19,11 +19,11 @@ export default {
|
|
19
19
|
};
|
20
20
|
|
21
21
|
var SideNav = function SideNav(_ref) {
|
22
|
-
var
|
23
|
-
|
22
|
+
var setSelectedKey = _ref.setSelectedKey,
|
23
|
+
selectedKey = _ref.selectedKey;
|
24
24
|
return ___EmotionJSX(NavBar, {
|
25
|
-
|
26
|
-
|
25
|
+
setSelectedKey: setSelectedKey,
|
26
|
+
selectedKey: selectedKey
|
27
27
|
}, ___EmotionJSX(Box, {
|
28
28
|
padding: "md"
|
29
29
|
}, ___EmotionJSX(Link, {
|
@@ -56,15 +56,15 @@ var SideNav = function SideNav(_ref) {
|
|
56
56
|
export var Default = function Default() {
|
57
57
|
var _useState = useState('Overview'),
|
58
58
|
_useState2 = _slicedToArray(_useState, 2),
|
59
|
-
|
60
|
-
|
59
|
+
selectedKey = _useState2[0],
|
60
|
+
setSelectedKey = _useState2[1];
|
61
61
|
|
62
62
|
return ___EmotionJSX(Box, {
|
63
63
|
bg: "accent.99",
|
64
64
|
height: "100vh"
|
65
65
|
}, ___EmotionJSX(SideNav, {
|
66
|
-
|
67
|
-
|
66
|
+
setSelectedKey: setSelectedKey,
|
67
|
+
selectedKey: selectedKey
|
68
68
|
}), ___EmotionJSX(HeaderBar, null), ___EmotionJSX(Box, {
|
69
69
|
ml: 255,
|
70
70
|
mt: 25
|
@@ -74,7 +74,7 @@ export var Default = function Default() {
|
|
74
74
|
sx: {
|
75
75
|
fontWeight: 3
|
76
76
|
}
|
77
|
-
},
|
77
|
+
}, selectedKey)));
|
78
78
|
};
|
79
79
|
Default.decorators = [function (Story) {
|
80
80
|
return ___EmotionJSX(Box, {
|