@instructure/ui-navigation 8.33.1 → 8.33.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/es/AppNav/AppNavLocator.js +3 -1
  3. package/es/AppNav/Item/AppNavItemLocator.js +2 -1
  4. package/es/AppNav/Item/index.js +9 -23
  5. package/es/AppNav/Item/styles.js +1 -2
  6. package/es/AppNav/Item/theme.js +4 -4
  7. package/es/AppNav/index.js +6 -16
  8. package/es/AppNav/locator.js +1 -0
  9. package/es/AppNav/props.js +1 -0
  10. package/es/AppNav/styles.js +0 -1
  11. package/es/AppNav/theme.js +5 -5
  12. package/es/Navigation/NavigationItem/NavigationItemLocator.js +4 -3
  13. package/es/Navigation/NavigationItem/index.js +7 -19
  14. package/es/Navigation/NavigationItem/styles.js +0 -1
  15. package/es/Navigation/NavigationItem/theme.js +5 -5
  16. package/es/Navigation/NavigationLocator.js +2 -1
  17. package/es/Navigation/index.js +1 -21
  18. package/es/Navigation/props.js +1 -0
  19. package/es/Navigation/styles.js +0 -1
  20. package/es/Navigation/theme.js +6 -6
  21. package/es/index.js +1 -0
  22. package/lib/AppNav/AppNavLocator.js +1 -4
  23. package/lib/AppNav/Item/AppNavItemLocator.js +1 -3
  24. package/lib/AppNav/Item/index.js +8 -38
  25. package/lib/AppNav/Item/locator.js +0 -2
  26. package/lib/AppNav/Item/props.js +1 -3
  27. package/lib/AppNav/Item/styles.js +1 -3
  28. package/lib/AppNav/Item/theme.js +4 -5
  29. package/lib/AppNav/index.js +5 -32
  30. package/lib/AppNav/locator.js +0 -2
  31. package/lib/AppNav/props.js +1 -6
  32. package/lib/AppNav/styles.js +0 -2
  33. package/lib/AppNav/theme.js +5 -6
  34. package/lib/Navigation/NavigationItem/NavigationItemLocator.js +2 -4
  35. package/lib/Navigation/NavigationItem/index.js +6 -29
  36. package/lib/Navigation/NavigationItem/locator.js +0 -2
  37. package/lib/Navigation/NavigationItem/props.js +1 -3
  38. package/lib/Navigation/NavigationItem/styles.js +0 -2
  39. package/lib/Navigation/NavigationItem/theme.js +5 -6
  40. package/lib/Navigation/NavigationLocator.js +1 -4
  41. package/lib/Navigation/index.js +1 -34
  42. package/lib/Navigation/locator.js +0 -2
  43. package/lib/Navigation/props.js +1 -6
  44. package/lib/Navigation/styles.js +0 -2
  45. package/lib/Navigation/theme.js +6 -7
  46. package/lib/index.js +0 -2
  47. package/package.json +24 -24
  48. package/tsconfig.build.tsbuildinfo +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
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.33.2](https://github.com/instructure/instructure-ui/compare/v8.33.1...v8.33.2) (2023-01-25)
7
+
8
+ **Note:** Version bump only for package @instructure/ui-navigation
9
+
6
10
  ## [8.33.1](https://github.com/instructure/instructure-ui/compare/v8.33.0...v8.33.1) (2023-01-06)
7
11
 
8
12
  **Note:** Version bump only for package @instructure/ui-navigation
@@ -21,10 +21,12 @@
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
25
  import { locator } from '@instructure/ui-test-locator';
25
26
  import { AppNav } from './index';
26
- import { AppNavItemLocator } from './Item/AppNavItemLocator'; // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
27
+ import { AppNavItemLocator } from './Item/AppNavItemLocator';
27
28
 
29
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
28
30
  export const AppNavLocator = locator(AppNav.selector, {
29
31
  findAllItems: function () {
30
32
  return AppNavItemLocator.findAll(...arguments);
@@ -22,6 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
  import { locator } from '@instructure/ui-test-locator';
25
- import { Item } from './index'; // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
25
+ import { Item } from './index';
26
26
 
27
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
27
28
  export const AppNavItemLocator = locator(Item.selector);
@@ -1,5 +1,4 @@
1
1
  var _dec, _dec2, _class, _class2;
2
-
3
2
  /*
4
3
  * The MIT License (MIT)
5
4
  *
@@ -35,6 +34,7 @@ import { withStyle, jsx } from '@instructure/emotion';
35
34
  import generateStyle from './styles';
36
35
  import generateComponentTheme from './theme';
37
36
  import { allowedProps, propTypes } from './props';
37
+
38
38
  /**
39
39
  ---
40
40
  parent: AppNav
@@ -43,26 +43,21 @@ id: AppNav.Item
43
43
  @tsProps
44
44
  @module Item
45
45
  **/
46
-
47
46
  let Item = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_class2 = class Item extends Component {
48
47
  constructor() {
49
48
  super(...arguments);
50
49
  this.ref = null;
51
-
52
50
  this.handleRef = el => {
53
51
  const elementRef = this.props.elementRef;
54
52
  this.ref = el;
55
-
56
53
  if (typeof elementRef === 'function') {
57
54
  elementRef(el);
58
55
  }
59
56
  };
60
-
61
57
  this.handleClick = e => {
62
58
  const _this$props = this.props,
63
- isDisabled = _this$props.isDisabled,
64
- onClick = _this$props.onClick;
65
-
59
+ isDisabled = _this$props.isDisabled,
60
+ onClick = _this$props.onClick;
66
61
  if (isDisabled) {
67
62
  e.preventDefault();
68
63
  e.stopPropagation();
@@ -71,38 +66,30 @@ let Item = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
71
66
  }
72
67
  };
73
68
  }
74
-
75
69
  componentDidMount() {
76
70
  var _this$props$makeStyle, _this$props2;
77
-
78
71
  (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
79
72
  }
80
-
81
73
  componentDidUpdate() {
82
74
  var _this$props$makeStyle2, _this$props3;
83
-
84
75
  (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
85
76
  }
86
-
87
77
  render() {
88
78
  var _this$props$styles, _this$props$styles2;
89
-
90
79
  const ElementType = getElementType(Item, this.props);
91
80
  const _this$props4 = this.props,
92
- renderIcon = _this$props4.renderIcon,
93
- renderLabel = _this$props4.renderLabel,
94
- href = _this$props4.href,
95
- renderAfter = _this$props4.renderAfter,
96
- cursor = _this$props4.cursor,
97
- isDisabled = _this$props4.isDisabled;
81
+ renderIcon = _this$props4.renderIcon,
82
+ renderLabel = _this$props4.renderLabel,
83
+ href = _this$props4.href,
84
+ renderAfter = _this$props4.renderAfter,
85
+ cursor = _this$props4.cursor,
86
+ isDisabled = _this$props4.isDisabled;
98
87
  const icon = callRenderProp(renderIcon);
99
88
  const label = callRenderProp(renderLabel);
100
89
  const labelIsForScreenReaders = matchComponentTypes(label, [ScreenReaderContent]);
101
-
102
90
  if (icon) {
103
91
  error(labelIsForScreenReaders, '[AppNav] If an icon is used, the label text should be wrapped in <ScreenReaderContent />.');
104
92
  }
105
-
106
93
  return jsx(View, Object.assign({}, passthroughProps(this.props), {
107
94
  as: ElementType,
108
95
  href: href,
@@ -118,7 +105,6 @@ let Item = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
118
105
  css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.label
119
106
  }, label), renderAfter && callRenderProp(renderAfter));
120
107
  }
121
-
122
108
  }, _class2.displayName = "Item", _class2.componentId = 'AppNav.Item', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
123
109
  children: null,
124
110
  isSelected: false,
@@ -34,7 +34,7 @@
34
34
  */
35
35
  const generateStyle = (componentTheme, props) => {
36
36
  const isSelected = props.isSelected,
37
- isDisabled = props.isDisabled;
37
+ isDisabled = props.isDisabled;
38
38
  const itemStyles = {
39
39
  appearance: 'none',
40
40
  overflow: 'visible',
@@ -82,5 +82,4 @@ const generateStyle = (componentTheme, props) => {
82
82
  }
83
83
  };
84
84
  };
85
-
86
85
  export default generateStyle;
@@ -29,8 +29,8 @@
29
29
  */
30
30
  const generateComponentTheme = theme => {
31
31
  const colors = theme.colors,
32
- spacing = theme.spacing,
33
- typography = theme.typography;
32
+ spacing = theme.spacing,
33
+ typography = theme.typography;
34
34
  const componentVariables = {
35
35
  fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
36
36
  fontSize: '1.125rem',
@@ -41,8 +41,8 @@ const generateComponentTheme = theme => {
41
41
  padding: spacing === null || spacing === void 0 ? void 0 : spacing.small,
42
42
  backgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest
43
43
  };
44
- return { ...componentVariables
44
+ return {
45
+ ...componentVariables
45
46
  };
46
47
  };
47
-
48
48
  export default generateComponentTheme;
@@ -1,5 +1,4 @@
1
1
  var _dec, _dec2, _class, _class2;
2
-
3
2
  /*
4
3
  * The MIT License (MIT)
5
4
  *
@@ -36,13 +35,13 @@ import generateStyle from './styles';
36
35
  import generateComponentTheme from './theme';
37
36
  import { allowedProps, propTypes } from './props';
38
37
  import { TruncateList } from '@instructure/ui-truncate-list';
38
+
39
39
  /**
40
40
  ---
41
41
  category: components
42
42
  ---
43
43
  @tsProps
44
44
  **/
45
-
46
45
  let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_class2 = class AppNav extends Component {
47
46
  constructor() {
48
47
  super(...arguments);
@@ -50,29 +49,22 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
50
49
  isMeasuring: false
51
50
  };
52
51
  this.ref = null;
53
-
54
52
  this.handleRef = el => {
55
53
  const elementRef = this.props.elementRef;
56
54
  this.ref = el;
57
-
58
55
  if (typeof elementRef === 'function') {
59
56
  elementRef(el);
60
57
  }
61
58
  };
62
59
  }
63
-
64
60
  componentDidMount() {
65
61
  var _this$props$makeStyle, _this$props;
66
-
67
62
  (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
68
63
  }
69
-
70
64
  componentDidUpdate() {
71
65
  var _this$props$makeStyle2, _this$props2;
72
-
73
66
  (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
74
67
  }
75
-
76
68
  renderMenu(items) {
77
69
  return jsx(Menu, {
78
70
  trigger: jsx(AppNav.Item, {
@@ -86,14 +78,13 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
86
78
  }, callRenderProp(item.props.renderLabel));
87
79
  }));
88
80
  }
89
-
90
81
  render() {
91
82
  const _this$props3 = this.props,
92
- visibleItemsCount = _this$props3.visibleItemsCount,
93
- screenReaderLabel = _this$props3.screenReaderLabel,
94
- margin = _this$props3.margin,
95
- debounce = _this$props3.debounce,
96
- styles = _this$props3.styles;
83
+ visibleItemsCount = _this$props3.visibleItemsCount,
84
+ screenReaderLabel = _this$props3.screenReaderLabel,
85
+ margin = _this$props3.margin,
86
+ debounce = _this$props3.debounce,
87
+ styles = _this$props3.styles;
97
88
  const passthroughProps = View.omitViewProps(omitProps(this.props, AppNav.allowedProps), AppNav);
98
89
  const renderBeforeItems = callRenderProp(this.props.renderBeforeItems);
99
90
  const renderAfterItems = callRenderProp(this.props.renderAfterItems);
@@ -115,7 +106,6 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
115
106
  "aria-label": callRenderProp(screenReaderLabel)
116
107
  }, this.props.children), renderAfterItems && jsx("span", null, renderAfterItems));
117
108
  }
118
-
119
109
  }, _class2.displayName = "AppNav", _class2.componentId = 'AppNav', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
120
110
  children: null,
121
111
  debounce: 300,
@@ -21,6 +21,7 @@
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
25
  import { AppNavLocator } from './AppNavLocator';
25
26
  export { AppNavLocator };
26
27
  export default AppNavLocator;
@@ -21,6 +21,7 @@
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
25
  import PropTypes from 'prop-types';
25
26
  import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
26
27
  import { ThemeablePropTypes } from '@instructure/emotion';
@@ -55,5 +55,4 @@ const generateStyle = componentTheme => {
55
55
  menuTriggerWidth: componentTheme.menuTriggerWidth.toString()
56
56
  };
57
57
  };
58
-
59
58
  export default generateStyle;
@@ -29,9 +29,9 @@
29
29
  */
30
30
  const generateComponentTheme = theme => {
31
31
  const colors = theme.colors,
32
- borders = theme.borders,
33
- spacing = theme.spacing,
34
- typography = theme.typography;
32
+ borders = theme.borders,
33
+ spacing = theme.spacing,
34
+ typography = theme.typography;
35
35
  const componentVariables = {
36
36
  fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
37
37
  height: '3.75rem',
@@ -42,8 +42,8 @@ const generateComponentTheme = theme => {
42
42
  horizontalMargin: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall,
43
43
  menuTriggerWidth: '7.5rem'
44
44
  };
45
- return { ...componentVariables
45
+ return {
46
+ ...componentVariables
46
47
  };
47
48
  };
48
-
49
49
  export default generateComponentTheme;
@@ -21,12 +21,13 @@
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 { locator } from '@instructure/ui-test-locator'; // @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module '@ins... Remove this comment to see the full error message
24
+ import { locator } from '@instructure/ui-test-locator';
25
+ // @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module '@ins... Remove this comment to see the full error message
25
26
  // eslint-disable-next-line no-restricted-imports
26
-
27
27
  import { TooltipLocator } from '@instructure/ui-tooltip/es/Tooltip/TooltipLocator';
28
- import { NavigationItem } from './index'; // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
28
+ import { NavigationItem } from './index';
29
29
 
30
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
30
31
  export const NavigationItemLocator = locator(NavigationItem.selector, {
31
32
  findTooltipContent: function () {
32
33
  return TooltipLocator.findContent(...arguments);
@@ -1,5 +1,4 @@
1
1
  var _dec, _dec2, _class, _class2;
2
-
3
2
  /*
4
3
  * The MIT License (MIT)
5
4
  *
@@ -23,7 +22,6 @@ var _dec, _dec2, _class, _class2;
23
22
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
23
  * SOFTWARE.
25
24
  */
26
-
27
25
  /** @jsx jsx */
28
26
  import { Component } from 'react';
29
27
  import { testable } from '@instructure/ui-testable';
@@ -34,6 +32,7 @@ import { withStyle, jsx } from '@instructure/emotion';
34
32
  import generateStyle from './styles';
35
33
  import generateComponentTheme from './theme';
36
34
  import { allowedProps, propTypes } from './props';
35
+
37
36
  /**
38
37
  ---
39
38
  parent: Navigation
@@ -41,47 +40,38 @@ id: Navigation.Item
41
40
  ---
42
41
  @tsProps
43
42
  **/
44
-
45
43
  let NavigationItem = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_class2 = class NavigationItem extends Component {
46
44
  constructor() {
47
45
  super(...arguments);
48
46
  this.ref = null;
49
-
50
47
  this.handleRef = el => {
51
48
  const elementRef = this.props.elementRef;
52
49
  this.ref = el;
53
-
54
50
  if (typeof elementRef === 'function') {
55
51
  elementRef(el);
56
52
  }
57
53
  };
58
54
  }
59
-
60
55
  componentDidMount() {
61
56
  var _this$props$makeStyle, _this$props;
62
-
63
57
  (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
64
58
  minimized: this.props.minimized
65
59
  });
66
60
  }
67
-
68
61
  componentDidUpdate() {
69
62
  var _this$props$makeStyle2, _this$props2;
70
-
71
63
  (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
72
64
  minimized: this.props.minimized
73
65
  });
74
66
  }
75
-
76
67
  renderLink(addRef) {
77
68
  var _this$props$styles, _this$props$styles2, _this$props$styles3;
78
-
79
69
  const ElementType = getElementType(NavigationItem, this.props);
80
70
  const _this$props3 = this.props,
81
- href = _this$props3.href,
82
- onClick = _this$props3.onClick,
83
- icon = _this$props3.icon,
84
- label = _this$props3.label;
71
+ href = _this$props3.href,
72
+ onClick = _this$props3.onClick,
73
+ icon = _this$props3.icon,
74
+ label = _this$props3.label;
85
75
  const props = omitProps(this.props, NavigationItem.allowedProps);
86
76
  return jsx(ElementType, Object.assign({}, props, {
87
77
  href: href,
@@ -96,11 +86,10 @@ let NavigationItem = (_dec = withStyle(generateStyle, generateComponentTheme), _
96
86
  css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.label
97
87
  }, label) : null);
98
88
  }
99
-
100
89
  render() {
101
90
  const _this$props4 = this.props,
102
- minimized = _this$props4.minimized,
103
- label = _this$props4.label;
91
+ minimized = _this$props4.minimized,
92
+ label = _this$props4.label;
104
93
  const hasTooltip = minimized && hasVisibleChildren(label);
105
94
  const link = this.renderLink(!hasTooltip);
106
95
  return hasTooltip ? jsx(Tooltip, {
@@ -109,7 +98,6 @@ let NavigationItem = (_dec = withStyle(generateStyle, generateComponentTheme), _
109
98
  elementRef: this.handleRef
110
99
  }, link) : link;
111
100
  }
112
-
113
101
  }, _class2.displayName = "NavigationItem", _class2.componentId = 'Navigation.Item', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
114
102
  as: 'a',
115
103
  selected: false,
@@ -90,5 +90,4 @@ const generateStyle = (componentTheme, props) => {
90
90
  }
91
91
  };
92
92
  };
93
-
94
93
  export default generateStyle;
@@ -29,9 +29,9 @@
29
29
  */
30
30
  const generateComponentTheme = theme => {
31
31
  const colors = theme.colors,
32
- spacing = theme.spacing,
33
- typography = theme.typography,
34
- themeName = theme.key;
32
+ spacing = theme.spacing,
33
+ typography = theme.typography,
34
+ themeName = theme.key;
35
35
  const themeSpecificStyle = {
36
36
  canvas: {
37
37
  fontColor: theme['ic-brand-global-nav-menu-item__text-color'],
@@ -65,9 +65,9 @@ const generateComponentTheme = theme => {
65
65
  selectedInnerFocusOutline: `inset 0 0 0 0.25rem ${colors === null || colors === void 0 ? void 0 : colors.borderBrand}`,
66
66
  contentPadding: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall
67
67
  };
68
- return { ...componentVariables,
68
+ return {
69
+ ...componentVariables,
69
70
  ...themeSpecificStyle[themeName]
70
71
  };
71
72
  };
72
-
73
73
  export default generateComponentTheme;
@@ -24,8 +24,9 @@
24
24
  import { locator } from '@instructure/ui-test-locator';
25
25
  import { Navigation } from './index';
26
26
  import { NavigationItemLocator } from './NavigationItem/NavigationItemLocator';
27
- export { NavigationItemLocator }; // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
27
+ export { NavigationItemLocator };
28
28
 
29
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
29
30
  export const NavigationLocator = locator(Navigation.selector, {
30
31
  findAllItems: function () {
31
32
  return NavigationItemLocator.findAll(...arguments);
@@ -1,5 +1,4 @@
1
1
  var _dec, _dec2, _dec3, _class, _class2;
2
-
3
2
  /*
4
3
  * The MIT License (MIT)
5
4
  *
@@ -23,7 +22,6 @@ var _dec, _dec2, _dec3, _class, _class2;
23
22
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
23
  * SOFTWARE.
25
24
  */
26
-
27
25
  /** @jsx jsx */
28
26
  import React, { Component, Children } from 'react';
29
27
  import { testable } from '@instructure/ui-testable';
@@ -35,74 +33,60 @@ import { NavigationItem } from './NavigationItem';
35
33
  import generateStyle from './styles';
36
34
  import generateComponentTheme from './theme';
37
35
  import { allowedProps, propTypes } from './props';
38
-
39
36
  const navMinimized = _ref => {
40
37
  let minimized = _ref.minimized;
41
38
  return {
42
39
  minimized: !minimized
43
40
  };
44
41
  };
42
+
45
43
  /**
46
44
  ---
47
45
  category: components/deprecated
48
46
  ---
49
47
  @tsProps
50
48
  **/
51
-
52
-
53
49
  let Navigation = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec3 = deprecated('9.0.0', null, 'No one uses <Navigation>, so we will deprecate it.'), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class Navigation extends Component {
54
50
  constructor(props) {
55
51
  super(props);
56
52
  this.ref = null;
57
-
58
53
  this.handleNavToggle = event => {
59
54
  if (!this.isControlled()) {
60
55
  this.setState(navMinimized);
61
56
  }
62
-
63
57
  if (typeof this.props.onMinimized === 'function') {
64
58
  this.props.onMinimized(event, !this.minimized);
65
59
  }
66
60
  };
67
-
68
61
  this.state = {
69
62
  minimized: this.isControlled(props) ? !!props.minimized : !!props.defaultMinimized
70
63
  };
71
64
  }
72
-
73
65
  componentDidMount() {
74
66
  var _this$props$makeStyle, _this$props;
75
-
76
67
  (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
77
68
  minimized: this.minimized
78
69
  });
79
70
  }
80
-
81
71
  componentDidUpdate() {
82
72
  var _this$props$makeStyle2, _this$props2;
83
-
84
73
  (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
85
74
  minimized: this.minimized
86
75
  });
87
76
  }
88
-
89
77
  get minimized() {
90
78
  if (this.isControlled()) {
91
79
  return !!this.props.minimized;
92
80
  }
93
-
94
81
  return !!this.state.minimized;
95
82
  }
96
-
97
83
  isControlled() {
98
84
  let props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props;
99
85
  return typeof props.minimized === 'boolean';
100
86
  }
101
-
102
87
  renderChildren() {
103
88
  return Children.map(this.props.children, child => {
104
89
  var _this$props$styles;
105
-
106
90
  const navItem = safeCloneElement(child, {
107
91
  minimized: this.state.minimized
108
92
  });
@@ -111,14 +95,11 @@ let Navigation = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
111
95
  }, navItem);
112
96
  });
113
97
  }
114
-
115
98
  toggleMessage() {
116
99
  return this.state.minimized ? this.props.toggleLabel.minimizedLabel : this.props.toggleLabel.expandedLabel;
117
100
  }
118
-
119
101
  render() {
120
102
  var _this$props$styles2, _this$props$styles3, _this$props$styles4, _this$props$styles5;
121
-
122
103
  const label = this.props.label;
123
104
  const props = omitProps(this.props, Navigation.allowedProps, ['minimized']);
124
105
  return jsx("nav", Object.assign({}, props, {
@@ -141,7 +122,6 @@ let Navigation = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
141
122
  label: jsx(ScreenReaderContent, null, this.toggleMessage())
142
123
  })));
143
124
  }
144
-
145
125
  }, _class2.displayName = "Navigation", _class2.componentId = 'Navigation', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
146
126
  children: null,
147
127
  defaultMinimized: false,
@@ -21,6 +21,7 @@
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
25
  import PropTypes from 'prop-types';
25
26
  import { controllable, Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
26
27
  import { NavigationItem } from './NavigationItem';
@@ -74,5 +74,4 @@ const generateStyle = (componentTheme, props, state) => {
74
74
  }
75
75
  };
76
76
  };
77
-
78
77
  export default generateStyle;
@@ -29,10 +29,10 @@
29
29
  */
30
30
  const generateComponentTheme = theme => {
31
31
  const colors = theme.colors,
32
- spacing = theme.spacing,
33
- borders = theme.borders,
34
- transitions = theme.transitions,
35
- themeName = theme.key;
32
+ spacing = theme.spacing,
33
+ borders = theme.borders,
34
+ transitions = theme.transitions,
35
+ themeName = theme.key;
36
36
  const themeSpecificStyle = {
37
37
  canvas: {
38
38
  backgroundColor: theme['ic-brand-global-nav-bgd'],
@@ -53,9 +53,9 @@ const generateComponentTheme = theme => {
53
53
  marginBottom: spacing === null || spacing === void 0 ? void 0 : spacing.small,
54
54
  toggleTransition: transitions === null || transitions === void 0 ? void 0 : transitions.duration
55
55
  };
56
- return { ...componentVariables,
56
+ return {
57
+ ...componentVariables,
57
58
  ...themeSpecificStyle[themeName]
58
59
  };
59
60
  };
60
-
61
61
  export default generateComponentTheme;
package/es/index.js CHANGED
@@ -21,5 +21,6 @@
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
25
  export { AppNav } from './AppNav';
25
26
  export { Navigation, NavigationItem } from './Navigation';
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.AppNavLocator = void 0;
7
-
8
7
  var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
9
-
10
8
  var _index = require("./index");
11
-
12
9
  var _AppNavItemLocator = require("./Item/AppNavItemLocator");
13
-
14
10
  /*
15
11
  * The MIT License (MIT)
16
12
  *
@@ -34,6 +30,7 @@ var _AppNavItemLocator = require("./Item/AppNavItemLocator");
34
30
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35
31
  * SOFTWARE.
36
32
  */
33
+
37
34
  // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
38
35
  const AppNavLocator = (0, _locator.locator)(_index.AppNav.selector, {
39
36
  findAllItems: function () {
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.AppNavItemLocator = void 0;
7
-
8
7
  var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
9
-
10
8
  var _index = require("./index");
11
-
12
9
  /*
13
10
  * The MIT License (MIT)
14
11
  *
@@ -32,6 +29,7 @@ var _index = require("./index");
32
29
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
30
  * SOFTWARE.
34
31
  */
32
+
35
33
  // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
36
34
  const AppNavItemLocator = (0, _locator.locator)(_index.Item.selector);
37
35
  exports.AppNavItemLocator = AppNavItemLocator;