@pingux/astro 2.53.0 → 2.53.1-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.d.ts +4 -0
- package/lib/cjs/components/NavBar/NavBar.js +5 -26
- package/lib/cjs/components/NavBar/NavBar.stories.d.ts +7 -0
- package/lib/cjs/components/NavBar/NavBar.stories.js +1 -1
- package/lib/cjs/components/NavBar/NavBar.styles.d.ts +364 -0
- package/lib/cjs/components/NavBar/NavBar.test.d.ts +1 -0
- package/lib/cjs/components/NavBar/index.d.ts +1 -0
- package/lib/cjs/components/NavBarSection/NavBarItem.d.ts +4 -0
- package/lib/cjs/components/NavBarSection/NavBarItem.js +1 -12
- package/lib/cjs/components/NavBarSection/NavBarItemBody.d.ts +4 -0
- package/lib/cjs/components/NavBarSection/NavBarItemBody.js +6 -11
- package/lib/cjs/components/NavBarSection/NavBarItemBody.test.d.ts +1 -0
- package/lib/cjs/components/NavBarSection/NavBarItemButton.d.ts +4 -0
- package/lib/cjs/components/NavBarSection/NavBarItemButton.js +0 -7
- package/lib/cjs/components/NavBarSection/NavBarItemHeader.d.ts +4 -0
- package/lib/cjs/components/NavBarSection/NavBarItemHeader.js +9 -33
- package/lib/cjs/components/NavBarSection/NavBarItemLink.d.ts +4 -0
- package/lib/cjs/components/NavBarSection/NavBarItemLink.js +0 -9
- package/lib/cjs/components/NavBarSection/NavBarSection.d.ts +9 -0
- package/lib/cjs/components/NavBarSection/NavBarSection.js +18 -50
- package/lib/cjs/components/NavBarSection/index.d.ts +4 -0
- package/lib/cjs/hooks/useNavBarPress/useNavBarPress.d.ts +1 -1
- package/lib/cjs/hooks/useNavBarPress/useNavBarPress.js +5 -3
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/cjs/types/index.js +23 -12
- package/lib/cjs/types/link.d.ts +4 -0
- package/lib/cjs/types/navBar.d.ts +136 -0
- package/lib/cjs/types/navBar.js +6 -0
- package/lib/components/NavBar/NavBar.js +5 -26
- package/lib/components/NavBar/NavBar.stories.js +1 -1
- package/lib/components/NavBarSection/NavBarItem.js +3 -14
- package/lib/components/NavBarSection/NavBarItemBody.js +6 -11
- package/lib/components/NavBarSection/NavBarItemButton.js +0 -7
- package/lib/components/NavBarSection/NavBarItemHeader.js +9 -33
- package/lib/components/NavBarSection/NavBarItemLink.js +0 -9
- package/lib/components/NavBarSection/NavBarSection.js +18 -50
- package/lib/hooks/useNavBarPress/useNavBarPress.js +5 -3
- package/lib/types/index.js +1 -0
- package/lib/types/navBar.js +1 -0
- package/package.json +1 -1
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
3
3
|
var _excluded = ["className", "id", "onPress", "sx"];
|
4
4
|
import React from 'react';
|
5
|
-
import PropTypes from 'prop-types';
|
6
5
|
import { useNavBarContext } from '../../context/NavBarContext';
|
7
6
|
import { useNavBarPress, useStatusClasses } from '../../hooks';
|
8
7
|
import { Button } from '../../index';
|
@@ -32,10 +31,4 @@ var NavBarItemButton = function NavBarItemButton(props) {
|
|
32
31
|
color: isSelected ? 'white' : undefined
|
33
32
|
}, others));
|
34
33
|
};
|
35
|
-
NavBarItemButton.propTypes = {
|
36
|
-
/** Handler that is called when the press is released over the target. */
|
37
|
-
onPress: PropTypes.func,
|
38
|
-
/** The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). */
|
39
|
-
id: PropTypes.string.isRequired
|
40
|
-
};
|
41
34
|
export default NavBarItemButton;
|
@@ -4,13 +4,12 @@ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/insta
|
|
4
4
|
import React, { useEffect } from 'react';
|
5
5
|
import MenuDown from '@pingux/mdi-react/MenuDownIcon';
|
6
6
|
import MenuUp from '@pingux/mdi-react/MenuUpIcon';
|
7
|
-
import PropTypes from 'prop-types';
|
8
7
|
import { useNavBarContext } from '../../context/NavBarContext';
|
9
8
|
import { useStatusClasses } from '../../hooks';
|
10
9
|
import { Box, Icon, Text } from '../../index';
|
11
10
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
12
|
-
var NavBarItemHeader = function NavBarItemHeader(
|
13
|
-
var item =
|
11
|
+
var NavBarItemHeader = function NavBarItemHeader(_ref) {
|
12
|
+
var item = _ref.item;
|
14
13
|
var children = item.children,
|
15
14
|
href = item.href;
|
16
15
|
return !children && href ? ___EmotionJSX(NavBarPrimaryItemHeader, {
|
@@ -19,9 +18,10 @@ var NavBarItemHeader = function NavBarItemHeader(props) {
|
|
19
18
|
item: item
|
20
19
|
});
|
21
20
|
};
|
22
|
-
var NavBarSectionItemHeader = function NavBarSectionItemHeader(
|
21
|
+
var NavBarSectionItemHeader = function NavBarSectionItemHeader(_ref2) {
|
23
22
|
var _context;
|
24
|
-
var item =
|
23
|
+
var item = _ref2.item;
|
24
|
+
// const { item } = props;
|
25
25
|
var icon = item.icon,
|
26
26
|
key = item.key,
|
27
27
|
className = item.className,
|
@@ -32,10 +32,10 @@ var NavBarSectionItemHeader = function NavBarSectionItemHeader(props) {
|
|
32
32
|
expandedKeys = navBarState.expandedKeys,
|
33
33
|
navStyles = navBarState.navStyles;
|
34
34
|
var isExpanded = _includesInstanceProperty(expandedKeys).call(expandedKeys, key);
|
35
|
-
var array = _mapInstanceProperty(_context = item.children).call(_context, function (i) {
|
35
|
+
var array = (item === null || item === void 0 ? void 0 : item.children) && _mapInstanceProperty(_context = item.children).call(_context, function (i) {
|
36
36
|
return i.key;
|
37
37
|
});
|
38
|
-
var childSelected = _includesInstanceProperty(array).call(array, navBarState.selectedKey);
|
38
|
+
var childSelected = array && _includesInstanceProperty(array).call(array, navBarState.selectedKey);
|
39
39
|
useEffect(function () {
|
40
40
|
if (childSelected && isExpanded === false) {
|
41
41
|
var _context2;
|
@@ -86,8 +86,8 @@ var NavBarSectionItemHeader = function NavBarSectionItemHeader(props) {
|
|
86
86
|
}
|
87
87
|
})));
|
88
88
|
};
|
89
|
-
var NavBarPrimaryItemHeader = function NavBarPrimaryItemHeader(
|
90
|
-
var item =
|
89
|
+
var NavBarPrimaryItemHeader = function NavBarPrimaryItemHeader(_ref3) {
|
90
|
+
var item = _ref3.item;
|
91
91
|
var icon = item.icon,
|
92
92
|
className = item.className,
|
93
93
|
heading = item.heading,
|
@@ -131,28 +131,4 @@ var NavBarPrimaryItemHeader = function NavBarPrimaryItemHeader(_ref) {
|
|
131
131
|
}
|
132
132
|
})));
|
133
133
|
};
|
134
|
-
NavBarItemHeader.propTypes = {
|
135
|
-
item: PropTypes.shape({
|
136
|
-
children: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object])),
|
137
|
-
href: PropTypes.string
|
138
|
-
})
|
139
|
-
};
|
140
|
-
NavBarSectionItemHeader.propTypes = {
|
141
|
-
item: PropTypes.shape({
|
142
|
-
heading: PropTypes.string,
|
143
|
-
icon: PropTypes.elementType,
|
144
|
-
className: PropTypes.string,
|
145
|
-
children: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object])),
|
146
|
-
key: PropTypes.string,
|
147
|
-
href: PropTypes.string
|
148
|
-
})
|
149
|
-
};
|
150
|
-
NavBarPrimaryItemHeader.propTypes = {
|
151
|
-
item: PropTypes.shape({
|
152
|
-
heading: PropTypes.string,
|
153
|
-
icon: PropTypes.elementType,
|
154
|
-
className: PropTypes.string,
|
155
|
-
customIcon: PropTypes.elementType
|
156
|
-
})
|
157
|
-
};
|
158
134
|
export default NavBarItemHeader;
|
@@ -13,7 +13,6 @@ var _excluded = ["className", "id", "onPress"];
|
|
13
13
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
14
14
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
15
15
|
import React from 'react';
|
16
|
-
import PropTypes from 'prop-types';
|
17
16
|
import { useNavBarContext } from '../../context/NavBarContext';
|
18
17
|
import { useNavBarPress, useStatusClasses } from '../../hooks';
|
19
18
|
import { Link } from '../../index';
|
@@ -47,12 +46,4 @@ var NavBarItemLink = function NavBarItemLink(props) {
|
|
47
46
|
}, props.sx)
|
48
47
|
}));
|
49
48
|
};
|
50
|
-
NavBarItemLink.propTypes = {
|
51
|
-
/** Specifies the location of the URL */
|
52
|
-
href: PropTypes.string,
|
53
|
-
/** Handler that is called when the press is released over the target. */
|
54
|
-
onPress: PropTypes.func,
|
55
|
-
/** The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). */
|
56
|
-
id: PropTypes.string.isRequired
|
57
|
-
};
|
58
49
|
export default NavBarItemLink;
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
3
3
|
var _excluded = ["hasSeparator", "title", "items", "onKeyDown"],
|
4
4
|
_excluded2 = ["key", "children"];
|
5
|
+
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
5
6
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
6
7
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
7
8
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
@@ -9,7 +10,6 @@ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/insta
|
|
9
10
|
import React, { forwardRef } from 'react';
|
10
11
|
import { useFocusManager } from '@react-aria/focus';
|
11
12
|
import { useKeyboard } from '@react-aria/interactions';
|
12
|
-
import PropTypes from 'prop-types';
|
13
13
|
import { Box, Button, Link, Separator, Text } from '../..';
|
14
14
|
import { useNavBarContext } from '../../context/NavBarContext';
|
15
15
|
import NavBarItemBody from './NavBarItemBody';
|
@@ -27,9 +27,12 @@ var NavBarSection = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
27
27
|
items = _ref.items,
|
28
28
|
onKeyDown = _ref.onKeyDown,
|
29
29
|
others = _objectWithoutProperties(_ref, _excluded);
|
30
|
-
var childrenItems
|
31
|
-
|
32
|
-
|
30
|
+
var childrenItems;
|
31
|
+
if (_Array$isArray(items)) {
|
32
|
+
childrenItems = items === null || items === void 0 ? void 0 : _filterInstanceProperty(items).call(items, function (item) {
|
33
|
+
return item.children || item.href;
|
34
|
+
});
|
35
|
+
}
|
33
36
|
var state = useNavBarContext();
|
34
37
|
return ___EmotionJSX(React.Fragment, null, hasSeparator && ___EmotionJSX(Separator, {
|
35
38
|
variant: "separator.navBarSeparator"
|
@@ -43,7 +46,7 @@ var NavBarSection = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
43
46
|
padding: 0,
|
44
47
|
listStyle: 'none'
|
45
48
|
}
|
46
|
-
}, others), _mapInstanceProperty(childrenItems).call(childrenItems, function (item) {
|
49
|
+
}, others), childrenItems && _mapInstanceProperty(childrenItems).call(childrenItems, function (item) {
|
47
50
|
return ___EmotionJSX(Box, {
|
48
51
|
as: "li",
|
49
52
|
key: item.key,
|
@@ -61,16 +64,17 @@ var NavBarSection = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
61
64
|
var SectionItem = function SectionItem(_ref2) {
|
62
65
|
var item = _ref2.item,
|
63
66
|
onKeyDownProp = _ref2.onKeyDown;
|
64
|
-
var
|
65
|
-
|
66
|
-
|
67
|
+
var _ref3 = item,
|
68
|
+
key = _ref3.key,
|
69
|
+
children = _ref3.children,
|
70
|
+
others = _objectWithoutProperties(_ref3, _excluded2);
|
67
71
|
var navBarState = useNavBarContext();
|
68
72
|
var isAutoСollapsible = navBarState.isAutoСollapsible,
|
69
73
|
expandedKeys = navBarState.expandedKeys,
|
70
74
|
setExpandedKeys = navBarState.setExpandedKeys;
|
71
75
|
var isExpanded = _includesInstanceProperty(expandedKeys).call(expandedKeys, key);
|
72
|
-
var firstChildKey = children.length ? children[0].key : null;
|
73
|
-
var lastChildKey = children.length ? children[children.length - 1].key : null;
|
76
|
+
var firstChildKey = children && children.length ? children[0].key : null;
|
77
|
+
var lastChildKey = children && children.length ? children[children.length - 1].key : null;
|
74
78
|
var onExpandedChange = function onExpandedChange(isOpen) {
|
75
79
|
var newArray;
|
76
80
|
if (isOpen) {
|
@@ -118,7 +122,7 @@ var SectionItem = function SectionItem(_ref2) {
|
|
118
122
|
};
|
119
123
|
var _useKeyboard = useKeyboard({
|
120
124
|
onKeyDown: function onKeyDown(e) {
|
121
|
-
_onKeyDown(e);
|
125
|
+
_onKeyDown(e, undefined);
|
122
126
|
e.continuePropagation();
|
123
127
|
}
|
124
128
|
}),
|
@@ -135,12 +139,12 @@ var SectionItem = function SectionItem(_ref2) {
|
|
135
139
|
onKeyDown: _onKeyDown
|
136
140
|
}));
|
137
141
|
};
|
138
|
-
var PrimaryItem = function PrimaryItem(
|
139
|
-
var item =
|
142
|
+
var PrimaryItem = function PrimaryItem(_ref4) {
|
143
|
+
var item = _ref4.item;
|
140
144
|
var state = useNavBarContext();
|
141
145
|
return ___EmotionJSX(Link, {
|
142
146
|
variant: state.navStyles.primaryItem,
|
143
|
-
href: item.href,
|
147
|
+
href: item && item.href,
|
144
148
|
target: "_blank"
|
145
149
|
}, ___EmotionJSX(NavBarItemHeader, {
|
146
150
|
item: item
|
@@ -149,40 +153,4 @@ var PrimaryItem = function PrimaryItem(_ref3) {
|
|
149
153
|
NavBarSection.defaultProps = {
|
150
154
|
hasSeparator: false
|
151
155
|
};
|
152
|
-
NavBarSection.propTypes = {
|
153
|
-
/** If true, a separator will render at the end of the section */
|
154
|
-
hasSeparator: PropTypes.bool,
|
155
|
-
/** callback that runs on key down */
|
156
|
-
onKeyDown: PropTypes.func,
|
157
|
-
/** If present, this string will render at the top of the section */
|
158
|
-
title: PropTypes.string,
|
159
|
-
/**
|
160
|
-
* *For performance reasons, use this prop instead of Array.map when iteratively rendering Items*.
|
161
|
-
* For use with [dynamic collections](https://react-spectrum.adobe.com/react-stately/collections.html#dynamic-collections).
|
162
|
-
*/
|
163
|
-
items: PropTypes.arrayOf(PropTypes.shape({}))
|
164
|
-
};
|
165
|
-
SectionItem.propTypes = {
|
166
|
-
onKeyDown: PropTypes.func,
|
167
|
-
item: PropTypes.shape({
|
168
|
-
key: PropTypes.string,
|
169
|
-
children: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object])),
|
170
|
-
'aria-label': PropTypes.string
|
171
|
-
}),
|
172
|
-
state: PropTypes.shape({
|
173
|
-
collection: PropTypes.shape({}),
|
174
|
-
selectedKey: PropTypes.string,
|
175
|
-
setSelectedKey: PropTypes.func,
|
176
|
-
selectionManager: PropTypes.shape({
|
177
|
-
focusedKey: PropTypes.string,
|
178
|
-
setFocusedKey: PropTypes.func
|
179
|
-
})
|
180
|
-
}),
|
181
|
-
menuProps: PropTypes.shape({})
|
182
|
-
};
|
183
|
-
PrimaryItem.propTypes = {
|
184
|
-
item: PropTypes.shape({
|
185
|
-
href: PropTypes.string
|
186
|
-
})
|
187
|
-
};
|
188
156
|
export default NavBarSection;
|
@@ -3,9 +3,11 @@ var useNavBarPress = function useNavBarPress(_ref, state) {
|
|
3
3
|
onPressCallback = _ref.onPressCallback;
|
4
4
|
var setSelectedKey = state.setSelectedKey;
|
5
5
|
var onNavPress = function onNavPress() {
|
6
|
-
|
7
|
-
|
8
|
-
onPressCallback
|
6
|
+
if (key) {
|
7
|
+
setSelectedKey(key);
|
8
|
+
if (onPressCallback) {
|
9
|
+
onPressCallback();
|
10
|
+
}
|
9
11
|
}
|
10
12
|
};
|
11
13
|
return {
|
package/lib/types/index.js
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|