@instructure/ui-top-nav-bar 8.47.2-snapshot-3 → 8.47.2-snapshot-5

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 (56) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/es/TopNavBar/TopNavBarBrand/index.js +4 -4
  3. package/es/TopNavBar/TopNavBarBreadcrumb/__new-tests__/TopNavBarBreadcrumb.test.js +105 -0
  4. package/es/TopNavBar/TopNavBarBreadcrumb/index.js +111 -0
  5. package/es/TopNavBar/TopNavBarBreadcrumb/props.js +34 -0
  6. package/es/TopNavBar/TopNavBarBreadcrumb/styles.js +66 -0
  7. package/es/TopNavBar/TopNavBarLayout/DesktopLayout/index.js +22 -6
  8. package/es/TopNavBar/TopNavBarLayout/DesktopLayout/styles.js +11 -0
  9. package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.js +10 -3
  10. package/es/TopNavBar/TopNavBarLayout/props.js +3 -1
  11. package/es/TopNavBar/index.js +2 -1
  12. package/lib/TopNavBar/TopNavBarBrand/index.js +4 -3
  13. package/lib/TopNavBar/TopNavBarBreadcrumb/__new-tests__/TopNavBarBreadcrumb.test.js +106 -0
  14. package/lib/TopNavBar/TopNavBarBreadcrumb/index.js +117 -0
  15. package/lib/TopNavBar/TopNavBarBreadcrumb/props.js +40 -0
  16. package/lib/TopNavBar/TopNavBarBreadcrumb/styles.js +72 -0
  17. package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/index.js +22 -5
  18. package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/styles.js +11 -0
  19. package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.js +10 -3
  20. package/lib/TopNavBar/TopNavBarLayout/props.js +3 -1
  21. package/lib/TopNavBar/index.js +2 -1
  22. package/package.json +31 -27
  23. package/src/TopNavBar/README.md +41 -0
  24. package/src/TopNavBar/TopNavBarBrand/index.tsx +6 -1
  25. package/src/TopNavBar/TopNavBarBreadcrumb/__new-tests__/TopNavBarBreadcrumb.test.tsx +127 -0
  26. package/src/TopNavBar/TopNavBarBreadcrumb/index.tsx +145 -0
  27. package/src/TopNavBar/TopNavBarBreadcrumb/props.ts +102 -0
  28. package/src/TopNavBar/TopNavBarBreadcrumb/styles.ts +77 -0
  29. package/src/TopNavBar/TopNavBarLayout/DesktopLayout/index.tsx +34 -2
  30. package/src/TopNavBar/TopNavBarLayout/DesktopLayout/props.ts +2 -0
  31. package/src/TopNavBar/TopNavBarLayout/DesktopLayout/styles.ts +11 -0
  32. package/src/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.tsx +23 -5
  33. package/src/TopNavBar/TopNavBarLayout/props.ts +13 -0
  34. package/src/TopNavBar/index.tsx +2 -0
  35. package/tsconfig.build.json +3 -1
  36. package/tsconfig.build.tsbuildinfo +1 -1
  37. package/types/TopNavBar/TopNavBarBrand/index.d.ts.map +1 -1
  38. package/types/TopNavBar/TopNavBarBreadcrumb/__new-tests__/TopNavBarBreadcrumb.test.d.ts +2 -0
  39. package/types/TopNavBar/TopNavBarBreadcrumb/__new-tests__/TopNavBarBreadcrumb.test.d.ts.map +1 -0
  40. package/types/TopNavBar/TopNavBarBreadcrumb/index.d.ts +36 -0
  41. package/types/TopNavBar/TopNavBarBreadcrumb/index.d.ts.map +1 -0
  42. package/types/TopNavBar/TopNavBarBreadcrumb/props.d.ts +38 -0
  43. package/types/TopNavBar/TopNavBarBreadcrumb/props.d.ts.map +1 -0
  44. package/types/TopNavBar/TopNavBarBreadcrumb/styles.d.ts +5 -0
  45. package/types/TopNavBar/TopNavBarBreadcrumb/styles.d.ts.map +1 -0
  46. package/types/TopNavBar/TopNavBarLayout/DesktopLayout/index.d.ts +2 -0
  47. package/types/TopNavBar/TopNavBarLayout/DesktopLayout/index.d.ts.map +1 -1
  48. package/types/TopNavBar/TopNavBarLayout/DesktopLayout/props.d.ts +1 -1
  49. package/types/TopNavBar/TopNavBarLayout/DesktopLayout/props.d.ts.map +1 -1
  50. package/types/TopNavBar/TopNavBarLayout/DesktopLayout/styles.d.ts.map +1 -1
  51. package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.d.ts +1 -0
  52. package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.d.ts.map +1 -1
  53. package/types/TopNavBar/TopNavBarLayout/props.d.ts +9 -0
  54. package/types/TopNavBar/TopNavBarLayout/props.d.ts.map +1 -1
  55. package/types/TopNavBar/index.d.ts +2 -0
  56. package/types/TopNavBar/index.d.ts.map +1 -1
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.47.2-snapshot-3](https://github.com/instructure/instructure-ui/compare/v8.47.1...v8.47.2-snapshot-3) (2023-11-10)
6
+ ## [8.47.2-snapshot-5](https://github.com/instructure/instructure-ui/compare/v8.47.1...v8.47.2-snapshot-5) (2023-11-10)
7
7
 
8
8
  **Note:** Version bump only for package @instructure/ui-top-nav-bar
9
9
 
@@ -1,4 +1,4 @@
1
- var _dec, _dec2, _class, _class2;
1
+ var _dec, _dec2, _dec3, _class, _class2;
2
2
  /*
3
3
  * The MIT License (MIT)
4
4
  *
@@ -25,7 +25,7 @@ var _dec, _dec2, _class, _class2;
25
25
 
26
26
  /** @jsx jsx */
27
27
  import React, { Component } from 'react';
28
- import { getElementType, omitProps } from '@instructure/ui-react-utils';
28
+ import { deprecated, getElementType, omitProps } from '@instructure/ui-react-utils';
29
29
  import { testable } from '@instructure/ui-testable';
30
30
  import { withStyle, jsx } from '@instructure/emotion';
31
31
  import { ScreenReaderContent } from '@instructure/ui-a11y-content';
@@ -41,7 +41,7 @@ id: TopNavBar.Brand
41
41
  ---
42
42
  @module TopNavBarBrand
43
43
  **/
44
- let TopNavBarBrand = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_class2 = class TopNavBarBrand extends Component {
44
+ let TopNavBarBrand = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec3 = deprecated('9', null, 'Please use the updated TopNavBar design.'), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class TopNavBarBrand extends Component {
45
45
  constructor(...args) {
46
46
  super(...args);
47
47
  this.ref = null;
@@ -100,6 +100,6 @@ let TopNavBarBrand = (_dec = withStyle(generateStyle, generateComponentTheme), _
100
100
  "aria-hidden": "true"
101
101
  }, renderName)));
102
102
  }
103
- }, _class2.displayName = "TopNavBarBrand", _class2.componentId = 'TopNavBar.Brand', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {}, _class2.contextType = TopNavBarContext, _class2)) || _class) || _class);
103
+ }, _class2.displayName = "TopNavBarBrand", _class2.componentId = 'TopNavBar.Brand', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {}, _class2.contextType = TopNavBarContext, _class2)) || _class) || _class) || _class);
104
104
  export { TopNavBarBrand };
105
105
  export default TopNavBarBrand;
@@ -0,0 +1,105 @@
1
+ var _TopNavBarBreadcrumb, _BaseExample, _BaseExample2, _BaseExample3;
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2015 - present Instructure, Inc.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ import React from 'react';
27
+ import { render } from '@testing-library/react';
28
+ import '@testing-library/jest-dom';
29
+
30
+ // eslint-disable-next-line no-restricted-imports
31
+ import { runAxeCheck } from '@instructure/ui-axe-check';
32
+ import { TopNavBarBreadcrumb } from '../index';
33
+ import { Breadcrumb } from '@instructure/ui-breadcrumb';
34
+ import TopNavBarContext from '../../TopNavBarContext';
35
+ let originalResizeObserver;
36
+ let originalMatchMedia;
37
+ beforeAll(() => {
38
+ originalResizeObserver = global.ResizeObserver;
39
+ originalMatchMedia = window.matchMedia;
40
+ class MockResizeObserver {
41
+ constructor() {
42
+ this.observe = jest.fn();
43
+ this.unobserve = jest.fn();
44
+ this.disconnect = jest.fn();
45
+ }
46
+ }
47
+ global.ResizeObserver = MockResizeObserver;
48
+ window.matchMedia = jest.fn().mockImplementation(query => {
49
+ return {
50
+ matches: false,
51
+ media: query,
52
+ onchange: null,
53
+ addListener: jest.fn(),
54
+ removeListener: jest.fn()
55
+ };
56
+ });
57
+ });
58
+ afterAll(() => {
59
+ global.ResizeObserver = originalResizeObserver;
60
+ window.matchMedia = originalMatchMedia;
61
+ });
62
+ const TEST_BREADCRUMB_LABEL = 'You are here:';
63
+ const BaseExample = props => {
64
+ return /*#__PURE__*/React.createElement(TopNavBarContext.Provider, {
65
+ value: {
66
+ layout: props.layout,
67
+ inverseColor: props.inverseColor
68
+ }
69
+ }, _TopNavBarBreadcrumb || (_TopNavBarBreadcrumb = /*#__PURE__*/React.createElement(TopNavBarBreadcrumb, null, /*#__PURE__*/React.createElement(Breadcrumb, {
70
+ label: TEST_BREADCRUMB_LABEL
71
+ }, /*#__PURE__*/React.createElement(Breadcrumb.Link, null, "Course page 1"), /*#__PURE__*/React.createElement(Breadcrumb.Link, null, "Course page 2"), /*#__PURE__*/React.createElement(Breadcrumb.Link, null, "Course page 3"), /*#__PURE__*/React.createElement(Breadcrumb.Link, null, "Course page 4"), /*#__PURE__*/React.createElement(Breadcrumb.Link, null, "Course page 5")))));
72
+ };
73
+ describe('<TopNavBarBreadcrumb />', () => {
74
+ it('should render', () => {
75
+ const _render = render(_BaseExample || (_BaseExample = /*#__PURE__*/React.createElement(BaseExample, {
76
+ inverseColor: true,
77
+ layout: "desktop"
78
+ }))),
79
+ getByLabelText = _render.getByLabelText;
80
+ const element = getByLabelText(TEST_BREADCRUMB_LABEL);
81
+ expect(element).toBeInTheDocument();
82
+ });
83
+ it('should warn if inverseColor is false', () => {
84
+ const consoleMock = jest.spyOn(console, 'error').mockImplementation();
85
+ const _render2 = render(_BaseExample2 || (_BaseExample2 = /*#__PURE__*/React.createElement(BaseExample, {
86
+ inverseColor: false,
87
+ layout: "desktop"
88
+ }))),
89
+ queryByLabelText = _render2.queryByLabelText;
90
+ const element = queryByLabelText(TEST_BREADCRUMB_LABEL);
91
+ expect(element).not.toBeInTheDocument();
92
+ expect(consoleMock.mock.calls[0][0]).toEqual('Warning: [TopNavBarBreadcrumb] If the inverseColor prop is not set to true, TopNavBarBreadcrumb fails to render.');
93
+ });
94
+ describe('should be accessible', () => {
95
+ it('a11y', async () => {
96
+ const _render3 = render(_BaseExample3 || (_BaseExample3 = /*#__PURE__*/React.createElement(BaseExample, {
97
+ inverseColor: true,
98
+ layout: "desktop"
99
+ }))),
100
+ container = _render3.container;
101
+ const axeCheck = await runAxeCheck(container);
102
+ expect(axeCheck).toBe(true);
103
+ });
104
+ });
105
+ });
@@ -0,0 +1,111 @@
1
+ var _dec, _dec2, _class, _class2, _IconHamburgerLine;
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2015 - present Instructure, Inc.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ /** @jsx jsx */
27
+ import React, { Component } from 'react';
28
+ import { allowedProps, propTypes } from './props';
29
+ import TopNavBar from '../index';
30
+ import { withStyle, jsx } from '@instructure/emotion';
31
+ import generateStyle from '../TopNavBarBreadcrumb/styles';
32
+ import { testable } from '@instructure/ui-testable';
33
+ import { IconArrowOpenStartLine, IconHamburgerLine } from '@instructure/ui-icons';
34
+ import TopNavBarContext from '../TopNavBarContext';
35
+ import { error } from '@instructure/console';
36
+ import { Link } from '@instructure/ui-link';
37
+
38
+ /**
39
+ ---
40
+ parent: TopNavBar
41
+ id: TopNavBar.Breadcrumb
42
+ ---
43
+ @module TopNavBarBreadcrumb
44
+ **/
45
+ let TopNavBarBreadcrumb = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec(_class = _dec2(_class = (_class2 = class TopNavBarBreadcrumb extends Component {
46
+ constructor(...args) {
47
+ super(...args);
48
+ this.ref = null;
49
+ this.handleRef = el => {
50
+ const elementRef = this.props.elementRef;
51
+ this.ref = el;
52
+ if (typeof elementRef === 'function') {
53
+ elementRef(el);
54
+ }
55
+ };
56
+ }
57
+ componentDidMount() {
58
+ var _this$props$makeStyle, _this$props;
59
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
60
+ inverseColor: this.context.inverseColor
61
+ });
62
+ }
63
+ componentDidUpdate() {
64
+ var _this$props$makeStyle2, _this$props2;
65
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
66
+ inverseColor: this.context.inverseColor
67
+ });
68
+ }
69
+ renderMenu() {
70
+ var _this$props$styles;
71
+ const onClick = this.props.onClick;
72
+ return jsx("div", {
73
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.icon
74
+ }, jsx(TopNavBar.Item, {
75
+ id: "iconItem",
76
+ variant: "icon",
77
+ renderIcon: _IconHamburgerLine || (_IconHamburgerLine = jsx(IconHamburgerLine, null)),
78
+ onClick: onClick
79
+ }, "Hamburger menu"));
80
+ }
81
+ render() {
82
+ const _this$props3 = this.props,
83
+ children = _this$props3.children,
84
+ styles = _this$props3.styles;
85
+ if (!this.context.inverseColor) {
86
+ error(false, `[TopNavBarBreadcrumb] If the inverseColor prop is not set to true, TopNavBarBreadcrumb fails to render.`);
87
+ }
88
+ const breadcrumbElement = React.Children.toArray(children)[0];
89
+ const breadCrumbLinks = breadcrumbElement.props.children;
90
+ const lastButOneLink = React.Children.toArray(breadCrumbLinks)[React.Children.count(breadCrumbLinks) - 2];
91
+ return this.context.inverseColor && (this.context.layout === 'desktop' ? jsx("div", {
92
+ ref: this.handleRef,
93
+ css: styles === null || styles === void 0 ? void 0 : styles.topNavBarBreadcrumb
94
+ }, jsx("div", {
95
+ css: styles === null || styles === void 0 ? void 0 : styles.iconContainer
96
+ }, this.renderMenu()), jsx("div", {
97
+ css: styles === null || styles === void 0 ? void 0 : styles.breadcrumbContainer
98
+ }, children)) : jsx("div", {
99
+ ref: this.handleRef,
100
+ css: styles === null || styles === void 0 ? void 0 : styles.topNavBarBreadcrumb
101
+ }, jsx("div", {
102
+ css: styles === null || styles === void 0 ? void 0 : styles.linkContainer
103
+ }, jsx(Link, {
104
+ href: lastButOneLink.props.href,
105
+ isWithinText: false,
106
+ renderIcon: IconArrowOpenStartLine
107
+ }, lastButOneLink.props.children))));
108
+ }
109
+ }, _class2.displayName = "TopNavBarBreadcrumb", _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {}, _class2.contextType = TopNavBarContext, _class2)) || _class) || _class);
110
+ export { TopNavBarBreadcrumb };
111
+ export default TopNavBarBreadcrumb;
@@ -0,0 +1,34 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
26
+ import PropTypes from 'prop-types';
27
+ import { Breadcrumb } from '@instructure/ui-breadcrumb';
28
+ const propTypes = {
29
+ onClick: PropTypes.func,
30
+ elementRef: PropTypes.func,
31
+ children: ChildrenPropTypes.oneOf([Breadcrumb])
32
+ };
33
+ const allowedProps = ['children', 'onClick', 'elementRef'];
34
+ export { propTypes, allowedProps };
@@ -0,0 +1,66 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ const generateStyle = (_props, _state) => {
26
+ return {
27
+ topNavBarBreadcrumb: {
28
+ label: 'topNavBarBreadcrumb',
29
+ display: 'flex',
30
+ flexDirection: 'row',
31
+ alignItems: 'center',
32
+ justifyContent: 'flex-start',
33
+ flexGrow: 1,
34
+ border: 0,
35
+ outline: 0,
36
+ padding: 0,
37
+ margin: 0,
38
+ appearance: 'none',
39
+ textDecoration: 'none'
40
+ },
41
+ iconContainer: {
42
+ label: 'topNavBarBreadcrumb__iconContainer',
43
+ display: 'flex',
44
+ justifyContent: 'center',
45
+ alignItems: 'center'
46
+ },
47
+ icon: {
48
+ label: 'topNavBarBreadcrumb__icon',
49
+ display: 'flex',
50
+ justifyContent: 'center',
51
+ alignItems: 'center'
52
+ },
53
+ breadcrumbContainer: {
54
+ label: 'topNavBarBreadcrumb__breadCrumbContainer',
55
+ appearance: 'none',
56
+ textDecoration: 'none',
57
+ marginLeft: '0.75rem',
58
+ flexGrow: 1
59
+ },
60
+ linkContainer: {
61
+ label: 'topNavBarBreadcrumb__linkContainer',
62
+ marginLeft: '0.5rem'
63
+ }
64
+ };
65
+ };
66
+ export default generateStyle;
@@ -1,4 +1,4 @@
1
- var _dec, _dec2, _class, _class2;
1
+ var _dec, _dec2, _dec3, _class, _class2;
2
2
  /*
3
3
  * The MIT License (MIT)
4
4
  *
@@ -25,7 +25,7 @@ var _dec, _dec2, _class, _class2;
25
25
 
26
26
  /** @jsx jsx */
27
27
  import React, { Component } from 'react';
28
- import { omitProps } from '@instructure/ui-react-utils';
28
+ import { deprecated, omitProps } from '@instructure/ui-react-utils';
29
29
  import { testable } from '@instructure/ui-testable';
30
30
  import { withStyle, jsx } from '@instructure/emotion';
31
31
  import { TopNavBarContext } from '../../TopNavBarContext';
@@ -37,7 +37,9 @@ import { propTypes, allowedProps } from './props';
37
37
  private: true
38
38
  ---
39
39
  **/
40
- let TopNavBarDesktopLayout = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_class2 = class TopNavBarDesktopLayout extends Component {
40
+ let TopNavBarDesktopLayout = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec3 = deprecated('9', {
41
+ hideActionsUserSeparator: true
42
+ }, 'Note: this prop is probably used inside the desktopConfig prop on [TopNavBar.Layout]'), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class TopNavBarDesktopLayout extends Component {
41
43
  constructor(...args) {
42
44
  super(...args);
43
45
  this.ref = null;
@@ -77,28 +79,42 @@ let TopNavBarDesktopLayout = (_dec = withStyle(generateStyle, generateComponentT
77
79
  const renderUser = this.props.renderUser;
78
80
  return !!renderUser && React.Children.count(renderUser.props.children) > 0;
79
81
  }
82
+ get hasMenuItemsBlock() {
83
+ const renderMenuItems = this.props.renderMenuItems;
84
+ return !!renderMenuItems && React.Children.count(renderMenuItems.props.children) > 0;
85
+ }
86
+ get hasBreadcrumbBlock() {
87
+ const renderBreadcrumb = this.props.renderBreadcrumb;
88
+ return !!renderBreadcrumb && React.Children.count(renderBreadcrumb.props.children) > 0;
89
+ }
80
90
  render() {
81
91
  const _this$props3 = this.props,
82
92
  renderBrand = _this$props3.renderBrand,
83
93
  renderMenuItems = _this$props3.renderMenuItems,
84
94
  renderActionItems = _this$props3.renderActionItems,
85
95
  renderUser = _this$props3.renderUser,
96
+ renderBreadcrumb = _this$props3.renderBreadcrumb,
86
97
  navLabel = _this$props3.navLabel,
87
98
  styles = _this$props3.styles;
99
+
100
+ // only render breadcrumb if there is no brand or menu items
101
+ const shouldRenderBreadcrumbBlock = !(this.hasBrandBlock || this.hasMenuItemsBlock) && this.hasBreadcrumbBlock;
88
102
  return jsx("nav", Object.assign({}, omitProps(this.props, allowedProps), {
89
103
  ref: this.handleRef,
90
104
  css: styles === null || styles === void 0 ? void 0 : styles.topNavBarDesktopLayout,
91
105
  "aria-label": navLabel
92
106
  }), this.hasBrandBlock && jsx("div", {
93
107
  css: styles === null || styles === void 0 ? void 0 : styles.brandContainer
94
- }, renderBrand), jsx("div", {
108
+ }, renderBrand), this.hasMenuItemsBlock && jsx("div", {
95
109
  css: styles === null || styles === void 0 ? void 0 : styles.menuItemsContainer
96
- }, renderMenuItems), this.hasActionItemsBlock && jsx("div", {
110
+ }, renderMenuItems), shouldRenderBreadcrumbBlock && renderBreadcrumb, jsx("span", {
111
+ css: styles === null || styles === void 0 ? void 0 : styles.spacer
112
+ }), this.hasActionItemsBlock && jsx("div", {
97
113
  css: styles === null || styles === void 0 ? void 0 : styles.actionItemsContainer
98
114
  }, renderActionItems), this.hasUserBlock && jsx("div", {
99
115
  css: styles === null || styles === void 0 ? void 0 : styles.userContainer
100
116
  }, renderUser));
101
117
  }
102
- }, _class2.displayName = "TopNavBarDesktopLayout", _class2.componentId = 'TopNavBar.DesktopLayout', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {}, _class2.contextType = TopNavBarContext, _class2)) || _class) || _class);
118
+ }, _class2.displayName = "TopNavBarDesktopLayout", _class2.componentId = 'TopNavBar.DesktopLayout', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {}, _class2.contextType = TopNavBarContext, _class2)) || _class) || _class) || _class);
103
119
  export { TopNavBarDesktopLayout };
104
120
  export default TopNavBarDesktopLayout;
@@ -86,6 +86,9 @@ const generateStyle = (componentTheme, props, state) => {
86
86
  marginBlock: 0,
87
87
  marginInline: componentTheme.desktopActionItemsContainerInlineMargin
88
88
  },
89
+ spacer: {
90
+ flexGrow: '1'
91
+ },
89
92
  userContainer: {
90
93
  label: 'topNavBarDesktopLayout__userContainer',
91
94
  display: 'flex',
@@ -108,6 +111,14 @@ const generateStyle = (componentTheme, props, state) => {
108
111
  display: 'block'
109
112
  }
110
113
  })
114
+ },
115
+ breadcrumbContainer: {
116
+ label: 'topNavBarDesktopLayout__breadcrumbContainer',
117
+ display: 'flex',
118
+ flexGrow: 0,
119
+ flexShrink: 0,
120
+ marginBlock: 0,
121
+ alignItems: 'center'
111
122
  }
112
123
  };
113
124
  };
@@ -147,6 +147,10 @@ let TopNavBarSmallViewportLayout = (_dec = withDeterministicId(), _dec2 = withSt
147
147
  get hasSubmenu() {
148
148
  return (this.dropdownMenuContent || []).length > 0;
149
149
  }
150
+ get hasBreadcrumbBlock() {
151
+ const renderBreadcrumb = this.props.renderBreadcrumb;
152
+ return !!renderBreadcrumb && React.Children.count(renderBreadcrumb.props.children) > 0;
153
+ }
150
154
  get isInPlaceDialogOpen() {
151
155
  var _this$props$renderInP;
152
156
  return (_this$props$renderInP = this.props.renderInPlaceDialogConfig) === null || _this$props$renderInP === void 0 ? void 0 : _this$props$renderInP.open;
@@ -381,18 +385,21 @@ let TopNavBarSmallViewportLayout = (_dec = withDeterministicId(), _dec2 = withSt
381
385
  trayMountNode = _this$props7.trayMountNode,
382
386
  navLabel = _this$props7.navLabel,
383
387
  renderActionItems = _this$props7.renderActionItems,
388
+ renderBreadcrumb = _this$props7.renderBreadcrumb,
384
389
  styles = _this$props7.styles;
385
390
  return jsx("nav", Object.assign({}, omitProps(this.props, allowedProps), {
386
391
  ref: this.handleRef,
387
392
  "aria-label": navLabel
388
393
  }), jsx(Global, {
389
394
  styles: styles === null || styles === void 0 ? void 0 : styles.globalStyles
390
- }), !this.isInPlaceDialogOpen && jsx("div", {
395
+ }), this.hasBreadcrumbBlock && jsx("div", {
396
+ css: styles === null || styles === void 0 ? void 0 : styles.navbar
397
+ }, renderBreadcrumb), !this.hasBreadcrumbBlock && !this.isInPlaceDialogOpen && jsx("div", {
391
398
  css: styles === null || styles === void 0 ? void 0 : styles.navbar
392
- }, this.renderMenuTrigger(), this.hasActionItemsBlock(renderActionItems) && renderActionItems), this.renderInPlaceDialog(), !trayMountNode && jsx("div", {
399
+ }, this.renderMenuTrigger(), this.hasActionItemsBlock(renderActionItems) && renderActionItems), !this.hasBreadcrumbBlock && this.renderInPlaceDialog(), !this.hasBreadcrumbBlock && !trayMountNode && jsx("div", {
393
400
  css: styles === null || styles === void 0 ? void 0 : styles.trayContainer,
394
401
  id: this._trayContainerId
395
- }), this.renderDropdownMenuTray());
402
+ }), !this.hasBreadcrumbBlock && this.renderDropdownMenuTray());
396
403
  }
397
404
  }, _class2.displayName = "TopNavBarSmallViewportLayout", _class2.componentId = 'TopNavBar.SmallViewportLayout', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {}, _class2.contextType = TopNavBarContext, _class2)) || _class) || _class) || _class);
398
405
  export { TopNavBarSmallViewportLayout };
@@ -29,11 +29,13 @@ import { TopNavBarBrand } from '../TopNavBarBrand';
29
29
  import { TopNavBarMenuItems } from '../TopNavBarMenuItems';
30
30
  import { TopNavBarUser } from '../TopNavBarUser';
31
31
  import { topNavBarItemTooltipPropType } from '../TopNavBarItem/props';
32
+ import { TopNavBarBreadcrumb } from '../TopNavBarBreadcrumb';
32
33
  const commonPropTypes = {
33
34
  renderBrand: ChildrenPropTypes.oneOf([TopNavBarBrand]),
34
35
  renderMenuItems: ChildrenPropTypes.oneOf([TopNavBarMenuItems]),
35
36
  renderActionItems: ChildrenPropTypes.oneOf([TopNavBarActionItems]),
36
37
  renderUser: ChildrenPropTypes.oneOf([TopNavBarUser]),
38
+ renderBreadcrumb: ChildrenPropTypes.oneOf([TopNavBarBreadcrumb]),
37
39
  navLabel: PropTypes.string,
38
40
  elementRef: PropTypes.func
39
41
  };
@@ -64,7 +66,7 @@ const propTypes = {
64
66
  desktopConfig: PropTypes.shape(desktopPropTypes),
65
67
  smallViewportConfig: PropTypes.shape(smallViewportPropTypes).isRequired
66
68
  };
67
- const commonAllowedProps = ['renderBrand', 'renderMenuItems', 'renderActionItems', 'renderUser', 'navLabel', 'elementRef'];
69
+ const commonAllowedProps = ['renderBrand', 'renderMenuItems', 'renderActionItems', 'renderUser', 'renderBreadcrumb', 'navLabel', 'elementRef'];
68
70
  const desktopAllowedProps = ['hideActionsUserSeparator'];
69
71
  const smallViewportAllowedProps = ['dropdownMenuToggleButtonLabel', 'dropdownMenuToggleButtonTooltip', 'dropdownMenuLabel', 'alternativeTitle', 'renderInPlaceDialogConfig', 'trayMountNode', 'onDropdownMenuToggle', 'onDropdownMenuSelect'];
70
72
  const allowedProps = [...commonAllowedProps, 'desktopConfig', 'smallViewportConfig'];
@@ -35,6 +35,7 @@ import { TopNavBarItem } from './TopNavBarItem';
35
35
  import { TopNavBarLayout } from './TopNavBarLayout';
36
36
  import { TopNavBarMenuItems } from './TopNavBarMenuItems';
37
37
  import { TopNavBarUser } from './TopNavBarUser';
38
+ import { TopNavBarBreadcrumb } from './TopNavBarBreadcrumb';
38
39
  import { TopNavBarContext } from './TopNavBarContext';
39
40
  import { propTypes, allowedProps } from './props';
40
41
  /**
@@ -92,7 +93,7 @@ let TopNavBar = (_dec = testable(), _dec(_class = (_class2 = class TopNavBar ext
92
93
  }
93
94
  });
94
95
  }
95
- }, _class2.displayName = "TopNavBar", _class2.componentId = 'TopNavBar', _class2.ActionItems = TopNavBarActionItems, _class2.Brand = TopNavBarBrand, _class2.Item = TopNavBarItem, _class2.Layout = TopNavBarLayout, _class2.MenuItems = TopNavBarMenuItems, _class2.User = TopNavBarUser, _class2.contextType = TopNavBarContext, _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
96
+ }, _class2.displayName = "TopNavBar", _class2.componentId = 'TopNavBar', _class2.ActionItems = TopNavBarActionItems, _class2.Brand = TopNavBarBrand, _class2.Item = TopNavBarItem, _class2.Layout = TopNavBarLayout, _class2.MenuItems = TopNavBarMenuItems, _class2.User = TopNavBarUser, _class2.Breadcrumb = TopNavBarBreadcrumb, _class2.contextType = TopNavBarContext, _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
96
97
  breakpoint: 1024,
97
98
  mediaQueryMatch: 'media',
98
99
  inverseColor: false
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = exports.TopNavBarBrand = void 0;
9
9
  var _react = _interopRequireWildcard(require("react"));
10
+ var _deprecated = require("@instructure/ui-react-utils/lib/deprecated.js");
10
11
  var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
11
12
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
12
13
  var _testable = require("@instructure/ui-testable/lib/testable.js");
@@ -17,7 +18,7 @@ var _TopNavBarContext = require("../TopNavBarContext");
17
18
  var _styles = _interopRequireDefault(require("./styles"));
18
19
  var _theme = _interopRequireDefault(require("./theme"));
19
20
  var _props = require("./props");
20
- var _dec, _dec2, _class, _class2;
21
+ var _dec, _dec2, _dec3, _class, _class2;
21
22
  /*
22
23
  * The MIT License (MIT)
23
24
  *
@@ -49,7 +50,7 @@ id: TopNavBar.Brand
49
50
  ---
50
51
  @module TopNavBarBrand
51
52
  **/
52
- let TopNavBarBrand = exports.TopNavBarBrand = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_class2 = class TopNavBarBrand extends _react.Component {
53
+ let TopNavBarBrand = exports.TopNavBarBrand = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec3 = (0, _deprecated.deprecated)('9', null, 'Please use the updated TopNavBar design.'), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class TopNavBarBrand extends _react.Component {
53
54
  constructor(...args) {
54
55
  super(...args);
55
56
  this.ref = null;
@@ -108,5 +109,5 @@ let TopNavBarBrand = exports.TopNavBarBrand = (_dec = (0, _emotion.withStyle)(_s
108
109
  "aria-hidden": "true"
109
110
  }, renderName)));
110
111
  }
111
- }, _class2.displayName = "TopNavBarBrand", _class2.componentId = 'TopNavBar.Brand', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {}, _class2.contextType = _TopNavBarContext.TopNavBarContext, _class2)) || _class) || _class);
112
+ }, _class2.displayName = "TopNavBarBrand", _class2.componentId = 'TopNavBar.Brand', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {}, _class2.contextType = _TopNavBarContext.TopNavBarContext, _class2)) || _class) || _class) || _class);
112
113
  var _default = exports.default = TopNavBarBrand;