@instructure/ui-navigation 8.25.1-snapshot-7 → 8.25.1-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 +1 -1
- package/es/AppNav/Item/index.js +39 -38
- package/es/AppNav/index.js +85 -84
- package/es/Navigation/NavigationItem/index.js +20 -19
- package/es/Navigation/index.js +26 -20
- package/lib/AppNav/Item/index.js +39 -38
- package/lib/AppNav/index.js +85 -84
- package/lib/Navigation/NavigationItem/index.js +21 -20
- package/lib/Navigation/index.js +26 -20
- package/package.json +23 -23
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/AppNav/AppNavLocator.d.ts +14 -14
- package/types/AppNav/Item/AppNavItemLocator.d.ts +4 -4
- package/types/Navigation/NavigationItem/NavigationItemLocator.d.ts +4 -4
- package/types/Navigation/NavigationLocator.d.ts +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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.25.1-snapshot-
|
|
6
|
+
## [8.25.1-snapshot-10](https://github.com/instructure/instructure-ui/compare/v8.25.0...v8.25.1-snapshot-10) (2022-06-20)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-navigation
|
|
9
9
|
|
package/es/AppNav/Item/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _dec2, _class
|
|
1
|
+
var _dec, _dec2, _class;
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* The MIT License (MIT)
|
|
@@ -44,46 +44,52 @@ id: AppNav.Item
|
|
|
44
44
|
@module Item
|
|
45
45
|
**/
|
|
46
46
|
|
|
47
|
-
let Item = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
this.handleClick = e => {
|
|
62
|
-
const _this$props = this.props,
|
|
63
|
-
isDisabled = _this$props.isDisabled,
|
|
64
|
-
onClick = _this$props.onClick;
|
|
65
|
-
|
|
66
|
-
if (isDisabled) {
|
|
67
|
-
e.preventDefault();
|
|
68
|
-
e.stopPropagation();
|
|
69
|
-
} else if (typeof onClick === 'function') {
|
|
70
|
-
onClick(e);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
}
|
|
47
|
+
let Item = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = class Item extends Component {
|
|
48
|
+
static displayName = "Item";
|
|
49
|
+
static componentId = 'AppNav.Item';
|
|
50
|
+
static allowedProps = allowedProps;
|
|
51
|
+
static propTypes = propTypes;
|
|
52
|
+
static defaultProps = {
|
|
53
|
+
children: null,
|
|
54
|
+
isSelected: false,
|
|
55
|
+
cursor: 'pointer',
|
|
56
|
+
isDisabled: false
|
|
57
|
+
};
|
|
58
|
+
ref = null;
|
|
74
59
|
|
|
75
60
|
componentDidMount() {
|
|
76
|
-
var _this$props$makeStyle, _this$
|
|
61
|
+
var _this$props$makeStyle, _this$props;
|
|
77
62
|
|
|
78
|
-
(_this$props$makeStyle = (_this$
|
|
63
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
79
64
|
}
|
|
80
65
|
|
|
81
66
|
componentDidUpdate() {
|
|
82
|
-
var _this$props$makeStyle2, _this$
|
|
67
|
+
var _this$props$makeStyle2, _this$props2;
|
|
83
68
|
|
|
84
|
-
(_this$props$makeStyle2 = (_this$
|
|
69
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
85
70
|
}
|
|
86
71
|
|
|
72
|
+
handleRef = el => {
|
|
73
|
+
const elementRef = this.props.elementRef;
|
|
74
|
+
this.ref = el;
|
|
75
|
+
|
|
76
|
+
if (typeof elementRef === 'function') {
|
|
77
|
+
elementRef(el);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
handleClick = e => {
|
|
81
|
+
const _this$props3 = this.props,
|
|
82
|
+
isDisabled = _this$props3.isDisabled,
|
|
83
|
+
onClick = _this$props3.onClick;
|
|
84
|
+
|
|
85
|
+
if (isDisabled) {
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
e.stopPropagation();
|
|
88
|
+
} else if (typeof onClick === 'function') {
|
|
89
|
+
onClick(e);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
87
93
|
render() {
|
|
88
94
|
var _this$props$styles, _this$props$styles2;
|
|
89
95
|
|
|
@@ -119,11 +125,6 @@ let Item = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
|
|
|
119
125
|
}, label), renderAfter && callRenderProp(renderAfter));
|
|
120
126
|
}
|
|
121
127
|
|
|
122
|
-
}
|
|
123
|
-
children: null,
|
|
124
|
-
isSelected: false,
|
|
125
|
-
cursor: 'pointer',
|
|
126
|
-
isDisabled: false
|
|
127
|
-
}, _class2)) || _class) || _class);
|
|
128
|
+
}) || _class) || _class);
|
|
128
129
|
export default Item;
|
|
129
130
|
export { Item };
|
package/es/AppNav/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _dec2, _class
|
|
1
|
+
var _dec, _dec2, _class;
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* The MIT License (MIT)
|
|
@@ -45,88 +45,34 @@ category: components
|
|
|
45
45
|
---
|
|
46
46
|
@tsProps
|
|
47
47
|
**/
|
|
48
|
-
let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class =
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const itemWidths = Array.from(this._list.getElementsByTagName('li')).map(item => {
|
|
70
|
-
// Todo: if item's type isn't `unknown`, can remove `Element`
|
|
71
|
-
const _getBoundingClientRec2 = getBoundingClientRect(item),
|
|
72
|
-
width = _getBoundingClientRec2.width;
|
|
73
|
-
|
|
74
|
-
return width;
|
|
75
|
-
});
|
|
76
|
-
let currentWidth = 0;
|
|
77
|
-
|
|
78
|
-
for (let i = 0; i < itemWidths.length; i++) {
|
|
79
|
-
currentWidth += itemWidths[i];
|
|
80
|
-
|
|
81
|
-
if (currentWidth <= navWidth - menuTriggerWidth) {
|
|
82
|
-
visibleItemsCount++;
|
|
83
|
-
} else {
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return {
|
|
90
|
-
visibleItemsCount
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
this.handleResize = () => {
|
|
95
|
-
this.setState({
|
|
96
|
-
isMeasuring: true
|
|
97
|
-
}, () => {
|
|
98
|
-
const _this$measureItems = this.measureItems(),
|
|
99
|
-
visibleItemsCount = _this$measureItems.visibleItemsCount;
|
|
100
|
-
|
|
101
|
-
if (typeof this.props.onUpdate === 'function') {
|
|
102
|
-
this.props.onUpdate({
|
|
103
|
-
visibleItemsCount
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
this.setState({
|
|
108
|
-
isMeasuring: false
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
this.handleRef = el => {
|
|
114
|
-
const elementRef = this.props.elementRef;
|
|
115
|
-
this.ref = el;
|
|
116
|
-
|
|
117
|
-
if (typeof elementRef === 'function') {
|
|
118
|
-
elementRef(el);
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
}
|
|
48
|
+
let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = class AppNav extends Component {
|
|
49
|
+
static displayName = "AppNav";
|
|
50
|
+
static componentId = 'AppNav';
|
|
51
|
+
static allowedProps = allowedProps;
|
|
52
|
+
static propTypes = propTypes;
|
|
53
|
+
static defaultProps = {
|
|
54
|
+
children: null,
|
|
55
|
+
debounce: 300,
|
|
56
|
+
margin: '0',
|
|
57
|
+
renderTruncateLabel: () => 'More',
|
|
58
|
+
visibleItemsCount: 0
|
|
59
|
+
};
|
|
60
|
+
static Item = Item;
|
|
61
|
+
state = {
|
|
62
|
+
isMeasuring: false
|
|
63
|
+
};
|
|
64
|
+
ref = null;
|
|
65
|
+
_list = null;
|
|
66
|
+
_debounced;
|
|
67
|
+
_resizeListener;
|
|
122
68
|
|
|
123
69
|
componentDidMount() {
|
|
124
70
|
var _this$props$makeStyle, _this$props;
|
|
125
71
|
|
|
126
72
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
127
73
|
|
|
128
|
-
const
|
|
129
|
-
origWidth =
|
|
74
|
+
const _getBoundingClientRec = getBoundingClientRect(this._list),
|
|
75
|
+
origWidth = _getBoundingClientRec.width;
|
|
130
76
|
|
|
131
77
|
this._debounced = debounce(this.handleResize, this.props.debounce, {
|
|
132
78
|
leading: true,
|
|
@@ -163,6 +109,67 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
163
109
|
}
|
|
164
110
|
}
|
|
165
111
|
|
|
112
|
+
measureItems = () => {
|
|
113
|
+
var _this$props$styles;
|
|
114
|
+
|
|
115
|
+
const menuTriggerWidth = px((_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.menuTriggerWidth);
|
|
116
|
+
let visibleItemsCount = 0;
|
|
117
|
+
|
|
118
|
+
if (this._list) {
|
|
119
|
+
const _getBoundingClientRec2 = getBoundingClientRect(this._list),
|
|
120
|
+
navWidth = _getBoundingClientRec2.width;
|
|
121
|
+
|
|
122
|
+
const itemWidths = Array.from(this._list.getElementsByTagName('li')).map(item => {
|
|
123
|
+
// Todo: if item's type isn't `unknown`, can remove `Element`
|
|
124
|
+
const _getBoundingClientRec3 = getBoundingClientRect(item),
|
|
125
|
+
width = _getBoundingClientRec3.width;
|
|
126
|
+
|
|
127
|
+
return width;
|
|
128
|
+
});
|
|
129
|
+
let currentWidth = 0;
|
|
130
|
+
|
|
131
|
+
for (let i = 0; i < itemWidths.length; i++) {
|
|
132
|
+
currentWidth += itemWidths[i];
|
|
133
|
+
|
|
134
|
+
if (currentWidth <= navWidth - menuTriggerWidth) {
|
|
135
|
+
visibleItemsCount++;
|
|
136
|
+
} else {
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return {
|
|
143
|
+
visibleItemsCount
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
handleResize = () => {
|
|
147
|
+
this.setState({
|
|
148
|
+
isMeasuring: true
|
|
149
|
+
}, () => {
|
|
150
|
+
const _this$measureItems = this.measureItems(),
|
|
151
|
+
visibleItemsCount = _this$measureItems.visibleItemsCount;
|
|
152
|
+
|
|
153
|
+
if (typeof this.props.onUpdate === 'function') {
|
|
154
|
+
this.props.onUpdate({
|
|
155
|
+
visibleItemsCount
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
this.setState({
|
|
160
|
+
isMeasuring: false
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
handleRef = el => {
|
|
165
|
+
const elementRef = this.props.elementRef;
|
|
166
|
+
this.ref = el;
|
|
167
|
+
|
|
168
|
+
if (typeof elementRef === 'function') {
|
|
169
|
+
elementRef(el);
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
|
|
166
173
|
renderListItem(item, isMenuTrigger, key) {
|
|
167
174
|
var _this$props$styles2, _this$props$styles3;
|
|
168
175
|
|
|
@@ -218,12 +225,6 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
|
|
|
218
225
|
}), hiddenChildren.length > 0 && this.renderMenu(hiddenChildren)), renderAfterItems && jsx("span", null, renderAfterItems));
|
|
219
226
|
}
|
|
220
227
|
|
|
221
|
-
}
|
|
222
|
-
children: null,
|
|
223
|
-
debounce: 300,
|
|
224
|
-
margin: '0',
|
|
225
|
-
renderTruncateLabel: () => 'More',
|
|
226
|
-
visibleItemsCount: 0
|
|
227
|
-
}, _class2.Item = Item, _class2)) || _class) || _class);
|
|
228
|
+
}) || _class) || _class);
|
|
228
229
|
export { AppNav };
|
|
229
230
|
export default AppNav;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _dec2, _class
|
|
1
|
+
var _dec, _dec2, _class;
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* The MIT License (MIT)
|
|
@@ -42,20 +42,25 @@ id: Navigation.Item
|
|
|
42
42
|
@tsProps
|
|
43
43
|
**/
|
|
44
44
|
|
|
45
|
-
let NavigationItem = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
let NavigationItem = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = class NavigationItem extends Component {
|
|
46
|
+
static displayName = "NavigationItem";
|
|
47
|
+
static componentId = 'Navigation.Item';
|
|
48
|
+
static allowedProps = allowedProps;
|
|
49
|
+
static propTypes = propTypes;
|
|
50
|
+
static defaultProps = {
|
|
51
|
+
as: 'a',
|
|
52
|
+
selected: false,
|
|
53
|
+
minimized: false
|
|
54
|
+
};
|
|
55
|
+
ref = null;
|
|
56
|
+
handleRef = el => {
|
|
57
|
+
const elementRef = this.props.elementRef;
|
|
58
|
+
this.ref = el;
|
|
49
59
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (typeof elementRef === 'function') {
|
|
55
|
-
elementRef(el);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
}
|
|
60
|
+
if (typeof elementRef === 'function') {
|
|
61
|
+
elementRef(el);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
59
64
|
|
|
60
65
|
componentDidMount() {
|
|
61
66
|
var _this$props$makeStyle, _this$props;
|
|
@@ -111,10 +116,6 @@ let NavigationItem = (_dec = withStyle(generateStyle, generateComponentTheme), _
|
|
|
111
116
|
}, link) : link;
|
|
112
117
|
}
|
|
113
118
|
|
|
114
|
-
}
|
|
115
|
-
as: 'a',
|
|
116
|
-
selected: false,
|
|
117
|
-
minimized: false
|
|
118
|
-
}, _class2)) || _class) || _class);
|
|
119
|
+
}) || _class) || _class);
|
|
119
120
|
export default NavigationItem;
|
|
120
121
|
export { NavigationItem };
|
package/es/Navigation/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _dec2, _dec3, _class
|
|
1
|
+
var _dec, _dec2, _dec3, _class;
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* The MIT License (MIT)
|
|
@@ -50,21 +50,22 @@ category: components/deprecated
|
|
|
50
50
|
**/
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
let Navigation = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec3 = deprecated('9.0.0', null, 'No one uses <Navigation>, so we will deprecate it.'), _dec(_class = _dec2(_class = _dec3(_class =
|
|
53
|
+
let Navigation = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec3 = deprecated('9.0.0', null, 'No one uses <Navigation>, so we will deprecate it.'), _dec(_class = _dec2(_class = _dec3(_class = class Navigation extends Component {
|
|
54
|
+
static displayName = "Navigation";
|
|
55
|
+
static componentId = 'Navigation';
|
|
56
|
+
static allowedProps = allowedProps;
|
|
57
|
+
static propTypes = propTypes;
|
|
58
|
+
static defaultProps = {
|
|
59
|
+
children: null,
|
|
60
|
+
defaultMinimized: false,
|
|
61
|
+
// TODO we should investigate later if it used or not
|
|
62
|
+
onClick: function (_e) {}
|
|
63
|
+
};
|
|
64
|
+
static Item = NavigationItem;
|
|
65
|
+
ref = null;
|
|
66
|
+
|
|
54
67
|
constructor(props) {
|
|
55
68
|
super(props);
|
|
56
|
-
this.ref = null;
|
|
57
|
-
|
|
58
|
-
this.handleNavToggle = event => {
|
|
59
|
-
if (!this.isControlled()) {
|
|
60
|
-
this.setState(navMinimized);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (typeof this.props.onMinimized === 'function') {
|
|
64
|
-
this.props.onMinimized(event, !this.minimized);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
69
|
this.state = {
|
|
69
70
|
minimized: this.isControlled(props) ? !!props.minimized : !!props.defaultMinimized
|
|
70
71
|
};
|
|
@@ -99,6 +100,16 @@ let Navigation = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
99
100
|
return typeof props.minimized === 'boolean';
|
|
100
101
|
}
|
|
101
102
|
|
|
103
|
+
handleNavToggle = event => {
|
|
104
|
+
if (!this.isControlled()) {
|
|
105
|
+
this.setState(navMinimized);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (typeof this.props.onMinimized === 'function') {
|
|
109
|
+
this.props.onMinimized(event, !this.minimized);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
102
113
|
renderChildren() {
|
|
103
114
|
return Children.map(this.props.children, child => {
|
|
104
115
|
var _this$props$styles;
|
|
@@ -142,11 +153,6 @@ let Navigation = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
142
153
|
})));
|
|
143
154
|
}
|
|
144
155
|
|
|
145
|
-
}
|
|
146
|
-
children: null,
|
|
147
|
-
defaultMinimized: false,
|
|
148
|
-
// TODO we should investigate later if it used or not
|
|
149
|
-
onClick: function (_e) {}
|
|
150
|
-
}, _class2.Item = NavigationItem, _class2)) || _class) || _class) || _class);
|
|
156
|
+
}) || _class) || _class) || _class);
|
|
151
157
|
export default Navigation;
|
|
152
158
|
export { Navigation, NavigationItem };
|
package/lib/AppNav/Item/index.js
CHANGED
|
@@ -35,7 +35,7 @@ var _theme = _interopRequireDefault(require("./theme"));
|
|
|
35
35
|
|
|
36
36
|
var _props = require("./props");
|
|
37
37
|
|
|
38
|
-
var _dec, _dec2, _class
|
|
38
|
+
var _dec, _dec2, _class;
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
---
|
|
@@ -45,46 +45,52 @@ id: AppNav.Item
|
|
|
45
45
|
@tsProps
|
|
46
46
|
@module Item
|
|
47
47
|
**/
|
|
48
|
-
let Item = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class =
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
this.handleClick = e => {
|
|
63
|
-
const _this$props = this.props,
|
|
64
|
-
isDisabled = _this$props.isDisabled,
|
|
65
|
-
onClick = _this$props.onClick;
|
|
66
|
-
|
|
67
|
-
if (isDisabled) {
|
|
68
|
-
e.preventDefault();
|
|
69
|
-
e.stopPropagation();
|
|
70
|
-
} else if (typeof onClick === 'function') {
|
|
71
|
-
onClick(e);
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
}
|
|
48
|
+
let Item = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = class Item extends _react.Component {
|
|
49
|
+
static displayName = "Item";
|
|
50
|
+
static componentId = 'AppNav.Item';
|
|
51
|
+
static allowedProps = _props.allowedProps;
|
|
52
|
+
static propTypes = _props.propTypes;
|
|
53
|
+
static defaultProps = {
|
|
54
|
+
children: null,
|
|
55
|
+
isSelected: false,
|
|
56
|
+
cursor: 'pointer',
|
|
57
|
+
isDisabled: false
|
|
58
|
+
};
|
|
59
|
+
ref = null;
|
|
75
60
|
|
|
76
61
|
componentDidMount() {
|
|
77
|
-
var _this$props$makeStyle, _this$
|
|
62
|
+
var _this$props$makeStyle, _this$props;
|
|
78
63
|
|
|
79
|
-
(_this$props$makeStyle = (_this$
|
|
64
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
80
65
|
}
|
|
81
66
|
|
|
82
67
|
componentDidUpdate() {
|
|
83
|
-
var _this$props$makeStyle2, _this$
|
|
68
|
+
var _this$props$makeStyle2, _this$props2;
|
|
84
69
|
|
|
85
|
-
(_this$props$makeStyle2 = (_this$
|
|
70
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
86
71
|
}
|
|
87
72
|
|
|
73
|
+
handleRef = el => {
|
|
74
|
+
const elementRef = this.props.elementRef;
|
|
75
|
+
this.ref = el;
|
|
76
|
+
|
|
77
|
+
if (typeof elementRef === 'function') {
|
|
78
|
+
elementRef(el);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
handleClick = e => {
|
|
82
|
+
const _this$props3 = this.props,
|
|
83
|
+
isDisabled = _this$props3.isDisabled,
|
|
84
|
+
onClick = _this$props3.onClick;
|
|
85
|
+
|
|
86
|
+
if (isDisabled) {
|
|
87
|
+
e.preventDefault();
|
|
88
|
+
e.stopPropagation();
|
|
89
|
+
} else if (typeof onClick === 'function') {
|
|
90
|
+
onClick(e);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
88
94
|
render() {
|
|
89
95
|
var _this$props$styles, _this$props$styles2;
|
|
90
96
|
|
|
@@ -120,12 +126,7 @@ let Item = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
120
126
|
}, label), renderAfter && (0, _callRenderProp.callRenderProp)(renderAfter));
|
|
121
127
|
}
|
|
122
128
|
|
|
123
|
-
}
|
|
124
|
-
children: null,
|
|
125
|
-
isSelected: false,
|
|
126
|
-
cursor: 'pointer',
|
|
127
|
-
isDisabled: false
|
|
128
|
-
}, _class2)) || _class) || _class);
|
|
129
|
+
}) || _class) || _class);
|
|
129
130
|
exports.Item = Item;
|
|
130
131
|
var _default = Item;
|
|
131
132
|
exports.default = _default;
|