@instructure/ui-top-nav-bar 8.56.0 → 9.0.0

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 (62) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/es/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.js +0 -3
  3. package/es/TopNavBar/TopNavBarBrand/index.js +11 -13
  4. package/es/TopNavBar/TopNavBarBrand/props.js +1 -3
  5. package/es/TopNavBar/TopNavBarBrand/styles.js +1 -11
  6. package/es/TopNavBar/TopNavBarLayout/DesktopLayout/__new-tests__/TopNavBarDesktopLayout.test.js +4 -132
  7. package/es/TopNavBar/TopNavBarLayout/DesktopLayout/index.js +5 -7
  8. package/es/TopNavBar/TopNavBarLayout/DesktopLayout/styles.js +3 -4
  9. package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/__new-tests__/TopNavBarSmallViewportLayout.test.js +1 -2
  10. package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.js +1 -1
  11. package/es/TopNavBar/TopNavBarLayout/__new-tests__/TopNavBarLayout.test.js +0 -18
  12. package/es/TopNavBar/TopNavBarLayout/index.js +6 -4
  13. package/es/TopNavBar/TopNavBarLayout/props.js +1 -2
  14. package/es/TopNavBar/__new-tests__/TopNavBar.test.js +0 -1
  15. package/es/TopNavBar/utils/exampleHelpers.js +1 -8
  16. package/lib/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.js +0 -3
  17. package/lib/TopNavBar/TopNavBarBrand/index.js +10 -13
  18. package/lib/TopNavBar/TopNavBarBrand/props.js +1 -3
  19. package/lib/TopNavBar/TopNavBarBrand/styles.js +1 -11
  20. package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/__new-tests__/TopNavBarDesktopLayout.test.js +3 -131
  21. package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/index.js +4 -7
  22. package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/styles.js +3 -4
  23. package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/__new-tests__/TopNavBarSmallViewportLayout.test.js +1 -2
  24. package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.js +1 -1
  25. package/lib/TopNavBar/TopNavBarLayout/__new-tests__/TopNavBarLayout.test.js +0 -18
  26. package/lib/TopNavBar/TopNavBarLayout/index.js +6 -4
  27. package/lib/TopNavBar/TopNavBarLayout/props.js +1 -2
  28. package/lib/TopNavBar/__new-tests__/TopNavBar.test.js +0 -1
  29. package/lib/TopNavBar/utils/exampleHelpers.js +0 -7
  30. package/package.json +30 -30
  31. package/src/TopNavBar/README.md +2 -248
  32. package/src/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.ts +0 -3
  33. package/src/TopNavBar/TopNavBarBrand/index.tsx +17 -22
  34. package/src/TopNavBar/TopNavBarBrand/props.ts +1 -21
  35. package/src/TopNavBar/TopNavBarBrand/styles.ts +1 -10
  36. package/src/TopNavBar/TopNavBarLayout/DesktopLayout/__new-tests__/TopNavBarDesktopLayout.test.tsx +3 -173
  37. package/src/TopNavBar/TopNavBarLayout/DesktopLayout/index.tsx +2 -10
  38. package/src/TopNavBar/TopNavBarLayout/DesktopLayout/styles.ts +3 -5
  39. package/src/TopNavBar/TopNavBarLayout/SmallViewportLayout/__new-tests__/TopNavBarSmallViewportLayout.test.tsx +2 -2
  40. package/src/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.tsx +1 -4
  41. package/src/TopNavBar/TopNavBarLayout/__new-tests__/TopNavBarLayout.test.tsx +0 -25
  42. package/src/TopNavBar/TopNavBarLayout/index.tsx +10 -3
  43. package/src/TopNavBar/TopNavBarLayout/props.ts +0 -7
  44. package/src/TopNavBar/__new-tests__/TopNavBar.test.tsx +0 -1
  45. package/src/TopNavBar/utils/exampleHelpers.tsx +1 -15
  46. package/tsconfig.build.tsbuildinfo +1 -1
  47. package/types/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.d.ts +1 -6
  48. package/types/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.d.ts.map +1 -1
  49. package/types/TopNavBar/TopNavBarBrand/index.d.ts.map +1 -1
  50. package/types/TopNavBar/TopNavBarBrand/props.d.ts +1 -10
  51. package/types/TopNavBar/TopNavBarBrand/props.d.ts.map +1 -1
  52. package/types/TopNavBar/TopNavBarBrand/styles.d.ts.map +1 -1
  53. package/types/TopNavBar/TopNavBarLayout/DesktopLayout/index.d.ts.map +1 -1
  54. package/types/TopNavBar/TopNavBarLayout/DesktopLayout/styles.d.ts +2 -2
  55. package/types/TopNavBar/TopNavBarLayout/DesktopLayout/styles.d.ts.map +1 -1
  56. package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.d.ts.map +1 -1
  57. package/types/TopNavBar/TopNavBarLayout/index.d.ts +3 -3
  58. package/types/TopNavBar/TopNavBarLayout/index.d.ts.map +1 -1
  59. package/types/TopNavBar/TopNavBarLayout/props.d.ts +0 -4
  60. package/types/TopNavBar/TopNavBarLayout/props.d.ts.map +1 -1
  61. package/types/TopNavBar/utils/exampleHelpers.d.ts +0 -2
  62. package/types/TopNavBar/utils/exampleHelpers.d.ts.map +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
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
+ # [9.0.0](https://github.com/instructure/instructure-ui/compare/v8.56.0...v9.0.0) (2024-05-09)
7
+
8
+
9
+ ### Features
10
+
11
+ * **instui-cli,ui-codemods,ui-top-nav-bar:** remove desktopConfig prop from TopNavBar.Layout ([d5efe5f](https://github.com/instructure/instructure-ui/commit/d5efe5f76b5af15db6ff9224a501121f35bf1ed9))
12
+ * **ui-top-nav-bar:** remove renderName and nameBackground prop from TopNavBar.Brand ([8e48ab5](https://github.com/instructure/instructure-ui/commit/8e48ab5d0302d6205f372a6ddd833cae860aee5b))
13
+
14
+
15
+ ### BREAKING CHANGES
16
+
17
+ * **ui-top-nav-bar:** renderName and nameBackground props have been removed
18
+ * **instui-cli,ui-codemods,ui-top-nav-bar:** desktopConfig prop from TopNavBar.Layout has been removed
19
+
20
+
21
+
22
+
23
+
6
24
  # [8.56.0](https://github.com/instructure/instructure-ui/compare/v8.55.1...v8.56.0) (2024-05-06)
7
25
 
8
26
 
@@ -31,9 +31,6 @@ export const TopNavBarBrandLocator = locator(TopNavBarBrand.selector, {
31
31
  findContainer: (...args) => {
32
32
  return find('[class$="-topNavBarBrand__container"]', ...args);
33
33
  },
34
- findBrandNameContainer: (...args) => {
35
- return find('[class$="-topNavBarBrand__nameContainer"]', ...args);
36
- },
37
34
  findBrandIconContainer: (...args) => {
38
35
  return find('[class$="-topNavBarBrand__iconContainer"]', ...args);
39
36
  },
@@ -1,4 +1,4 @@
1
- var _dec, _dec2, _dec3, _class, _class2;
1
+ var _dec, _dec2, _class, _class2;
2
2
  /*
3
3
  * The MIT License (MIT)
4
4
  *
@@ -25,7 +25,7 @@ var _dec, _dec2, _dec3, _class, _class2;
25
25
 
26
26
  /** @jsx jsx */
27
27
  import React, { Component } from 'react';
28
- import { deprecated, getElementType, omitProps } from '@instructure/ui-react-utils';
28
+ import { 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,9 +41,7 @@ id: TopNavBar.Brand
41
41
  ---
42
42
  @module TopNavBarBrand
43
43
  **/
44
- let TopNavBarBrand = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec3 = deprecated('9', {
45
- renderName: true
46
- }, 'Please use the updated TopNavBar design.'), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class TopNavBarBrand extends Component {
44
+ let TopNavBarBrand = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_class2 = class TopNavBarBrand extends Component {
47
45
  constructor(...args) {
48
46
  super(...args);
49
47
  this.ref = null;
@@ -57,6 +55,11 @@ let TopNavBarBrand = (_dec = withStyle(generateStyle, generateComponentTheme), _
57
55
  }
58
56
  componentDidMount() {
59
57
  var _this$props$makeStyle, _this$props;
58
+ // TODO: Remove this in v10!
59
+ if ('renderName' in this.props) {}
60
+
61
+ // TODO: Remove this in v10!
62
+ if ('nameBackground' in this.props) {}
60
63
  (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStylesVariables);
61
64
  }
62
65
  componentDidUpdate() {
@@ -71,7 +74,6 @@ let TopNavBarBrand = (_dec = withStyle(generateStyle, generateComponentTheme), _
71
74
  render() {
72
75
  const _this$props3 = this.props,
73
76
  screenReaderLabel = _this$props3.screenReaderLabel,
74
- renderName = _this$props3.renderName,
75
77
  renderIcon = _this$props3.renderIcon,
76
78
  href = _this$props3.href,
77
79
  onClick = _this$props3.onClick,
@@ -80,7 +82,7 @@ let TopNavBarBrand = (_dec = withStyle(generateStyle, generateComponentTheme), _
80
82
  return jsx("div", {
81
83
  ref: this.handleRef,
82
84
  css: styles === null || styles === void 0 ? void 0 : styles.topNavBarBrand
83
- }, (renderIcon || renderName) && jsx(View, Object.assign({}, omitProps(this.props, allowedProps), {
85
+ }, renderIcon && jsx(View, Object.assign({}, omitProps(this.props, allowedProps), {
84
86
  css: styles === null || styles === void 0 ? void 0 : styles.container,
85
87
  as: ElementType,
86
88
  href: href,
@@ -96,12 +98,8 @@ let TopNavBarBrand = (_dec = withStyle(generateStyle, generateComponentTheme), _
96
98
  css: styles === null || styles === void 0 ? void 0 : styles.iconContainer,
97
99
  role: "presentation",
98
100
  "aria-hidden": "true"
99
- }, renderIcon), renderName && jsx("div", {
100
- css: styles === null || styles === void 0 ? void 0 : styles.nameContainer,
101
- role: "presentation",
102
- "aria-hidden": "true"
103
- }, renderName)));
101
+ }, renderIcon)));
104
102
  }
105
- }, _class2.displayName = "TopNavBarBrand", _class2.componentId = 'TopNavBar.Brand', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {}, _class2.contextType = TopNavBarContext, _class2)) || _class) || _class) || _class);
103
+ }, _class2.displayName = "TopNavBarBrand", _class2.componentId = 'TopNavBar.Brand', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {}, _class2.contextType = TopNavBarContext, _class2)) || _class) || _class);
106
104
  export { TopNavBarBrand };
107
105
  export default TopNavBarBrand;
@@ -25,14 +25,12 @@
25
25
  import PropTypes from 'prop-types';
26
26
  const propTypes = {
27
27
  screenReaderLabel: PropTypes.string.isRequired,
28
- renderName: PropTypes.node,
29
28
  renderIcon: PropTypes.node,
30
- nameBackground: PropTypes.string,
31
29
  iconBackground: PropTypes.string,
32
30
  href: PropTypes.string,
33
31
  onClick: PropTypes.func,
34
32
  as: PropTypes.elementType,
35
33
  elementRef: PropTypes.func
36
34
  };
37
- const allowedProps = ['screenReaderLabel', 'renderName', 'renderIcon', 'nameBackground', 'iconBackground', 'href', 'onClick', 'as', 'elementRef'];
35
+ const allowedProps = ['screenReaderLabel', 'renderIcon', 'iconBackground', 'href', 'onClick', 'as', 'elementRef'];
38
36
  export { propTypes, allowedProps };
@@ -33,8 +33,7 @@
33
33
  * @return {Object} The final style object, which will be used in the component
34
34
  */
35
35
  const generateStyle = (componentTheme, props, state) => {
36
- const nameBackground = props.nameBackground,
37
- iconBackground = props.iconBackground;
36
+ const iconBackground = props.iconBackground;
38
37
  const isDesktop = state.layout === 'desktop';
39
38
  return {
40
39
  topNavBarBrand: {
@@ -54,15 +53,6 @@ const generateStyle = (componentTheme, props, state) => {
54
53
  appearance: 'none',
55
54
  textDecoration: 'none'
56
55
  },
57
- nameContainer: {
58
- label: 'topNavBarBrand__nameContainer',
59
- display: 'flex',
60
- justifyContent: 'center',
61
- alignItems: 'center',
62
- pointerEvents: 'none',
63
- padding: componentTheme.logoPadding,
64
- background: isDesktop ? nameBackground : void 0
65
- },
66
56
  name: {
67
57
  label: 'topNavBarBrand__name',
68
58
  display: 'flex',
@@ -25,7 +25,7 @@
25
25
  import React from 'react';
26
26
  import { render, screen } from '@testing-library/react';
27
27
  import '@testing-library/jest-dom';
28
- import { getActionItems, getBrand, getMenuItems, getUser, getBreadcrumb, SmallViewportModeWrapper } from '../../../utils/exampleHelpers';
28
+ import { getActionItems, getBrand, getMenuItems, getUser, getBreadcrumb } from '../../../utils/exampleHelpers';
29
29
  import { TopNavBarDesktopLayout } from '../index';
30
30
  import TopNavBarContext from '../../../TopNavBarContext';
31
31
  import { runAxeCheck } from '@instructure/ui-axe-check';
@@ -93,7 +93,6 @@ describe('<TopNavBarDesktopLayout />', () => {
93
93
  expect(consoleMock.mock.calls[0][0]).toEqual('Warning: [TopNavBarBreadcrumb] If the inverseColor prop is not set to true, TopNavBarBreadcrumb fails to render.');
94
94
  });
95
95
  it('should not render breadcrumb if brand exists', () => {
96
- const consoleMock = jest.spyOn(console, 'warn').mockImplementation();
97
96
  const _render3 = render( /*#__PURE__*/React.createElement(TopNavBarContext.Provider, {
98
97
  value: {
99
98
  layout: 'desktop',
@@ -113,7 +112,6 @@ describe('<TopNavBarDesktopLayout />', () => {
113
112
  expect(crumb1).not.toBeInTheDocument();
114
113
  expect(crumb2).not.toBeInTheDocument();
115
114
  expect(crumb3).not.toBeInTheDocument();
116
- expect(consoleMock.mock.calls[0][0]).toEqual('Warning: [TopNavBarBrand] `renderName` is deprecated and will be removed in version 9. Please use the updated TopNavBar design.');
117
115
  });
118
116
  it('should not render breadcrumb if menuitems exist', () => {
119
117
  const _render4 = render( /*#__PURE__*/React.createElement(TopNavBarContext.Provider, {
@@ -158,11 +156,10 @@ describe('<TopNavBarDesktopLayout />', () => {
158
156
  expect(brandContainer).not.toBeInTheDocument();
159
157
  expect(desktopLayout).not.toHaveTextContent('Brand name');
160
158
  });
161
- it('should not render brand container when "renderName" and "renderIcon" props are both missing', () => {
159
+ it('should not render brand container when "renderIcon" props is missing', () => {
162
160
  const _render7 = render( /*#__PURE__*/React.createElement(TopNavBarDesktopLayout, Object.assign({}, defaultBlocks, {
163
161
  renderBrand: getBrand({
164
162
  brandProps: {
165
- renderName: void 0,
166
163
  renderIcon: void 0
167
164
  }
168
165
  })
@@ -313,135 +310,10 @@ describe('<TopNavBarDesktopLayout />', () => {
313
310
  expect(elementRef).toHaveBeenCalledWith(container.firstChild);
314
311
  });
315
312
  });
316
- describe('hideActionsUserSeparator prop', () => {
317
- describe('in default mode', () => {
318
- it('should hide separator between actions and user', () => {
319
- const _render20 = render( /*#__PURE__*/React.createElement(TopNavBarDesktopLayout, Object.assign({}, defaultBlocks, {
320
- hideActionsUserSeparator: true
321
- }))),
322
- container = _render20.container;
323
- const userContainer = container.querySelector("[class$='topNavBarDesktopLayout__userContainer']");
324
-
325
- // TODO convert to e2e
326
- // const actionsUserSeparator = await component.getActionsUserSeparatorBackground()
327
- // expect(actionsUserSeparator).to.equal('rgba(0, 0, 0, 0)')
328
- // const actionsUserSeparator = getComputedStyle(userContainer!, '::before')
329
- // const actionsUserSeparatorBackground = actionsUserSeparator.getPropertyValue('background-color')
330
-
331
- // expect(actionsUserSeparatorBackground).toBe('rgba(0, 0, 0, 0)')
332
-
333
- expect(userContainer).toBeInTheDocument();
334
- });
335
- it('should show separator between actions and user, when false', () => {
336
- const _render21 = render( /*#__PURE__*/React.createElement(TopNavBarDesktopLayout, Object.assign({}, defaultBlocks, {
337
- hideActionsUserSeparator: false
338
- }))),
339
- container = _render21.container;
340
- const userContainer = container.querySelector("[class$='topNavBarDesktopLayout__userContainer']");
341
-
342
- // TODO convert to e2e
343
- // const component = await TopNavBarDesktopLayoutLocator.find()
344
- // const actionsUserSeparator = await component.getActionsUserSeparatorBackground()
345
- // expect(actionsUserSeparator).to.equal('rgb(199, 205, 209)')
346
-
347
- expect(userContainer).toBeInTheDocument();
348
- });
349
- });
350
- describe('in inverse mode', () => {
351
- it('should hide separator between actions and user', () => {
352
- const _render22 = render( /*#__PURE__*/React.createElement(SmallViewportModeWrapper, {
353
- layout: "desktop",
354
- inverseColor: true
355
- }, /*#__PURE__*/React.createElement(TopNavBarDesktopLayout, Object.assign({}, defaultBlocks, {
356
- hideActionsUserSeparator: true
357
- })))),
358
- container = _render22.container;
359
- const userContainer = container.querySelector("[class$='topNavBarDesktopLayout__userContainer']");
360
-
361
- // TODO convert to e2e
362
- // const component = await TopNavBarDesktopLayoutLocator.find()
363
- // const actionsUserSeparator = await component.getActionsUserSeparatorBackground()
364
- // expect(actionsUserSeparator).to.equal('rgba(0, 0, 0, 0)')
365
-
366
- expect(userContainer).toBeInTheDocument();
367
- });
368
- it('should show separator between actions and user, when false', () => {
369
- const _render23 = render( /*#__PURE__*/React.createElement(SmallViewportModeWrapper, {
370
- layout: "desktop",
371
- inverseColor: true
372
- }, /*#__PURE__*/React.createElement(TopNavBarDesktopLayout, Object.assign({}, defaultBlocks, {
373
- hideActionsUserSeparator: false
374
- })))),
375
- container = _render23.container;
376
- const userContainer = container.querySelector("[class$='topNavBarDesktopLayout__userContainer']");
377
-
378
- // TODO convert to e2e
379
- // const component = await TopNavBarDesktopLayoutLocator.find()
380
- // const actionsUserSeparator = await component.getActionsUserSeparatorBackground()
381
- // expect(actionsUserSeparator).to.equal('rgb(199, 205, 209)')
382
-
383
- expect(userContainer).toBeInTheDocument();
384
- });
385
- });
386
- describe('should not display when:', () => {
387
- it('renderActionItems is missing', () => {
388
- const _render24 = render( /*#__PURE__*/React.createElement(TopNavBarDesktopLayout, Object.assign({}, defaultBlocks, {
389
- hideActionsUserSeparator: void 0,
390
- renderActionItems: void 0
391
- }))),
392
- container = _render24.container;
393
- const userContainer = container.querySelector("[class$='topNavBarDesktopLayout__userContainer']");
394
- const actionItemsContainer = container.querySelector("[class$='topNavBarDesktopLayout__actionItemsContainer']");
395
-
396
- // TODO convert to e2e
397
- // const component = await TopNavBarDesktopLayoutLocator.find()
398
- // const actionsUserSeparator = await component.getActionsUserSeparatorBackground()
399
- // expect(actionsUserSeparator).to.equal('rgba(0, 0, 0, 0)')
400
-
401
- expect(actionItemsContainer).not.toBeInTheDocument();
402
- expect(userContainer).toBeInTheDocument();
403
- });
404
- it('renderUser is missing', () => {
405
- const _render25 = render( /*#__PURE__*/React.createElement(TopNavBarDesktopLayout, Object.assign({}, defaultBlocks, {
406
- hideActionsUserSeparator: void 0,
407
- renderUser: void 0
408
- }))),
409
- container = _render25.container;
410
- const userContainer = container.querySelector("[class$='topNavBarDesktopLayout__userContainer']");
411
- const actionItemsContainer = container.querySelector("[class$='topNavBarDesktopLayout__actionItemsContainer']");
412
-
413
- // TODO convert to e2e
414
- // const component = await TopNavBarDesktopLayoutLocator.find()
415
- // const actionsUserSeparator = await component.getActionsUserSeparatorBackground()
416
- // expect(actionsUserSeparator).to.equal('rgba(0, 0, 0, 0)')
417
-
418
- expect(actionItemsContainer).toBeInTheDocument();
419
- expect(userContainer).not.toBeInTheDocument();
420
- });
421
- it('renderActionItems and renderUser is missing', () => {
422
- const _render26 = render( /*#__PURE__*/React.createElement(TopNavBarDesktopLayout, Object.assign({}, defaultBlocks, {
423
- hideActionsUserSeparator: void 0,
424
- renderActionItems: void 0,
425
- renderUser: void 0
426
- }))),
427
- container = _render26.container;
428
- const userContainer = container.querySelector("[class$='topNavBarDesktopLayout__userContainer']");
429
- const actionItemsContainer = container.querySelector("[class$='topNavBarDesktopLayout__actionItemsContainer']");
430
-
431
- // TODO convert to e2e
432
- // const component = await TopNavBarDesktopLayoutLocator.find()
433
- // const actionsUserSeparator = await component.getActionsUserSeparatorBackground()
434
- // expect(actionsUserSeparator).to.equal('rgba(0, 0, 0, 0)')
435
-
436
- expect(actionItemsContainer).not.toBeInTheDocument();
437
- expect(userContainer).not.toBeInTheDocument();
438
- });
439
- });
440
- });
441
313
  describe('should be accessible', () => {
442
314
  it('a11y', async () => {
443
- const _render27 = render( /*#__PURE__*/React.createElement(TopNavBarDesktopLayout, defaultBlocks)),
444
- container = _render27.container;
315
+ const _render20 = render( /*#__PURE__*/React.createElement(TopNavBarDesktopLayout, defaultBlocks)),
316
+ container = _render20.container;
445
317
  const axeCheck = await runAxeCheck(container);
446
318
  expect(axeCheck).toBe(true);
447
319
  });
@@ -1,4 +1,4 @@
1
- var _dec, _dec2, _dec3, _class, _class2;
1
+ var _dec, _dec2, _class, _class2;
2
2
  /*
3
3
  * The MIT License (MIT)
4
4
  *
@@ -25,7 +25,7 @@ var _dec, _dec2, _dec3, _class, _class2;
25
25
 
26
26
  /** @jsx jsx */
27
27
  import React, { Component } from 'react';
28
- import { deprecated, omitProps } from '@instructure/ui-react-utils';
28
+ import { 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,9 +37,7 @@ import { propTypes, allowedProps } from './props';
37
37
  private: true
38
38
  ---
39
39
  **/
40
- let TopNavBarDesktopLayout = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec3 = deprecated('9', {
41
- hideActionsUserSeparator: true
42
- }, 'From v9, actionUserSeparator has to be visible at all times. Please do not use designs which hide it. Note: this prop is probably used inside the desktopConfig prop on [TopNavBar.Layout]'), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class TopNavBarDesktopLayout extends Component {
40
+ let TopNavBarDesktopLayout = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_class2 = class TopNavBarDesktopLayout extends Component {
43
41
  constructor(...args) {
44
42
  super(...args);
45
43
  this.ref = null;
@@ -69,7 +67,7 @@ let TopNavBarDesktopLayout = (_dec = withStyle(generateStyle, generateComponentT
69
67
  }
70
68
  get hasBrandBlock() {
71
69
  const renderBrand = this.props.renderBrand;
72
- return !!renderBrand && (!!renderBrand.props.renderName || !!renderBrand.props.renderIcon);
70
+ return !!renderBrand && !!renderBrand.props.renderIcon;
73
71
  }
74
72
  get hasActionItemsBlock() {
75
73
  const renderActionItems = this.props.renderActionItems;
@@ -115,6 +113,6 @@ let TopNavBarDesktopLayout = (_dec = withStyle(generateStyle, generateComponentT
115
113
  css: styles === null || styles === void 0 ? void 0 : styles.userContainer
116
114
  }, renderUser));
117
115
  }
118
- }, _class2.displayName = "TopNavBarDesktopLayout", _class2.componentId = 'TopNavBar.DesktopLayout', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {}, _class2.contextType = TopNavBarContext, _class2)) || _class) || _class) || _class);
116
+ }, _class2.displayName = "TopNavBarDesktopLayout", _class2.componentId = 'TopNavBar.DesktopLayout', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {}, _class2.contextType = TopNavBarContext, _class2)) || _class) || _class);
119
117
  export { TopNavBarDesktopLayout };
120
118
  export default TopNavBarDesktopLayout;
@@ -28,17 +28,16 @@
28
28
  * ---
29
29
  * Generates the style object from the theme and provided additional information
30
30
  * @param {Object} componentTheme The theme variable object.
31
- * @param {Object} props the props of the component, the style is applied to
31
+ * @param {Object} _props the props of the component, the style is applied to
32
32
  * @param {Object} state the state of the component, the style is applied to
33
33
  * @return {Object} The final style object, which will be used in the component
34
34
  */
35
- const generateStyle = (componentTheme, props, state) => {
36
- const hideActionsUserSeparator = props.hideActionsUserSeparator;
35
+ const generateStyle = (componentTheme, _props, state) => {
37
36
  const inverseColor = state.inverseColor,
38
37
  hasBrandBlock = state.hasBrandBlock,
39
38
  hasActionItemsBlock = state.hasActionItemsBlock,
40
39
  hasUserBlock = state.hasUserBlock;
41
- const hasUserSeparator = hasActionItemsBlock && hasUserBlock && !hideActionsUserSeparator;
40
+ const hasUserSeparator = hasActionItemsBlock && hasUserBlock;
42
41
  return {
43
42
  topNavBarDesktopLayout: {
44
43
  label: 'topNavBarDesktopLayout',
@@ -136,11 +136,10 @@ describe('<TopNavBarSmallViewportLayout />', () => {
136
136
  expect(brandContainer).not.toBeInTheDocument();
137
137
  expect(brandNameText).not.toBeInTheDocument();
138
138
  });
139
- it('should not render brand container when "renderName" and "renderIcon" props are both missing', () => {
139
+ it('should not render brand container when "renderIcon" prop is missing', () => {
140
140
  const _render6 = render( /*#__PURE__*/React.createElement(SmallViewportModeWrapper, null, /*#__PURE__*/React.createElement(TopNavBarSmallViewportLayout, Object.assign({}, defaultProps, {
141
141
  renderBrand: getBrand({
142
142
  brandProps: {
143
- renderName: void 0,
144
143
  renderIcon: void 0
145
144
  }
146
145
  })
@@ -133,7 +133,7 @@ let TopNavBarSmallViewportLayout = (_dec = withDeterministicId(), _dec2 = withSt
133
133
  };
134
134
  }
135
135
  hasBrandBlock(renderBrand) {
136
- return !!renderBrand && (!!renderBrand.props.renderName || !!renderBrand.props.renderIcon);
136
+ return !!renderBrand && !!renderBrand.props.renderIcon;
137
137
  }
138
138
  hasMenuItemsBlock(renderMenuItems) {
139
139
  return !!renderMenuItems && React.Children.count(renderMenuItems.props.children) > 0;
@@ -70,24 +70,6 @@ describe('<TopNavBarLayout />', () => {
70
70
  expect(desktopLayout).toBeVisible();
71
71
  expect(smallViewportLayout).toBeUndefined();
72
72
  });
73
- it('should pass the "desktopConfig" props to DesktopLayout', () => {
74
- render( /*#__PURE__*/React.createElement(SmallViewportModeWrapper, {
75
- layout: "desktop"
76
- }, /*#__PURE__*/React.createElement(TopNavBarLayout, Object.assign({}, getLayoutProps({
77
- currentLayout: 'desktop',
78
- inverseColor: false
79
- }), {
80
- desktopConfig: {
81
- hideActionsUserSeparator: false
82
- }
83
- }))));
84
- const navElement = screen.getByRole('navigation');
85
- const userContainer = Array.from(navElement.children).find(child => child.className.includes('topNavBarDesktopLayout__userContainer'));
86
- const userContainerStyle = userContainer ? window.getComputedStyle(userContainer) : null;
87
-
88
- // userContainer get position relative and a pseudo ::before as a separator
89
- expect(userContainerStyle === null || userContainerStyle === void 0 ? void 0 : userContainerStyle.position).toBe('relative');
90
- });
91
73
  it('should pass the proper "themeOverride"-s to DesktopLayout', () => {
92
74
  render( /*#__PURE__*/React.createElement(SmallViewportModeWrapper, {
93
75
  layout: "desktop"
@@ -1,5 +1,5 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
- const _excluded = ["desktopConfig", "smallViewportConfig", "styles", "makeStyles"];
2
+ const _excluded = ["smallViewportConfig", "styles", "makeStyles"];
3
3
  var _dec, _dec2, _class, _class2;
4
4
  /*
5
5
  * The MIT License (MIT)
@@ -53,6 +53,10 @@ let TopNavBarLayout = (_dec = withStyle(null, generateComponentTheme), _dec2 = t
53
53
  }
54
54
  };
55
55
  }
56
+ componentDidMount() {
57
+ // TODO: Remove this in v10!
58
+ if ('desktopConfig' in this.props) {}
59
+ }
56
60
  get sortedThemeOverride() {
57
61
  const themeOverride = this.props.themeOverride;
58
62
 
@@ -82,7 +86,6 @@ let TopNavBarLayout = (_dec = withStyle(null, generateComponentTheme), _dec2 = t
82
86
  }
83
87
  render() {
84
88
  const _this$props = this.props,
85
- desktopConfig = _this$props.desktopConfig,
86
89
  smallViewportConfig = _this$props.smallViewportConfig,
87
90
  styles = _this$props.styles,
88
91
  makeStyles = _this$props.makeStyles,
@@ -93,13 +96,12 @@ let TopNavBarLayout = (_dec = withStyle(null, generateComponentTheme), _dec2 = t
93
96
  elementRef: this.handleRef
94
97
  }));
95
98
  }
96
- return jsx(TopNavBarDesktopLayout, Object.assign({}, desktopConfig, restProps, {
99
+ return jsx(TopNavBarDesktopLayout, Object.assign({}, restProps, {
97
100
  themeOverride: this.sortedThemeOverride.desktopThemeOverride,
98
101
  elementRef: this.handleRef
99
102
  }));
100
103
  }
101
104
  }, _class2.displayName = "TopNavBarLayout", _class2.componentId = 'TopNavBar.Layout', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
102
- desktopConfig: {},
103
105
  smallViewportConfig: {}
104
106
  }, _class2.contextType = TopNavBarContext, _class2)) || _class) || _class);
105
107
  export { TopNavBarLayout };
@@ -63,11 +63,10 @@ const smallViewportPropTypes = {
63
63
  };
64
64
  const propTypes = {
65
65
  ...commonPropTypes,
66
- desktopConfig: PropTypes.shape(desktopPropTypes),
67
66
  smallViewportConfig: PropTypes.shape(smallViewportPropTypes).isRequired
68
67
  };
69
68
  const commonAllowedProps = ['renderBrand', 'renderMenuItems', 'renderActionItems', 'renderUser', 'renderBreadcrumb', 'navLabel', 'elementRef'];
70
69
  const desktopAllowedProps = ['hideActionsUserSeparator'];
71
70
  const smallViewportAllowedProps = ['dropdownMenuToggleButtonLabel', 'dropdownMenuToggleButtonTooltip', 'dropdownMenuLabel', 'alternativeTitle', 'renderInPlaceDialogConfig', 'trayMountNode', 'onDropdownMenuToggle', 'onDropdownMenuSelect'];
72
- const allowedProps = [...commonAllowedProps, 'desktopConfig', 'smallViewportConfig'];
71
+ const allowedProps = [...commonAllowedProps, 'smallViewportConfig'];
73
72
  export { propTypes, allowedProps, commonPropTypes, commonAllowedProps, desktopPropTypes, smallViewportPropTypes, desktopAllowedProps, smallViewportAllowedProps };
@@ -64,7 +64,6 @@ const BaseExample = () => {
64
64
  return /*#__PURE__*/React.createElement(TopNavBar, {
65
65
  breakpoint: 700
66
66
  }, () => /*#__PURE__*/React.createElement(TopNavBar.Layout, {
67
- desktopConfig: {},
68
67
  smallViewportConfig: {
69
68
  dropdownMenuToggleButtonLabel: 'Toggle Menu',
70
69
  dropdownMenuLabel: 'Main Menu'
@@ -28,7 +28,7 @@ import { Drilldown } from '@instructure/ui-drilldown';
28
28
  import { IconQuestionLine, IconAlertsLine, IconConfigureLine, IconSearchLine, IconDiscussionLine, IconDashboardLine } from '@instructure/ui-icons';
29
29
  import { TopNavBarContext } from '../TopNavBarContext';
30
30
  import { TopNavBar } from '../index';
31
- import { elevateIcon, elevateLogo, elevateLogoInverse } from './exampleSvgFiles';
31
+ import { elevateIcon } from './exampleSvgFiles';
32
32
  import { Breadcrumb } from '@instructure/ui-breadcrumb';
33
33
  const avatarExample = {
34
34
  avatarName: 'User Name',
@@ -85,14 +85,10 @@ SmallViewportModeWrapper.defaultProps = {
85
85
  inverseColor: false
86
86
  };
87
87
  const getBrand = (config = {}) => {
88
- const logo = config.inverseColor ? elevateLogoInverse : elevateLogo;
89
- const nameBackground = !config.hasBrandNameBackground ? void 0 : config.inverseColor ? '#F5F5F5' : '#2D3B45';
90
88
  return /*#__PURE__*/React.createElement(TopNavBar.Brand, Object.assign({
91
89
  screenReaderLabel: "Brand name",
92
- renderName: logo,
93
90
  renderIcon: elevateIcon,
94
91
  iconBackground: "#0097D3",
95
- nameBackground: nameBackground,
96
92
  href: "/#TopNavBar"
97
93
  }, config.brandProps));
98
94
  };
@@ -169,9 +165,6 @@ const getBreadcrumb = (_config = {}) => {
169
165
  };
170
166
  const getLayoutProps = (props, config = {}) => {
171
167
  return {
172
- desktopConfig: {
173
- hideActionsUserSeparator: config.hideActionsUserSeparator
174
- },
175
168
  smallViewportConfig: {
176
169
  dropdownMenuToggleButtonLabel: 'Toggle Menu',
177
170
  dropdownMenuLabel: 'Main Menu',
@@ -36,9 +36,6 @@ const TopNavBarBrandLocator = exports.TopNavBarBrandLocator = (0, _locator.locat
36
36
  findContainer: (...args) => {
37
37
  return (0, _uiTestUtils.find)('[class$="-topNavBarBrand__container"]', ...args);
38
38
  },
39
- findBrandNameContainer: (...args) => {
40
- return (0, _uiTestUtils.find)('[class$="-topNavBarBrand__nameContainer"]', ...args);
41
- },
42
39
  findBrandIconContainer: (...args) => {
43
40
  return (0, _uiTestUtils.find)('[class$="-topNavBarBrand__iconContainer"]', ...args);
44
41
  },
@@ -7,7 +7,6 @@ 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");
11
10
  var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
12
11
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
13
12
  var _testable = require("@instructure/ui-testable/lib/testable.js");
@@ -18,7 +17,7 @@ var _TopNavBarContext = require("../TopNavBarContext");
18
17
  var _styles = _interopRequireDefault(require("./styles"));
19
18
  var _theme = _interopRequireDefault(require("./theme"));
20
19
  var _props = require("./props");
21
- var _dec, _dec2, _dec3, _class, _class2;
20
+ var _dec, _dec2, _class, _class2;
22
21
  /*
23
22
  * The MIT License (MIT)
24
23
  *
@@ -50,9 +49,7 @@ id: TopNavBar.Brand
50
49
  ---
51
50
  @module TopNavBarBrand
52
51
  **/
53
- let TopNavBarBrand = exports.TopNavBarBrand = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec3 = (0, _deprecated.deprecated)('9', {
54
- renderName: true
55
- }, 'Please use the updated TopNavBar design.'), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class TopNavBarBrand extends _react.Component {
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 {
56
53
  constructor(...args) {
57
54
  super(...args);
58
55
  this.ref = null;
@@ -66,6 +63,11 @@ let TopNavBarBrand = exports.TopNavBarBrand = (_dec = (0, _emotion.withStyle)(_s
66
63
  }
67
64
  componentDidMount() {
68
65
  var _this$props$makeStyle, _this$props;
66
+ // TODO: Remove this in v10!
67
+ if ('renderName' in this.props) {}
68
+
69
+ // TODO: Remove this in v10!
70
+ if ('nameBackground' in this.props) {}
69
71
  (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStylesVariables);
70
72
  }
71
73
  componentDidUpdate() {
@@ -80,7 +82,6 @@ let TopNavBarBrand = exports.TopNavBarBrand = (_dec = (0, _emotion.withStyle)(_s
80
82
  render() {
81
83
  const _this$props3 = this.props,
82
84
  screenReaderLabel = _this$props3.screenReaderLabel,
83
- renderName = _this$props3.renderName,
84
85
  renderIcon = _this$props3.renderIcon,
85
86
  href = _this$props3.href,
86
87
  onClick = _this$props3.onClick,
@@ -89,7 +90,7 @@ let TopNavBarBrand = exports.TopNavBarBrand = (_dec = (0, _emotion.withStyle)(_s
89
90
  return (0, _emotion.jsx)("div", {
90
91
  ref: this.handleRef,
91
92
  css: styles === null || styles === void 0 ? void 0 : styles.topNavBarBrand
92
- }, (renderIcon || renderName) && (0, _emotion.jsx)(_View.View, Object.assign({}, (0, _omitProps.omitProps)(this.props, _props.allowedProps), {
93
+ }, renderIcon && (0, _emotion.jsx)(_View.View, Object.assign({}, (0, _omitProps.omitProps)(this.props, _props.allowedProps), {
93
94
  css: styles === null || styles === void 0 ? void 0 : styles.container,
94
95
  as: ElementType,
95
96
  href: href,
@@ -105,11 +106,7 @@ let TopNavBarBrand = exports.TopNavBarBrand = (_dec = (0, _emotion.withStyle)(_s
105
106
  css: styles === null || styles === void 0 ? void 0 : styles.iconContainer,
106
107
  role: "presentation",
107
108
  "aria-hidden": "true"
108
- }, renderIcon), renderName && (0, _emotion.jsx)("div", {
109
- css: styles === null || styles === void 0 ? void 0 : styles.nameContainer,
110
- role: "presentation",
111
- "aria-hidden": "true"
112
- }, renderName)));
109
+ }, renderIcon)));
113
110
  }
114
- }, _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);
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);
115
112
  var _default = exports.default = TopNavBarBrand;
@@ -32,13 +32,11 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
32
32
 
33
33
  const propTypes = exports.propTypes = {
34
34
  screenReaderLabel: _propTypes.default.string.isRequired,
35
- renderName: _propTypes.default.node,
36
35
  renderIcon: _propTypes.default.node,
37
- nameBackground: _propTypes.default.string,
38
36
  iconBackground: _propTypes.default.string,
39
37
  href: _propTypes.default.string,
40
38
  onClick: _propTypes.default.func,
41
39
  as: _propTypes.default.elementType,
42
40
  elementRef: _propTypes.default.func
43
41
  };
44
- const allowedProps = exports.allowedProps = ['screenReaderLabel', 'renderName', 'renderIcon', 'nameBackground', 'iconBackground', 'href', 'onClick', 'as', 'elementRef'];
42
+ const allowedProps = exports.allowedProps = ['screenReaderLabel', 'renderIcon', 'iconBackground', 'href', 'onClick', 'as', 'elementRef'];