@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.
Files changed (40) hide show
  1. package/lib/cjs/components/NavBar/NavBar.d.ts +4 -0
  2. package/lib/cjs/components/NavBar/NavBar.js +5 -26
  3. package/lib/cjs/components/NavBar/NavBar.stories.d.ts +7 -0
  4. package/lib/cjs/components/NavBar/NavBar.stories.js +1 -1
  5. package/lib/cjs/components/NavBar/NavBar.styles.d.ts +364 -0
  6. package/lib/cjs/components/NavBar/NavBar.test.d.ts +1 -0
  7. package/lib/cjs/components/NavBar/index.d.ts +1 -0
  8. package/lib/cjs/components/NavBarSection/NavBarItem.d.ts +4 -0
  9. package/lib/cjs/components/NavBarSection/NavBarItem.js +1 -12
  10. package/lib/cjs/components/NavBarSection/NavBarItemBody.d.ts +4 -0
  11. package/lib/cjs/components/NavBarSection/NavBarItemBody.js +6 -11
  12. package/lib/cjs/components/NavBarSection/NavBarItemBody.test.d.ts +1 -0
  13. package/lib/cjs/components/NavBarSection/NavBarItemButton.d.ts +4 -0
  14. package/lib/cjs/components/NavBarSection/NavBarItemButton.js +0 -7
  15. package/lib/cjs/components/NavBarSection/NavBarItemHeader.d.ts +4 -0
  16. package/lib/cjs/components/NavBarSection/NavBarItemHeader.js +9 -33
  17. package/lib/cjs/components/NavBarSection/NavBarItemLink.d.ts +4 -0
  18. package/lib/cjs/components/NavBarSection/NavBarItemLink.js +0 -9
  19. package/lib/cjs/components/NavBarSection/NavBarSection.d.ts +9 -0
  20. package/lib/cjs/components/NavBarSection/NavBarSection.js +18 -50
  21. package/lib/cjs/components/NavBarSection/index.d.ts +4 -0
  22. package/lib/cjs/hooks/useNavBarPress/useNavBarPress.d.ts +1 -1
  23. package/lib/cjs/hooks/useNavBarPress/useNavBarPress.js +5 -3
  24. package/lib/cjs/types/index.d.ts +1 -0
  25. package/lib/cjs/types/index.js +23 -12
  26. package/lib/cjs/types/link.d.ts +4 -0
  27. package/lib/cjs/types/navBar.d.ts +136 -0
  28. package/lib/cjs/types/navBar.js +6 -0
  29. package/lib/components/NavBar/NavBar.js +5 -26
  30. package/lib/components/NavBar/NavBar.stories.js +1 -1
  31. package/lib/components/NavBarSection/NavBarItem.js +3 -14
  32. package/lib/components/NavBarSection/NavBarItemBody.js +6 -11
  33. package/lib/components/NavBarSection/NavBarItemButton.js +0 -7
  34. package/lib/components/NavBarSection/NavBarItemHeader.js +9 -33
  35. package/lib/components/NavBarSection/NavBarItemLink.js +0 -9
  36. package/lib/components/NavBarSection/NavBarSection.js +18 -50
  37. package/lib/hooks/useNavBarPress/useNavBarPress.js +5 -3
  38. package/lib/types/index.js +1 -0
  39. package/lib/types/navBar.js +1 -0
  40. package/package.json +1 -1
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { NavBarProps } from '../../types/navBar';
3
+ declare const NavBar: React.ForwardRefExoticComponent<NavBarProps & React.RefAttributes<HTMLElement>>;
4
+ export default NavBar;
@@ -16,17 +16,16 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/hel
16
16
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
17
17
  var _react = _interopRequireWildcard(require("react"));
18
18
  var _focus = require("@react-aria/focus");
19
- var _propTypes = _interopRequireDefault(require("prop-types"));
20
19
  var _NavBarContext = require("../../context/NavBarContext");
21
20
  var _useNavBarStyling = _interopRequireDefault(require("../../hooks/useNavBarStyling/useNavBarStyling"));
22
21
  var _useProgressiveState3 = _interopRequireDefault(require("../../hooks/useProgressiveState"));
23
- var _isIterable = require("../../utils/devUtils/props/isIterable");
24
22
  var _Box = _interopRequireDefault(require("../Box/Box"));
25
23
  var _react2 = require("@emotion/react");
26
24
  var _excluded = ["isAuto\u0421ollapsible", "defaultSelectedKey", "selectedKey", "setSelectedKey", "hasRestoreFocus", "defaultExpandedKeys", "children", "variant"];
27
25
  function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
28
26
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
29
27
  var NavBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
28
+ var _children$;
30
29
  var isAutoСollapsible = props.isAutoСollapsible,
31
30
  defaultSelectedKey = props.defaultSelectedKey,
32
31
  selectedKeyProp = props.selectedKey,
@@ -36,7 +35,7 @@ var NavBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
36
35
  children = props.children,
37
36
  variant = props.variant,
38
37
  others = (0, _objectWithoutProperties2["default"])(props, _excluded);
39
- var initialExpandedKeys = isAutoСollapsible && defaultExpandedKeys.length ? defaultExpandedKeys[0] : defaultExpandedKeys;
38
+ var initialExpandedKeys = isAutoСollapsible && (0, _isArray["default"])(defaultExpandedKeys) && defaultExpandedKeys.length ? defaultExpandedKeys[0] : defaultExpandedKeys;
40
39
  var _useState = (0, _react.useState)(initialExpandedKeys),
41
40
  _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
42
41
  expandedKeys = _useState2[0],
@@ -53,7 +52,7 @@ var NavBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
53
52
  };
54
53
  }) : [{
55
54
  item: children,
56
- key: children.key
55
+ key: !children ? '' : (_children$ = children[0]) === null || _children$ === void 0 ? void 0 : _children$.key
57
56
  }];
58
57
  var contextValue = (0, _react.useMemo)(function () {
59
58
  return {
@@ -74,11 +73,11 @@ var NavBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
74
73
  as: "nav"
75
74
  }, others), items.length ? (0, _react2.jsx)(_focus.FocusScope, {
76
75
  restoreFocus: hasRestoreFocus
77
- }, (0, _map["default"])(items).call(items, function (_ref) {
76
+ }, (0, _map["default"])(items).call(items, function (_ref, index) {
78
77
  var item = _ref.item,
79
78
  key = _ref.key;
80
79
  return (0, _react2.jsx)(FocusableItem, {
81
- key: key
80
+ key: key || "key".concat(index)
82
81
  }, item);
83
82
  })) : null));
84
83
  });
@@ -105,26 +104,6 @@ var FocusableItem = function FocusableItem(props) {
105
104
  });
106
105
  return childWithFocusHandle;
107
106
  };
108
- NavBar.propTypes = {
109
- /** Allows only one item to be expanded. */
110
- isAutoСollapsible: _propTypes["default"].bool,
111
- /** This applies a style to the entire nav tree. the options are default and popup. */
112
- variant: _propTypes["default"].oneOf(['default', 'popupNav']),
113
- /** Whether or not the focus will return to the previously focused element upon unmount. */
114
- hasRestoreFocus: _propTypes["default"].bool,
115
- /** The initial selected key in the collection (uncontrolled). */
116
- defaultSelectedKey: _propTypes["default"].string,
117
- /** The initial expanded keys in the collection (uncontrolled). */
118
- defaultExpandedKeys: _isIterable.isIterableProp,
119
- /** The selected key in the collection (controlled). */
120
- selectedKey: _isIterable.isIterableProp,
121
- /**
122
- * Callback function that fires when the selected key changes.
123
- *
124
- * `(selectedKey: String) => void`
125
- */
126
- setSelectedKey: _propTypes["default"].func
127
- };
128
107
  NavBar.defaultProps = {
129
108
  isAutoСollapsible: false,
130
109
  defaultSelectedKey: '',
@@ -0,0 +1,7 @@
1
+ import { StoryFn } from '@storybook/react';
2
+ import { NavBarProps } from '../../types';
3
+ declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
4
+ export default _default;
5
+ export declare const Default: StoryFn<NavBarProps>;
6
+ export declare const Controlled: StoryFn<NavBarProps>;
7
+ export declare const AutoCollapse: StoryFn<NavBarProps>;
@@ -25,7 +25,7 @@ var _ViewGridPlusOutlineIcon = _interopRequireDefault(require("@pingux/mdi-react
25
25
  var _storybookAddonDesigns = require("storybook-addon-designs");
26
26
  var _storybookDocsLayout = _interopRequireDefault(require("../../../.storybook/storybookDocsLayout"));
27
27
  var _index = require("../../index");
28
- var _figmaLinks = require("../../utils/designUtils/figmaLinks.ts");
28
+ var _figmaLinks = require("../../utils/designUtils/figmaLinks");
29
29
  var _NavBar = _interopRequireDefault(require("./NavBar.mdx"));
30
30
  var _react2 = require("@emotion/react");
31
31
  function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -0,0 +1,364 @@
1
+ declare const _default: {
2
+ container: {
3
+ height: string;
4
+ width: string;
5
+ position: string;
6
+ zIndex: string;
7
+ top: string;
8
+ left: string;
9
+ backgroundColor: string;
10
+ overflowY: string;
11
+ };
12
+ popUpContainer: {
13
+ minWidth: string;
14
+ maxWidth: string;
15
+ width: string;
16
+ backgroundColor: string;
17
+ borderRight: string;
18
+ borderRightColor: string;
19
+ height: string;
20
+ position: string;
21
+ zIndex: string;
22
+ top: string;
23
+ left: string;
24
+ overflowY: string;
25
+ };
26
+ itemHeaderContainer: {
27
+ flexGrow: number;
28
+ alignItems: string;
29
+ maxWidth: string;
30
+ py: string;
31
+ px: string;
32
+ cursor: string;
33
+ minHeight: string;
34
+ '&.is-selected': {
35
+ backgroundColor: string;
36
+ boxShadow: string;
37
+ };
38
+ };
39
+ popUpItemHeaderContainer: {
40
+ minHeight: string;
41
+ maxWidth: string;
42
+ pl: string;
43
+ pr: string;
44
+ '&.is-selected': {
45
+ backgroundColor: string;
46
+ };
47
+ flexGrow: number;
48
+ alignItems: string;
49
+ py: string;
50
+ px: string;
51
+ cursor: string;
52
+ };
53
+ popUpItemListItem: {
54
+ borderBottom: string;
55
+ };
56
+ sectionContainer: {
57
+ pt: string;
58
+ height: string;
59
+ maxHeight: string;
60
+ overflowY: string;
61
+ '&::-webkit-scrollbar-thumb': {
62
+ backgroundColor: string;
63
+ borderRadius: string;
64
+ };
65
+ '&::-webkit-scrollbar': {
66
+ width: number;
67
+ };
68
+ '&::-webkit-scrollbar-track': {
69
+ backgroundColor: string;
70
+ };
71
+ scrollbarColor: string;
72
+ '&:hover': {
73
+ '&::-webkit-scrollbar-thumb': {
74
+ backgroundColor: string;
75
+ borderRadius: string;
76
+ };
77
+ '&::-webkit-scrollbar-track': {
78
+ backgroundColor: string;
79
+ };
80
+ scrollbarColor: string;
81
+ };
82
+ };
83
+ popUpSectionContainer: {
84
+ height: string;
85
+ maxHeight: string;
86
+ overflowY: string;
87
+ '&::-webkit-scrollbar-thumb': {
88
+ backgroundColor: string;
89
+ borderRadius: string;
90
+ };
91
+ '&::-webkit-scrollbar': {
92
+ width: number;
93
+ };
94
+ '&::-webkit-scrollbar-track': {
95
+ backgroundColor: string;
96
+ };
97
+ scrollbarColor: string;
98
+ '&:hover': {
99
+ '&::-webkit-scrollbar-thumb': {
100
+ backgroundColor: string;
101
+ borderRadius: string;
102
+ };
103
+ '&::-webkit-scrollbar-track': {
104
+ backgroundColor: string;
105
+ };
106
+ scrollbarColor: string;
107
+ };
108
+ };
109
+ sectionBody: any;
110
+ sectionButton: {
111
+ width: string;
112
+ '&.is-focused': {
113
+ outline: string;
114
+ outlineColor: string;
115
+ };
116
+ '&.is-hovered': {
117
+ backgroundColor: string;
118
+ };
119
+ '&.is-pressed': {
120
+ backgroundColor: string;
121
+ };
122
+ all: string;
123
+ display: string;
124
+ };
125
+ popUpSectionButton: {
126
+ width: string;
127
+ '&.is-focused': {
128
+ outline: string;
129
+ outlineColor: string;
130
+ };
131
+ '&.is-hovered': {
132
+ backgroundColor: string;
133
+ };
134
+ '&.is-pressed': {
135
+ backgroundColor: string;
136
+ color: string;
137
+ };
138
+ '&.is-pressed > div > div > svg > path': {
139
+ fill: string;
140
+ };
141
+ all: string;
142
+ display: string;
143
+ };
144
+ itemButton: {
145
+ textDecoration: string;
146
+ outline: string;
147
+ cursor: string;
148
+ borderRadius: number;
149
+ backgroundColor: string;
150
+ paddingTop: string;
151
+ paddingBottom: string;
152
+ display: string;
153
+ color: string;
154
+ fontSize: string;
155
+ fontWeight: number;
156
+ flexGrow: string;
157
+ width: string;
158
+ textAlign: string;
159
+ whiteSpace: string;
160
+ overflowWrap: string;
161
+ maxWidth: string;
162
+ wordWrap: string;
163
+ wordBreak: string;
164
+ paddingLeft: string;
165
+ paddingRight: string;
166
+ '&.is-focused': {
167
+ outline: string;
168
+ outlineColor: string;
169
+ };
170
+ '&.is-hovered': {
171
+ bg: string;
172
+ };
173
+ '&.is-selected': {
174
+ bg: string;
175
+ boxShadow: string;
176
+ };
177
+ '&.is-pressed': {
178
+ bg: string;
179
+ };
180
+ };
181
+ popUpItemButton: {
182
+ fontSize: string;
183
+ px: string;
184
+ color: string;
185
+ '&.is-focused': {
186
+ outline: string;
187
+ outlineColor: string;
188
+ outlineOffset: string;
189
+ };
190
+ '&.is-selected': {
191
+ bg: string;
192
+ color: string;
193
+ };
194
+ '&.is-hovered': {
195
+ bg: string;
196
+ color: string;
197
+ };
198
+ '&.is-pressed': {
199
+ bg: string;
200
+ color: string;
201
+ };
202
+ textDecoration: string;
203
+ outline: string;
204
+ cursor: string;
205
+ borderRadius: number;
206
+ backgroundColor: string;
207
+ paddingTop: string;
208
+ paddingBottom: string;
209
+ display: string;
210
+ fontWeight: number;
211
+ flexGrow: string;
212
+ width: string;
213
+ textAlign: string;
214
+ whiteSpace: string;
215
+ overflowWrap: string;
216
+ maxWidth: string;
217
+ wordWrap: string;
218
+ wordBreak: string;
219
+ paddingLeft: string;
220
+ paddingRight: string;
221
+ };
222
+ subtitle: {
223
+ ml: string;
224
+ my: string;
225
+ fontWeight: number;
226
+ fontSize: string;
227
+ color: string;
228
+ zIndex: string;
229
+ };
230
+ headerText: {
231
+ whiteSpace: string;
232
+ lineHeight: number;
233
+ fontSize: string;
234
+ fontWeight: number;
235
+ maxWidth: string;
236
+ color: string;
237
+ '.is-selected &': {
238
+ color: string;
239
+ };
240
+ display: string;
241
+ overflowWrap: import("../..").overflowWrap;
242
+ wordWrap: import("../..").wordWrap;
243
+ wordBreak: import("../..").wordBreak;
244
+ };
245
+ popUpHeaderText: {
246
+ fontWeight: number;
247
+ color: string;
248
+ '.is-pressed &': {
249
+ color: string;
250
+ };
251
+ '.is-selected &': {
252
+ color: string;
253
+ };
254
+ whiteSpace: string;
255
+ lineHeight: number;
256
+ fontSize: string;
257
+ maxWidth: string;
258
+ display: string;
259
+ overflowWrap: import("../..").overflowWrap;
260
+ wordWrap: import("../..").wordWrap;
261
+ wordBreak: import("../..").wordBreak;
262
+ };
263
+ headerNav: {
264
+ cursor: string;
265
+ minHeight: string;
266
+ lineHeight: string;
267
+ outline: string;
268
+ display: string;
269
+ justifyContent: string;
270
+ flexShrink: number;
271
+ wordBreak: string;
272
+ whiteSpace: string;
273
+ color: string;
274
+ flexGrow: number;
275
+ fontWeight: number;
276
+ fontSize: string;
277
+ '&.is-focused': {
278
+ outline: string;
279
+ boxShadow: string;
280
+ WebkitBoxShadow: string;
281
+ MozBoxShadow: string;
282
+ };
283
+ '&.is-hovered': {
284
+ backgroundColor: string;
285
+ };
286
+ '&.is-pressed': {
287
+ backgroundColor: string;
288
+ };
289
+ };
290
+ item: {
291
+ py: string;
292
+ px: string;
293
+ '&.is-selected': {
294
+ backgroundColor: string;
295
+ boxShadow: string;
296
+ };
297
+ cursor: string;
298
+ minHeight: string;
299
+ lineHeight: string;
300
+ outline: string;
301
+ display: string;
302
+ justifyContent: string;
303
+ flexShrink: number;
304
+ wordBreak: string;
305
+ whiteSpace: string;
306
+ color: string;
307
+ flexGrow: number;
308
+ fontWeight: number;
309
+ fontSize: string;
310
+ '&.is-focused': {
311
+ outline: string;
312
+ boxShadow: string;
313
+ WebkitBoxShadow: string;
314
+ MozBoxShadow: string;
315
+ };
316
+ '&.is-hovered': {
317
+ backgroundColor: string;
318
+ };
319
+ '&.is-pressed': {
320
+ backgroundColor: string;
321
+ };
322
+ };
323
+ popUpItem: {
324
+ py: string;
325
+ px: string;
326
+ '&.is-selected': {
327
+ boxShadow: string;
328
+ };
329
+ cursor: string;
330
+ minHeight: string;
331
+ lineHeight: string;
332
+ outline: string;
333
+ display: string;
334
+ justifyContent: string;
335
+ flexShrink: number;
336
+ wordBreak: string;
337
+ whiteSpace: string;
338
+ color: string;
339
+ flexGrow: number;
340
+ fontWeight: number;
341
+ fontSize: string;
342
+ '&.is-focused': {
343
+ outline: string;
344
+ boxShadow: string;
345
+ WebkitBoxShadow: string;
346
+ MozBoxShadow: string;
347
+ };
348
+ '&.is-hovered': {
349
+ backgroundColor: string;
350
+ };
351
+ '&.is-pressed': {
352
+ backgroundColor: string;
353
+ };
354
+ };
355
+ navBarItemBody: {
356
+ alignItems: string;
357
+ mb: string;
358
+ };
359
+ popUpNavBarItemBody: {
360
+ mb: number;
361
+ alignItems: string;
362
+ };
363
+ };
364
+ export default _default;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export { default } from './NavBar';
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { NavBarItemProps } from '../../types/navBar';
3
+ declare const NavBarItem: React.ForwardRefExoticComponent<NavBarItemProps & React.RefAttributes<HTMLElement>>;
4
+ export default NavBarItem;
@@ -14,7 +14,6 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-c
14
14
  var _react = _interopRequireWildcard(require("react"));
15
15
  var _reactAria = require("react-aria");
16
16
  var _interactions = require("@react-aria/interactions");
17
- var _propTypes = _interopRequireDefault(require("prop-types"));
18
17
  var _NavBarContext = require("../../context/NavBarContext");
19
18
  var _hooks = require("../../hooks");
20
19
  var _index = require("../../index");
@@ -29,7 +28,7 @@ var NavBarItem = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
29
28
  key = props.id,
30
29
  onPressCallback = props.onPress,
31
30
  others = (0, _objectWithoutProperties2["default"])(props, _excluded);
32
- var navItemRef = (0, _react.useRef)();
31
+ var navItemRef = (0, _hooks.useLocalOrForwardRef)(null);
33
32
 
34
33
  /* istanbul ignore next */
35
34
  (0, _react.useImperativeHandle)(ref, function () {
@@ -98,15 +97,5 @@ var NavBarItem = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
98
97
  variant: state.navStyles.navBarItemText
99
98
  }, text)));
100
99
  });
101
- NavBarItem.propTypes = {
102
- /** Handler that is called when the press is released over the target. */
103
- onPress: _propTypes["default"].func,
104
- /** The icon to render in between each node. */
105
- icon: _propTypes["default"].elementType,
106
- /** The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). */
107
- id: _propTypes["default"].string,
108
- /** Text that will render within the component */
109
- text: _propTypes["default"].string
110
- };
111
100
  var _default = NavBarItem;
112
101
  exports["default"] = _default;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { NavBarItemBodyProps } from '../../types/navBar';
3
+ declare const NavBarItemBody: React.ForwardRefExoticComponent<NavBarItemBodyProps & React.RefAttributes<HTMLElement>>;
4
+ export default NavBarItemBody;
@@ -48,28 +48,23 @@ var NavBarItemBody = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
48
48
  return (0, _react2.jsx)(_index.Box, {
49
49
  variant: state.navStyles.navBarItemBody,
50
50
  ref: ref
51
- }, (0, _map["default"])(_context = item.children).call(_context, renderChild));
51
+ }, (item === null || item === void 0 ? void 0 : item.children) && (0, _map["default"])(_context = item.children).call(_context, renderChild));
52
52
  });
53
53
  var ChildItemWrapper = function ChildItemWrapper(_ref2) {
54
54
  var children = _ref2.children,
55
55
  _onKeyDown = _ref2.onKeyDown;
56
- var childrenKey = children.key || children;
56
+ var childrenKey = (children === null || children === void 0 ? void 0 : children.key) || children;
57
57
  var _useKeyboard = (0, _interactions.useKeyboard)({
58
58
  onKeyDown: function onKeyDown(e) {
59
- return _onKeyDown(e, childrenKey);
59
+ return _onKeyDown ? _onKeyDown(e, childrenKey) : undefined;
60
60
  }
61
61
  }),
62
62
  keyboardProps = _useKeyboard.keyboardProps;
63
63
  return (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({
64
64
  width: "100%"
65
- }, keyboardProps), children);
66
- };
67
- NavBarItemBody.propTypes = {
68
- item: _propTypes["default"].shape({
69
- children: _propTypes["default"].arrayOf(_propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].object])),
70
- key: _propTypes["default"].string
71
- }),
72
- onKeyDown: _propTypes["default"].func
65
+ }, keyboardProps, {
66
+ role: "none"
67
+ }), (0, _react2.jsx)(_react["default"].Fragment, null, ' ', children && children));
73
68
  };
74
69
  ChildItemWrapper.propTypes = {
75
70
  onKeyDown: _propTypes["default"].func
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { NavBarItemButtonProps } from '../../types/navBar';
3
+ declare const NavBarItemButton: (props: NavBarItemButtonProps) => React.JSX.Element;
4
+ export default NavBarItemButton;
@@ -9,7 +9,6 @@ exports["default"] = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
10
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
11
11
  var _react = _interopRequireDefault(require("react"));
12
- var _propTypes = _interopRequireDefault(require("prop-types"));
13
12
  var _NavBarContext = require("../../context/NavBarContext");
14
13
  var _hooks = require("../../hooks");
15
14
  var _index = require("../../index");
@@ -40,11 +39,5 @@ var NavBarItemButton = function NavBarItemButton(props) {
40
39
  color: isSelected ? 'white' : undefined
41
40
  }, others));
42
41
  };
43
- NavBarItemButton.propTypes = {
44
- /** Handler that is called when the press is released over the target. */
45
- onPress: _propTypes["default"].func,
46
- /** The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). */
47
- id: _propTypes["default"].string.isRequired
48
- };
49
42
  var _default = NavBarItemButton;
50
43
  exports["default"] = _default;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { NavBarItemHeaderProps } from '../../types/navBar';
3
+ declare const NavBarItemHeader: ({ item }: NavBarItemHeaderProps) => React.JSX.Element;
4
+ export default NavBarItemHeader;
@@ -15,15 +15,14 @@ var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
15
15
  var _react = _interopRequireWildcard(require("react"));
16
16
  var _MenuDownIcon = _interopRequireDefault(require("@pingux/mdi-react/MenuDownIcon"));
17
17
  var _MenuUpIcon = _interopRequireDefault(require("@pingux/mdi-react/MenuUpIcon"));
18
- var _propTypes = _interopRequireDefault(require("prop-types"));
19
18
  var _NavBarContext = require("../../context/NavBarContext");
20
19
  var _hooks = require("../../hooks");
21
20
  var _index = require("../../index");
22
21
  var _react2 = require("@emotion/react");
23
22
  function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
24
23
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
- var NavBarItemHeader = function NavBarItemHeader(props) {
26
- var item = props.item;
24
+ var NavBarItemHeader = function NavBarItemHeader(_ref) {
25
+ var item = _ref.item;
27
26
  var children = item.children,
28
27
  href = item.href;
29
28
  return !children && href ? (0, _react2.jsx)(NavBarPrimaryItemHeader, {
@@ -32,9 +31,10 @@ var NavBarItemHeader = function NavBarItemHeader(props) {
32
31
  item: item
33
32
  });
34
33
  };
35
- var NavBarSectionItemHeader = function NavBarSectionItemHeader(props) {
34
+ var NavBarSectionItemHeader = function NavBarSectionItemHeader(_ref2) {
36
35
  var _context;
37
- var item = props.item;
36
+ var item = _ref2.item;
37
+ // const { item } = props;
38
38
  var icon = item.icon,
39
39
  key = item.key,
40
40
  className = item.className,
@@ -45,10 +45,10 @@ var NavBarSectionItemHeader = function NavBarSectionItemHeader(props) {
45
45
  expandedKeys = navBarState.expandedKeys,
46
46
  navStyles = navBarState.navStyles;
47
47
  var isExpanded = (0, _includes["default"])(expandedKeys).call(expandedKeys, key);
48
- var array = (0, _map["default"])(_context = item.children).call(_context, function (i) {
48
+ var array = (item === null || item === void 0 ? void 0 : item.children) && (0, _map["default"])(_context = item.children).call(_context, function (i) {
49
49
  return i.key;
50
50
  });
51
- var childSelected = (0, _includes["default"])(array).call(array, navBarState.selectedKey);
51
+ var childSelected = array && (0, _includes["default"])(array).call(array, navBarState.selectedKey);
52
52
  (0, _react.useEffect)(function () {
53
53
  if (childSelected && isExpanded === false) {
54
54
  var _context2;
@@ -99,8 +99,8 @@ var NavBarSectionItemHeader = function NavBarSectionItemHeader(props) {
99
99
  }
100
100
  })));
101
101
  };
102
- var NavBarPrimaryItemHeader = function NavBarPrimaryItemHeader(_ref) {
103
- var item = _ref.item;
102
+ var NavBarPrimaryItemHeader = function NavBarPrimaryItemHeader(_ref3) {
103
+ var item = _ref3.item;
104
104
  var icon = item.icon,
105
105
  className = item.className,
106
106
  heading = item.heading,
@@ -144,29 +144,5 @@ var NavBarPrimaryItemHeader = function NavBarPrimaryItemHeader(_ref) {
144
144
  }
145
145
  })));
146
146
  };
147
- NavBarItemHeader.propTypes = {
148
- item: _propTypes["default"].shape({
149
- children: _propTypes["default"].arrayOf(_propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].object])),
150
- href: _propTypes["default"].string
151
- })
152
- };
153
- NavBarSectionItemHeader.propTypes = {
154
- item: _propTypes["default"].shape({
155
- heading: _propTypes["default"].string,
156
- icon: _propTypes["default"].elementType,
157
- className: _propTypes["default"].string,
158
- children: _propTypes["default"].arrayOf(_propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].object])),
159
- key: _propTypes["default"].string,
160
- href: _propTypes["default"].string
161
- })
162
- };
163
- NavBarPrimaryItemHeader.propTypes = {
164
- item: _propTypes["default"].shape({
165
- heading: _propTypes["default"].string,
166
- icon: _propTypes["default"].elementType,
167
- className: _propTypes["default"].string,
168
- customIcon: _propTypes["default"].elementType
169
- })
170
- };
171
147
  var _default = NavBarItemHeader;
172
148
  exports["default"] = _default;