@instructure/ui-navigation 8.8.1-snapshot.8 → 8.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/es/AppNav/Item/index.js +21 -77
  3. package/es/AppNav/Item/props.js +79 -0
  4. package/es/AppNav/index.js +26 -80
  5. package/es/AppNav/props.js +87 -0
  6. package/es/Navigation/NavigationItem/index.js +25 -60
  7. package/{src/AppNav/types.ts → es/Navigation/NavigationItem/props.js} +37 -14
  8. package/es/Navigation/index.js +18 -57
  9. package/es/Navigation/props.js +68 -0
  10. package/lib/AppNav/Item/index.js +21 -77
  11. package/lib/AppNav/Item/props.js +90 -0
  12. package/lib/AppNav/index.js +25 -80
  13. package/lib/AppNav/props.js +101 -0
  14. package/lib/Navigation/NavigationItem/index.js +25 -60
  15. package/lib/Navigation/NavigationItem/props.js +73 -0
  16. package/lib/Navigation/index.js +19 -61
  17. package/lib/Navigation/props.js +83 -0
  18. package/package.json +24 -25
  19. package/src/AppNav/Item/index.tsx +8 -62
  20. package/src/AppNav/Item/props.ts +107 -0
  21. package/src/AppNav/Item/styles.ts +1 -1
  22. package/src/AppNav/index.tsx +13 -69
  23. package/src/AppNav/props.ts +118 -0
  24. package/src/Navigation/NavigationItem/index.tsx +10 -45
  25. package/src/Navigation/NavigationItem/props.ts +87 -0
  26. package/src/Navigation/NavigationItem/styles.ts +1 -1
  27. package/src/Navigation/index.tsx +13 -56
  28. package/src/Navigation/props.ts +108 -0
  29. package/src/Navigation/styles.ts +1 -1
  30. package/src/index.ts +4 -4
  31. package/types/AppNav/Item/index.d.ts +25 -53
  32. package/types/AppNav/Item/index.d.ts.map +1 -1
  33. package/types/AppNav/Item/props.d.ts +23 -0
  34. package/types/AppNav/Item/props.d.ts.map +1 -0
  35. package/types/AppNav/Item/styles.d.ts +1 -1
  36. package/types/AppNav/index.d.ts +25 -58
  37. package/types/AppNav/index.d.ts.map +1 -1
  38. package/types/AppNav/props.d.ts +23 -0
  39. package/types/AppNav/props.d.ts.map +1 -0
  40. package/types/Navigation/NavigationItem/index.d.ts +19 -35
  41. package/types/Navigation/NavigationItem/index.d.ts.map +1 -1
  42. package/types/Navigation/NavigationItem/props.d.ts +20 -0
  43. package/types/Navigation/NavigationItem/props.d.ts.map +1 -0
  44. package/types/Navigation/NavigationItem/styles.d.ts +1 -1
  45. package/types/Navigation/index.d.ts +26 -42
  46. package/types/Navigation/index.d.ts.map +1 -1
  47. package/types/Navigation/props.d.ts +27 -0
  48. package/types/Navigation/props.d.ts.map +1 -0
  49. package/types/Navigation/styles.d.ts +1 -1
  50. package/types/index.d.ts +4 -4
  51. package/LICENSE.md +0 -27
  52. package/es/AppNav/Item/types.js +0 -1
  53. package/es/AppNav/types.js +0 -1
  54. package/es/Navigation/NavigationItem/types.js +0 -1
  55. package/es/Navigation/types.js +0 -1
  56. package/lib/AppNav/Item/types.js +0 -1
  57. package/lib/AppNav/types.js +0 -1
  58. package/lib/Navigation/NavigationItem/types.js +0 -1
  59. package/lib/Navigation/types.js +0 -1
  60. package/src/AppNav/Item/types.ts +0 -40
  61. package/src/Navigation/NavigationItem/types.ts +0 -37
  62. package/src/Navigation/types.ts +0 -42
  63. package/types/AppNav/Item/types.d.ts +0 -17
  64. package/types/AppNav/Item/types.d.ts.map +0 -1
  65. package/types/AppNav/types.d.ts +0 -16
  66. package/types/AppNav/types.d.ts.map +0 -1
  67. package/types/Navigation/NavigationItem/types.d.ts +0 -14
  68. package/types/Navigation/NavigationItem/types.d.ts.map +0 -1
  69. package/types/Navigation/types.d.ts +0 -18
  70. package/types/Navigation/types.d.ts.map +0 -1
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.allowedProps = exports.propTypes = void 0;
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ /*
13
+ * The MIT License (MIT)
14
+ *
15
+ * Copyright (c) 2015 - present Instructure, Inc.
16
+ *
17
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ * of this software and associated documentation files (the "Software"), to deal
19
+ * in the Software without restriction, including without limitation the rights
20
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ * copies of the Software, and to permit persons to whom the Software is
22
+ * furnished to do so, subject to the following conditions:
23
+ *
24
+ * The above copyright notice and this permission notice shall be included in all
25
+ * copies or substantial portions of the Software.
26
+ *
27
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
+ * SOFTWARE.
34
+ */
35
+ const propTypes = {
36
+ /**
37
+ * The visual to display (ex. an Image, Logo, Avatar, or Icon)
38
+ */
39
+ icon: _propTypes.default.node.isRequired,
40
+
41
+ /**
42
+ * The text to display for the Navigation Link
43
+ */
44
+ label: _propTypes.default.node.isRequired,
45
+
46
+ /**
47
+ * The element type to render as (will default to `<a>` if href is provided)
48
+ */
49
+ as: _propTypes.default.elementType,
50
+
51
+ /**
52
+ * If the NavigationItem goes to a new page, pass an href
53
+ */
54
+ href: _propTypes.default.string,
55
+
56
+ /**
57
+ * If the NavigationItem does not go to a new page pass an onClick
58
+ */
59
+ onClick: _propTypes.default.func,
60
+
61
+ /**
62
+ * Denotes which NavigationItem is currently selected
63
+ */
64
+ selected: _propTypes.default.bool,
65
+
66
+ /**
67
+ * When minimized is set to true, the `<Navigation />` shows icons only while the text becomes a tooltip. When it is set to false, the `<Navigation />` shows text in addition to the icons
68
+ */
69
+ minimized: _propTypes.default.bool
70
+ };
71
+ exports.propTypes = propTypes;
72
+ const allowedProps = ['icon', 'label', 'as', 'href', 'onClick', 'selected', 'minimized'];
73
+ exports.allowedProps = allowedProps;
@@ -15,14 +15,8 @@ exports.Navigation = exports.default = void 0;
15
15
 
16
16
  var _react = require("react");
17
17
 
18
- var _propTypes = _interopRequireDefault(require("prop-types"));
19
-
20
18
  var _testable = require("@instructure/ui-testable/lib/testable.js");
21
19
 
22
- var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
23
-
24
- var _Children = require("@instructure/ui-prop-types/lib/Children.js");
25
-
26
20
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
27
21
 
28
22
  var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
@@ -39,6 +33,8 @@ var _styles = _interopRequireDefault(require("./styles"));
39
33
 
40
34
  var _theme = _interopRequireDefault(require("./theme"));
41
35
 
36
+ var _props = require("./props");
37
+
42
38
  var _dec, _dec2, _class, _class2, _temp;
43
39
 
44
40
  const navMinimized = ({
@@ -71,13 +67,17 @@ let Navigation = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
71
67
  }
72
68
 
73
69
  componentDidMount() {
74
- this.props.makeStyles({
70
+ var _this$props$makeStyle, _this$props;
71
+
72
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
75
73
  minimized: this.minimized
76
74
  });
77
75
  }
78
76
 
79
77
  componentDidUpdate() {
80
- this.props.makeStyles({
78
+ var _this$props$makeStyle2, _this$props2;
79
+
80
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
81
81
  minimized: this.minimized
82
82
  });
83
83
  }
@@ -96,11 +96,13 @@ let Navigation = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
96
96
 
97
97
  renderChildren() {
98
98
  return _react.Children.map(this.props.children, child => {
99
+ var _this$props$styles;
100
+
99
101
  const navItem = (0, _safeCloneElement.safeCloneElement)(child, {
100
102
  minimized: this.state.minimized
101
103
  });
102
104
  return (0, _emotion.jsx)("li", {
103
- css: this.props.styles.list
105
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.list
104
106
  }, navItem);
105
107
  });
106
108
  }
@@ -110,77 +112,33 @@ let Navigation = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
110
112
  }
111
113
 
112
114
  render() {
115
+ var _this$props$styles2, _this$props$styles3, _this$props$styles4, _this$props$styles5;
116
+
113
117
  const label = this.props.label;
114
118
  const props = (0, _omitProps.omitProps)(this.props, Navigation.propTypes, ['minimized']);
115
119
  return (0, _emotion.jsx)("nav", Object.assign({}, props, {
116
- css: this.props.styles.navigation,
120
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.navigation,
117
121
  "aria-label": label
118
122
  }), (0, _emotion.jsx)("ul", {
119
- css: this.props.styles.content
123
+ css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.content
120
124
  }, this.renderChildren()), (0, _emotion.jsx)("div", {
121
- css: this.props.styles.toggle
125
+ css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.toggle
122
126
  }, (0, _emotion.jsx)(_NavigationItem.NavigationItem, {
123
127
  "aria-expanded": !this.minimized,
124
128
  onClick: this.handleNavToggle,
125
129
  icon: (0, _emotion.jsx)(_IconMoveStartLine.IconMoveStartLine, {
126
- css: this.props.styles.toggleIcon,
130
+ css: (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.toggleIcon,
127
131
  inline: false
128
132
  }),
129
133
  label: (0, _emotion.jsx)(_ScreenReaderContent.ScreenReaderContent, null, this.toggleMessage())
130
134
  })));
131
135
  }
132
136
 
133
- }, _class2.displayName = "Navigation", _class2.componentId = 'Navigation', _class2.propTypes = {
134
- // eslint-disable-next-line react/require-default-props
135
- makeStyles: _propTypes.default.func,
136
- // eslint-disable-next-line react/require-default-props
137
- styles: _propTypes.default.object,
138
-
139
- /**
140
- * children of type Navigation.Item
141
- */
142
- children: _Children.Children.oneOf([_NavigationItem.NavigationItem]),
143
-
144
- /**
145
- * When minimized is set to true, the `<Navigation />` shows icons only while the text becomes a tooltip. When it is set to false, the `<Navigation />` shows text in addition to the icons
146
- */
147
- minimized: (0, _controllable.controllable)(_propTypes.default.bool, 'onMinimized', 'defaultMinimized'),
148
-
149
- /**
150
- * Whether the `<Navigation />` is initially minimized (uncontrolled)
151
- */
152
- defaultMinimized: _propTypes.default.bool,
153
- onMinimized: _propTypes.default.func,
154
-
155
- /**
156
- * Screen reader label for the main Navigation
157
- */
158
- label: _propTypes.default.string.isRequired,
159
-
160
- /**
161
- * Screen reader label for the toggle button expanded/minimized state
162
- */
163
- toggleLabel: _propTypes.default.shape({
164
- expandedLabel: _propTypes.default.string,
165
- minimizedLabel: _propTypes.default.string
166
- }).isRequired,
167
-
168
- /**
169
- * If the `<Navigation.Item>` goes to a new page, pass an href
170
- */
171
- href: _propTypes.default.string,
172
-
173
- /**
174
- * If the `<Navigation.Item>` does not go to a new page pass an onClick
175
- */
176
- onClick: _propTypes.default.func
177
- }, _class2.defaultProps = {
137
+ }, _class2.displayName = "Navigation", _class2.componentId = 'Navigation', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
178
138
  children: null,
179
139
  defaultMinimized: false,
180
140
  onMinimized: function (event, minimized) {},
181
- onClick: function (e) {},
182
- href: void 0,
183
- minimized: void 0
141
+ onClick: function (e) {}
184
142
  }, _class2.Item = _NavigationItem.NavigationItem, _temp)) || _class) || _class);
185
143
  exports.Navigation = Navigation;
186
144
  var _default = Navigation;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.allowedProps = exports.propTypes = void 0;
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
13
+
14
+ var _Children = require("@instructure/ui-prop-types/lib/Children.js");
15
+
16
+ var _NavigationItem = require("./NavigationItem");
17
+
18
+ /*
19
+ * The MIT License (MIT)
20
+ *
21
+ * Copyright (c) 2015 - present Instructure, Inc.
22
+ *
23
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
24
+ * of this software and associated documentation files (the "Software"), to deal
25
+ * in the Software without restriction, including without limitation the rights
26
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
27
+ * copies of the Software, and to permit persons to whom the Software is
28
+ * furnished to do so, subject to the following conditions:
29
+ *
30
+ * The above copyright notice and this permission notice shall be included in all
31
+ * copies or substantial portions of the Software.
32
+ *
33
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
36
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
37
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
38
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
39
+ * SOFTWARE.
40
+ */
41
+ const propTypes = {
42
+ /**
43
+ * children of type Navigation.Item
44
+ */
45
+ children: _Children.Children.oneOf([_NavigationItem.NavigationItem]),
46
+
47
+ /**
48
+ * When minimized is set to true, the `<Navigation />` shows icons only while the text becomes a tooltip. When it is set to false, the `<Navigation />` shows text in addition to the icons
49
+ */
50
+ minimized: (0, _controllable.controllable)(_propTypes.default.bool, 'onMinimized', 'defaultMinimized'),
51
+
52
+ /**
53
+ * Whether the `<Navigation />` is initially minimized (uncontrolled)
54
+ */
55
+ defaultMinimized: _propTypes.default.bool,
56
+ onMinimized: _propTypes.default.func,
57
+
58
+ /**
59
+ * Screen reader label for the main Navigation
60
+ */
61
+ label: _propTypes.default.string.isRequired,
62
+
63
+ /**
64
+ * Screen reader label for the toggle button expanded/minimized state
65
+ */
66
+ toggleLabel: _propTypes.default.shape({
67
+ expandedLabel: _propTypes.default.string,
68
+ minimizedLabel: _propTypes.default.string
69
+ }).isRequired,
70
+
71
+ /**
72
+ * If the `<Navigation.Item>` goes to a new page, pass an href
73
+ */
74
+ href: _propTypes.default.string,
75
+
76
+ /**
77
+ * If the `<Navigation.Item>` does not go to a new page pass an onClick
78
+ */
79
+ onClick: _propTypes.default.func
80
+ };
81
+ exports.propTypes = propTypes;
82
+ const allowedProps = ['children', 'minimized', 'defaultMinimized', 'onMinimized', 'label', 'toggleLabel', 'href', 'onClick'];
83
+ exports.allowedProps = allowedProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-navigation",
3
- "version": "8.8.1-snapshot.8+7b83164f4",
3
+ "version": "8.9.1",
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.8.1-snapshot.8+7b83164f4",
28
- "@instructure/ui-color-utils": "8.8.1-snapshot.8+7b83164f4",
29
- "@instructure/ui-test-locator": "8.8.1-snapshot.8+7b83164f4",
30
- "@instructure/ui-test-utils": "8.8.1-snapshot.8+7b83164f4",
31
- "@instructure/ui-themes": "8.8.1-snapshot.8+7b83164f4"
27
+ "@instructure/ui-babel-preset": "8.9.1",
28
+ "@instructure/ui-color-utils": "8.9.1",
29
+ "@instructure/ui-test-locator": "8.9.1",
30
+ "@instructure/ui-test-utils": "8.9.1",
31
+ "@instructure/ui-themes": "8.9.1"
32
32
  },
33
33
  "dependencies": {
34
34
  "@babel/runtime": "^7.13.10",
35
- "@instructure/console": "8.8.1-snapshot.8+7b83164f4",
36
- "@instructure/debounce": "8.8.1-snapshot.8+7b83164f4",
37
- "@instructure/emotion": "8.8.1-snapshot.8+7b83164f4",
38
- "@instructure/shared-types": "8.8.1-snapshot.8+7b83164f4",
39
- "@instructure/ui-a11y-content": "8.8.1-snapshot.8+7b83164f4",
40
- "@instructure/ui-a11y-utils": "8.8.1-snapshot.8+7b83164f4",
41
- "@instructure/ui-badge": "8.8.1-snapshot.8+7b83164f4",
42
- "@instructure/ui-dom-utils": "8.8.1-snapshot.8+7b83164f4",
43
- "@instructure/ui-focusable": "8.8.1-snapshot.8+7b83164f4",
44
- "@instructure/ui-icons": "8.8.1-snapshot.8+7b83164f4",
45
- "@instructure/ui-menu": "8.8.1-snapshot.8+7b83164f4",
46
- "@instructure/ui-prop-types": "8.8.1-snapshot.8+7b83164f4",
47
- "@instructure/ui-react-utils": "8.8.1-snapshot.8+7b83164f4",
48
- "@instructure/ui-testable": "8.8.1-snapshot.8+7b83164f4",
49
- "@instructure/ui-tooltip": "8.8.1-snapshot.8+7b83164f4",
50
- "@instructure/ui-utils": "8.8.1-snapshot.8+7b83164f4",
51
- "@instructure/ui-view": "8.8.1-snapshot.8+7b83164f4",
35
+ "@instructure/console": "8.9.1",
36
+ "@instructure/debounce": "8.9.1",
37
+ "@instructure/emotion": "8.9.1",
38
+ "@instructure/shared-types": "8.9.1",
39
+ "@instructure/ui-a11y-content": "8.9.1",
40
+ "@instructure/ui-a11y-utils": "8.9.1",
41
+ "@instructure/ui-badge": "8.9.1",
42
+ "@instructure/ui-dom-utils": "8.9.1",
43
+ "@instructure/ui-focusable": "8.9.1",
44
+ "@instructure/ui-icons": "8.9.1",
45
+ "@instructure/ui-menu": "8.9.1",
46
+ "@instructure/ui-prop-types": "8.9.1",
47
+ "@instructure/ui-react-utils": "8.9.1",
48
+ "@instructure/ui-testable": "8.9.1",
49
+ "@instructure/ui-tooltip": "8.9.1",
50
+ "@instructure/ui-utils": "8.9.1",
51
+ "@instructure/ui-view": "8.9.1",
52
52
  "prop-types": "^15"
53
53
  },
54
54
  "peerDependencies": {
@@ -57,6 +57,5 @@
57
57
  "publishConfig": {
58
58
  "access": "public"
59
59
  },
60
- "sideEffects": false,
61
- "gitHead": "7b83164f4c5872f3a217e010563f59bf584ae4fc"
60
+ "sideEffects": false
62
61
  }
@@ -23,7 +23,6 @@
23
23
  */
24
24
  /** @jsx jsx */
25
25
  import { Component } from 'react'
26
- import PropTypes from 'prop-types'
27
26
 
28
27
  import { logError as error } from '@instructure/console'
29
28
  import {
@@ -40,7 +39,8 @@ import { withStyle, jsx } from '@instructure/emotion'
40
39
 
41
40
  import generateStyle from './styles'
42
41
  import generateComponentTheme from './theme'
43
- import { AppNavItemProps } from './types'
42
+ import type { AppNavItemProps } from './props'
43
+ import { allowedProps, propTypes } from './props'
44
44
 
45
45
  /**
46
46
  ---
@@ -54,78 +54,24 @@ id: AppNav.Item
54
54
  class Item extends Component<AppNavItemProps> {
55
55
  static readonly componentId = 'AppNav.Item'
56
56
 
57
- static propTypes = {
58
- // eslint-disable-next-line react/require-default-props
59
- makeStyles: PropTypes.func,
60
- // eslint-disable-next-line react/require-default-props
61
- styles: PropTypes.object,
62
- /**
63
- * The text to display. If the `icon` prop is used, label text must be wrapped
64
- * in `ScreenReaderContent`.
65
- */
66
- renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
67
- .isRequired,
68
- /**
69
- * Content to display after the renderLabel text, such as a badge
70
- */
71
- renderAfter: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
72
- /**
73
- * The visual to display (ex. an Image, Logo, Avatar, or Icon)
74
- */
75
- renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
76
- /**
77
- * If the item goes to a new page, pass an href
78
- */
79
- href: PropTypes.string,
80
- /**
81
- * If the item does not go to a new page, pass an onClick
82
- */
83
- onClick: PropTypes.func,
84
- /**
85
- * Denotes which item is currently selected
86
- */
87
- isSelected: PropTypes.bool,
88
- /**
89
- * provides a reference to the underlying focusable (`button` or `a`) element
90
- */
91
- elementRef: PropTypes.func,
92
- /**
93
- * The element type to render as (will default to `<a>` if href is provided)
94
- */
95
- as: PropTypes.elementType,
96
- /**
97
- * Specify the mouse cursor to use on :hover.
98
- * The `pointer` cursor is used by default.
99
- */
100
- cursor: PropTypes.string,
101
- /**
102
- * Disables the link or button visually and functionally
103
- */
104
- isDisabled: PropTypes.bool
105
- }
57
+ static allowedProps = allowedProps
58
+ static propTypes = propTypes
106
59
 
107
60
  static defaultProps = {
108
61
  children: null,
109
62
  // @ts-expect-error ts-migrate(6133) FIXME: 'event' is declared but its value is never read.
110
63
  onClick: function (event) {},
111
64
  isSelected: false,
112
- href: undefined,
113
- elementRef: undefined,
114
- renderIcon: undefined,
115
- renderAfter: undefined,
116
- as: undefined,
117
65
  cursor: 'pointer',
118
66
  isDisabled: false
119
67
  }
120
68
 
121
69
  componentDidMount() {
122
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
123
- this.props.makeStyles()
70
+ this.props.makeStyles?.()
124
71
  }
125
72
 
126
73
  componentDidUpdate() {
127
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
128
- this.props.makeStyles()
74
+ this.props.makeStyles?.()
129
75
  }
130
76
 
131
77
  // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'e' implicitly has an 'any' type.
@@ -183,13 +129,13 @@ class Item extends Component<AppNavItemProps> {
183
129
  // @ts-expect-error ts-migrate(2339) FIXME: Property 'handleBlur' does not exist on type 'Item... Remove this comment to see the full error message
184
130
  onBlur={this.handleBlur}
185
131
  cursor={isDisabled ? 'not-allowed' : cursor}
186
- css={this.props.styles.item}
132
+ css={this.props.styles?.item}
187
133
  >
188
134
  {icon}
189
135
  {labelIsForScreenReaders ? (
190
136
  label
191
137
  ) : (
192
- <span css={this.props.styles.label}>{label}</span>
138
+ <span css={this.props.styles?.label}>{label}</span>
193
139
  )}
194
140
  {renderAfter && callRenderProp(renderAfter)}
195
141
  </View>