@instructure/ui-navigation 8.33.1 → 8.33.2
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 +4 -0
- package/es/AppNav/AppNavLocator.js +3 -1
- package/es/AppNav/Item/AppNavItemLocator.js +2 -1
- package/es/AppNav/Item/index.js +9 -23
- package/es/AppNav/Item/styles.js +1 -2
- package/es/AppNav/Item/theme.js +4 -4
- package/es/AppNav/index.js +6 -16
- package/es/AppNav/locator.js +1 -0
- package/es/AppNav/props.js +1 -0
- package/es/AppNav/styles.js +0 -1
- package/es/AppNav/theme.js +5 -5
- package/es/Navigation/NavigationItem/NavigationItemLocator.js +4 -3
- package/es/Navigation/NavigationItem/index.js +7 -19
- package/es/Navigation/NavigationItem/styles.js +0 -1
- package/es/Navigation/NavigationItem/theme.js +5 -5
- package/es/Navigation/NavigationLocator.js +2 -1
- package/es/Navigation/index.js +1 -21
- package/es/Navigation/props.js +1 -0
- package/es/Navigation/styles.js +0 -1
- package/es/Navigation/theme.js +6 -6
- package/es/index.js +1 -0
- package/lib/AppNav/AppNavLocator.js +1 -4
- package/lib/AppNav/Item/AppNavItemLocator.js +1 -3
- package/lib/AppNav/Item/index.js +8 -38
- package/lib/AppNav/Item/locator.js +0 -2
- package/lib/AppNav/Item/props.js +1 -3
- package/lib/AppNav/Item/styles.js +1 -3
- package/lib/AppNav/Item/theme.js +4 -5
- package/lib/AppNav/index.js +5 -32
- package/lib/AppNav/locator.js +0 -2
- package/lib/AppNav/props.js +1 -6
- package/lib/AppNav/styles.js +0 -2
- package/lib/AppNav/theme.js +5 -6
- package/lib/Navigation/NavigationItem/NavigationItemLocator.js +2 -4
- package/lib/Navigation/NavigationItem/index.js +6 -29
- package/lib/Navigation/NavigationItem/locator.js +0 -2
- package/lib/Navigation/NavigationItem/props.js +1 -3
- package/lib/Navigation/NavigationItem/styles.js +0 -2
- package/lib/Navigation/NavigationItem/theme.js +5 -6
- package/lib/Navigation/NavigationLocator.js +1 -4
- package/lib/Navigation/index.js +1 -34
- package/lib/Navigation/locator.js +0 -2
- package/lib/Navigation/props.js +1 -6
- package/lib/Navigation/styles.js +0 -2
- package/lib/Navigation/theme.js +6 -7
- package/lib/index.js +0 -2
- package/package.json +24 -24
- package/tsconfig.build.tsbuildinfo +1 -1
package/lib/AppNav/Item/index.js
CHANGED
|
@@ -1,42 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.default = exports.Item = void 0;
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
10
|
var _console = require("@instructure/console");
|
|
15
|
-
|
|
16
11
|
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
17
|
-
|
|
18
12
|
var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
|
|
19
|
-
|
|
20
13
|
var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
|
|
21
|
-
|
|
22
14
|
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
23
|
-
|
|
24
15
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
25
|
-
|
|
26
16
|
var _View = require("@instructure/ui-view/lib/View");
|
|
27
|
-
|
|
28
17
|
var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
|
|
29
|
-
|
|
30
18
|
var _emotion = require("@instructure/emotion");
|
|
31
|
-
|
|
32
19
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
33
|
-
|
|
34
20
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
35
|
-
|
|
36
21
|
var _props = require("./props");
|
|
37
|
-
|
|
38
22
|
var _dec, _dec2, _class, _class2;
|
|
39
|
-
|
|
40
23
|
/**
|
|
41
24
|
---
|
|
42
25
|
parent: AppNav
|
|
@@ -49,21 +32,17 @@ let Item = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
49
32
|
constructor() {
|
|
50
33
|
super(...arguments);
|
|
51
34
|
this.ref = null;
|
|
52
|
-
|
|
53
35
|
this.handleRef = el => {
|
|
54
36
|
const elementRef = this.props.elementRef;
|
|
55
37
|
this.ref = el;
|
|
56
|
-
|
|
57
38
|
if (typeof elementRef === 'function') {
|
|
58
39
|
elementRef(el);
|
|
59
40
|
}
|
|
60
41
|
};
|
|
61
|
-
|
|
62
42
|
this.handleClick = e => {
|
|
63
43
|
const _this$props = this.props,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
44
|
+
isDisabled = _this$props.isDisabled,
|
|
45
|
+
onClick = _this$props.onClick;
|
|
67
46
|
if (isDisabled) {
|
|
68
47
|
e.preventDefault();
|
|
69
48
|
e.stopPropagation();
|
|
@@ -72,38 +51,30 @@ let Item = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
72
51
|
}
|
|
73
52
|
};
|
|
74
53
|
}
|
|
75
|
-
|
|
76
54
|
componentDidMount() {
|
|
77
55
|
var _this$props$makeStyle, _this$props2;
|
|
78
|
-
|
|
79
56
|
(_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
|
|
80
57
|
}
|
|
81
|
-
|
|
82
58
|
componentDidUpdate() {
|
|
83
59
|
var _this$props$makeStyle2, _this$props3;
|
|
84
|
-
|
|
85
60
|
(_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
|
|
86
61
|
}
|
|
87
|
-
|
|
88
62
|
render() {
|
|
89
63
|
var _this$props$styles, _this$props$styles2;
|
|
90
|
-
|
|
91
64
|
const ElementType = (0, _getElementType.getElementType)(Item, this.props);
|
|
92
65
|
const _this$props4 = this.props,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
66
|
+
renderIcon = _this$props4.renderIcon,
|
|
67
|
+
renderLabel = _this$props4.renderLabel,
|
|
68
|
+
href = _this$props4.href,
|
|
69
|
+
renderAfter = _this$props4.renderAfter,
|
|
70
|
+
cursor = _this$props4.cursor,
|
|
71
|
+
isDisabled = _this$props4.isDisabled;
|
|
99
72
|
const icon = (0, _callRenderProp.callRenderProp)(renderIcon);
|
|
100
73
|
const label = (0, _callRenderProp.callRenderProp)(renderLabel);
|
|
101
74
|
const labelIsForScreenReaders = (0, _matchComponentTypes.matchComponentTypes)(label, [_ScreenReaderContent.ScreenReaderContent]);
|
|
102
|
-
|
|
103
75
|
if (icon) {
|
|
104
76
|
(0, _console.logError)(labelIsForScreenReaders, '[AppNav] If an icon is used, the label text should be wrapped in <ScreenReaderContent />.');
|
|
105
77
|
}
|
|
106
|
-
|
|
107
78
|
return (0, _emotion.jsx)(_View.View, Object.assign({}, (0, _passthroughProps.passthroughProps)(this.props), {
|
|
108
79
|
as: ElementType,
|
|
109
80
|
href: href,
|
|
@@ -119,7 +90,6 @@ let Item = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
119
90
|
css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.label
|
|
120
91
|
}, label), renderAfter && (0, _callRenderProp.callRenderProp)(renderAfter));
|
|
121
92
|
}
|
|
122
|
-
|
|
123
93
|
}, _class2.displayName = "Item", _class2.componentId = 'AppNav.Item', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
|
124
94
|
children: null,
|
|
125
95
|
isSelected: false,
|
package/lib/AppNav/Item/props.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
/*
|
|
13
10
|
* The MIT License (MIT)
|
|
14
11
|
*
|
|
@@ -32,6 +29,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
32
29
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
30
|
* SOFTWARE.
|
|
34
31
|
*/
|
|
32
|
+
|
|
35
33
|
const propTypes = {
|
|
36
34
|
renderLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.string, _propTypes.default.func]).isRequired,
|
|
37
35
|
renderAfter: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/*
|
|
9
8
|
* The MIT License (MIT)
|
|
10
9
|
*
|
|
@@ -41,7 +40,7 @@ exports.default = void 0;
|
|
|
41
40
|
*/
|
|
42
41
|
const generateStyle = (componentTheme, props) => {
|
|
43
42
|
const isSelected = props.isSelected,
|
|
44
|
-
|
|
43
|
+
isDisabled = props.isDisabled;
|
|
45
44
|
const itemStyles = {
|
|
46
45
|
appearance: 'none',
|
|
47
46
|
overflow: 'visible',
|
|
@@ -89,6 +88,5 @@ const generateStyle = (componentTheme, props) => {
|
|
|
89
88
|
}
|
|
90
89
|
};
|
|
91
90
|
};
|
|
92
|
-
|
|
93
91
|
var _default = generateStyle;
|
|
94
92
|
exports.default = _default;
|
package/lib/AppNav/Item/theme.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/*
|
|
9
8
|
* The MIT License (MIT)
|
|
10
9
|
*
|
|
@@ -36,8 +35,8 @@ exports.default = void 0;
|
|
|
36
35
|
*/
|
|
37
36
|
const generateComponentTheme = theme => {
|
|
38
37
|
const colors = theme.colors,
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
spacing = theme.spacing,
|
|
39
|
+
typography = theme.typography;
|
|
41
40
|
const componentVariables = {
|
|
42
41
|
fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
|
|
43
42
|
fontSize: '1.125rem',
|
|
@@ -48,9 +47,9 @@ const generateComponentTheme = theme => {
|
|
|
48
47
|
padding: spacing === null || spacing === void 0 ? void 0 : spacing.small,
|
|
49
48
|
backgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest
|
|
50
49
|
};
|
|
51
|
-
return {
|
|
50
|
+
return {
|
|
51
|
+
...componentVariables
|
|
52
52
|
};
|
|
53
53
|
};
|
|
54
|
-
|
|
55
54
|
var _default = generateComponentTheme;
|
|
56
55
|
exports.default = _default;
|
package/lib/AppNav/index.js
CHANGED
|
@@ -1,40 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.default = exports.AppNav = void 0;
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
10
|
var _emotion = require("@instructure/emotion");
|
|
15
|
-
|
|
16
11
|
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
17
|
-
|
|
18
12
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
19
|
-
|
|
20
13
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
21
|
-
|
|
22
14
|
var _View = require("@instructure/ui-view/lib/View");
|
|
23
|
-
|
|
24
15
|
var _Menu = require("@instructure/ui-menu/lib/Menu");
|
|
25
|
-
|
|
26
16
|
var _Item = require("./Item");
|
|
27
|
-
|
|
28
17
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
29
|
-
|
|
30
18
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
31
|
-
|
|
32
19
|
var _props = require("./props");
|
|
33
|
-
|
|
34
20
|
var _TruncateList = require("@instructure/ui-truncate-list/lib/TruncateList");
|
|
35
|
-
|
|
36
21
|
var _dec, _dec2, _class, _class2;
|
|
37
|
-
|
|
38
22
|
/**
|
|
39
23
|
---
|
|
40
24
|
category: components
|
|
@@ -48,29 +32,22 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
48
32
|
isMeasuring: false
|
|
49
33
|
};
|
|
50
34
|
this.ref = null;
|
|
51
|
-
|
|
52
35
|
this.handleRef = el => {
|
|
53
36
|
const elementRef = this.props.elementRef;
|
|
54
37
|
this.ref = el;
|
|
55
|
-
|
|
56
38
|
if (typeof elementRef === 'function') {
|
|
57
39
|
elementRef(el);
|
|
58
40
|
}
|
|
59
41
|
};
|
|
60
42
|
}
|
|
61
|
-
|
|
62
43
|
componentDidMount() {
|
|
63
44
|
var _this$props$makeStyle, _this$props;
|
|
64
|
-
|
|
65
45
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
66
46
|
}
|
|
67
|
-
|
|
68
47
|
componentDidUpdate() {
|
|
69
48
|
var _this$props$makeStyle2, _this$props2;
|
|
70
|
-
|
|
71
49
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
72
50
|
}
|
|
73
|
-
|
|
74
51
|
renderMenu(items) {
|
|
75
52
|
return (0, _emotion.jsx)(_Menu.Menu, {
|
|
76
53
|
trigger: (0, _emotion.jsx)(AppNav.Item, {
|
|
@@ -84,17 +61,14 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
84
61
|
}, (0, _callRenderProp.callRenderProp)(item.props.renderLabel));
|
|
85
62
|
}));
|
|
86
63
|
}
|
|
87
|
-
|
|
88
64
|
render() {
|
|
89
65
|
const _this$props3 = this.props,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
66
|
+
visibleItemsCount = _this$props3.visibleItemsCount,
|
|
67
|
+
screenReaderLabel = _this$props3.screenReaderLabel,
|
|
68
|
+
margin = _this$props3.margin,
|
|
69
|
+
debounce = _this$props3.debounce,
|
|
70
|
+
styles = _this$props3.styles;
|
|
96
71
|
const passthroughProps = _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, AppNav.allowedProps), AppNav);
|
|
97
|
-
|
|
98
72
|
const renderBeforeItems = (0, _callRenderProp.callRenderProp)(this.props.renderBeforeItems);
|
|
99
73
|
const renderAfterItems = (0, _callRenderProp.callRenderProp)(this.props.renderAfterItems);
|
|
100
74
|
const hasRenderedContent = renderBeforeItems || renderAfterItems;
|
|
@@ -115,7 +89,6 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
115
89
|
"aria-label": (0, _callRenderProp.callRenderProp)(screenReaderLabel)
|
|
116
90
|
}, this.props.children), renderAfterItems && (0, _emotion.jsx)("span", null, renderAfterItems));
|
|
117
91
|
}
|
|
118
|
-
|
|
119
92
|
}, _class2.displayName = "AppNav", _class2.componentId = 'AppNav', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
|
120
93
|
children: null,
|
|
121
94
|
debounce: 300,
|
package/lib/AppNav/locator.js
CHANGED
package/lib/AppNav/props.js
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _Children = require("@instructure/ui-prop-types/lib/Children.js");
|
|
13
|
-
|
|
14
10
|
var _emotion = require("@instructure/emotion");
|
|
15
|
-
|
|
16
11
|
var _Item = require("./Item");
|
|
17
|
-
|
|
18
12
|
/*
|
|
19
13
|
* The MIT License (MIT)
|
|
20
14
|
*
|
|
@@ -38,6 +32,7 @@ var _Item = require("./Item");
|
|
|
38
32
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
39
33
|
* SOFTWARE.
|
|
40
34
|
*/
|
|
35
|
+
|
|
41
36
|
const propTypes = {
|
|
42
37
|
screenReaderLabel: _propTypes.default.string.isRequired,
|
|
43
38
|
children: _Children.Children.oneOf([_Item.Item]),
|
package/lib/AppNav/styles.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/*
|
|
9
8
|
* The MIT License (MIT)
|
|
10
9
|
*
|
|
@@ -62,6 +61,5 @@ const generateStyle = componentTheme => {
|
|
|
62
61
|
menuTriggerWidth: componentTheme.menuTriggerWidth.toString()
|
|
63
62
|
};
|
|
64
63
|
};
|
|
65
|
-
|
|
66
64
|
var _default = generateStyle;
|
|
67
65
|
exports.default = _default;
|
package/lib/AppNav/theme.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/*
|
|
9
8
|
* The MIT License (MIT)
|
|
10
9
|
*
|
|
@@ -36,9 +35,9 @@ exports.default = void 0;
|
|
|
36
35
|
*/
|
|
37
36
|
const generateComponentTheme = theme => {
|
|
38
37
|
const colors = theme.colors,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
borders = theme.borders,
|
|
39
|
+
spacing = theme.spacing,
|
|
40
|
+
typography = theme.typography;
|
|
42
41
|
const componentVariables = {
|
|
43
42
|
fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
|
|
44
43
|
height: '3.75rem',
|
|
@@ -49,9 +48,9 @@ const generateComponentTheme = theme => {
|
|
|
49
48
|
horizontalMargin: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall,
|
|
50
49
|
menuTriggerWidth: '7.5rem'
|
|
51
50
|
};
|
|
52
|
-
return {
|
|
51
|
+
return {
|
|
52
|
+
...componentVariables
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
|
-
|
|
56
55
|
var _default = generateComponentTheme;
|
|
57
56
|
exports.default = _default;
|
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.NavigationItemLocator = void 0;
|
|
7
|
-
|
|
8
7
|
var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
|
|
9
|
-
|
|
10
8
|
var _TooltipLocator = require("@instructure/ui-tooltip/lib/Tooltip/TooltipLocator");
|
|
11
|
-
|
|
12
9
|
var _index = require("./index");
|
|
13
|
-
|
|
14
10
|
/*
|
|
15
11
|
* The MIT License (MIT)
|
|
16
12
|
*
|
|
@@ -34,8 +30,10 @@ var _index = require("./index");
|
|
|
34
30
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
31
|
* SOFTWARE.
|
|
36
32
|
*/
|
|
33
|
+
|
|
37
34
|
// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module '@ins... Remove this comment to see the full error message
|
|
38
35
|
// eslint-disable-next-line no-restricted-imports
|
|
36
|
+
|
|
39
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
|
|
40
38
|
const NavigationItemLocator = (0, _locator.locator)(_index.NavigationItem.selector, {
|
|
41
39
|
findTooltipContent: function () {
|
|
@@ -1,34 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = exports.NavigationItem = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = require("react");
|
|
11
|
-
|
|
12
9
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
13
|
-
|
|
14
10
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
15
|
-
|
|
16
11
|
var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
|
|
17
|
-
|
|
18
12
|
var _Tooltip = require("@instructure/ui-tooltip/lib/Tooltip");
|
|
19
|
-
|
|
20
13
|
var _hasVisibleChildren = require("@instructure/ui-a11y-utils/lib/hasVisibleChildren.js");
|
|
21
|
-
|
|
22
14
|
var _emotion = require("@instructure/emotion");
|
|
23
|
-
|
|
24
15
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
25
|
-
|
|
26
16
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
27
|
-
|
|
28
17
|
var _props = require("./props");
|
|
29
|
-
|
|
30
18
|
var _dec, _dec2, _class, _class2;
|
|
31
|
-
|
|
32
19
|
/**
|
|
33
20
|
---
|
|
34
21
|
parent: Navigation
|
|
@@ -40,42 +27,34 @@ let NavigationItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
|
|
|
40
27
|
constructor() {
|
|
41
28
|
super(...arguments);
|
|
42
29
|
this.ref = null;
|
|
43
|
-
|
|
44
30
|
this.handleRef = el => {
|
|
45
31
|
const elementRef = this.props.elementRef;
|
|
46
32
|
this.ref = el;
|
|
47
|
-
|
|
48
33
|
if (typeof elementRef === 'function') {
|
|
49
34
|
elementRef(el);
|
|
50
35
|
}
|
|
51
36
|
};
|
|
52
37
|
}
|
|
53
|
-
|
|
54
38
|
componentDidMount() {
|
|
55
39
|
var _this$props$makeStyle, _this$props;
|
|
56
|
-
|
|
57
40
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
|
|
58
41
|
minimized: this.props.minimized
|
|
59
42
|
});
|
|
60
43
|
}
|
|
61
|
-
|
|
62
44
|
componentDidUpdate() {
|
|
63
45
|
var _this$props$makeStyle2, _this$props2;
|
|
64
|
-
|
|
65
46
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
|
|
66
47
|
minimized: this.props.minimized
|
|
67
48
|
});
|
|
68
49
|
}
|
|
69
|
-
|
|
70
50
|
renderLink(addRef) {
|
|
71
51
|
var _this$props$styles, _this$props$styles2, _this$props$styles3;
|
|
72
|
-
|
|
73
52
|
const ElementType = (0, _getElementType.getElementType)(NavigationItem, this.props);
|
|
74
53
|
const _this$props3 = this.props,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
54
|
+
href = _this$props3.href,
|
|
55
|
+
onClick = _this$props3.onClick,
|
|
56
|
+
icon = _this$props3.icon,
|
|
57
|
+
label = _this$props3.label;
|
|
79
58
|
const props = (0, _omitProps.omitProps)(this.props, NavigationItem.allowedProps);
|
|
80
59
|
return (0, _emotion.jsx)(ElementType, Object.assign({}, props, {
|
|
81
60
|
href: href,
|
|
@@ -90,11 +69,10 @@ let NavigationItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
|
|
|
90
69
|
css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.label
|
|
91
70
|
}, label) : null);
|
|
92
71
|
}
|
|
93
|
-
|
|
94
72
|
render() {
|
|
95
73
|
const _this$props4 = this.props,
|
|
96
|
-
|
|
97
|
-
|
|
74
|
+
minimized = _this$props4.minimized,
|
|
75
|
+
label = _this$props4.label;
|
|
98
76
|
const hasTooltip = minimized && (0, _hasVisibleChildren.hasVisibleChildren)(label);
|
|
99
77
|
const link = this.renderLink(!hasTooltip);
|
|
100
78
|
return hasTooltip ? (0, _emotion.jsx)(_Tooltip.Tooltip, {
|
|
@@ -103,7 +81,6 @@ let NavigationItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
|
|
|
103
81
|
elementRef: this.handleRef
|
|
104
82
|
}, link) : link;
|
|
105
83
|
}
|
|
106
|
-
|
|
107
84
|
}, _class2.displayName = "NavigationItem", _class2.componentId = 'Navigation.Item', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
|
108
85
|
as: 'a',
|
|
109
86
|
selected: false,
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
/*
|
|
13
10
|
* The MIT License (MIT)
|
|
14
11
|
*
|
|
@@ -32,6 +29,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
32
29
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
30
|
* SOFTWARE.
|
|
34
31
|
*/
|
|
32
|
+
|
|
35
33
|
const propTypes = {
|
|
36
34
|
elementRef: _propTypes.default.func,
|
|
37
35
|
icon: _propTypes.default.node.isRequired,
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/*
|
|
9
8
|
* The MIT License (MIT)
|
|
10
9
|
*
|
|
@@ -97,6 +96,5 @@ const generateStyle = (componentTheme, props) => {
|
|
|
97
96
|
}
|
|
98
97
|
};
|
|
99
98
|
};
|
|
100
|
-
|
|
101
99
|
var _default = generateStyle;
|
|
102
100
|
exports.default = _default;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/*
|
|
9
8
|
* The MIT License (MIT)
|
|
10
9
|
*
|
|
@@ -36,9 +35,9 @@ exports.default = void 0;
|
|
|
36
35
|
*/
|
|
37
36
|
const generateComponentTheme = theme => {
|
|
38
37
|
const colors = theme.colors,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
spacing = theme.spacing,
|
|
39
|
+
typography = theme.typography,
|
|
40
|
+
themeName = theme.key;
|
|
42
41
|
const themeSpecificStyle = {
|
|
43
42
|
canvas: {
|
|
44
43
|
fontColor: theme['ic-brand-global-nav-menu-item__text-color'],
|
|
@@ -72,10 +71,10 @@ const generateComponentTheme = theme => {
|
|
|
72
71
|
selectedInnerFocusOutline: `inset 0 0 0 0.25rem ${colors === null || colors === void 0 ? void 0 : colors.borderBrand}`,
|
|
73
72
|
contentPadding: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall
|
|
74
73
|
};
|
|
75
|
-
return {
|
|
74
|
+
return {
|
|
75
|
+
...componentVariables,
|
|
76
76
|
...themeSpecificStyle[themeName]
|
|
77
77
|
};
|
|
78
78
|
};
|
|
79
|
-
|
|
80
79
|
var _default = generateComponentTheme;
|
|
81
80
|
exports.default = _default;
|
|
@@ -10,13 +10,9 @@ Object.defineProperty(exports, "NavigationItemLocator", {
|
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
exports.NavigationLocator = void 0;
|
|
13
|
-
|
|
14
13
|
var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
|
|
15
|
-
|
|
16
14
|
var _index = require("./index");
|
|
17
|
-
|
|
18
15
|
var _NavigationItemLocator = require("./NavigationItem/NavigationItemLocator");
|
|
19
|
-
|
|
20
16
|
/*
|
|
21
17
|
* The MIT License (MIT)
|
|
22
18
|
*
|
|
@@ -40,6 +36,7 @@ var _NavigationItemLocator = require("./NavigationItem/NavigationItemLocator");
|
|
|
40
36
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
41
37
|
* SOFTWARE.
|
|
42
38
|
*/
|
|
39
|
+
|
|
43
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
|
|
44
41
|
const NavigationLocator = (0, _locator.locator)(_index.Navigation.selector, {
|
|
45
42
|
findAllItems: function () {
|