@instructure/ui-navigation 8.10.1-snapshot.9 → 8.10.3-snapshot.10
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/es/AppNav/Item/index.js +23 -15
- package/es/AppNav/index.js +18 -11
- package/es/Navigation/NavigationItem/index.js +9 -1
- package/es/Navigation/index.js +5 -1
- package/lib/AppNav/Item/index.js +23 -15
- package/lib/AppNav/index.js +18 -11
- package/lib/Navigation/NavigationItem/index.js +9 -1
- package/lib/Navigation/index.js +5 -1
- package/package.json +24 -24
- package/src/AppNav/Item/index.tsx +7 -0
- package/src/AppNav/Item/props.ts +1 -1
- package/src/AppNav/index.tsx +8 -3
- package/src/AppNav/props.ts +1 -1
- package/src/Navigation/NavigationItem/index.tsx +7 -1
- package/src/Navigation/index.tsx +10 -1
- package/types/AppNav/AppNavLocator.d.ts +224 -224
- package/types/AppNav/Item/AppNavItemLocator.d.ts +64 -64
- package/types/AppNav/Item/index.d.ts +4 -2
- package/types/AppNav/Item/index.d.ts.map +1 -1
- package/types/AppNav/Item/props.d.ts +1 -1
- package/types/AppNav/Item/props.d.ts.map +1 -1
- package/types/AppNav/index.d.ts +4 -2
- package/types/AppNav/index.d.ts.map +1 -1
- package/types/AppNav/props.d.ts +1 -1
- package/types/AppNav/props.d.ts.map +1 -1
- package/types/Navigation/NavigationItem/NavigationItemLocator.d.ts +64 -64
- package/types/Navigation/NavigationItem/index.d.ts +1 -0
- package/types/Navigation/NavigationItem/index.d.ts.map +1 -1
- package/types/Navigation/NavigationLocator.d.ts +224 -224
- package/types/Navigation/index.d.ts +1 -0
- package/types/Navigation/index.d.ts.map +1 -1
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.10.2](https://github.com/instructure/instructure-ui/compare/v8.10.1...v8.10.2) (2021-10-01)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-navigation
|
|
9
|
+
|
|
10
|
+
## [8.10.1](https://github.com/instructure/instructure-ui/compare/v8.10.0...v8.10.1) (2021-10-01)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @instructure/ui-navigation
|
|
13
|
+
|
|
6
14
|
# [8.10.0](https://github.com/instructure/instructure-ui/compare/v8.9.1...v8.10.0) (2021-09-28)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @instructure/ui-navigation
|
package/es/AppNav/Item/index.js
CHANGED
|
@@ -46,11 +46,19 @@ id: AppNav.Item
|
|
|
46
46
|
let Item = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_temp = _class2 = class Item extends Component {
|
|
47
47
|
constructor(...args) {
|
|
48
48
|
super(...args);
|
|
49
|
+
this.ref = null;
|
|
50
|
+
|
|
51
|
+
this.handleRef = el => {
|
|
52
|
+
var _this$props$elementRe, _this$props;
|
|
53
|
+
|
|
54
|
+
this.ref = el;
|
|
55
|
+
(_this$props$elementRe = (_this$props = this.props).elementRef) === null || _this$props$elementRe === void 0 ? void 0 : _this$props$elementRe.call(_this$props, el);
|
|
56
|
+
};
|
|
49
57
|
|
|
50
58
|
this.handleClick = e => {
|
|
51
|
-
const _this$
|
|
52
|
-
isDisabled = _this$
|
|
53
|
-
onClick = _this$
|
|
59
|
+
const _this$props2 = this.props,
|
|
60
|
+
isDisabled = _this$props2.isDisabled,
|
|
61
|
+
onClick = _this$props2.onClick;
|
|
54
62
|
|
|
55
63
|
if (isDisabled) {
|
|
56
64
|
e.preventDefault();
|
|
@@ -62,29 +70,29 @@ let Item = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
|
|
|
62
70
|
}
|
|
63
71
|
|
|
64
72
|
componentDidMount() {
|
|
65
|
-
var _this$props$makeStyle, _this$
|
|
73
|
+
var _this$props$makeStyle, _this$props3;
|
|
66
74
|
|
|
67
|
-
(_this$props$makeStyle = (_this$
|
|
75
|
+
(_this$props$makeStyle = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props3);
|
|
68
76
|
}
|
|
69
77
|
|
|
70
78
|
componentDidUpdate() {
|
|
71
|
-
var _this$props$makeStyle2, _this$
|
|
79
|
+
var _this$props$makeStyle2, _this$props4;
|
|
72
80
|
|
|
73
|
-
(_this$props$makeStyle2 = (_this$
|
|
81
|
+
(_this$props$makeStyle2 = (_this$props4 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props4);
|
|
74
82
|
}
|
|
75
83
|
|
|
76
84
|
render() {
|
|
77
85
|
var _this$props$styles, _this$props$styles2;
|
|
78
86
|
|
|
79
87
|
const ElementType = getElementType(Item, this.props);
|
|
80
|
-
const _this$
|
|
81
|
-
renderIcon = _this$
|
|
82
|
-
renderLabel = _this$
|
|
83
|
-
href = _this$
|
|
84
|
-
elementRef = _this$
|
|
85
|
-
renderAfter = _this$
|
|
86
|
-
cursor = _this$
|
|
87
|
-
isDisabled = _this$
|
|
88
|
+
const _this$props5 = this.props,
|
|
89
|
+
renderIcon = _this$props5.renderIcon,
|
|
90
|
+
renderLabel = _this$props5.renderLabel,
|
|
91
|
+
href = _this$props5.href,
|
|
92
|
+
elementRef = _this$props5.elementRef,
|
|
93
|
+
renderAfter = _this$props5.renderAfter,
|
|
94
|
+
cursor = _this$props5.cursor,
|
|
95
|
+
isDisabled = _this$props5.isDisabled;
|
|
88
96
|
const icon = callRenderProp(renderIcon);
|
|
89
97
|
const label = callRenderProp(renderLabel);
|
|
90
98
|
const labelIsForScreenReaders = matchComponentTypes(label, [ScreenReaderContent]);
|
package/es/AppNav/index.js
CHANGED
|
@@ -50,6 +50,7 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
50
50
|
this.state = {
|
|
51
51
|
isMeasuring: false
|
|
52
52
|
};
|
|
53
|
+
this.ref = null;
|
|
53
54
|
this._list = null;
|
|
54
55
|
|
|
55
56
|
this.measureItems = () => {
|
|
@@ -102,12 +103,19 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
102
103
|
});
|
|
103
104
|
});
|
|
104
105
|
};
|
|
106
|
+
|
|
107
|
+
this.handleRef = el => {
|
|
108
|
+
var _this$props$elementRe, _this$props;
|
|
109
|
+
|
|
110
|
+
this.ref = el;
|
|
111
|
+
(_this$props$elementRe = (_this$props = this.props).elementRef) === null || _this$props$elementRe === void 0 ? void 0 : _this$props$elementRe.call(_this$props, el);
|
|
112
|
+
};
|
|
105
113
|
}
|
|
106
114
|
|
|
107
115
|
componentDidMount() {
|
|
108
|
-
var _this$props$makeStyle, _this$
|
|
116
|
+
var _this$props$makeStyle, _this$props2;
|
|
109
117
|
|
|
110
|
-
(_this$props$makeStyle = (_this$
|
|
118
|
+
(_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
|
|
111
119
|
|
|
112
120
|
const _getBoundingClientRec3 = getBoundingClientRect(this._list),
|
|
113
121
|
origWidth = _getBoundingClientRec3.width;
|
|
@@ -132,9 +140,9 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
132
140
|
}
|
|
133
141
|
|
|
134
142
|
componentDidUpdate() {
|
|
135
|
-
var _this$props$makeStyle2, _this$
|
|
143
|
+
var _this$props$makeStyle2, _this$props3;
|
|
136
144
|
|
|
137
|
-
(_this$props$makeStyle2 = (_this$
|
|
145
|
+
(_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
|
|
138
146
|
}
|
|
139
147
|
|
|
140
148
|
componentWillUnmount() {
|
|
@@ -176,12 +184,11 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
176
184
|
render() {
|
|
177
185
|
var _this$props$styles4, _this$props$styles5, _this$props$styles6;
|
|
178
186
|
|
|
179
|
-
const _this$
|
|
180
|
-
children = _this$
|
|
181
|
-
visibleItemsCount = _this$
|
|
182
|
-
screenReaderLabel = _this$
|
|
183
|
-
margin = _this$
|
|
184
|
-
elementRef = _this$props3.elementRef;
|
|
187
|
+
const _this$props4 = this.props,
|
|
188
|
+
children = _this$props4.children,
|
|
189
|
+
visibleItemsCount = _this$props4.visibleItemsCount,
|
|
190
|
+
screenReaderLabel = _this$props4.screenReaderLabel,
|
|
191
|
+
margin = _this$props4.margin;
|
|
185
192
|
const passthroughProps = View.omitViewProps(omitProps(this.props, AppNav.allowedProps), AppNav);
|
|
186
193
|
const isMeasuring = this.state.isMeasuring;
|
|
187
194
|
const childrenArray = Children.toArray(children);
|
|
@@ -195,7 +202,7 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
195
202
|
css: [(_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.appNav, hasRenderedContent ? (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.alignCenter : ''],
|
|
196
203
|
margin: margin,
|
|
197
204
|
display: hasRenderedContent ? 'flex' : 'block',
|
|
198
|
-
elementRef:
|
|
205
|
+
elementRef: this.handleRef
|
|
199
206
|
}), renderBeforeItems && jsx("span", null, renderBeforeItems), jsx("ul", {
|
|
200
207
|
ref: el => this._list = el,
|
|
201
208
|
css: (_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.list,
|
|
@@ -42,6 +42,11 @@ id: Navigation.Item
|
|
|
42
42
|
**/
|
|
43
43
|
|
|
44
44
|
let NavigationItem = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_temp = _class2 = class NavigationItem extends Component {
|
|
45
|
+
constructor(...args) {
|
|
46
|
+
super(...args);
|
|
47
|
+
this.ref = null;
|
|
48
|
+
}
|
|
49
|
+
|
|
45
50
|
componentDidMount() {
|
|
46
51
|
var _this$props$makeStyle, _this$props;
|
|
47
52
|
|
|
@@ -72,7 +77,10 @@ let NavigationItem = (_dec = withStyle(generateStyle, generateComponentTheme), _
|
|
|
72
77
|
href: href,
|
|
73
78
|
onClick: onClick,
|
|
74
79
|
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.navigationItem,
|
|
75
|
-
"aria-label": this.props.minimized ? label : void 0
|
|
80
|
+
"aria-label": this.props.minimized ? label : void 0,
|
|
81
|
+
ref: element => {
|
|
82
|
+
this.ref = element;
|
|
83
|
+
}
|
|
76
84
|
}), jsx("div", {
|
|
77
85
|
css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.icon,
|
|
78
86
|
"aria-hidden": "true"
|
package/es/Navigation/index.js
CHANGED
|
@@ -51,6 +51,7 @@ category: components
|
|
|
51
51
|
let Navigation = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_temp = _class2 = class Navigation extends Component {
|
|
52
52
|
constructor(props) {
|
|
53
53
|
super();
|
|
54
|
+
this.ref = null;
|
|
54
55
|
|
|
55
56
|
this.handleNavToggle = event => {
|
|
56
57
|
if (!this.isControlled()) {
|
|
@@ -117,7 +118,10 @@ let Navigation = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
117
118
|
const props = omitProps(this.props, Navigation.allowedProps, ['minimized']);
|
|
118
119
|
return jsx("nav", Object.assign({}, props, {
|
|
119
120
|
css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.navigation,
|
|
120
|
-
"aria-label": label
|
|
121
|
+
"aria-label": label,
|
|
122
|
+
ref: element => {
|
|
123
|
+
this.ref = element;
|
|
124
|
+
}
|
|
121
125
|
}), jsx("ul", {
|
|
122
126
|
css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.content
|
|
123
127
|
}, this.renderChildren()), jsx("div", {
|
package/lib/AppNav/Item/index.js
CHANGED
|
@@ -45,11 +45,19 @@ id: AppNav.Item
|
|
|
45
45
|
let Item = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_temp = _class2 = class Item extends _react.Component {
|
|
46
46
|
constructor(...args) {
|
|
47
47
|
super(...args);
|
|
48
|
+
this.ref = null;
|
|
49
|
+
|
|
50
|
+
this.handleRef = el => {
|
|
51
|
+
var _this$props$elementRe, _this$props;
|
|
52
|
+
|
|
53
|
+
this.ref = el;
|
|
54
|
+
(_this$props$elementRe = (_this$props = this.props).elementRef) === null || _this$props$elementRe === void 0 ? void 0 : _this$props$elementRe.call(_this$props, el);
|
|
55
|
+
};
|
|
48
56
|
|
|
49
57
|
this.handleClick = e => {
|
|
50
|
-
const _this$
|
|
51
|
-
isDisabled = _this$
|
|
52
|
-
onClick = _this$
|
|
58
|
+
const _this$props2 = this.props,
|
|
59
|
+
isDisabled = _this$props2.isDisabled,
|
|
60
|
+
onClick = _this$props2.onClick;
|
|
53
61
|
|
|
54
62
|
if (isDisabled) {
|
|
55
63
|
e.preventDefault();
|
|
@@ -61,29 +69,29 @@ let Item = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
61
69
|
}
|
|
62
70
|
|
|
63
71
|
componentDidMount() {
|
|
64
|
-
var _this$props$makeStyle, _this$
|
|
72
|
+
var _this$props$makeStyle, _this$props3;
|
|
65
73
|
|
|
66
|
-
(_this$props$makeStyle = (_this$
|
|
74
|
+
(_this$props$makeStyle = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props3);
|
|
67
75
|
}
|
|
68
76
|
|
|
69
77
|
componentDidUpdate() {
|
|
70
|
-
var _this$props$makeStyle2, _this$
|
|
78
|
+
var _this$props$makeStyle2, _this$props4;
|
|
71
79
|
|
|
72
|
-
(_this$props$makeStyle2 = (_this$
|
|
80
|
+
(_this$props$makeStyle2 = (_this$props4 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props4);
|
|
73
81
|
}
|
|
74
82
|
|
|
75
83
|
render() {
|
|
76
84
|
var _this$props$styles, _this$props$styles2;
|
|
77
85
|
|
|
78
86
|
const ElementType = (0, _getElementType.getElementType)(Item, this.props);
|
|
79
|
-
const _this$
|
|
80
|
-
renderIcon = _this$
|
|
81
|
-
renderLabel = _this$
|
|
82
|
-
href = _this$
|
|
83
|
-
elementRef = _this$
|
|
84
|
-
renderAfter = _this$
|
|
85
|
-
cursor = _this$
|
|
86
|
-
isDisabled = _this$
|
|
87
|
+
const _this$props5 = this.props,
|
|
88
|
+
renderIcon = _this$props5.renderIcon,
|
|
89
|
+
renderLabel = _this$props5.renderLabel,
|
|
90
|
+
href = _this$props5.href,
|
|
91
|
+
elementRef = _this$props5.elementRef,
|
|
92
|
+
renderAfter = _this$props5.renderAfter,
|
|
93
|
+
cursor = _this$props5.cursor,
|
|
94
|
+
isDisabled = _this$props5.isDisabled;
|
|
87
95
|
const icon = (0, _callRenderProp.callRenderProp)(renderIcon);
|
|
88
96
|
const label = (0, _callRenderProp.callRenderProp)(renderLabel);
|
|
89
97
|
const labelIsForScreenReaders = (0, _matchComponentTypes.matchComponentTypes)(label, [_ScreenReaderContent.ScreenReaderContent]);
|
package/lib/AppNav/index.js
CHANGED
|
@@ -48,6 +48,7 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
48
48
|
this.state = {
|
|
49
49
|
isMeasuring: false
|
|
50
50
|
};
|
|
51
|
+
this.ref = null;
|
|
51
52
|
this._list = null;
|
|
52
53
|
|
|
53
54
|
this.measureItems = () => {
|
|
@@ -100,12 +101,19 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
100
101
|
});
|
|
101
102
|
});
|
|
102
103
|
};
|
|
104
|
+
|
|
105
|
+
this.handleRef = el => {
|
|
106
|
+
var _this$props$elementRe, _this$props;
|
|
107
|
+
|
|
108
|
+
this.ref = el;
|
|
109
|
+
(_this$props$elementRe = (_this$props = this.props).elementRef) === null || _this$props$elementRe === void 0 ? void 0 : _this$props$elementRe.call(_this$props, el);
|
|
110
|
+
};
|
|
103
111
|
}
|
|
104
112
|
|
|
105
113
|
componentDidMount() {
|
|
106
|
-
var _this$props$makeStyle, _this$
|
|
114
|
+
var _this$props$makeStyle, _this$props2;
|
|
107
115
|
|
|
108
|
-
(_this$props$makeStyle = (_this$
|
|
116
|
+
(_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
|
|
109
117
|
|
|
110
118
|
const _getBoundingClientRec3 = (0, _getBoundingClientRect.getBoundingClientRect)(this._list),
|
|
111
119
|
origWidth = _getBoundingClientRec3.width;
|
|
@@ -130,9 +138,9 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
130
138
|
}
|
|
131
139
|
|
|
132
140
|
componentDidUpdate() {
|
|
133
|
-
var _this$props$makeStyle2, _this$
|
|
141
|
+
var _this$props$makeStyle2, _this$props3;
|
|
134
142
|
|
|
135
|
-
(_this$props$makeStyle2 = (_this$
|
|
143
|
+
(_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
|
|
136
144
|
}
|
|
137
145
|
|
|
138
146
|
componentWillUnmount() {
|
|
@@ -174,12 +182,11 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
174
182
|
render() {
|
|
175
183
|
var _this$props$styles4, _this$props$styles5, _this$props$styles6;
|
|
176
184
|
|
|
177
|
-
const _this$
|
|
178
|
-
children = _this$
|
|
179
|
-
visibleItemsCount = _this$
|
|
180
|
-
screenReaderLabel = _this$
|
|
181
|
-
margin = _this$
|
|
182
|
-
elementRef = _this$props3.elementRef;
|
|
185
|
+
const _this$props4 = this.props,
|
|
186
|
+
children = _this$props4.children,
|
|
187
|
+
visibleItemsCount = _this$props4.visibleItemsCount,
|
|
188
|
+
screenReaderLabel = _this$props4.screenReaderLabel,
|
|
189
|
+
margin = _this$props4.margin;
|
|
183
190
|
|
|
184
191
|
const passthroughProps = _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, AppNav.allowedProps), AppNav);
|
|
185
192
|
|
|
@@ -197,7 +204,7 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
197
204
|
css: [(_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.appNav, hasRenderedContent ? (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.alignCenter : ''],
|
|
198
205
|
margin: margin,
|
|
199
206
|
display: hasRenderedContent ? 'flex' : 'block',
|
|
200
|
-
elementRef:
|
|
207
|
+
elementRef: this.handleRef
|
|
201
208
|
}), renderBeforeItems && (0, _emotion.jsx)("span", null, renderBeforeItems), (0, _emotion.jsx)("ul", {
|
|
202
209
|
ref: el => this._list = el,
|
|
203
210
|
css: (_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.list,
|
|
@@ -36,6 +36,11 @@ id: Navigation.Item
|
|
|
36
36
|
---
|
|
37
37
|
**/
|
|
38
38
|
let NavigationItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_temp = _class2 = class NavigationItem extends _react.Component {
|
|
39
|
+
constructor(...args) {
|
|
40
|
+
super(...args);
|
|
41
|
+
this.ref = null;
|
|
42
|
+
}
|
|
43
|
+
|
|
39
44
|
componentDidMount() {
|
|
40
45
|
var _this$props$makeStyle, _this$props;
|
|
41
46
|
|
|
@@ -66,7 +71,10 @@ let NavigationItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
|
|
|
66
71
|
href: href,
|
|
67
72
|
onClick: onClick,
|
|
68
73
|
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.navigationItem,
|
|
69
|
-
"aria-label": this.props.minimized ? label : void 0
|
|
74
|
+
"aria-label": this.props.minimized ? label : void 0,
|
|
75
|
+
ref: element => {
|
|
76
|
+
this.ref = element;
|
|
77
|
+
}
|
|
70
78
|
}), (0, _emotion.jsx)("div", {
|
|
71
79
|
css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.icon,
|
|
72
80
|
"aria-hidden": "true"
|
package/lib/Navigation/index.js
CHANGED
|
@@ -52,6 +52,7 @@ category: components
|
|
|
52
52
|
let Navigation = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_temp = _class2 = class Navigation extends _react.Component {
|
|
53
53
|
constructor(props) {
|
|
54
54
|
super();
|
|
55
|
+
this.ref = null;
|
|
55
56
|
|
|
56
57
|
this.handleNavToggle = event => {
|
|
57
58
|
if (!this.isControlled()) {
|
|
@@ -118,7 +119,10 @@ let Navigation = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
|
|
|
118
119
|
const props = (0, _omitProps.omitProps)(this.props, Navigation.allowedProps, ['minimized']);
|
|
119
120
|
return (0, _emotion.jsx)("nav", Object.assign({}, props, {
|
|
120
121
|
css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.navigation,
|
|
121
|
-
"aria-label": label
|
|
122
|
+
"aria-label": label,
|
|
123
|
+
ref: element => {
|
|
124
|
+
this.ref = element;
|
|
125
|
+
}
|
|
122
126
|
}), (0, _emotion.jsx)("ul", {
|
|
123
127
|
css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.content
|
|
124
128
|
}, this.renderChildren()), (0, _emotion.jsx)("div", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-navigation",
|
|
3
|
-
"version": "8.10.
|
|
3
|
+
"version": "8.10.3-snapshot.10+cca148595",
|
|
4
4
|
"description": "Main and application level navigational components",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -24,31 +24,31 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@instructure/ui-babel-preset": "8.10.
|
|
28
|
-
"@instructure/ui-color-utils": "8.10.
|
|
29
|
-
"@instructure/ui-test-locator": "8.10.
|
|
30
|
-
"@instructure/ui-test-utils": "8.10.
|
|
31
|
-
"@instructure/ui-themes": "8.10.
|
|
27
|
+
"@instructure/ui-babel-preset": "8.10.3-snapshot.10+cca148595",
|
|
28
|
+
"@instructure/ui-color-utils": "8.10.3-snapshot.10+cca148595",
|
|
29
|
+
"@instructure/ui-test-locator": "8.10.3-snapshot.10+cca148595",
|
|
30
|
+
"@instructure/ui-test-utils": "8.10.3-snapshot.10+cca148595",
|
|
31
|
+
"@instructure/ui-themes": "8.10.3-snapshot.10+cca148595"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.13.10",
|
|
35
|
-
"@instructure/console": "8.10.
|
|
36
|
-
"@instructure/debounce": "8.10.
|
|
37
|
-
"@instructure/emotion": "8.10.
|
|
38
|
-
"@instructure/shared-types": "8.10.
|
|
39
|
-
"@instructure/ui-a11y-content": "8.10.
|
|
40
|
-
"@instructure/ui-a11y-utils": "8.10.
|
|
41
|
-
"@instructure/ui-badge": "8.10.
|
|
42
|
-
"@instructure/ui-dom-utils": "8.10.
|
|
43
|
-
"@instructure/ui-focusable": "8.10.
|
|
44
|
-
"@instructure/ui-icons": "8.10.
|
|
45
|
-
"@instructure/ui-menu": "8.10.
|
|
46
|
-
"@instructure/ui-prop-types": "8.10.
|
|
47
|
-
"@instructure/ui-react-utils": "8.10.
|
|
48
|
-
"@instructure/ui-testable": "8.10.
|
|
49
|
-
"@instructure/ui-tooltip": "8.10.
|
|
50
|
-
"@instructure/ui-utils": "8.10.
|
|
51
|
-
"@instructure/ui-view": "8.10.
|
|
35
|
+
"@instructure/console": "8.10.3-snapshot.10+cca148595",
|
|
36
|
+
"@instructure/debounce": "8.10.3-snapshot.10+cca148595",
|
|
37
|
+
"@instructure/emotion": "8.10.3-snapshot.10+cca148595",
|
|
38
|
+
"@instructure/shared-types": "8.10.3-snapshot.10+cca148595",
|
|
39
|
+
"@instructure/ui-a11y-content": "8.10.3-snapshot.10+cca148595",
|
|
40
|
+
"@instructure/ui-a11y-utils": "8.10.3-snapshot.10+cca148595",
|
|
41
|
+
"@instructure/ui-badge": "8.10.3-snapshot.10+cca148595",
|
|
42
|
+
"@instructure/ui-dom-utils": "8.10.3-snapshot.10+cca148595",
|
|
43
|
+
"@instructure/ui-focusable": "8.10.3-snapshot.10+cca148595",
|
|
44
|
+
"@instructure/ui-icons": "8.10.3-snapshot.10+cca148595",
|
|
45
|
+
"@instructure/ui-menu": "8.10.3-snapshot.10+cca148595",
|
|
46
|
+
"@instructure/ui-prop-types": "8.10.3-snapshot.10+cca148595",
|
|
47
|
+
"@instructure/ui-react-utils": "8.10.3-snapshot.10+cca148595",
|
|
48
|
+
"@instructure/ui-testable": "8.10.3-snapshot.10+cca148595",
|
|
49
|
+
"@instructure/ui-tooltip": "8.10.3-snapshot.10+cca148595",
|
|
50
|
+
"@instructure/ui-utils": "8.10.3-snapshot.10+cca148595",
|
|
51
|
+
"@instructure/ui-view": "8.10.3-snapshot.10+cca148595",
|
|
52
52
|
"prop-types": "^15"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
60
|
"sideEffects": false,
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "cca1485957b780165ac6b283afc28f4bba1eda06"
|
|
62
62
|
}
|
|
@@ -66,6 +66,8 @@ class Item extends Component<AppNavItemProps> {
|
|
|
66
66
|
isDisabled: false
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
ref: Element | null = null
|
|
70
|
+
|
|
69
71
|
componentDidMount() {
|
|
70
72
|
this.props.makeStyles?.()
|
|
71
73
|
}
|
|
@@ -74,6 +76,11 @@ class Item extends Component<AppNavItemProps> {
|
|
|
74
76
|
this.props.makeStyles?.()
|
|
75
77
|
}
|
|
76
78
|
|
|
79
|
+
handleRef = (el: Element | null) => {
|
|
80
|
+
this.ref = el
|
|
81
|
+
this.props.elementRef?.(el)
|
|
82
|
+
}
|
|
83
|
+
|
|
77
84
|
// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'e' implicitly has an 'any' type.
|
|
78
85
|
handleClick = (e) => {
|
|
79
86
|
const { isDisabled, onClick } = this.props
|
package/src/AppNav/Item/props.ts
CHANGED
|
@@ -37,7 +37,7 @@ type AppNavItemOwnProps = {
|
|
|
37
37
|
href?: string
|
|
38
38
|
onClick?: (...args: any[]) => any
|
|
39
39
|
isSelected?: boolean
|
|
40
|
-
elementRef?: (
|
|
40
|
+
elementRef?: (element: Element | null) => void
|
|
41
41
|
as?: AsElementType
|
|
42
42
|
cursor?: string
|
|
43
43
|
isDisabled?: boolean
|
package/src/AppNav/index.tsx
CHANGED
|
@@ -72,6 +72,7 @@ class AppNav extends Component<AppNavProps> {
|
|
|
72
72
|
isMeasuring: false
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
ref: Element | null = null
|
|
75
76
|
_list = null
|
|
76
77
|
|
|
77
78
|
componentDidMount() {
|
|
@@ -161,6 +162,11 @@ class AppNav extends Component<AppNavProps> {
|
|
|
161
162
|
})
|
|
162
163
|
}
|
|
163
164
|
|
|
165
|
+
handleRef = (el: Element | null) => {
|
|
166
|
+
this.ref = el
|
|
167
|
+
this.props.elementRef?.(el)
|
|
168
|
+
}
|
|
169
|
+
|
|
164
170
|
// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'item' implicitly has an 'any' type.
|
|
165
171
|
renderListItem(item, isMenuTrigger, key) {
|
|
166
172
|
return (
|
|
@@ -216,8 +222,7 @@ class AppNav extends Component<AppNavProps> {
|
|
|
216
222
|
children,
|
|
217
223
|
visibleItemsCount,
|
|
218
224
|
screenReaderLabel,
|
|
219
|
-
margin
|
|
220
|
-
elementRef
|
|
225
|
+
margin
|
|
221
226
|
} = this.props
|
|
222
227
|
|
|
223
228
|
const passthroughProps = View.omitViewProps(
|
|
@@ -245,7 +250,7 @@ class AppNav extends Component<AppNavProps> {
|
|
|
245
250
|
]}
|
|
246
251
|
margin={margin}
|
|
247
252
|
display={hasRenderedContent ? 'flex' : 'block'}
|
|
248
|
-
elementRef={
|
|
253
|
+
elementRef={this.handleRef}
|
|
249
254
|
>
|
|
250
255
|
{renderBeforeItems && <span>{renderBeforeItems}</span>}
|
|
251
256
|
<ul
|
package/src/AppNav/props.ts
CHANGED
|
@@ -42,7 +42,7 @@ type AppNavOwnProps = {
|
|
|
42
42
|
renderBeforeItems?: React.ReactNode | ((...args: any[]) => any)
|
|
43
43
|
renderAfterItems?: React.ReactNode | ((...args: any[]) => any)
|
|
44
44
|
margin?: Spacing
|
|
45
|
-
elementRef?: (
|
|
45
|
+
elementRef?: (element: Element | null) => void
|
|
46
46
|
renderTruncateLabel?: React.ReactNode | ((...args: any[]) => any)
|
|
47
47
|
onUpdate?: (...args: any[]) => any
|
|
48
48
|
visibleItemsCount?: number
|
|
@@ -57,6 +57,8 @@ class NavigationItem extends Component<NavigationItemProps> {
|
|
|
57
57
|
minimized: false
|
|
58
58
|
} as const
|
|
59
59
|
|
|
60
|
+
ref: Element | null = null
|
|
61
|
+
|
|
60
62
|
componentDidMount() {
|
|
61
63
|
this.props.makeStyles?.({ minimized: this.props.minimized })
|
|
62
64
|
}
|
|
@@ -73,13 +75,17 @@ class NavigationItem extends Component<NavigationItemProps> {
|
|
|
73
75
|
const props = omitProps(this.props, NavigationItem.allowedProps)
|
|
74
76
|
|
|
75
77
|
return (
|
|
78
|
+
//@ts-expect-error TODO: INSTUI-3245
|
|
76
79
|
<ElementType
|
|
77
80
|
{...props}
|
|
78
81
|
href={href}
|
|
79
82
|
onClick={onClick}
|
|
80
83
|
css={this.props.styles?.navigationItem}
|
|
81
|
-
//@ts-expect-error TODO: INSTUI-3245
|
|
82
84
|
aria-label={this.props.minimized ? label : undefined}
|
|
85
|
+
// @ts-expect-error TODO fix TS2590: Expression produces a union type that is too complex to represent.
|
|
86
|
+
ref={(element) => {
|
|
87
|
+
this.ref = element
|
|
88
|
+
}}
|
|
83
89
|
>
|
|
84
90
|
<div css={this.props.styles?.icon} aria-hidden="true">
|
|
85
91
|
{icon}
|
package/src/Navigation/index.tsx
CHANGED
|
@@ -65,6 +65,8 @@ class Navigation extends Component<NavigationProps, NavigationState> {
|
|
|
65
65
|
|
|
66
66
|
static Item = NavigationItem
|
|
67
67
|
|
|
68
|
+
ref: Element | null = null
|
|
69
|
+
|
|
68
70
|
// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'props' implicitly has an 'any' type.
|
|
69
71
|
constructor(props) {
|
|
70
72
|
// @ts-expect-error ts-migrate(2554) FIXME: Expected 1-2 arguments, but got 0.
|
|
@@ -127,7 +129,14 @@ class Navigation extends Component<NavigationProps, NavigationState> {
|
|
|
127
129
|
const props = omitProps(this.props, Navigation.allowedProps, ['minimized'])
|
|
128
130
|
|
|
129
131
|
return (
|
|
130
|
-
<nav
|
|
132
|
+
<nav
|
|
133
|
+
{...props}
|
|
134
|
+
css={this.props.styles?.navigation}
|
|
135
|
+
aria-label={label}
|
|
136
|
+
ref={(element) => {
|
|
137
|
+
this.ref = element
|
|
138
|
+
}}
|
|
139
|
+
>
|
|
131
140
|
<ul css={this.props.styles?.content}>{this.renderChildren()}</ul>
|
|
132
141
|
<div css={this.props.styles?.toggle}>
|
|
133
142
|
<NavigationItem
|