@pingux/astro 2.37.1 → 2.37.2-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/NavBarSection/NavBarItemBody.js +4 -3
- package/lib/cjs/components/NavBarSection/NavBarItemBody.test.js +39 -2
- package/lib/cjs/components/NavBarSection/NavBarSection.js +2 -3
- package/lib/components/NavBarSection/NavBarItemBody.js +5 -4
- package/lib/components/NavBarSection/NavBarItemBody.test.js +39 -2
- package/lib/components/NavBarSection/NavBarSection.js +3 -4
- package/package.json +1 -1
@@ -19,7 +19,7 @@ var _index = require("../../index");
|
|
19
19
|
var _react2 = require("@emotion/react");
|
20
20
|
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); }
|
21
21
|
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; }
|
22
|
-
var NavBarItemBody = function
|
22
|
+
var NavBarItemBody = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
23
23
|
var _context;
|
24
24
|
var item = _ref.item,
|
25
25
|
onKeyDown = _ref.onKeyDown;
|
@@ -46,9 +46,10 @@ var NavBarItemBody = function NavBarItemBody(_ref) {
|
|
46
46
|
}, child);
|
47
47
|
};
|
48
48
|
return (0, _react2.jsx)(_index.Box, {
|
49
|
-
variant: state.navStyles.navBarItemBody
|
49
|
+
variant: state.navStyles.navBarItemBody,
|
50
|
+
ref: ref
|
50
51
|
}, (0, _map["default"])(_context = item.children).call(_context, renderChild));
|
51
|
-
};
|
52
|
+
});
|
52
53
|
var ChildItemWrapper = function ChildItemWrapper(_ref2) {
|
53
54
|
var children = _ref2.children,
|
54
55
|
_onKeyDown = _ref2.onKeyDown;
|
@@ -1,12 +1,51 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
4
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
4
5
|
var _react = _interopRequireDefault(require("react"));
|
5
6
|
var _ = require("../..");
|
6
7
|
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
8
|
+
var _universalComponentTest = require("../../utils/testUtils/universalComponentTest");
|
7
9
|
var _NavBar = _interopRequireDefault(require("../NavBar"));
|
8
10
|
var _NavBarItemBody = _interopRequireDefault(require("./NavBarItemBody"));
|
11
|
+
var _NavBarSection = _interopRequireDefault(require("./NavBarSection"));
|
9
12
|
var _react2 = require("@emotion/react");
|
13
|
+
var SUBTITLE = 'subtitle';
|
14
|
+
var TEXT = 'text';
|
15
|
+
var data = [{
|
16
|
+
key: 'Dashboard',
|
17
|
+
children: ['Users', 'Group', 'Populations', 'Attributes', 'Roles', 'Dashboard Unique']
|
18
|
+
}];
|
19
|
+
var NavBarWithItemBody = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
20
|
+
return (0, _react2.jsx)(_NavBar["default"], null, (0, _react2.jsx)(_NavBarItemBody["default"], (0, _extends2["default"])({
|
21
|
+
ref: ref
|
22
|
+
}, props, {
|
23
|
+
item: {
|
24
|
+
children: [(0, _react2.jsx)(_.Text, null, TEXT)]
|
25
|
+
}
|
26
|
+
})));
|
27
|
+
});
|
28
|
+
var NavBarWithSection = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
29
|
+
return (0, _react2.jsx)(_NavBar["default"], null, (0, _react2.jsx)(_NavBarSection["default"], (0, _extends2["default"])({
|
30
|
+
ref: ref
|
31
|
+
}, props, {
|
32
|
+
items: data
|
33
|
+
})));
|
34
|
+
});
|
35
|
+
|
36
|
+
// Needs to be added to each component's test file
|
37
|
+
(0, _universalComponentTest.universalComponentTests)({
|
38
|
+
renderComponent: function renderComponent(props) {
|
39
|
+
return (0, _react2.jsx)(NavBarWithItemBody, props);
|
40
|
+
}
|
41
|
+
});
|
42
|
+
|
43
|
+
// Needs to be added to each component's test file
|
44
|
+
(0, _universalComponentTest.universalComponentTests)({
|
45
|
+
renderComponent: function renderComponent(props) {
|
46
|
+
return (0, _react2.jsx)(NavBarWithSection, props);
|
47
|
+
}
|
48
|
+
});
|
10
49
|
var getComponent = function getComponent(item) {
|
11
50
|
return (0, _testWrapper.render)((0, _react2.jsx)(_NavBar["default"], null, (0, _react2.jsx)(_NavBarItemBody["default"], {
|
12
51
|
item: {
|
@@ -14,8 +53,6 @@ var getComponent = function getComponent(item) {
|
|
14
53
|
}
|
15
54
|
})));
|
16
55
|
};
|
17
|
-
var SUBTITLE = 'subtitle';
|
18
|
-
var TEXT = 'text';
|
19
56
|
describe('NavBarItemBody', function () {
|
20
57
|
describe('when its passed a component', function () {
|
21
58
|
it('renders the component', function () {
|
@@ -33,13 +33,12 @@ var _excluded = ["hasSeparator", "title", "items", "onKeyDown"],
|
|
33
33
|
*/
|
34
34
|
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); }
|
35
35
|
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; }
|
36
|
-
var NavBarSection = function
|
36
|
+
var NavBarSection = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
37
37
|
var hasSeparator = _ref.hasSeparator,
|
38
38
|
title = _ref.title,
|
39
39
|
items = _ref.items,
|
40
40
|
onKeyDown = _ref.onKeyDown,
|
41
41
|
others = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
42
|
-
var ref = (0, _react.useRef)();
|
43
42
|
var childrenItems = (0, _filter["default"])(items).call(items, function (item) {
|
44
43
|
return item.children || item.href;
|
45
44
|
});
|
@@ -70,7 +69,7 @@ var NavBarSection = function NavBarSection(_ref) {
|
|
70
69
|
onKeyDown: onKeyDown
|
71
70
|
}));
|
72
71
|
})));
|
73
|
-
};
|
72
|
+
});
|
74
73
|
var SectionItem = function SectionItem(_ref2) {
|
75
74
|
var item = _ref2.item,
|
76
75
|
onKeyDownProp = _ref2.onKeyDown;
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
2
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
3
|
-
import React, { Fragment } from 'react';
|
3
|
+
import React, { forwardRef, Fragment } from 'react';
|
4
4
|
import { useKeyboard } from '@react-aria/interactions';
|
5
5
|
import PropTypes from 'prop-types';
|
6
6
|
import { useNavBarContext } from '../../context/NavBarContext';
|
7
7
|
import { Box, Separator, Text } from '../../index';
|
8
8
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
9
|
-
var NavBarItemBody = function
|
9
|
+
var NavBarItemBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
10
10
|
var _context;
|
11
11
|
var item = _ref.item,
|
12
12
|
onKeyDown = _ref.onKeyDown;
|
@@ -33,9 +33,10 @@ var NavBarItemBody = function NavBarItemBody(_ref) {
|
|
33
33
|
}, child);
|
34
34
|
};
|
35
35
|
return ___EmotionJSX(Box, {
|
36
|
-
variant: state.navStyles.navBarItemBody
|
36
|
+
variant: state.navStyles.navBarItemBody,
|
37
|
+
ref: ref
|
37
38
|
}, _mapInstanceProperty(_context = item.children).call(_context, renderChild));
|
38
|
-
};
|
39
|
+
});
|
39
40
|
var ChildItemWrapper = function ChildItemWrapper(_ref2) {
|
40
41
|
var children = _ref2.children,
|
41
42
|
_onKeyDown = _ref2.onKeyDown;
|
@@ -1,9 +1,48 @@
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
1
2
|
import React from 'react';
|
2
3
|
import { Text } from '../..';
|
3
4
|
import { render, screen } from '../../utils/testUtils/testWrapper';
|
5
|
+
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
4
6
|
import NavBar from '../NavBar';
|
5
7
|
import NavBarItemBody from './NavBarItemBody';
|
8
|
+
import NavBarSection from './NavBarSection';
|
6
9
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
|
+
var SUBTITLE = 'subtitle';
|
11
|
+
var TEXT = 'text';
|
12
|
+
var data = [{
|
13
|
+
key: 'Dashboard',
|
14
|
+
children: ['Users', 'Group', 'Populations', 'Attributes', 'Roles', 'Dashboard Unique']
|
15
|
+
}];
|
16
|
+
var NavBarWithItemBody = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
17
|
+
return ___EmotionJSX(NavBar, null, ___EmotionJSX(NavBarItemBody, _extends({
|
18
|
+
ref: ref
|
19
|
+
}, props, {
|
20
|
+
item: {
|
21
|
+
children: [___EmotionJSX(Text, null, TEXT)]
|
22
|
+
}
|
23
|
+
})));
|
24
|
+
});
|
25
|
+
var NavBarWithSection = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
26
|
+
return ___EmotionJSX(NavBar, null, ___EmotionJSX(NavBarSection, _extends({
|
27
|
+
ref: ref
|
28
|
+
}, props, {
|
29
|
+
items: data
|
30
|
+
})));
|
31
|
+
});
|
32
|
+
|
33
|
+
// Needs to be added to each component's test file
|
34
|
+
universalComponentTests({
|
35
|
+
renderComponent: function renderComponent(props) {
|
36
|
+
return ___EmotionJSX(NavBarWithItemBody, props);
|
37
|
+
}
|
38
|
+
});
|
39
|
+
|
40
|
+
// Needs to be added to each component's test file
|
41
|
+
universalComponentTests({
|
42
|
+
renderComponent: function renderComponent(props) {
|
43
|
+
return ___EmotionJSX(NavBarWithSection, props);
|
44
|
+
}
|
45
|
+
});
|
7
46
|
var getComponent = function getComponent(item) {
|
8
47
|
return render(___EmotionJSX(NavBar, null, ___EmotionJSX(NavBarItemBody, {
|
9
48
|
item: {
|
@@ -11,8 +50,6 @@ var getComponent = function getComponent(item) {
|
|
11
50
|
}
|
12
51
|
})));
|
13
52
|
};
|
14
|
-
var SUBTITLE = 'subtitle';
|
15
|
-
var TEXT = 'text';
|
16
53
|
describe('NavBarItemBody', function () {
|
17
54
|
describe('when its passed a component', function () {
|
18
55
|
it('renders the component', function () {
|
@@ -6,7 +6,7 @@ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/insta
|
|
6
6
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
7
7
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
8
8
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
9
|
-
import React, {
|
9
|
+
import React, { forwardRef } from 'react';
|
10
10
|
import { useFocusManager } from '@react-aria/focus';
|
11
11
|
import { useKeyboard } from '@react-aria/interactions';
|
12
12
|
import PropTypes from 'prop-types';
|
@@ -21,13 +21,12 @@ import NavBarItemHeader from './NavBarItemHeader';
|
|
21
21
|
*
|
22
22
|
*/
|
23
23
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
24
|
-
var NavBarSection = function
|
24
|
+
var NavBarSection = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
25
25
|
var hasSeparator = _ref.hasSeparator,
|
26
26
|
title = _ref.title,
|
27
27
|
items = _ref.items,
|
28
28
|
onKeyDown = _ref.onKeyDown,
|
29
29
|
others = _objectWithoutProperties(_ref, _excluded);
|
30
|
-
var ref = useRef();
|
31
30
|
var childrenItems = _filterInstanceProperty(items).call(items, function (item) {
|
32
31
|
return item.children || item.href;
|
33
32
|
});
|
@@ -58,7 +57,7 @@ var NavBarSection = function NavBarSection(_ref) {
|
|
58
57
|
onKeyDown: onKeyDown
|
59
58
|
}));
|
60
59
|
})));
|
61
|
-
};
|
60
|
+
});
|
62
61
|
var SectionItem = function SectionItem(_ref2) {
|
63
62
|
var item = _ref2.item,
|
64
63
|
onKeyDownProp = _ref2.onKeyDown;
|