@instructure/ui-navigation 10.26.1-snapshot-2 → 10.26.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 CHANGED
@@ -3,30 +3,17 @@
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
- ## [10.26.1-snapshot-2](https://github.com/instructure/instructure-ui/compare/v10.26.0...v10.26.1-snapshot-2) (2025-10-06)
6
+ ## [10.26.2](https://github.com/instructure/instructure-ui/compare/v10.26.1...v10.26.2) (2025-10-13)
7
7
 
8
+ **Note:** Version bump only for package @instructure/ui-navigation
8
9
 
9
- ### Features
10
10
 
11
- * **many:** instUI v11 release ([36f5438](https://github.com/instructure/instructure-ui/commit/36f54382669186227ba24798bbf7201ef2f5cd4c))
12
11
 
13
12
 
14
- ### BREAKING CHANGES
15
13
 
16
- * **many:** InstUI v11 contains the following breaking changes:
17
- - React 16 and 17 are no longer supported
18
- - remove `PropTypes` from all packages
19
- - remove `CodeEditor` component
20
- - remove `@instui/theme-registry` package
21
- - remove `@testable`, `@experimental`, `@hack` decorators
22
- - InstUISettingsProvider's `as` prop is removed
23
- - `canvas.use()`, `canvasHighContrast.use()` functions are removed
24
- - `canvasThemeLocal`, `canvasHighContrastThemeLocal` are removed
25
- - `variables` field on theme objects are removed
26
- - remove deprecated props from Table: Row's `isStacked`, Body's
27
- `isStacked`, `hover`, and `headers`
28
- - `Table`'s `caption` prop is now required
29
- - `ui-dom-utils`'s `getComputedStyle` can now return `undefined`
14
+ ## [10.26.1](https://github.com/instructure/instructure-ui/compare/v10.26.0...v10.26.1) (2025-10-06)
15
+
16
+ **Note:** Version bump only for package @instructure/ui-navigation
30
17
 
31
18
 
32
19
 
@@ -1,4 +1,4 @@
1
- var _dec, _class, _Item;
1
+ var _dec, _dec2, _class, _Item;
2
2
  /*
3
3
  * The MIT License (MIT)
4
4
  *
@@ -26,12 +26,13 @@ var _dec, _class, _Item;
26
26
  import { Component } from 'react';
27
27
  import { logError as error } from '@instructure/console';
28
28
  import { callRenderProp, getElementType, matchComponentTypes, passthroughProps } from '@instructure/ui-react-utils';
29
+ import { testable } from '@instructure/ui-testable';
29
30
  import { View } from '@instructure/ui-view';
30
31
  import { ScreenReaderContent } from '@instructure/ui-a11y-content';
31
32
  import { withStyle } from '@instructure/emotion';
32
33
  import generateStyle from './styles';
33
34
  import generateComponentTheme from './theme';
34
- import { allowedProps } from './props';
35
+ import { allowedProps, propTypes } from './props';
35
36
 
36
37
  /**
37
38
  ---
@@ -41,7 +42,7 @@ id: AppNav.Item
41
42
  @module Item
42
43
  **/
43
44
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
44
- let Item = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_Item = class Item extends Component {
45
+ let Item = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_Item = class Item extends Component {
45
46
  constructor(...args) {
46
47
  super(...args);
47
48
  this.ref = null;
@@ -100,18 +101,17 @@ let Item = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
100
101
  borderRadius: "medium",
101
102
  cursor: isDisabled ? 'not-allowed' : cursor,
102
103
  css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.item,
103
- "data-cid": "AppNav.Item",
104
104
  children: [icon, labelIsForScreenReaders ? label : _jsx("span", {
105
105
  css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.label,
106
106
  children: label
107
107
  }), renderAfter && callRenderProp(renderAfter)]
108
108
  });
109
109
  }
110
- }, _Item.displayName = "Item", _Item.componentId = 'AppNav.Item', _Item.allowedProps = allowedProps, _Item.defaultProps = {
110
+ }, _Item.displayName = "Item", _Item.componentId = 'AppNav.Item', _Item.allowedProps = allowedProps, _Item.propTypes = propTypes, _Item.defaultProps = {
111
111
  children: null,
112
112
  isSelected: false,
113
113
  cursor: 'pointer',
114
114
  isDisabled: false
115
- }, _Item)) || _class);
115
+ }, _Item)) || _class) || _class);
116
116
  export default Item;
117
117
  export { Item };
@@ -21,6 +21,18 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
-
24
+ import PropTypes from 'prop-types';
25
+ const propTypes = {
26
+ renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.string, PropTypes.func]).isRequired,
27
+ renderAfter: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
28
+ renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
29
+ href: PropTypes.string,
30
+ onClick: PropTypes.func,
31
+ isSelected: PropTypes.bool,
32
+ elementRef: PropTypes.func,
33
+ as: PropTypes.elementType,
34
+ cursor: PropTypes.string,
35
+ isDisabled: PropTypes.bool
36
+ };
25
37
  const allowedProps = ['renderLabel', 'renderAfter', 'renderIcon', 'href', 'onClick', 'isSelected', 'elementRef', 'as', 'cursor', 'isDisabled'];
26
- export { allowedProps };
38
+ export { propTypes, allowedProps };
@@ -1,4 +1,4 @@
1
- var _dec, _class, _AppNav;
1
+ var _dec, _dec2, _class, _AppNav;
2
2
  /*
3
3
  * The MIT License (MIT)
4
4
  *
@@ -26,12 +26,13 @@ var _dec, _class, _AppNav;
26
26
  import { Component } from 'react';
27
27
  import { withStyle } from '@instructure/emotion';
28
28
  import { callRenderProp, omitProps } from '@instructure/ui-react-utils';
29
+ import { testable } from '@instructure/ui-testable';
29
30
  import { View } from '@instructure/ui-view';
30
31
  import { Menu } from '@instructure/ui-menu';
31
32
  import { Item } from './Item';
32
33
  import generateStyle from './styles';
33
34
  import generateComponentTheme from './theme';
34
- import { allowedProps } from './props';
35
+ import { allowedProps, propTypes } from './props';
35
36
  import { TruncateList } from '@instructure/ui-truncate-list';
36
37
 
37
38
  /**
@@ -40,7 +41,7 @@ category: components
40
41
  ---
41
42
  **/
42
43
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
43
- let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_AppNav = class AppNav extends Component {
44
+ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_AppNav = class AppNav extends Component {
44
45
  constructor(...args) {
45
46
  super(...args);
46
47
  this.state = {
@@ -95,7 +96,6 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_cla
95
96
  margin: margin,
96
97
  display: hasRenderedContent ? 'flex' : 'block',
97
98
  elementRef: this.handleRef,
98
- "data-cid": "AppNav",
99
99
  children: [renderBeforeItems && _jsx("span", {
100
100
  children: renderBeforeItems
101
101
  }), _jsx(TruncateList, {
@@ -113,12 +113,12 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_cla
113
113
  })]
114
114
  });
115
115
  }
116
- }, _AppNav.displayName = "AppNav", _AppNav.componentId = 'AppNav', _AppNav.allowedProps = allowedProps, _AppNav.defaultProps = {
116
+ }, _AppNav.displayName = "AppNav", _AppNav.componentId = 'AppNav', _AppNav.allowedProps = allowedProps, _AppNav.propTypes = propTypes, _AppNav.defaultProps = {
117
117
  children: null,
118
118
  debounce: 300,
119
119
  margin: '0',
120
120
  renderTruncateLabel: () => 'More',
121
121
  visibleItemsCount: 0
122
- }, _AppNav.Item = Item, _AppNav)) || _class);
122
+ }, _AppNav.Item = Item, _AppNav)) || _class) || _class);
123
123
  export { AppNav };
124
124
  export default AppNav;
@@ -22,5 +22,20 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ import PropTypes from 'prop-types';
26
+ import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
27
+ import { Item } from './Item';
28
+ const propTypes = {
29
+ screenReaderLabel: PropTypes.string.isRequired,
30
+ children: ChildrenPropTypes.oneOf([Item]),
31
+ debounce: PropTypes.number,
32
+ renderBeforeItems: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
33
+ renderAfterItems: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
34
+ margin: PropTypes.string,
35
+ elementRef: PropTypes.func,
36
+ renderTruncateLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
37
+ onUpdate: PropTypes.func,
38
+ visibleItemsCount: PropTypes.number
39
+ };
25
40
  const allowedProps = ['screenReaderLabel', 'children', 'debounce', 'renderBeforeItems', 'renderAfterItems', 'margin', 'elementRef', 'renderTruncateLabel', 'onUpdate', 'visibleItemsCount'];
26
- export { allowedProps };
41
+ export { propTypes, allowedProps };
@@ -11,6 +11,7 @@ var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js
11
11
  var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
12
12
  var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
13
13
  var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
14
+ var _testable = require("@instructure/ui-testable/lib/testable.js");
14
15
  var _View = require("@instructure/ui-view/lib/View");
15
16
  var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
16
17
  var _emotion = require("@instructure/emotion");
@@ -18,7 +19,7 @@ var _styles = _interopRequireDefault(require("./styles"));
18
19
  var _theme = _interopRequireDefault(require("./theme"));
19
20
  var _props = require("./props");
20
21
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
21
- var _dec, _class, _Item;
22
+ var _dec, _dec2, _class, _Item;
22
23
  /*
23
24
  * The MIT License (MIT)
24
25
  *
@@ -49,7 +50,7 @@ id: AppNav.Item
49
50
  ---
50
51
  @module Item
51
52
  **/
52
- let Item = exports.Item = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_Item = class Item extends _react.Component {
53
+ let Item = exports.Item = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_Item = class Item extends _react.Component {
53
54
  constructor(...args) {
54
55
  super(...args);
55
56
  this.ref = null;
@@ -108,17 +109,16 @@ let Item = exports.Item = (_dec = (0, _emotion.withStyle)(_styles.default, _them
108
109
  borderRadius: "medium",
109
110
  cursor: isDisabled ? 'not-allowed' : cursor,
110
111
  css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.item,
111
- "data-cid": "AppNav.Item",
112
112
  children: [icon, labelIsForScreenReaders ? label : (0, _jsxRuntime.jsx)("span", {
113
113
  css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.label,
114
114
  children: label
115
115
  }), renderAfter && (0, _callRenderProp.callRenderProp)(renderAfter)]
116
116
  });
117
117
  }
118
- }, _Item.displayName = "Item", _Item.componentId = 'AppNav.Item', _Item.allowedProps = _props.allowedProps, _Item.defaultProps = {
118
+ }, _Item.displayName = "Item", _Item.componentId = 'AppNav.Item', _Item.allowedProps = _props.allowedProps, _Item.propTypes = _props.propTypes, _Item.defaultProps = {
119
119
  children: null,
120
120
  isSelected: false,
121
121
  cursor: 'pointer',
122
122
  isDisabled: false
123
- }, _Item)) || _class);
123
+ }, _Item)) || _class) || _class);
124
124
  var _default = exports.default = Item;
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.allowedProps = void 0;
7
+ exports.propTypes = exports.allowedProps = void 0;
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
7
9
  /*
8
10
  * The MIT License (MIT)
9
11
  *
@@ -28,4 +30,16 @@ exports.allowedProps = void 0;
28
30
  * SOFTWARE.
29
31
  */
30
32
 
33
+ const propTypes = exports.propTypes = {
34
+ renderLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.string, _propTypes.default.func]).isRequired,
35
+ renderAfter: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
36
+ renderIcon: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
37
+ href: _propTypes.default.string,
38
+ onClick: _propTypes.default.func,
39
+ isSelected: _propTypes.default.bool,
40
+ elementRef: _propTypes.default.func,
41
+ as: _propTypes.default.elementType,
42
+ cursor: _propTypes.default.string,
43
+ isDisabled: _propTypes.default.bool
44
+ };
31
45
  const allowedProps = exports.allowedProps = ['renderLabel', 'renderAfter', 'renderIcon', 'href', 'onClick', 'isSelected', 'elementRef', 'as', 'cursor', 'isDisabled'];
@@ -9,6 +9,7 @@ var _react = require("react");
9
9
  var _emotion = require("@instructure/emotion");
10
10
  var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
11
11
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
12
+ var _testable = require("@instructure/ui-testable/lib/testable.js");
12
13
  var _View = require("@instructure/ui-view/lib/View");
13
14
  var _Menu = require("@instructure/ui-menu/lib/Menu");
14
15
  var _Item = require("./Item");
@@ -17,7 +18,7 @@ var _theme = _interopRequireDefault(require("./theme"));
17
18
  var _props = require("./props");
18
19
  var _TruncateList = require("@instructure/ui-truncate-list/lib/TruncateList");
19
20
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
20
- var _dec, _class, _AppNav;
21
+ var _dec, _dec2, _class, _AppNav;
21
22
  /*
22
23
  * The MIT License (MIT)
23
24
  *
@@ -46,7 +47,7 @@ var _dec, _class, _AppNav;
46
47
  category: components
47
48
  ---
48
49
  **/
49
- let AppNav = exports.AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_AppNav = class AppNav extends _react.Component {
50
+ let AppNav = exports.AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_AppNav = class AppNav extends _react.Component {
50
51
  constructor(...args) {
51
52
  super(...args);
52
53
  this.state = {
@@ -101,7 +102,6 @@ let AppNav = exports.AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _
101
102
  margin: margin,
102
103
  display: hasRenderedContent ? 'flex' : 'block',
103
104
  elementRef: this.handleRef,
104
- "data-cid": "AppNav",
105
105
  children: [renderBeforeItems && (0, _jsxRuntime.jsx)("span", {
106
106
  children: renderBeforeItems
107
107
  }), (0, _jsxRuntime.jsx)(_TruncateList.TruncateList, {
@@ -119,11 +119,11 @@ let AppNav = exports.AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _
119
119
  })]
120
120
  });
121
121
  }
122
- }, _AppNav.displayName = "AppNav", _AppNav.componentId = 'AppNav', _AppNav.allowedProps = _props.allowedProps, _AppNav.defaultProps = {
122
+ }, _AppNav.displayName = "AppNav", _AppNav.componentId = 'AppNav', _AppNav.allowedProps = _props.allowedProps, _AppNav.propTypes = _props.propTypes, _AppNav.defaultProps = {
123
123
  children: null,
124
124
  debounce: 300,
125
125
  margin: '0',
126
126
  renderTruncateLabel: () => 'More',
127
127
  visibleItemsCount: 0
128
- }, _AppNav.Item = _Item.Item, _AppNav)) || _class);
128
+ }, _AppNav.Item = _Item.Item, _AppNav)) || _class) || _class);
129
129
  var _default = exports.default = AppNav;
@@ -1,9 +1,13 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.allowedProps = void 0;
7
+ exports.propTypes = exports.allowedProps = void 0;
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _Children = require("@instructure/ui-prop-types/lib/Children.js");
10
+ var _Item = require("./Item");
7
11
  /*
8
12
  * The MIT License (MIT)
9
13
  *
@@ -28,4 +32,16 @@ exports.allowedProps = void 0;
28
32
  * SOFTWARE.
29
33
  */
30
34
 
35
+ const propTypes = exports.propTypes = {
36
+ screenReaderLabel: _propTypes.default.string.isRequired,
37
+ children: _Children.Children.oneOf([_Item.Item]),
38
+ debounce: _propTypes.default.number,
39
+ renderBeforeItems: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
40
+ renderAfterItems: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
41
+ margin: _propTypes.default.string,
42
+ elementRef: _propTypes.default.func,
43
+ renderTruncateLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
44
+ onUpdate: _propTypes.default.func,
45
+ visibleItemsCount: _propTypes.default.number
46
+ };
31
47
  const allowedProps = exports.allowedProps = ['screenReaderLabel', 'children', 'debounce', 'renderBeforeItems', 'renderAfterItems', 'margin', 'elementRef', 'renderTruncateLabel', 'onUpdate', 'visibleItemsCount'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-navigation",
3
- "version": "10.26.1-snapshot-2",
3
+ "version": "10.26.2",
4
4
  "description": "Main and application level navigational components",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -23,37 +23,40 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@instructure/ui-axe-check": "10.26.1-snapshot-2",
27
- "@instructure/ui-babel-preset": "10.26.1-snapshot-2",
28
- "@instructure/ui-color-utils": "10.26.1-snapshot-2",
29
- "@instructure/ui-scripts": "10.26.1-snapshot-2",
30
- "@instructure/ui-themes": "10.26.1-snapshot-2",
26
+ "@instructure/ui-axe-check": "10.26.2",
27
+ "@instructure/ui-babel-preset": "10.26.2",
28
+ "@instructure/ui-color-utils": "10.26.2",
29
+ "@instructure/ui-scripts": "10.26.2",
30
+ "@instructure/ui-themes": "10.26.2",
31
31
  "@testing-library/jest-dom": "^6.6.3",
32
- "@testing-library/react": "15.0.7",
32
+ "@testing-library/react": "^16.0.1",
33
33
  "@testing-library/user-event": "^14.6.1",
34
34
  "vitest": "^3.2.2"
35
35
  },
36
36
  "dependencies": {
37
37
  "@babel/runtime": "^7.27.6",
38
- "@instructure/console": "10.26.1-snapshot-2",
39
- "@instructure/debounce": "10.26.1-snapshot-2",
40
- "@instructure/emotion": "10.26.1-snapshot-2",
41
- "@instructure/shared-types": "10.26.1-snapshot-2",
42
- "@instructure/ui-a11y-content": "10.26.1-snapshot-2",
43
- "@instructure/ui-a11y-utils": "10.26.1-snapshot-2",
44
- "@instructure/ui-badge": "10.26.1-snapshot-2",
45
- "@instructure/ui-dom-utils": "10.26.1-snapshot-2",
46
- "@instructure/ui-focusable": "10.26.1-snapshot-2",
47
- "@instructure/ui-icons": "10.26.1-snapshot-2",
48
- "@instructure/ui-menu": "10.26.1-snapshot-2",
49
- "@instructure/ui-react-utils": "10.26.1-snapshot-2",
50
- "@instructure/ui-tooltip": "10.26.1-snapshot-2",
51
- "@instructure/ui-truncate-list": "10.26.1-snapshot-2",
52
- "@instructure/ui-utils": "10.26.1-snapshot-2",
53
- "@instructure/ui-view": "10.26.1-snapshot-2"
38
+ "@instructure/console": "10.26.2",
39
+ "@instructure/debounce": "10.26.2",
40
+ "@instructure/emotion": "10.26.2",
41
+ "@instructure/shared-types": "10.26.2",
42
+ "@instructure/ui-a11y-content": "10.26.2",
43
+ "@instructure/ui-a11y-utils": "10.26.2",
44
+ "@instructure/ui-badge": "10.26.2",
45
+ "@instructure/ui-dom-utils": "10.26.2",
46
+ "@instructure/ui-focusable": "10.26.2",
47
+ "@instructure/ui-icons": "10.26.2",
48
+ "@instructure/ui-menu": "10.26.2",
49
+ "@instructure/ui-prop-types": "10.26.2",
50
+ "@instructure/ui-react-utils": "10.26.2",
51
+ "@instructure/ui-testable": "10.26.2",
52
+ "@instructure/ui-tooltip": "10.26.2",
53
+ "@instructure/ui-truncate-list": "10.26.2",
54
+ "@instructure/ui-utils": "10.26.2",
55
+ "@instructure/ui-view": "10.26.2",
56
+ "prop-types": "^15.8.1"
54
57
  },
55
58
  "peerDependencies": {
56
- "react": ">=18 <=19"
59
+ "react": ">=16.14 <=18"
57
60
  },
58
61
  "publishConfig": {
59
62
  "access": "public"
@@ -31,6 +31,7 @@ import {
31
31
  matchComponentTypes,
32
32
  passthroughProps
33
33
  } from '@instructure/ui-react-utils'
34
+ import { testable } from '@instructure/ui-testable'
34
35
 
35
36
  import { View } from '@instructure/ui-view'
36
37
  import { ScreenReaderContent } from '@instructure/ui-a11y-content'
@@ -41,7 +42,7 @@ import { withStyle } from '@instructure/emotion'
41
42
  import generateStyle from './styles'
42
43
  import generateComponentTheme from './theme'
43
44
  import type { AppNavItemProps } from './props'
44
- import { allowedProps } from './props'
45
+ import { allowedProps, propTypes } from './props'
45
46
 
46
47
  /**
47
48
  ---
@@ -51,10 +52,12 @@ id: AppNav.Item
51
52
  @module Item
52
53
  **/
53
54
  @withStyle(generateStyle, generateComponentTheme)
55
+ @testable()
54
56
  class Item extends Component<AppNavItemProps> {
55
57
  static readonly componentId = 'AppNav.Item'
56
58
 
57
59
  static allowedProps = allowedProps
60
+ static propTypes = propTypes
58
61
 
59
62
  static defaultProps = {
60
63
  children: null,
@@ -127,7 +130,6 @@ class Item extends Component<AppNavItemProps> {
127
130
  borderRadius="medium"
128
131
  cursor={isDisabled ? 'not-allowed' : cursor}
129
132
  css={this.props.styles?.item}
130
- data-cid="AppNav.Item"
131
133
  >
132
134
  {icon}
133
135
  {labelIsForScreenReaders ? (
@@ -21,14 +21,16 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
+ import PropTypes from 'prop-types'
24
25
 
25
26
  import type {
26
27
  AsElementType,
28
+ PropValidators,
27
29
  AppNavItemTheme,
28
30
  OtherHTMLAttributes
29
31
  } from '@instructure/shared-types'
30
32
  import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
31
- import type { Cursor } from '@instructure/shared-types'
33
+ import type { Cursor } from '@instructure/ui-prop-types'
32
34
  import React from 'react'
33
35
  import { Renderable } from '@instructure/shared-types'
34
36
 
@@ -86,6 +88,24 @@ type AppNavItemProps = AppNavItemOwnProps &
86
88
  OtherHTMLAttributes<AppNavItemOwnProps>
87
89
 
88
90
  type AppNavItemStyle = ComponentStyle<'item' | 'label'>
91
+
92
+ const propTypes: PropValidators<PropKeys> = {
93
+ renderLabel: PropTypes.oneOfType([
94
+ PropTypes.node,
95
+ PropTypes.string,
96
+ PropTypes.func
97
+ ]).isRequired,
98
+ renderAfter: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
99
+ renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
100
+ href: PropTypes.string,
101
+ onClick: PropTypes.func,
102
+ isSelected: PropTypes.bool,
103
+ elementRef: PropTypes.func,
104
+ as: PropTypes.elementType,
105
+ cursor: PropTypes.string,
106
+ isDisabled: PropTypes.bool
107
+ }
108
+
89
109
  const allowedProps: AllowedPropKeys = [
90
110
  'renderLabel',
91
111
  'renderAfter',
@@ -100,4 +120,4 @@ const allowedProps: AllowedPropKeys = [
100
120
  ]
101
121
 
102
122
  export type { AppNavItemProps, AppNavItemStyle }
103
- export { allowedProps }
123
+ export { propTypes, allowedProps }
@@ -27,6 +27,7 @@ import { ComponentElement, Component } from 'react'
27
27
  import { withStyle } from '@instructure/emotion'
28
28
 
29
29
  import { callRenderProp, omitProps } from '@instructure/ui-react-utils'
30
+ import { testable } from '@instructure/ui-testable'
30
31
 
31
32
  import { View } from '@instructure/ui-view'
32
33
  import { Menu } from '@instructure/ui-menu'
@@ -35,7 +36,7 @@ import { Item } from './Item'
35
36
  import generateStyle from './styles'
36
37
  import generateComponentTheme from './theme'
37
38
  import type { AppNavProps } from './props'
38
- import { allowedProps } from './props'
39
+ import { allowedProps, propTypes } from './props'
39
40
  import { AppNavItemProps } from './Item/props'
40
41
 
41
42
  import { TruncateList } from '@instructure/ui-truncate-list'
@@ -46,10 +47,12 @@ category: components
46
47
  ---
47
48
  **/
48
49
  @withStyle(generateStyle, generateComponentTheme)
50
+ @testable()
49
51
  class AppNav extends Component<AppNavProps> {
50
52
  static readonly componentId = 'AppNav'
51
53
 
52
54
  static allowedProps = allowedProps
55
+ static propTypes = propTypes
53
56
 
54
57
  static defaultProps = {
55
58
  children: null,
@@ -136,7 +139,6 @@ class AppNav extends Component<AppNavProps> {
136
139
  margin={margin}
137
140
  display={hasRenderedContent ? 'flex' : 'block'}
138
141
  elementRef={this.handleRef}
139
- data-cid="AppNav"
140
142
  >
141
143
  {renderBeforeItems && <span>{renderBeforeItems}</span>}
142
144
 
@@ -22,6 +22,11 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
  import React from 'react'
25
+ import PropTypes from 'prop-types'
26
+
27
+ import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types'
28
+
29
+ import { Item } from './Item'
25
30
 
26
31
  import type {
27
32
  Spacing,
@@ -29,6 +34,7 @@ import type {
29
34
  ComponentStyle
30
35
  } from '@instructure/emotion'
31
36
  import type {
37
+ PropValidators,
32
38
  AppNavTheme,
33
39
  OtherHTMLAttributes
34
40
  } from '@instructure/shared-types'
@@ -96,6 +102,20 @@ type AppNavStyle = ComponentStyle<'appNav' | 'alignCenter' | 'list'> & {
96
102
  horizontalMargin: string
97
103
  menuTriggerWidth: string
98
104
  }
105
+
106
+ const propTypes: PropValidators<PropKeys> = {
107
+ screenReaderLabel: PropTypes.string.isRequired,
108
+ children: ChildrenPropTypes.oneOf([Item]),
109
+ debounce: PropTypes.number,
110
+ renderBeforeItems: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
111
+ renderAfterItems: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
112
+ margin: PropTypes.string,
113
+ elementRef: PropTypes.func,
114
+ renderTruncateLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
115
+ onUpdate: PropTypes.func,
116
+ visibleItemsCount: PropTypes.number
117
+ }
118
+
99
119
  const allowedProps: AllowedPropKeys = [
100
120
  'screenReaderLabel',
101
121
  'children',
@@ -110,4 +130,4 @@ const allowedProps: AllowedPropKeys = [
110
130
  ]
111
131
 
112
132
  export type { AppNavProps, AppNavStyle }
113
- export { allowedProps }
133
+ export { propTypes, allowedProps }
@@ -22,8 +22,10 @@
22
22
  { "path": "../ui-focusable/tsconfig.build.json" },
23
23
  { "path": "../ui-icons/tsconfig.build.json" },
24
24
  { "path": "../ui-menu/tsconfig.build.json" },
25
+ { "path": "../ui-prop-types/tsconfig.build.json" },
25
26
  { "path": "../ui-react-utils/tsconfig.build.json" },
26
27
  { "path": "../ui-scripts/tsconfig.build.json" },
28
+ { "path": "../ui-testable/tsconfig.build.json" },
27
29
  { "path": "../ui-tooltip/tsconfig.build.json" },
28
30
  { "path": "../ui-truncate-list/tsconfig.build.json" },
29
31
  { "path": "../ui-utils/tsconfig.build.json" },