@pingux/astro 2.80.0 → 2.81.0-alpha.1
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.styles.d.ts +30 -0
- package/lib/cjs/components/NavBar/NavBar.styles.js +34 -1
- package/lib/cjs/components/NavBarSection/NavBarItemLink.js +1 -4
- package/lib/cjs/components/NavSideBar/Icon.test.d.ts +1 -0
- package/lib/cjs/components/NavSideBar/Icon.test.js +67 -0
- package/lib/cjs/components/NavSideBar/NavSideBar.d.ts +4 -0
- package/lib/cjs/components/NavSideBar/NavSideBar.js +115 -0
- package/lib/cjs/components/NavSideBar/NavSideBar.mdx +42 -0
- package/lib/cjs/components/NavSideBar/NavSideBar.stories.d.ts +8 -0
- package/lib/cjs/components/NavSideBar/NavSideBar.stories.js +1344 -0
- package/lib/cjs/components/NavSideBar/NavSideBar.test.d.ts +1 -0
- package/lib/cjs/components/NavSideBar/NavSideBar.test.js +311 -0
- package/lib/cjs/components/NavSideBar/NavSideBarHeader.d.ts +4 -0
- package/lib/cjs/components/NavSideBar/NavSideBarHeader.js +33 -0
- package/lib/cjs/components/NavSideBar/NavSideBarItem.d.ts +4 -0
- package/lib/cjs/components/NavSideBar/NavSideBarItem.js +112 -0
- package/lib/cjs/components/NavSideBar/NavSideBarSection.d.ts +4 -0
- package/lib/cjs/components/NavSideBar/NavSideBarSection.js +122 -0
- package/lib/cjs/components/NavSideBar/NavSideBarSectionHeader.d.ts +4 -0
- package/lib/cjs/components/NavSideBar/NavSideBarSectionHeader.js +98 -0
- package/lib/cjs/components/NavSideBar/NavSideBarSectionItem.d.ts +4 -0
- package/lib/cjs/components/NavSideBar/NavSideBarSectionItem.js +81 -0
- package/lib/cjs/components/NavSideBar/NavSideBarSubTitle.d.ts +4 -0
- package/lib/cjs/components/NavSideBar/NavSideBarSubTitle.js +25 -0
- package/lib/cjs/components/NavSideBar/icons.d.ts +15 -0
- package/lib/cjs/components/NavSideBar/icons.js +174 -0
- package/lib/cjs/components/NavSideBar/index.d.ts +5 -0
- package/lib/cjs/components/NavSideBar/index.js +42 -0
- package/lib/cjs/components/TextField/TextField.d.ts +4 -0
- package/lib/cjs/components/TextField/TextField.js +5 -79
- package/lib/cjs/components/TextField/TextField.stories.d.ts +22 -0
- package/lib/cjs/components/TextField/TextField.stories.js +24 -0
- package/lib/cjs/components/TextField/TextField.test.d.ts +1 -0
- package/lib/cjs/components/TextField/TextField.test.js +11 -9
- package/lib/cjs/components/TextField/index.d.ts +1 -0
- package/lib/cjs/hooks/useField/useField.d.ts +2 -1
- package/lib/cjs/hooks/useNavBarStyling/useNavBarStyling.d.ts +1 -0
- package/lib/cjs/hooks/useNavBarStyling/useNavBarStyling.js +14 -3
- package/lib/cjs/hooks/useNavBarStyling/useNavBarStyling.test.js +1 -1
- package/lib/cjs/index.d.ts +2 -0
- package/lib/cjs/index.js +54 -35
- package/lib/cjs/types/arrayField.d.ts +1 -1
- package/lib/cjs/types/copyText.d.ts +2 -0
- package/lib/cjs/types/helpHint.d.ts +1 -0
- package/lib/cjs/types/index.d.ts +2 -0
- package/lib/cjs/types/index.js +38 -16
- package/lib/cjs/types/link.d.ts +1 -0
- package/lib/cjs/types/navSideBar.d.ts +75 -0
- package/lib/cjs/types/navSideBar.js +6 -0
- package/lib/cjs/types/textField.d.ts +65 -0
- package/lib/cjs/types/textField.js +6 -0
- package/lib/components/NavBar/NavBar.styles.js +34 -1
- package/lib/components/NavBarSection/NavBarItemLink.js +1 -4
- package/lib/components/NavSideBar/Icon.test.js +58 -0
- package/lib/components/NavSideBar/NavSideBar.js +101 -0
- package/lib/components/NavSideBar/NavSideBar.mdx +42 -0
- package/lib/components/NavSideBar/NavSideBar.stories.js +1326 -0
- package/lib/components/NavSideBar/NavSideBar.test.js +308 -0
- package/lib/components/NavSideBar/NavSideBarHeader.js +19 -0
- package/lib/components/NavSideBar/NavSideBarItem.js +98 -0
- package/lib/components/NavSideBar/NavSideBarSection.js +108 -0
- package/lib/components/NavSideBar/NavSideBarSectionHeader.js +84 -0
- package/lib/components/NavSideBar/NavSideBarSectionItem.js +69 -0
- package/lib/components/NavSideBar/NavSideBarSubTitle.js +16 -0
- package/lib/components/NavSideBar/icons.js +102 -0
- package/lib/components/NavSideBar/index.js +5 -0
- package/lib/components/TextField/TextField.js +7 -81
- package/lib/components/TextField/TextField.stories.js +24 -0
- package/lib/components/TextField/TextField.test.js +11 -9
- package/lib/hooks/useNavBarStyling/useNavBarStyling.js +14 -3
- package/lib/hooks/useNavBarStyling/useNavBarStyling.test.js +1 -1
- package/lib/index.js +2 -0
- package/lib/types/index.js +2 -0
- package/lib/types/navSideBar.js +1 -0
- package/lib/types/textField.js +1 -0
- package/package.json +1 -1
@@ -142,6 +142,7 @@ declare const _default: {
|
|
142
142
|
display: string;
|
143
143
|
};
|
144
144
|
itemButton: {
|
145
|
+
marginY: string;
|
145
146
|
textDecoration: string;
|
146
147
|
outline: string;
|
147
148
|
cursor: string;
|
@@ -199,6 +200,7 @@ declare const _default: {
|
|
199
200
|
bg: string;
|
200
201
|
color: string;
|
201
202
|
};
|
203
|
+
marginY: string;
|
202
204
|
textDecoration: string;
|
203
205
|
outline: string;
|
204
206
|
cursor: string;
|
@@ -367,5 +369,33 @@ declare const _default: {
|
|
367
369
|
height: string;
|
368
370
|
marginBottom: number;
|
369
371
|
};
|
372
|
+
itemLinkButtonColor: {
|
373
|
+
color: string;
|
374
|
+
};
|
375
|
+
sectionList: {
|
376
|
+
margin: number;
|
377
|
+
padding: number;
|
378
|
+
listStyle: string;
|
379
|
+
};
|
380
|
+
itemIcon: {
|
381
|
+
mr: string;
|
382
|
+
color: string;
|
383
|
+
fill: string;
|
384
|
+
};
|
385
|
+
itemIconSelected: {
|
386
|
+
color: string;
|
387
|
+
fill: string;
|
388
|
+
mr: string;
|
389
|
+
};
|
390
|
+
itemCustomIcon: {
|
391
|
+
color: string;
|
392
|
+
fill: string;
|
393
|
+
ml: string;
|
394
|
+
};
|
395
|
+
itemCustomIconSelected: {
|
396
|
+
color: string;
|
397
|
+
fill: string;
|
398
|
+
ml: string;
|
399
|
+
};
|
370
400
|
};
|
371
401
|
export default _default;
|
@@ -127,6 +127,7 @@ var sectionBody = _objectSpread(_objectSpread({}, _AccordionGrid["default"].body
|
|
127
127
|
pl: '0'
|
128
128
|
});
|
129
129
|
var itemButton = {
|
130
|
+
marginY: '2px',
|
130
131
|
textDecoration: 'none',
|
131
132
|
outline: 'none',
|
132
133
|
cursor: 'pointer',
|
@@ -296,6 +297,32 @@ var navBarItemBody = {
|
|
296
297
|
var popUpNavBarItemBody = _objectSpread(_objectSpread({}, navBarItemBody), {}, {
|
297
298
|
mb: 0
|
298
299
|
});
|
300
|
+
var itemLinkButtonColor = {
|
301
|
+
color: 'white'
|
302
|
+
};
|
303
|
+
var sectionList = {
|
304
|
+
margin: 0,
|
305
|
+
padding: 0,
|
306
|
+
listStyle: 'none'
|
307
|
+
};
|
308
|
+
var itemIcon = {
|
309
|
+
mr: 'sm',
|
310
|
+
color: 'neutral.95',
|
311
|
+
fill: 'neutral.95'
|
312
|
+
};
|
313
|
+
var itemIconSelected = _objectSpread(_objectSpread({}, itemIcon), {}, {
|
314
|
+
color: 'white',
|
315
|
+
fill: 'white'
|
316
|
+
});
|
317
|
+
var itemCustomIcon = {
|
318
|
+
color: 'neutral.95',
|
319
|
+
fill: 'neutral.95',
|
320
|
+
ml: 'auto'
|
321
|
+
};
|
322
|
+
var itemCustomIconSelected = _objectSpread(_objectSpread({}, itemCustomIcon), {}, {
|
323
|
+
color: 'white',
|
324
|
+
fill: 'white'
|
325
|
+
});
|
299
326
|
var _default = {
|
300
327
|
container: container,
|
301
328
|
popUpContainer: popUpContainer,
|
@@ -316,6 +343,12 @@ var _default = {
|
|
316
343
|
item: item,
|
317
344
|
popUpItem: popUpItem,
|
318
345
|
navBarItemBody: navBarItemBody,
|
319
|
-
popUpNavBarItemBody: popUpNavBarItemBody
|
346
|
+
popUpNavBarItemBody: popUpNavBarItemBody,
|
347
|
+
itemLinkButtonColor: itemLinkButtonColor,
|
348
|
+
sectionList: sectionList,
|
349
|
+
itemIcon: itemIcon,
|
350
|
+
itemIconSelected: itemIconSelected,
|
351
|
+
itemCustomIcon: itemCustomIcon,
|
352
|
+
itemCustomIconSelected: itemCustomIconSelected
|
320
353
|
};
|
321
354
|
exports["default"] = _default;
|
@@ -47,10 +47,7 @@ var NavBarItemLink = function NavBarItemLink(props) {
|
|
47
47
|
onPress: onNavPress,
|
48
48
|
color: isSelected ? 'white' : undefined
|
49
49
|
}, others, {
|
50
|
-
sx: _objectSpread({
|
51
|
-
paddingLeft: '45px',
|
52
|
-
paddingRight: 'md'
|
53
|
-
}, props.sx)
|
50
|
+
sx: _objectSpread({}, props.sx)
|
54
51
|
}));
|
55
52
|
};
|
56
53
|
var _default = NavBarItemLink;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,67 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
|
4
|
+
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
5
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
6
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
7
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
10
|
+
var _react2 = require("@testing-library/react");
|
11
|
+
var _index = require("../../index");
|
12
|
+
var _universalComponentTest = require("../../utils/testUtils/universalComponentTest");
|
13
|
+
var _icons = require("./icons");
|
14
|
+
var _react3 = require("@emotion/react");
|
15
|
+
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); }
|
16
|
+
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; }
|
17
|
+
var testId = 'test-icon';
|
18
|
+
var defaultProps = {
|
19
|
+
'data-testid': testId
|
20
|
+
};
|
21
|
+
var getComponent = function getComponent() {
|
22
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
23
|
+
return (0, _react2.render)((0, _react3.jsx)(_index.Icon, (0, _extends2["default"])({}, defaultProps, props)));
|
24
|
+
};
|
25
|
+
|
26
|
+
// The mdi-react and @pingux/mid-react libraries don't support ref forwarding
|
27
|
+
// A simple implementation of an SVG component demonstrates ref forwarding
|
28
|
+
var SVGTestComponent = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
29
|
+
return (0, _react3.jsx)("svg", (0, _extends2["default"])({
|
30
|
+
ref: ref
|
31
|
+
}, props, {
|
32
|
+
"aria-labelledby": "id"
|
33
|
+
}), (0, _react3.jsx)("title", {
|
34
|
+
id: "id"
|
35
|
+
}, "title"));
|
36
|
+
});
|
37
|
+
|
38
|
+
// Needs to be added to each components test file
|
39
|
+
(0, _universalComponentTest.universalComponentTests)({
|
40
|
+
renderComponent: function renderComponent(props) {
|
41
|
+
return (0, _react3.jsx)(_index.Icon, (0, _extends2["default"])({
|
42
|
+
icon: SVGTestComponent
|
43
|
+
}, props));
|
44
|
+
}
|
45
|
+
});
|
46
|
+
test('Credentials icon', function () {
|
47
|
+
getComponent({
|
48
|
+
icon: _icons.Credentials,
|
49
|
+
title: {
|
50
|
+
name: 'Credentials Icon'
|
51
|
+
}
|
52
|
+
});
|
53
|
+
var icon = _react2.screen.getByTestId(testId);
|
54
|
+
expect(icon).toBeInstanceOf(SVGSVGElement);
|
55
|
+
expect(icon).toBeInTheDocument();
|
56
|
+
});
|
57
|
+
test('Verify icon', function () {
|
58
|
+
getComponent({
|
59
|
+
icon: _icons.Verify,
|
60
|
+
title: {
|
61
|
+
name: 'Verify Icon'
|
62
|
+
}
|
63
|
+
});
|
64
|
+
var icon = _react2.screen.getByTestId(testId);
|
65
|
+
expect(icon).toBeInstanceOf(SVGSVGElement);
|
66
|
+
expect(icon).toBeInTheDocument();
|
67
|
+
});
|
@@ -0,0 +1,115 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
|
4
|
+
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
5
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
6
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
7
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
8
|
+
_Object$defineProperty(exports, "__esModule", {
|
9
|
+
value: true
|
10
|
+
});
|
11
|
+
exports["default"] = void 0;
|
12
|
+
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
13
|
+
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
14
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
15
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
16
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
17
|
+
var _react = _interopRequireWildcard(require("react"));
|
18
|
+
var _focus = require("@react-aria/focus");
|
19
|
+
var _NavBarContext = require("../../context/NavBarContext");
|
20
|
+
var _hooks = require("../../hooks");
|
21
|
+
var _useNavBarStyling = _interopRequireDefault(require("../../hooks/useNavBarStyling/useNavBarStyling"));
|
22
|
+
var _useProgressiveState3 = _interopRequireDefault(require("../../hooks/useProgressiveState"));
|
23
|
+
var _Box = _interopRequireDefault(require("../Box/Box"));
|
24
|
+
var _react2 = require("@emotion/react");
|
25
|
+
var _excluded = ["isAuto\u0421ollapsible", "defaultSelectedKey", "selectedKey", "setSelectedKey", "hasRestoreFocus", "defaultExpandedKeys", "children", "variant"];
|
26
|
+
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); }
|
27
|
+
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; }
|
28
|
+
var NavSideBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
29
|
+
var _context;
|
30
|
+
var isAutoСollapsible = props.isAutoСollapsible,
|
31
|
+
defaultSelectedKey = props.defaultSelectedKey,
|
32
|
+
selectedKeyProp = props.selectedKey,
|
33
|
+
setSelectedKeyProp = props.setSelectedKey,
|
34
|
+
hasRestoreFocus = props.hasRestoreFocus,
|
35
|
+
defaultExpandedKeys = props.defaultExpandedKeys,
|
36
|
+
children = props.children,
|
37
|
+
variant = props.variant,
|
38
|
+
others = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
39
|
+
var initialExpandedKeys = isAutoСollapsible && (0, _isArray["default"])(defaultExpandedKeys) && defaultExpandedKeys.length ? defaultExpandedKeys[0] : defaultExpandedKeys;
|
40
|
+
var _useState = (0, _react.useState)(initialExpandedKeys),
|
41
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
42
|
+
expandedKeys = _useState2[0],
|
43
|
+
setExpandedKeys = _useState2[1];
|
44
|
+
var _useProgressiveState = (0, _useProgressiveState3["default"])(selectedKeyProp, defaultSelectedKey),
|
45
|
+
_useProgressiveState2 = (0, _slicedToArray2["default"])(_useProgressiveState, 2),
|
46
|
+
selectedKey = _useProgressiveState2[0],
|
47
|
+
setSelectedKey = _useProgressiveState2[1];
|
48
|
+
var navStyles = (0, _useNavBarStyling["default"])(variant || 'default');
|
49
|
+
var items = (0, _map["default"])(_context = _react["default"].Children.toArray(children)).call(_context, function (child) {
|
50
|
+
return {
|
51
|
+
item: child,
|
52
|
+
key: /*#__PURE__*/_react["default"].isValidElement(child) ? child.key : ''
|
53
|
+
};
|
54
|
+
});
|
55
|
+
var contextValue = (0, _react.useMemo)(function () {
|
56
|
+
return {
|
57
|
+
isAutoСollapsible: isAutoСollapsible,
|
58
|
+
selectedKey: selectedKey,
|
59
|
+
setSelectedKey: setSelectedKeyProp || setSelectedKey,
|
60
|
+
expandedKeys: expandedKeys,
|
61
|
+
setExpandedKeys: setExpandedKeys,
|
62
|
+
navStyles: navStyles
|
63
|
+
};
|
64
|
+
}, [isAutoСollapsible, selectedKey, setSelectedKeyProp, setSelectedKey, expandedKeys, setExpandedKeys, navStyles]);
|
65
|
+
var navSideBarRef = (0, _hooks.useLocalOrForwardRef)(ref);
|
66
|
+
return (0, _react2.jsx)(_NavBarContext.NavBarContext.Provider, {
|
67
|
+
value: contextValue
|
68
|
+
}, (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({
|
69
|
+
ref: navSideBarRef,
|
70
|
+
variant: navStyles.navBar,
|
71
|
+
role: "navigation",
|
72
|
+
as: "nav"
|
73
|
+
}, others), items.length ? (0, _react2.jsx)(_focus.FocusScope, {
|
74
|
+
restoreFocus: hasRestoreFocus
|
75
|
+
}, (0, _map["default"])(items).call(items, function (_ref, index) {
|
76
|
+
var item = _ref.item,
|
77
|
+
key = _ref.key;
|
78
|
+
return (0, _react2.jsx)(FocusableItem, {
|
79
|
+
key: key || "key".concat(index)
|
80
|
+
}, item);
|
81
|
+
})) : null));
|
82
|
+
});
|
83
|
+
var FocusableItem = function FocusableItem(props) {
|
84
|
+
var focusManager = (0, _focus.useFocusManager)();
|
85
|
+
var onKeyDown = function onKeyDown(e) {
|
86
|
+
switch (e.key) {
|
87
|
+
case 'ArrowRight':
|
88
|
+
case 'ArrowDown':
|
89
|
+
e.preventDefault();
|
90
|
+
focusManager.focusNext();
|
91
|
+
break;
|
92
|
+
case 'ArrowLeft':
|
93
|
+
case 'ArrowUp':
|
94
|
+
e.preventDefault();
|
95
|
+
focusManager.focusPrevious();
|
96
|
+
break;
|
97
|
+
default:
|
98
|
+
break;
|
99
|
+
}
|
100
|
+
};
|
101
|
+
var childWithFocusHandle = /*#__PURE__*/_react["default"].cloneElement(props.children, {
|
102
|
+
onKeyDown: onKeyDown
|
103
|
+
});
|
104
|
+
return childWithFocusHandle;
|
105
|
+
};
|
106
|
+
NavSideBar.defaultProps = {
|
107
|
+
isAutoСollapsible: false,
|
108
|
+
defaultSelectedKey: '',
|
109
|
+
defaultExpandedKeys: [],
|
110
|
+
variant: 'default',
|
111
|
+
hasRestoreFocus: true
|
112
|
+
};
|
113
|
+
NavSideBar.displayName = 'NavSideBar';
|
114
|
+
var _default = NavSideBar;
|
115
|
+
exports["default"] = _default;
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import { Meta } from '@storybook/addon-docs';
|
2
|
+
|
3
|
+
<Meta title="Components/NavSideBar/NavSideBar" />
|
4
|
+
|
5
|
+
# NavSideBar
|
6
|
+
|
7
|
+
The NavSideBar component is primarily to navigate within apps.
|
8
|
+
This component is built to have the NavSideBarSection component passed into it. Inside the NavSideBarSection, the NavSideBarSectionItem is passed.
|
9
|
+
|
10
|
+
The NavSideBar should:
|
11
|
+
- Be visually separate from the content.
|
12
|
+
- Have descriptive titles describing the destination, action item or category.
|
13
|
+
- Group navigation items into sections based on related categories.
|
14
|
+
- Order content logically for a natural progression.
|
15
|
+
|
16
|
+
### Required Components
|
17
|
+
|
18
|
+
This component requires these components:
|
19
|
+
- NavSideBarHeader
|
20
|
+
- NavSideBarItem
|
21
|
+
- NavSideBarSectionItem
|
22
|
+
- NavSideBarSection
|
23
|
+
|
24
|
+
### Accessibility
|
25
|
+
|
26
|
+
#### Keyboard Navigation
|
27
|
+
|
28
|
+
These keys provide additional functionality to the component.
|
29
|
+
|
30
|
+
| Key | Functions |
|
31
|
+
| ---- | ---- |
|
32
|
+
| Tab | All of the content in the NavSideBar is focusable. |
|
33
|
+
| Shift + Tab | Moves focus to the previous focusable component. |
|
34
|
+
| Space or Enter | Toggles the component when the accordion is focused. |
|
35
|
+
| Arrow keys | All components within the NavSideBar are accessible using arrow keys. |
|
36
|
+
| Esc | Pressing the escape key when the accordion is open and focused collapses the component. |
|
37
|
+
|
38
|
+
#### Screen readers
|
39
|
+
|
40
|
+
This component uses the following attributes to assist screen readers:
|
41
|
+
- Each Link component uses the **`aria-label`** attribute to provide an accessible name.
|
42
|
+
- The Icon uses the **`aria-hidden`** attribute to hide its content from assistive technology.
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { StoryFn } from '@storybook/react';
|
2
|
+
import { NavSideBarProps } 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<NavSideBarProps>;
|
6
|
+
export declare const Controlled: StoryFn<NavSideBarProps>;
|
7
|
+
export declare const AutoCollapse: StoryFn<NavSideBarProps>;
|
8
|
+
export declare const Dynamic: StoryFn<NavSideBarProps>;
|