@instructure/ui-navigation 8.56.1 → 8.56.2-pr-snapshot-1721749364069
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/CHANGELOG.md +8 -0
- package/lib/AppNav/AppNavLocator.js +2 -2
- package/lib/AppNav/Item/AppNavItemLocator.js +2 -2
- package/lib/AppNav/Item/index.js +11 -14
- package/lib/AppNav/index.js +16 -17
- package/lib/AppNav/props.js +2 -2
- package/lib/Navigation/NavigationItem/NavigationItemLocator.js +3 -3
- package/lib/Navigation/NavigationItem/index.js +9 -10
- package/lib/Navigation/NavigationLocator.js +2 -2
- package/lib/Navigation/index.js +9 -11
- package/lib/Navigation/props.js +3 -4
- package/package.json +24 -24
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [8.56.2-pr-snapshot-1721749364069](https://github.com/instructure/instructure-ui/compare/v8.56.1...v8.56.2-pr-snapshot-1721749364069) (2024-07-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-navigation
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [8.56.1](https://github.com/instructure/instructure-ui/compare/v8.56.0...v8.56.1) (2024-06-13)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @instructure/ui-navigation
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.AppNavLocator = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _uiTestLocator = require("@instructure/ui-test-locator");
|
|
8
8
|
var _index = require("./index");
|
|
9
9
|
var _AppNavItemLocator = require("./Item/AppNavItemLocator");
|
|
10
10
|
/*
|
|
@@ -32,7 +32,7 @@ var _AppNavItemLocator = require("./Item/AppNavItemLocator");
|
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
34
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
35
|
-
const AppNavLocator = exports.AppNavLocator = (0,
|
|
35
|
+
const AppNavLocator = exports.AppNavLocator = (0, _uiTestLocator.locator)(_index.AppNav.selector, {
|
|
36
36
|
findAllItems: (...args) => {
|
|
37
37
|
return _AppNavItemLocator.AppNavItemLocator.findAll(...args);
|
|
38
38
|
},
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.AppNavItemLocator = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _uiTestLocator = require("@instructure/ui-test-locator");
|
|
8
8
|
var _index = require("./index");
|
|
9
9
|
/*
|
|
10
10
|
* The MIT License (MIT)
|
|
@@ -31,4 +31,4 @@ var _index = require("./index");
|
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
33
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
34
|
-
const AppNavItemLocator = exports.AppNavItemLocator = (0,
|
|
34
|
+
const AppNavItemLocator = exports.AppNavItemLocator = (0, _uiTestLocator.locator)(_index.Item.selector);
|
package/lib/AppNav/Item/index.js
CHANGED
|
@@ -8,13 +8,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = exports.Item = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _console = require("@instructure/console");
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
16
|
-
var _View = require("@instructure/ui-view/lib/View");
|
|
17
|
-
var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
|
|
11
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
12
|
+
var _uiTestable = require("@instructure/ui-testable");
|
|
13
|
+
var _uiView = require("@instructure/ui-view");
|
|
14
|
+
var _uiA11yContent = require("@instructure/ui-a11y-content");
|
|
18
15
|
var _emotion = require("@instructure/emotion");
|
|
19
16
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
20
17
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
@@ -51,7 +48,7 @@ id: AppNav.Item
|
|
|
51
48
|
---
|
|
52
49
|
@module Item
|
|
53
50
|
**/
|
|
54
|
-
let Item = exports.Item = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0,
|
|
51
|
+
let Item = exports.Item = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _uiTestable.testable)(), _dec(_class = _dec2(_class = (_class2 = class Item extends _react.Component {
|
|
55
52
|
constructor(...args) {
|
|
56
53
|
super(...args);
|
|
57
54
|
this.ref = null;
|
|
@@ -84,7 +81,7 @@ let Item = exports.Item = (_dec = (0, _emotion.withStyle)(_styles.default, _them
|
|
|
84
81
|
}
|
|
85
82
|
render() {
|
|
86
83
|
var _this$props$styles, _this$props$styles2;
|
|
87
|
-
const ElementType = (0,
|
|
84
|
+
const ElementType = (0, _uiReactUtils.getElementType)(Item, this.props);
|
|
88
85
|
const _this$props4 = this.props,
|
|
89
86
|
renderIcon = _this$props4.renderIcon,
|
|
90
87
|
renderLabel = _this$props4.renderLabel,
|
|
@@ -92,13 +89,13 @@ let Item = exports.Item = (_dec = (0, _emotion.withStyle)(_styles.default, _them
|
|
|
92
89
|
renderAfter = _this$props4.renderAfter,
|
|
93
90
|
cursor = _this$props4.cursor,
|
|
94
91
|
isDisabled = _this$props4.isDisabled;
|
|
95
|
-
const icon = (0,
|
|
96
|
-
const label = (0,
|
|
97
|
-
const labelIsForScreenReaders = (0,
|
|
92
|
+
const icon = (0, _uiReactUtils.callRenderProp)(renderIcon);
|
|
93
|
+
const label = (0, _uiReactUtils.callRenderProp)(renderLabel);
|
|
94
|
+
const labelIsForScreenReaders = (0, _uiReactUtils.matchComponentTypes)(label, [_uiA11yContent.ScreenReaderContent]);
|
|
98
95
|
if (icon) {
|
|
99
96
|
(0, _console.logError)(labelIsForScreenReaders, '[AppNav] If an icon is used, the label text should be wrapped in <ScreenReaderContent />.');
|
|
100
97
|
}
|
|
101
|
-
return (0, _emotion.jsx)(
|
|
98
|
+
return (0, _emotion.jsx)(_uiView.View, Object.assign({}, (0, _uiReactUtils.passthroughProps)(this.props), {
|
|
102
99
|
as: ElementType,
|
|
103
100
|
href: href,
|
|
104
101
|
onClick: this.handleClick,
|
|
@@ -111,7 +108,7 @@ let Item = exports.Item = (_dec = (0, _emotion.withStyle)(_styles.default, _them
|
|
|
111
108
|
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.item
|
|
112
109
|
}), icon, labelIsForScreenReaders ? label : (0, _emotion.jsx)("span", {
|
|
113
110
|
css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.label
|
|
114
|
-
}, label), renderAfter && (0,
|
|
111
|
+
}, label), renderAfter && (0, _uiReactUtils.callRenderProp)(renderAfter));
|
|
115
112
|
}
|
|
116
113
|
}, _class2.displayName = "Item", _class2.componentId = 'AppNav.Item', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
|
117
114
|
children: null,
|
package/lib/AppNav/index.js
CHANGED
|
@@ -8,16 +8,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = exports.AppNav = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _emotion = require("@instructure/emotion");
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var _Menu = require("@instructure/ui-menu/lib/Menu");
|
|
11
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
12
|
+
var _uiTestable = require("@instructure/ui-testable");
|
|
13
|
+
var _uiView = require("@instructure/ui-view");
|
|
14
|
+
var _uiMenu = require("@instructure/ui-menu");
|
|
16
15
|
var _Item = require("./Item");
|
|
17
16
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
18
17
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
19
18
|
var _props = require("./props");
|
|
20
|
-
var
|
|
19
|
+
var _uiTruncateList = require("@instructure/ui-truncate-list");
|
|
21
20
|
var _dec, _dec2, _class, _class2;
|
|
22
21
|
/*
|
|
23
22
|
* The MIT License (MIT)
|
|
@@ -48,7 +47,7 @@ var _dec, _dec2, _class, _class2;
|
|
|
48
47
|
category: components
|
|
49
48
|
---
|
|
50
49
|
**/
|
|
51
|
-
let AppNav = exports.AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0,
|
|
50
|
+
let AppNav = exports.AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _uiTestable.testable)(), _dec(_class = _dec2(_class = (_class2 = class AppNav extends _react.Component {
|
|
52
51
|
constructor(...args) {
|
|
53
52
|
super(...args);
|
|
54
53
|
this.state = {
|
|
@@ -72,16 +71,16 @@ let AppNav = exports.AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _
|
|
|
72
71
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
73
72
|
}
|
|
74
73
|
renderMenu(items) {
|
|
75
|
-
return (0, _emotion.jsx)(
|
|
74
|
+
return (0, _emotion.jsx)(_uiMenu.Menu, {
|
|
76
75
|
trigger: (0, _emotion.jsx)(AppNav.Item, {
|
|
77
|
-
renderLabel: (0,
|
|
76
|
+
renderLabel: (0, _uiReactUtils.callRenderProp)(this.props.renderTruncateLabel)
|
|
78
77
|
})
|
|
79
78
|
}, items.map((item, index) => {
|
|
80
|
-
return (0, _emotion.jsx)(
|
|
79
|
+
return (0, _emotion.jsx)(_uiMenu.Menu.Item, {
|
|
81
80
|
href: item.props.href ? item.props.href : void 0,
|
|
82
81
|
onClick: item.props.onClick && !item.props.href ? item.props.onClick : void 0,
|
|
83
82
|
key: index
|
|
84
|
-
}, (0,
|
|
83
|
+
}, (0, _uiReactUtils.callRenderProp)(item.props.renderLabel));
|
|
85
84
|
}));
|
|
86
85
|
}
|
|
87
86
|
render() {
|
|
@@ -91,17 +90,17 @@ let AppNav = exports.AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _
|
|
|
91
90
|
margin = _this$props3.margin,
|
|
92
91
|
debounce = _this$props3.debounce,
|
|
93
92
|
styles = _this$props3.styles;
|
|
94
|
-
const passthroughProps =
|
|
95
|
-
const renderBeforeItems = (0,
|
|
96
|
-
const renderAfterItems = (0,
|
|
93
|
+
const passthroughProps = _uiView.View.omitViewProps((0, _uiReactUtils.omitProps)(this.props, AppNav.allowedProps), AppNav);
|
|
94
|
+
const renderBeforeItems = (0, _uiReactUtils.callRenderProp)(this.props.renderBeforeItems);
|
|
95
|
+
const renderAfterItems = (0, _uiReactUtils.callRenderProp)(this.props.renderAfterItems);
|
|
97
96
|
const hasRenderedContent = renderBeforeItems || renderAfterItems;
|
|
98
|
-
return (0, _emotion.jsx)(
|
|
97
|
+
return (0, _emotion.jsx)(_uiView.View, Object.assign({}, passthroughProps, {
|
|
99
98
|
as: "nav",
|
|
100
99
|
css: [styles === null || styles === void 0 ? void 0 : styles.appNav, hasRenderedContent ? styles === null || styles === void 0 ? void 0 : styles.alignCenter : ''],
|
|
101
100
|
margin: margin,
|
|
102
101
|
display: hasRenderedContent ? 'flex' : 'block',
|
|
103
102
|
elementRef: this.handleRef
|
|
104
|
-
}), renderBeforeItems && (0, _emotion.jsx)("span", null, renderBeforeItems), (0, _emotion.jsx)(
|
|
103
|
+
}), renderBeforeItems && (0, _emotion.jsx)("span", null, renderBeforeItems), (0, _emotion.jsx)(_uiTruncateList.TruncateList, {
|
|
105
104
|
visibleItemsCount: visibleItemsCount,
|
|
106
105
|
debounce: debounce,
|
|
107
106
|
onUpdate: this.props.onUpdate,
|
|
@@ -109,7 +108,7 @@ let AppNav = exports.AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _
|
|
|
109
108
|
itemSpacing: styles === null || styles === void 0 ? void 0 : styles.horizontalMargin,
|
|
110
109
|
fixMenuTriggerWidth: styles === null || styles === void 0 ? void 0 : styles.menuTriggerWidth,
|
|
111
110
|
css: styles === null || styles === void 0 ? void 0 : styles.list,
|
|
112
|
-
"aria-label": (0,
|
|
111
|
+
"aria-label": (0, _uiReactUtils.callRenderProp)(screenReaderLabel)
|
|
113
112
|
}, this.props.children), renderAfterItems && (0, _emotion.jsx)("span", null, renderAfterItems));
|
|
114
113
|
}
|
|
115
114
|
}, _class2.displayName = "AppNav", _class2.componentId = 'AppNav', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
package/lib/AppNav/props.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var
|
|
9
|
+
var _uiPropTypes = require("@instructure/ui-prop-types");
|
|
10
10
|
var _emotion = require("@instructure/emotion");
|
|
11
11
|
var _Item = require("./Item");
|
|
12
12
|
/*
|
|
@@ -35,7 +35,7 @@ var _Item = require("./Item");
|
|
|
35
35
|
|
|
36
36
|
const propTypes = exports.propTypes = {
|
|
37
37
|
screenReaderLabel: _propTypes.default.string.isRequired,
|
|
38
|
-
children:
|
|
38
|
+
children: _uiPropTypes.Children.oneOf([_Item.Item]),
|
|
39
39
|
debounce: _propTypes.default.number,
|
|
40
40
|
renderBeforeItems: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
41
41
|
renderAfterItems: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.NavigationItemLocator = void 0;
|
|
7
|
-
var
|
|
8
|
-
var _TooltipLocator = require("@instructure/ui-tooltip/
|
|
7
|
+
var _uiTestLocator = require("@instructure/ui-test-locator");
|
|
8
|
+
var _TooltipLocator = require("@instructure/ui-tooltip/es/Tooltip/TooltipLocator");
|
|
9
9
|
var _index = require("./index");
|
|
10
10
|
/*
|
|
11
11
|
* The MIT License (MIT)
|
|
@@ -35,6 +35,6 @@ var _index = require("./index");
|
|
|
35
35
|
// eslint-disable-next-line no-restricted-imports
|
|
36
36
|
|
|
37
37
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
38
|
-
const NavigationItemLocator = exports.NavigationItemLocator = (0,
|
|
38
|
+
const NavigationItemLocator = exports.NavigationItemLocator = (0, _uiTestLocator.locator)(_index.NavigationItem.selector, {
|
|
39
39
|
findTooltipContent: (...args) => _TooltipLocator.TooltipLocator.findContent(...args)
|
|
40
40
|
});
|
|
@@ -6,11 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.NavigationItem = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var _hasVisibleChildren = require("@instructure/ui-a11y-utils/lib/hasVisibleChildren.js");
|
|
9
|
+
var _uiTestable = require("@instructure/ui-testable");
|
|
10
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
11
|
+
var _uiTooltip = require("@instructure/ui-tooltip");
|
|
12
|
+
var _uiA11yUtils = require("@instructure/ui-a11y-utils");
|
|
14
13
|
var _emotion = require("@instructure/emotion");
|
|
15
14
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
16
15
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
@@ -46,7 +45,7 @@ parent: Navigation
|
|
|
46
45
|
id: Navigation.Item
|
|
47
46
|
---
|
|
48
47
|
**/
|
|
49
|
-
let NavigationItem = exports.NavigationItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0,
|
|
48
|
+
let NavigationItem = exports.NavigationItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _uiTestable.testable)(), _dec(_class = _dec2(_class = (_class2 = class NavigationItem extends _react.Component {
|
|
50
49
|
constructor(...args) {
|
|
51
50
|
super(...args);
|
|
52
51
|
this.ref = null;
|
|
@@ -72,13 +71,13 @@ let NavigationItem = exports.NavigationItem = (_dec = (0, _emotion.withStyle)(_s
|
|
|
72
71
|
}
|
|
73
72
|
renderLink(addRef) {
|
|
74
73
|
var _this$props$styles, _this$props$styles2, _this$props$styles3;
|
|
75
|
-
const ElementType = (0,
|
|
74
|
+
const ElementType = (0, _uiReactUtils.getElementType)(NavigationItem, this.props);
|
|
76
75
|
const _this$props3 = this.props,
|
|
77
76
|
href = _this$props3.href,
|
|
78
77
|
onClick = _this$props3.onClick,
|
|
79
78
|
icon = _this$props3.icon,
|
|
80
79
|
label = _this$props3.label;
|
|
81
|
-
const props = (0,
|
|
80
|
+
const props = (0, _uiReactUtils.omitProps)(this.props, NavigationItem.allowedProps);
|
|
82
81
|
return (0, _emotion.jsx)(ElementType, Object.assign({}, props, {
|
|
83
82
|
href: href,
|
|
84
83
|
onClick: onClick,
|
|
@@ -96,9 +95,9 @@ let NavigationItem = exports.NavigationItem = (_dec = (0, _emotion.withStyle)(_s
|
|
|
96
95
|
const _this$props4 = this.props,
|
|
97
96
|
minimized = _this$props4.minimized,
|
|
98
97
|
label = _this$props4.label;
|
|
99
|
-
const hasTooltip = minimized && (0,
|
|
98
|
+
const hasTooltip = minimized && (0, _uiA11yUtils.hasVisibleChildren)(label);
|
|
100
99
|
const link = this.renderLink(!hasTooltip);
|
|
101
|
-
return hasTooltip ? (0, _emotion.jsx)(
|
|
100
|
+
return hasTooltip ? (0, _emotion.jsx)(_uiTooltip.Tooltip, {
|
|
102
101
|
renderTip: label,
|
|
103
102
|
placement: "end",
|
|
104
103
|
elementRef: this.handleRef
|
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "NavigationItemLocator", {
|
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
exports.NavigationLocator = void 0;
|
|
13
|
-
var
|
|
13
|
+
var _uiTestLocator = require("@instructure/ui-test-locator");
|
|
14
14
|
var _index = require("./index");
|
|
15
15
|
var _NavigationItemLocator = require("./NavigationItem/NavigationItemLocator");
|
|
16
16
|
/*
|
|
@@ -38,7 +38,7 @@ var _NavigationItemLocator = require("./NavigationItem/NavigationItemLocator");
|
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
40
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
41
|
-
const NavigationLocator = exports.NavigationLocator = (0,
|
|
41
|
+
const NavigationLocator = exports.NavigationLocator = (0, _uiTestLocator.locator)(_index.Navigation.selector, {
|
|
42
42
|
findAllItems: (...args) => {
|
|
43
43
|
return _NavigationItemLocator.NavigationItemLocator.findAll(...args);
|
|
44
44
|
},
|
package/lib/Navigation/index.js
CHANGED
|
@@ -14,12 +14,10 @@ Object.defineProperty(exports, "NavigationItem", {
|
|
|
14
14
|
});
|
|
15
15
|
exports.default = void 0;
|
|
16
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var _IconMoveStartLine = require("@instructure/ui-icons/lib/IconMoveStartLine.js");
|
|
22
|
-
var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
|
|
17
|
+
var _uiTestable = require("@instructure/ui-testable");
|
|
18
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
19
|
+
var _uiIcons = require("@instructure/ui-icons");
|
|
20
|
+
var _uiA11yContent = require("@instructure/ui-a11y-content");
|
|
23
21
|
var _emotion = require("@instructure/emotion");
|
|
24
22
|
var _NavigationItem = require("./NavigationItem");
|
|
25
23
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
@@ -61,7 +59,7 @@ const navMinimized = ({
|
|
|
61
59
|
category: components/deprecated
|
|
62
60
|
---
|
|
63
61
|
**/
|
|
64
|
-
let Navigation = exports.Navigation = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0,
|
|
62
|
+
let Navigation = exports.Navigation = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _uiTestable.testable)(), _dec3 = (0, _uiReactUtils.deprecated)('9.0.0', null, 'This component is deprecated and will be removed in a later version. Use <SideNavBar /> instead.'), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class Navigation extends _react.Component {
|
|
65
63
|
constructor(props) {
|
|
66
64
|
super(props);
|
|
67
65
|
this.ref = null;
|
|
@@ -101,7 +99,7 @@ let Navigation = exports.Navigation = (_dec = (0, _emotion.withStyle)(_styles.de
|
|
|
101
99
|
renderChildren() {
|
|
102
100
|
return _react.Children.map(this.props.children, child => {
|
|
103
101
|
var _this$props$styles;
|
|
104
|
-
const navItem = (0,
|
|
102
|
+
const navItem = (0, _uiReactUtils.safeCloneElement)(child, {
|
|
105
103
|
minimized: this.state.minimized
|
|
106
104
|
});
|
|
107
105
|
return (0, _emotion.jsx)("li", {
|
|
@@ -115,7 +113,7 @@ let Navigation = exports.Navigation = (_dec = (0, _emotion.withStyle)(_styles.de
|
|
|
115
113
|
render() {
|
|
116
114
|
var _this$props$styles2, _this$props$styles3, _this$props$styles4, _this$props$styles5;
|
|
117
115
|
const label = this.props.label;
|
|
118
|
-
const props = (0,
|
|
116
|
+
const props = (0, _uiReactUtils.omitProps)(this.props, Navigation.allowedProps, ['minimized']);
|
|
119
117
|
return (0, _emotion.jsx)("nav", Object.assign({}, props, {
|
|
120
118
|
css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.navigation,
|
|
121
119
|
"aria-label": label,
|
|
@@ -129,11 +127,11 @@ let Navigation = exports.Navigation = (_dec = (0, _emotion.withStyle)(_styles.de
|
|
|
129
127
|
}, (0, _emotion.jsx)(_NavigationItem.NavigationItem, {
|
|
130
128
|
"aria-expanded": !this.minimized,
|
|
131
129
|
onClick: this.handleNavToggle,
|
|
132
|
-
icon: (0, _emotion.jsx)(
|
|
130
|
+
icon: (0, _emotion.jsx)(_uiIcons.IconMoveStartLine, {
|
|
133
131
|
css: (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.toggleIcon,
|
|
134
132
|
inline: false
|
|
135
133
|
}),
|
|
136
|
-
label: (0, _emotion.jsx)(
|
|
134
|
+
label: (0, _emotion.jsx)(_uiA11yContent.ScreenReaderContent, null, this.toggleMessage())
|
|
137
135
|
})));
|
|
138
136
|
}
|
|
139
137
|
}, _class2.displayName = "Navigation", _class2.componentId = 'Navigation', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
package/lib/Navigation/props.js
CHANGED
|
@@ -6,8 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var
|
|
10
|
-
var _Children = require("@instructure/ui-prop-types/lib/Children.js");
|
|
9
|
+
var _uiPropTypes = require("@instructure/ui-prop-types");
|
|
11
10
|
var _NavigationItem = require("./NavigationItem");
|
|
12
11
|
/*
|
|
13
12
|
* The MIT License (MIT)
|
|
@@ -34,8 +33,8 @@ var _NavigationItem = require("./NavigationItem");
|
|
|
34
33
|
*/
|
|
35
34
|
|
|
36
35
|
const propTypes = exports.propTypes = {
|
|
37
|
-
children:
|
|
38
|
-
minimized: (0,
|
|
36
|
+
children: _uiPropTypes.Children.oneOf([_NavigationItem.NavigationItem]),
|
|
37
|
+
minimized: (0, _uiPropTypes.controllable)(_propTypes.default.bool, 'onMinimized', 'defaultMinimized'),
|
|
39
38
|
defaultMinimized: _propTypes.default.bool,
|
|
40
39
|
onMinimized: _propTypes.default.func,
|
|
41
40
|
label: _propTypes.default.string.isRequired,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-navigation",
|
|
3
|
-
"version": "8.56.
|
|
3
|
+
"version": "8.56.2-pr-snapshot-1721749364069",
|
|
4
4
|
"description": "Main and application level navigational components",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,32 +23,32 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.56.
|
|
27
|
-
"@instructure/ui-color-utils": "8.56.
|
|
28
|
-
"@instructure/ui-test-locator": "8.56.
|
|
29
|
-
"@instructure/ui-test-utils": "8.56.
|
|
30
|
-
"@instructure/ui-themes": "8.56.
|
|
26
|
+
"@instructure/ui-babel-preset": "8.56.2-pr-snapshot-1721749364069",
|
|
27
|
+
"@instructure/ui-color-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
28
|
+
"@instructure/ui-test-locator": "8.56.2-pr-snapshot-1721749364069",
|
|
29
|
+
"@instructure/ui-test-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
30
|
+
"@instructure/ui-themes": "8.56.2-pr-snapshot-1721749364069"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.23.2",
|
|
34
|
-
"@instructure/console": "8.56.
|
|
35
|
-
"@instructure/debounce": "8.56.
|
|
36
|
-
"@instructure/emotion": "8.56.
|
|
37
|
-
"@instructure/shared-types": "8.56.
|
|
38
|
-
"@instructure/ui-a11y-content": "8.56.
|
|
39
|
-
"@instructure/ui-a11y-utils": "8.56.
|
|
40
|
-
"@instructure/ui-badge": "8.56.
|
|
41
|
-
"@instructure/ui-dom-utils": "8.56.
|
|
42
|
-
"@instructure/ui-focusable": "8.56.
|
|
43
|
-
"@instructure/ui-icons": "8.56.
|
|
44
|
-
"@instructure/ui-menu": "8.56.
|
|
45
|
-
"@instructure/ui-prop-types": "8.56.
|
|
46
|
-
"@instructure/ui-react-utils": "8.56.
|
|
47
|
-
"@instructure/ui-testable": "8.56.
|
|
48
|
-
"@instructure/ui-tooltip": "8.56.
|
|
49
|
-
"@instructure/ui-truncate-list": "8.56.
|
|
50
|
-
"@instructure/ui-utils": "8.56.
|
|
51
|
-
"@instructure/ui-view": "8.56.
|
|
34
|
+
"@instructure/console": "8.56.2-pr-snapshot-1721749364069",
|
|
35
|
+
"@instructure/debounce": "8.56.2-pr-snapshot-1721749364069",
|
|
36
|
+
"@instructure/emotion": "8.56.2-pr-snapshot-1721749364069",
|
|
37
|
+
"@instructure/shared-types": "8.56.2-pr-snapshot-1721749364069",
|
|
38
|
+
"@instructure/ui-a11y-content": "8.56.2-pr-snapshot-1721749364069",
|
|
39
|
+
"@instructure/ui-a11y-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
40
|
+
"@instructure/ui-badge": "8.56.2-pr-snapshot-1721749364069",
|
|
41
|
+
"@instructure/ui-dom-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
42
|
+
"@instructure/ui-focusable": "8.56.2-pr-snapshot-1721749364069",
|
|
43
|
+
"@instructure/ui-icons": "8.56.2-pr-snapshot-1721749364069",
|
|
44
|
+
"@instructure/ui-menu": "8.56.2-pr-snapshot-1721749364069",
|
|
45
|
+
"@instructure/ui-prop-types": "8.56.2-pr-snapshot-1721749364069",
|
|
46
|
+
"@instructure/ui-react-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
47
|
+
"@instructure/ui-testable": "8.56.2-pr-snapshot-1721749364069",
|
|
48
|
+
"@instructure/ui-tooltip": "8.56.2-pr-snapshot-1721749364069",
|
|
49
|
+
"@instructure/ui-truncate-list": "8.56.2-pr-snapshot-1721749364069",
|
|
50
|
+
"@instructure/ui-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
51
|
+
"@instructure/ui-view": "8.56.2-pr-snapshot-1721749364069",
|
|
52
52
|
"prop-types": "^15.8.1"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|