@instructure/ui-navigation 8.17.1-snapshot.82 → 8.18.1-snapshot.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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.18.0](https://github.com/instructure/instructure-ui/compare/v8.17.0...v8.18.0) (2022-02-23)
7
+
8
+ **Note:** Version bump only for package @instructure/ui-navigation
9
+
6
10
  # [8.17.0](https://github.com/instructure/instructure-ui/compare/v8.16.0...v8.17.0) (2022-02-07)
7
11
 
8
12
  ### Bug Fixes
@@ -72,22 +72,28 @@ let Item = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
72
72
  }
73
73
 
74
74
  componentDidMount() {
75
- this.props.makeStyles?.();
75
+ var _this$props$makeStyle, _this$props2;
76
+
77
+ (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
76
78
  }
77
79
 
78
80
  componentDidUpdate() {
79
- this.props.makeStyles?.();
81
+ var _this$props$makeStyle2, _this$props3;
82
+
83
+ (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
80
84
  }
81
85
 
82
86
  render() {
87
+ var _this$props$styles, _this$props$styles2;
88
+
83
89
  const ElementType = getElementType(Item, this.props);
84
- const _this$props2 = this.props,
85
- renderIcon = _this$props2.renderIcon,
86
- renderLabel = _this$props2.renderLabel,
87
- href = _this$props2.href,
88
- renderAfter = _this$props2.renderAfter,
89
- cursor = _this$props2.cursor,
90
- isDisabled = _this$props2.isDisabled;
90
+ const _this$props4 = this.props,
91
+ renderIcon = _this$props4.renderIcon,
92
+ renderLabel = _this$props4.renderLabel,
93
+ href = _this$props4.href,
94
+ renderAfter = _this$props4.renderAfter,
95
+ cursor = _this$props4.cursor,
96
+ isDisabled = _this$props4.isDisabled;
91
97
  const icon = callRenderProp(renderIcon);
92
98
  const label = callRenderProp(renderLabel);
93
99
  const labelIsForScreenReaders = matchComponentTypes(label, [ScreenReaderContent]);
@@ -108,9 +114,9 @@ let Item = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
108
114
  onFocus: this.handleFocus,
109
115
  onBlur: this.handleBlur,
110
116
  cursor: isDisabled ? 'not-allowed' : cursor,
111
- css: this.props.styles?.item
117
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.item
112
118
  }), icon, labelIsForScreenReaders ? label : jsx("span", {
113
- css: this.props.styles?.label
119
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.label
114
120
  }, label), renderAfter && callRenderProp(renderAfter));
115
121
  }
116
122
 
@@ -32,14 +32,14 @@ const generateComponentTheme = theme => {
32
32
  spacing = theme.spacing,
33
33
  typography = theme.typography;
34
34
  const componentVariables = {
35
- fontFamily: typography?.fontFamily,
35
+ fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
36
36
  fontSize: '1.125rem',
37
- fontWeight: typography?.fontWeightBold,
38
- textColor: colors?.textLink,
39
- textColorSelected: colors?.textDarkest,
37
+ fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightBold,
38
+ textColor: colors === null || colors === void 0 ? void 0 : colors.textLink,
39
+ textColorSelected: colors === null || colors === void 0 ? void 0 : colors.textDarkest,
40
40
  height: '2.25rem',
41
- padding: spacing?.small,
42
- backgroundColor: colors?.backgroundLightest
41
+ padding: spacing === null || spacing === void 0 ? void 0 : spacing.small,
42
+ backgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest
43
43
  };
44
44
  return { ...componentVariables
45
45
  };
@@ -54,7 +54,9 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
54
54
  this._list = null;
55
55
 
56
56
  this.measureItems = () => {
57
- const menuTriggerWidth = px(this.props.styles?.menuTriggerWidth);
57
+ var _this$props$styles;
58
+
59
+ const menuTriggerWidth = px((_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.menuTriggerWidth);
58
60
  let visibleItemsCount = 0;
59
61
 
60
62
  if (this._list) {
@@ -113,7 +115,9 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
113
115
  }
114
116
 
115
117
  componentDidMount() {
116
- this.props.makeStyles?.();
118
+ var _this$props$makeStyle, _this$props;
119
+
120
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
117
121
 
118
122
  const _getBoundingClientRec3 = getBoundingClientRect(this._list),
119
123
  origWidth = _getBoundingClientRec3.width;
@@ -138,7 +142,9 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
138
142
  }
139
143
 
140
144
  componentDidUpdate() {
141
- this.props.makeStyles?.();
145
+ var _this$props$makeStyle2, _this$props2;
146
+
147
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
142
148
  }
143
149
 
144
150
  componentWillUnmount() {
@@ -152,9 +158,11 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
152
158
  }
153
159
 
154
160
  renderListItem(item, isMenuTrigger, key) {
161
+ var _this$props$styles2, _this$props$styles3;
162
+
155
163
  return jsx("li", {
156
164
  key: key,
157
- css: isMenuTrigger ? this.props.styles?.listItemWithMenuTrigger : this.props.styles?.listItem
165
+ css: isMenuTrigger ? (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.listItemWithMenuTrigger : (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.listItem
158
166
  }, item);
159
167
  }
160
168
 
@@ -176,11 +184,13 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
176
184
  }
177
185
 
178
186
  render() {
179
- const _this$props = this.props,
180
- children = _this$props.children,
181
- visibleItemsCount = _this$props.visibleItemsCount,
182
- screenReaderLabel = _this$props.screenReaderLabel,
183
- margin = _this$props.margin;
187
+ var _this$props$styles4, _this$props$styles5, _this$props$styles6;
188
+
189
+ const _this$props3 = this.props,
190
+ children = _this$props3.children,
191
+ visibleItemsCount = _this$props3.visibleItemsCount,
192
+ screenReaderLabel = _this$props3.screenReaderLabel,
193
+ margin = _this$props3.margin;
184
194
  const passthroughProps = View.omitViewProps(omitProps(this.props, AppNav.allowedProps), AppNav);
185
195
  const isMeasuring = this.state.isMeasuring;
186
196
  const childrenArray = Children.toArray(children);
@@ -191,13 +201,13 @@ let AppNav = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = t
191
201
  const hasRenderedContent = renderBeforeItems || renderAfterItems;
192
202
  return jsx(View, Object.assign({}, passthroughProps, {
193
203
  as: "nav",
194
- css: [this.props.styles?.appNav, hasRenderedContent ? this.props.styles?.alignCenter : ''],
204
+ css: [(_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.appNav, hasRenderedContent ? (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.alignCenter : ''],
195
205
  margin: margin,
196
206
  display: hasRenderedContent ? 'flex' : 'block',
197
207
  elementRef: this.handleRef
198
208
  }), renderBeforeItems && jsx("span", null, renderBeforeItems), jsx("ul", {
199
209
  ref: el => this._list = el,
200
- css: this.props.styles?.list,
210
+ css: (_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.list,
201
211
  "aria-label": callRenderProp(screenReaderLabel)
202
212
  }, visibleChildren.map((child, index) => {
203
213
  return this.renderListItem(child, false, index);
@@ -33,13 +33,13 @@ const generateComponentTheme = theme => {
33
33
  spacing = theme.spacing,
34
34
  typography = theme.typography;
35
35
  const componentVariables = {
36
- fontFamily: typography?.fontFamily,
36
+ fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
37
37
  height: '3.75rem',
38
38
  // 60px per product design
39
- borderColor: colors?.borderMedium,
40
- borderStyle: borders?.style,
41
- borderWidth: borders?.widthSmall,
42
- horizontalMargin: spacing?.xxSmall,
39
+ borderColor: colors === null || colors === void 0 ? void 0 : colors.borderMedium,
40
+ borderStyle: borders === null || borders === void 0 ? void 0 : borders.style,
41
+ borderWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
42
+ horizontalMargin: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall,
43
43
  menuTriggerWidth: '7.5rem'
44
44
  };
45
45
  return { ...componentVariables
@@ -48,45 +48,51 @@ let NavigationItem = (_dec = withStyle(generateStyle, generateComponentTheme), _
48
48
  }
49
49
 
50
50
  componentDidMount() {
51
- this.props.makeStyles?.({
51
+ var _this$props$makeStyle, _this$props;
52
+
53
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
52
54
  minimized: this.props.minimized
53
55
  });
54
56
  }
55
57
 
56
58
  componentDidUpdate() {
57
- this.props.makeStyles?.({
59
+ var _this$props$makeStyle2, _this$props2;
60
+
61
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
58
62
  minimized: this.props.minimized
59
63
  });
60
64
  }
61
65
 
62
66
  renderLink() {
67
+ var _this$props$styles, _this$props$styles2, _this$props$styles3;
68
+
63
69
  const ElementType = getElementType(NavigationItem, this.props);
64
- const _this$props = this.props,
65
- href = _this$props.href,
66
- onClick = _this$props.onClick,
67
- icon = _this$props.icon,
68
- label = _this$props.label;
70
+ const _this$props3 = this.props,
71
+ href = _this$props3.href,
72
+ onClick = _this$props3.onClick,
73
+ icon = _this$props3.icon,
74
+ label = _this$props3.label;
69
75
  const props = omitProps(this.props, NavigationItem.allowedProps);
70
76
  return jsx(ElementType, Object.assign({}, props, {
71
77
  href: href,
72
78
  onClick: onClick,
73
- css: this.props.styles?.navigationItem,
79
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.navigationItem,
74
80
  "aria-label": this.props.minimized ? label : void 0,
75
81
  ref: element => {
76
82
  this.ref = element;
77
83
  }
78
84
  }), jsx("div", {
79
- css: this.props.styles?.icon,
85
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.icon,
80
86
  "aria-hidden": "true"
81
87
  }, icon), !this.props.minimized ? jsx("div", {
82
- css: this.props.styles?.label
88
+ css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.label
83
89
  }, label) : null);
84
90
  }
85
91
 
86
92
  render() {
87
- const _this$props2 = this.props,
88
- minimized = _this$props2.minimized,
89
- label = _this$props2.label;
93
+ const _this$props4 = this.props,
94
+ minimized = _this$props4.minimized,
95
+ label = _this$props4.label;
90
96
  const link = this.renderLink();
91
97
  return minimized && hasVisibleChildren(label) ? jsx(Tooltip, {
92
98
  renderTip: label,
@@ -46,24 +46,24 @@ const generateComponentTheme = theme => {
46
46
  }
47
47
  };
48
48
  const componentVariables = {
49
- fontSize: typography?.fontSizeSmall,
50
- fontFamily: typography?.fontFamily,
51
- fontWeight: typography?.fontWeightLight,
52
- fontColor: colors?.textLightest,
49
+ fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeSmall,
50
+ fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
51
+ fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightLight,
52
+ fontColor: colors === null || colors === void 0 ? void 0 : colors.textLightest,
53
53
  iconSize: '1.625rem',
54
- iconColor: colors?.textLightest,
55
- lineHeight: typography?.lineHeight,
54
+ iconColor: colors === null || colors === void 0 ? void 0 : colors.textLightest,
55
+ lineHeight: typography === null || typography === void 0 ? void 0 : typography.lineHeight,
56
56
  backgroundColor: 'transparent',
57
57
  linkTextDecoration: 'none',
58
- hoverBackgroundColor: colors?.backgroundDarkest,
59
- outerFocusOutline: `inset 0 0 0 0.125rem ${colors?.borderDarkest}`,
60
- innerFocusOutline: `inset 0 0 0 0.25rem ${colors?.borderLightest}`,
61
- selectedFontColor: colors?.textBrand,
62
- selectedIconColor: colors?.textBrand,
63
- selectedBackgroundColor: colors?.backgroundLightest,
64
- selectedOuterFocusOutline: `inset 0 0 0 0.125rem ${colors?.borderLightest}`,
65
- selectedInnerFocusOutline: `inset 0 0 0 0.25rem ${colors?.borderBrand}`,
66
- contentPadding: spacing?.xxSmall
58
+ hoverBackgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundDarkest,
59
+ outerFocusOutline: `inset 0 0 0 0.125rem ${colors === null || colors === void 0 ? void 0 : colors.borderDarkest}`,
60
+ innerFocusOutline: `inset 0 0 0 0.25rem ${colors === null || colors === void 0 ? void 0 : colors.borderLightest}`,
61
+ selectedFontColor: colors === null || colors === void 0 ? void 0 : colors.textBrand,
62
+ selectedIconColor: colors === null || colors === void 0 ? void 0 : colors.textBrand,
63
+ selectedBackgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest,
64
+ selectedOuterFocusOutline: `inset 0 0 0 0.125rem ${colors === null || colors === void 0 ? void 0 : colors.borderLightest}`,
65
+ selectedInnerFocusOutline: `inset 0 0 0 0.25rem ${colors === null || colors === void 0 ? void 0 : colors.borderBrand}`,
66
+ contentPadding: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall
67
67
  };
68
68
  return { ...componentVariables,
69
69
  ...themeSpecificStyle[themeName]
@@ -68,13 +68,17 @@ let Navigation = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
68
68
  }
69
69
 
70
70
  componentDidMount() {
71
- this.props.makeStyles?.({
71
+ var _this$props$makeStyle, _this$props;
72
+
73
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
72
74
  minimized: this.minimized
73
75
  });
74
76
  }
75
77
 
76
78
  componentDidUpdate() {
77
- this.props.makeStyles?.({
79
+ var _this$props$makeStyle2, _this$props2;
80
+
81
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
78
82
  minimized: this.minimized
79
83
  });
80
84
  }
@@ -94,11 +98,13 @@ let Navigation = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
94
98
 
95
99
  renderChildren() {
96
100
  return Children.map(this.props.children, child => {
101
+ var _this$props$styles;
102
+
97
103
  const navItem = safeCloneElement(child, {
98
104
  minimized: this.state.minimized
99
105
  });
100
106
  return jsx("li", {
101
- css: this.props.styles?.list
107
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.list
102
108
  }, navItem);
103
109
  });
104
110
  }
@@ -108,23 +114,25 @@ let Navigation = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
108
114
  }
109
115
 
110
116
  render() {
117
+ var _this$props$styles2, _this$props$styles3, _this$props$styles4, _this$props$styles5;
118
+
111
119
  const label = this.props.label;
112
120
  const props = omitProps(this.props, Navigation.allowedProps, ['minimized']);
113
121
  return jsx("nav", Object.assign({}, props, {
114
- css: this.props.styles?.navigation,
122
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.navigation,
115
123
  "aria-label": label,
116
124
  ref: element => {
117
125
  this.ref = element;
118
126
  }
119
127
  }), jsx("ul", {
120
- css: this.props.styles?.content
128
+ css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.content
121
129
  }, this.renderChildren()), jsx("div", {
122
- css: this.props.styles?.toggle
130
+ css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.toggle
123
131
  }, jsx(NavigationItem, {
124
132
  "aria-expanded": !this.minimized,
125
133
  onClick: this.handleNavToggle,
126
134
  icon: jsx(IconMoveStartLine, {
127
- css: this.props.styles?.toggleIcon,
135
+ css: (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.toggleIcon,
128
136
  inline: false
129
137
  }),
130
138
  label: jsx(ScreenReaderContent, null, this.toggleMessage())
@@ -41,17 +41,17 @@ const generateComponentTheme = theme => {
41
41
  }
42
42
  };
43
43
  const componentVariables = {
44
- fontColor: colors?.textLightest,
45
- backgroundColor: colors?.backgroundBrandSecondary,
44
+ fontColor: colors === null || colors === void 0 ? void 0 : colors.textLightest,
45
+ backgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundBrandSecondary,
46
46
  width: '5.25rem',
47
47
  minimizedWidth: '3.375rem',
48
- fill: colors?.textLightest,
49
- focusOutlineInnerWidth: borders?.widthMedium,
50
- focusOutlineOuterWidth: borders?.widthSmall,
51
- focusOutlineInnerColor: colors?.borderBrand,
52
- focusOutlineOuterColor: colors?.borderLightest,
53
- marginBottom: spacing?.small,
54
- toggleTransition: transitions?.duration
48
+ fill: colors === null || colors === void 0 ? void 0 : colors.textLightest,
49
+ focusOutlineInnerWidth: borders === null || borders === void 0 ? void 0 : borders.widthMedium,
50
+ focusOutlineOuterWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
51
+ focusOutlineInnerColor: colors === null || colors === void 0 ? void 0 : colors.borderBrand,
52
+ focusOutlineOuterColor: colors === null || colors === void 0 ? void 0 : colors.borderLightest,
53
+ marginBottom: spacing === null || spacing === void 0 ? void 0 : spacing.small,
54
+ toggleTransition: transitions === null || transitions === void 0 ? void 0 : transitions.duration
55
55
  };
56
56
  return { ...componentVariables,
57
57
  ...themeSpecificStyle[themeName]
@@ -73,22 +73,28 @@ let Item = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
73
73
  }
74
74
 
75
75
  componentDidMount() {
76
- this.props.makeStyles?.();
76
+ var _this$props$makeStyle, _this$props2;
77
+
78
+ (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
77
79
  }
78
80
 
79
81
  componentDidUpdate() {
80
- this.props.makeStyles?.();
82
+ var _this$props$makeStyle2, _this$props3;
83
+
84
+ (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
81
85
  }
82
86
 
83
87
  render() {
88
+ var _this$props$styles, _this$props$styles2;
89
+
84
90
  const ElementType = (0, _getElementType.getElementType)(Item, this.props);
85
- const _this$props2 = this.props,
86
- renderIcon = _this$props2.renderIcon,
87
- renderLabel = _this$props2.renderLabel,
88
- href = _this$props2.href,
89
- renderAfter = _this$props2.renderAfter,
90
- cursor = _this$props2.cursor,
91
- isDisabled = _this$props2.isDisabled;
91
+ 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;
92
98
  const icon = (0, _callRenderProp.callRenderProp)(renderIcon);
93
99
  const label = (0, _callRenderProp.callRenderProp)(renderLabel);
94
100
  const labelIsForScreenReaders = (0, _matchComponentTypes.matchComponentTypes)(label, [_ScreenReaderContent.ScreenReaderContent]);
@@ -109,9 +115,9 @@ let Item = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
109
115
  onFocus: this.handleFocus,
110
116
  onBlur: this.handleBlur,
111
117
  cursor: isDisabled ? 'not-allowed' : cursor,
112
- css: this.props.styles?.item
118
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.item
113
119
  }), icon, labelIsForScreenReaders ? label : (0, _emotion.jsx)("span", {
114
- css: this.props.styles?.label
120
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.label
115
121
  }, label), renderAfter && (0, _callRenderProp.callRenderProp)(renderAfter));
116
122
  }
117
123
 
@@ -39,14 +39,14 @@ const generateComponentTheme = theme => {
39
39
  spacing = theme.spacing,
40
40
  typography = theme.typography;
41
41
  const componentVariables = {
42
- fontFamily: typography?.fontFamily,
42
+ fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
43
43
  fontSize: '1.125rem',
44
- fontWeight: typography?.fontWeightBold,
45
- textColor: colors?.textLink,
46
- textColorSelected: colors?.textDarkest,
44
+ fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightBold,
45
+ textColor: colors === null || colors === void 0 ? void 0 : colors.textLink,
46
+ textColorSelected: colors === null || colors === void 0 ? void 0 : colors.textDarkest,
47
47
  height: '2.25rem',
48
- padding: spacing?.small,
49
- backgroundColor: colors?.backgroundLightest
48
+ padding: spacing === null || spacing === void 0 ? void 0 : spacing.small,
49
+ backgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest
50
50
  };
51
51
  return { ...componentVariables
52
52
  };
@@ -52,7 +52,9 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
52
52
  this._list = null;
53
53
 
54
54
  this.measureItems = () => {
55
- const menuTriggerWidth = (0, _px.px)(this.props.styles?.menuTriggerWidth);
55
+ var _this$props$styles;
56
+
57
+ const menuTriggerWidth = (0, _px.px)((_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.menuTriggerWidth);
56
58
  let visibleItemsCount = 0;
57
59
 
58
60
  if (this._list) {
@@ -111,7 +113,9 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
111
113
  }
112
114
 
113
115
  componentDidMount() {
114
- this.props.makeStyles?.();
116
+ var _this$props$makeStyle, _this$props;
117
+
118
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
115
119
 
116
120
  const _getBoundingClientRec3 = (0, _getBoundingClientRect.getBoundingClientRect)(this._list),
117
121
  origWidth = _getBoundingClientRec3.width;
@@ -136,7 +140,9 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
136
140
  }
137
141
 
138
142
  componentDidUpdate() {
139
- this.props.makeStyles?.();
143
+ var _this$props$makeStyle2, _this$props2;
144
+
145
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
140
146
  }
141
147
 
142
148
  componentWillUnmount() {
@@ -150,9 +156,11 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
150
156
  }
151
157
 
152
158
  renderListItem(item, isMenuTrigger, key) {
159
+ var _this$props$styles2, _this$props$styles3;
160
+
153
161
  return (0, _emotion.jsx)("li", {
154
162
  key: key,
155
- css: isMenuTrigger ? this.props.styles?.listItemWithMenuTrigger : this.props.styles?.listItem
163
+ css: isMenuTrigger ? (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.listItemWithMenuTrigger : (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.listItem
156
164
  }, item);
157
165
  }
158
166
 
@@ -174,11 +182,13 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
174
182
  }
175
183
 
176
184
  render() {
177
- const _this$props = this.props,
178
- children = _this$props.children,
179
- visibleItemsCount = _this$props.visibleItemsCount,
180
- screenReaderLabel = _this$props.screenReaderLabel,
181
- margin = _this$props.margin;
185
+ var _this$props$styles4, _this$props$styles5, _this$props$styles6;
186
+
187
+ const _this$props3 = this.props,
188
+ children = _this$props3.children,
189
+ visibleItemsCount = _this$props3.visibleItemsCount,
190
+ screenReaderLabel = _this$props3.screenReaderLabel,
191
+ margin = _this$props3.margin;
182
192
 
183
193
  const passthroughProps = _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, AppNav.allowedProps), AppNav);
184
194
 
@@ -193,13 +203,13 @@ let AppNav = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
193
203
  const hasRenderedContent = renderBeforeItems || renderAfterItems;
194
204
  return (0, _emotion.jsx)(_View.View, Object.assign({}, passthroughProps, {
195
205
  as: "nav",
196
- css: [this.props.styles?.appNav, hasRenderedContent ? this.props.styles?.alignCenter : ''],
206
+ css: [(_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.appNav, hasRenderedContent ? (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.alignCenter : ''],
197
207
  margin: margin,
198
208
  display: hasRenderedContent ? 'flex' : 'block',
199
209
  elementRef: this.handleRef
200
210
  }), renderBeforeItems && (0, _emotion.jsx)("span", null, renderBeforeItems), (0, _emotion.jsx)("ul", {
201
211
  ref: el => this._list = el,
202
- css: this.props.styles?.list,
212
+ css: (_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.list,
203
213
  "aria-label": (0, _callRenderProp.callRenderProp)(screenReaderLabel)
204
214
  }, visibleChildren.map((child, index) => {
205
215
  return this.renderListItem(child, false, index);
@@ -40,13 +40,13 @@ const generateComponentTheme = theme => {
40
40
  spacing = theme.spacing,
41
41
  typography = theme.typography;
42
42
  const componentVariables = {
43
- fontFamily: typography?.fontFamily,
43
+ fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
44
44
  height: '3.75rem',
45
45
  // 60px per product design
46
- borderColor: colors?.borderMedium,
47
- borderStyle: borders?.style,
48
- borderWidth: borders?.widthSmall,
49
- horizontalMargin: spacing?.xxSmall,
46
+ borderColor: colors === null || colors === void 0 ? void 0 : colors.borderMedium,
47
+ borderStyle: borders === null || borders === void 0 ? void 0 : borders.style,
48
+ borderWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
49
+ horizontalMargin: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall,
50
50
  menuTriggerWidth: '7.5rem'
51
51
  };
52
52
  return { ...componentVariables
@@ -42,45 +42,51 @@ let NavigationItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
42
42
  }
43
43
 
44
44
  componentDidMount() {
45
- this.props.makeStyles?.({
45
+ var _this$props$makeStyle, _this$props;
46
+
47
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
46
48
  minimized: this.props.minimized
47
49
  });
48
50
  }
49
51
 
50
52
  componentDidUpdate() {
51
- this.props.makeStyles?.({
53
+ var _this$props$makeStyle2, _this$props2;
54
+
55
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
52
56
  minimized: this.props.minimized
53
57
  });
54
58
  }
55
59
 
56
60
  renderLink() {
61
+ var _this$props$styles, _this$props$styles2, _this$props$styles3;
62
+
57
63
  const ElementType = (0, _getElementType.getElementType)(NavigationItem, this.props);
58
- const _this$props = this.props,
59
- href = _this$props.href,
60
- onClick = _this$props.onClick,
61
- icon = _this$props.icon,
62
- label = _this$props.label;
64
+ const _this$props3 = this.props,
65
+ href = _this$props3.href,
66
+ onClick = _this$props3.onClick,
67
+ icon = _this$props3.icon,
68
+ label = _this$props3.label;
63
69
  const props = (0, _omitProps.omitProps)(this.props, NavigationItem.allowedProps);
64
70
  return (0, _emotion.jsx)(ElementType, Object.assign({}, props, {
65
71
  href: href,
66
72
  onClick: onClick,
67
- css: this.props.styles?.navigationItem,
73
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.navigationItem,
68
74
  "aria-label": this.props.minimized ? label : void 0,
69
75
  ref: element => {
70
76
  this.ref = element;
71
77
  }
72
78
  }), (0, _emotion.jsx)("div", {
73
- css: this.props.styles?.icon,
79
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.icon,
74
80
  "aria-hidden": "true"
75
81
  }, icon), !this.props.minimized ? (0, _emotion.jsx)("div", {
76
- css: this.props.styles?.label
82
+ css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.label
77
83
  }, label) : null);
78
84
  }
79
85
 
80
86
  render() {
81
- const _this$props2 = this.props,
82
- minimized = _this$props2.minimized,
83
- label = _this$props2.label;
87
+ const _this$props4 = this.props,
88
+ minimized = _this$props4.minimized,
89
+ label = _this$props4.label;
84
90
  const link = this.renderLink();
85
91
  return minimized && (0, _hasVisibleChildren.hasVisibleChildren)(label) ? (0, _emotion.jsx)(_Tooltip.Tooltip, {
86
92
  renderTip: label,
@@ -53,24 +53,24 @@ const generateComponentTheme = theme => {
53
53
  }
54
54
  };
55
55
  const componentVariables = {
56
- fontSize: typography?.fontSizeSmall,
57
- fontFamily: typography?.fontFamily,
58
- fontWeight: typography?.fontWeightLight,
59
- fontColor: colors?.textLightest,
56
+ fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeSmall,
57
+ fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
58
+ fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightLight,
59
+ fontColor: colors === null || colors === void 0 ? void 0 : colors.textLightest,
60
60
  iconSize: '1.625rem',
61
- iconColor: colors?.textLightest,
62
- lineHeight: typography?.lineHeight,
61
+ iconColor: colors === null || colors === void 0 ? void 0 : colors.textLightest,
62
+ lineHeight: typography === null || typography === void 0 ? void 0 : typography.lineHeight,
63
63
  backgroundColor: 'transparent',
64
64
  linkTextDecoration: 'none',
65
- hoverBackgroundColor: colors?.backgroundDarkest,
66
- outerFocusOutline: `inset 0 0 0 0.125rem ${colors?.borderDarkest}`,
67
- innerFocusOutline: `inset 0 0 0 0.25rem ${colors?.borderLightest}`,
68
- selectedFontColor: colors?.textBrand,
69
- selectedIconColor: colors?.textBrand,
70
- selectedBackgroundColor: colors?.backgroundLightest,
71
- selectedOuterFocusOutline: `inset 0 0 0 0.125rem ${colors?.borderLightest}`,
72
- selectedInnerFocusOutline: `inset 0 0 0 0.25rem ${colors?.borderBrand}`,
73
- contentPadding: spacing?.xxSmall
65
+ hoverBackgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundDarkest,
66
+ outerFocusOutline: `inset 0 0 0 0.125rem ${colors === null || colors === void 0 ? void 0 : colors.borderDarkest}`,
67
+ innerFocusOutline: `inset 0 0 0 0.25rem ${colors === null || colors === void 0 ? void 0 : colors.borderLightest}`,
68
+ selectedFontColor: colors === null || colors === void 0 ? void 0 : colors.textBrand,
69
+ selectedIconColor: colors === null || colors === void 0 ? void 0 : colors.textBrand,
70
+ selectedBackgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest,
71
+ selectedOuterFocusOutline: `inset 0 0 0 0.125rem ${colors === null || colors === void 0 ? void 0 : colors.borderLightest}`,
72
+ selectedInnerFocusOutline: `inset 0 0 0 0.25rem ${colors === null || colors === void 0 ? void 0 : colors.borderBrand}`,
73
+ contentPadding: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall
74
74
  };
75
75
  return { ...componentVariables,
76
76
  ...themeSpecificStyle[themeName]
@@ -72,13 +72,17 @@ let Navigation = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
72
72
  }
73
73
 
74
74
  componentDidMount() {
75
- this.props.makeStyles?.({
75
+ var _this$props$makeStyle, _this$props;
76
+
77
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
76
78
  minimized: this.minimized
77
79
  });
78
80
  }
79
81
 
80
82
  componentDidUpdate() {
81
- this.props.makeStyles?.({
83
+ var _this$props$makeStyle2, _this$props2;
84
+
85
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
82
86
  minimized: this.minimized
83
87
  });
84
88
  }
@@ -98,11 +102,13 @@ let Navigation = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
98
102
 
99
103
  renderChildren() {
100
104
  return _react.Children.map(this.props.children, child => {
105
+ var _this$props$styles;
106
+
101
107
  const navItem = (0, _safeCloneElement.safeCloneElement)(child, {
102
108
  minimized: this.state.minimized
103
109
  });
104
110
  return (0, _emotion.jsx)("li", {
105
- css: this.props.styles?.list
111
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.list
106
112
  }, navItem);
107
113
  });
108
114
  }
@@ -112,23 +118,25 @@ let Navigation = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
112
118
  }
113
119
 
114
120
  render() {
121
+ var _this$props$styles2, _this$props$styles3, _this$props$styles4, _this$props$styles5;
122
+
115
123
  const label = this.props.label;
116
124
  const props = (0, _omitProps.omitProps)(this.props, Navigation.allowedProps, ['minimized']);
117
125
  return (0, _emotion.jsx)("nav", Object.assign({}, props, {
118
- css: this.props.styles?.navigation,
126
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.navigation,
119
127
  "aria-label": label,
120
128
  ref: element => {
121
129
  this.ref = element;
122
130
  }
123
131
  }), (0, _emotion.jsx)("ul", {
124
- css: this.props.styles?.content
132
+ css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.content
125
133
  }, this.renderChildren()), (0, _emotion.jsx)("div", {
126
- css: this.props.styles?.toggle
134
+ css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.toggle
127
135
  }, (0, _emotion.jsx)(_NavigationItem.NavigationItem, {
128
136
  "aria-expanded": !this.minimized,
129
137
  onClick: this.handleNavToggle,
130
138
  icon: (0, _emotion.jsx)(_IconMoveStartLine.IconMoveStartLine, {
131
- css: this.props.styles?.toggleIcon,
139
+ css: (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.toggleIcon,
132
140
  inline: false
133
141
  }),
134
142
  label: (0, _emotion.jsx)(_ScreenReaderContent.ScreenReaderContent, null, this.toggleMessage())
@@ -48,17 +48,17 @@ const generateComponentTheme = theme => {
48
48
  }
49
49
  };
50
50
  const componentVariables = {
51
- fontColor: colors?.textLightest,
52
- backgroundColor: colors?.backgroundBrandSecondary,
51
+ fontColor: colors === null || colors === void 0 ? void 0 : colors.textLightest,
52
+ backgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundBrandSecondary,
53
53
  width: '5.25rem',
54
54
  minimizedWidth: '3.375rem',
55
- fill: colors?.textLightest,
56
- focusOutlineInnerWidth: borders?.widthMedium,
57
- focusOutlineOuterWidth: borders?.widthSmall,
58
- focusOutlineInnerColor: colors?.borderBrand,
59
- focusOutlineOuterColor: colors?.borderLightest,
60
- marginBottom: spacing?.small,
61
- toggleTransition: transitions?.duration
55
+ fill: colors === null || colors === void 0 ? void 0 : colors.textLightest,
56
+ focusOutlineInnerWidth: borders === null || borders === void 0 ? void 0 : borders.widthMedium,
57
+ focusOutlineOuterWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
58
+ focusOutlineInnerColor: colors === null || colors === void 0 ? void 0 : colors.borderBrand,
59
+ focusOutlineOuterColor: colors === null || colors === void 0 ? void 0 : colors.borderLightest,
60
+ marginBottom: spacing === null || spacing === void 0 ? void 0 : spacing.small,
61
+ toggleTransition: transitions === null || transitions === void 0 ? void 0 : transitions.duration
62
62
  };
63
63
  return { ...componentVariables,
64
64
  ...themeSpecificStyle[themeName]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-navigation",
3
- "version": "8.17.1-snapshot.82+96244a097",
3
+ "version": "8.18.1-snapshot.1+669aa5892",
4
4
  "description": "Main and application level navigational components",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -23,31 +23,31 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@instructure/ui-babel-preset": "8.17.1-snapshot.82+96244a097",
27
- "@instructure/ui-color-utils": "8.17.1-snapshot.82+96244a097",
28
- "@instructure/ui-test-locator": "8.17.1-snapshot.82+96244a097",
29
- "@instructure/ui-test-utils": "8.17.1-snapshot.82+96244a097",
30
- "@instructure/ui-themes": "8.17.1-snapshot.82+96244a097"
26
+ "@instructure/ui-babel-preset": "8.18.1-snapshot.1+669aa5892",
27
+ "@instructure/ui-color-utils": "8.18.1-snapshot.1+669aa5892",
28
+ "@instructure/ui-test-locator": "8.18.1-snapshot.1+669aa5892",
29
+ "@instructure/ui-test-utils": "8.18.1-snapshot.1+669aa5892",
30
+ "@instructure/ui-themes": "8.18.1-snapshot.1+669aa5892"
31
31
  },
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.13.10",
34
- "@instructure/console": "8.17.1-snapshot.82+96244a097",
35
- "@instructure/debounce": "8.17.1-snapshot.82+96244a097",
36
- "@instructure/emotion": "8.17.1-snapshot.82+96244a097",
37
- "@instructure/shared-types": "8.17.1-snapshot.82+96244a097",
38
- "@instructure/ui-a11y-content": "8.17.1-snapshot.82+96244a097",
39
- "@instructure/ui-a11y-utils": "8.17.1-snapshot.82+96244a097",
40
- "@instructure/ui-badge": "8.17.1-snapshot.82+96244a097",
41
- "@instructure/ui-dom-utils": "8.17.1-snapshot.82+96244a097",
42
- "@instructure/ui-focusable": "8.17.1-snapshot.82+96244a097",
43
- "@instructure/ui-icons": "8.17.1-snapshot.82+96244a097",
44
- "@instructure/ui-menu": "8.17.1-snapshot.82+96244a097",
45
- "@instructure/ui-prop-types": "8.17.1-snapshot.82+96244a097",
46
- "@instructure/ui-react-utils": "8.17.1-snapshot.82+96244a097",
47
- "@instructure/ui-testable": "8.17.1-snapshot.82+96244a097",
48
- "@instructure/ui-tooltip": "8.17.1-snapshot.82+96244a097",
49
- "@instructure/ui-utils": "8.17.1-snapshot.82+96244a097",
50
- "@instructure/ui-view": "8.17.1-snapshot.82+96244a097",
34
+ "@instructure/console": "8.18.1-snapshot.1+669aa5892",
35
+ "@instructure/debounce": "8.18.1-snapshot.1+669aa5892",
36
+ "@instructure/emotion": "8.18.1-snapshot.1+669aa5892",
37
+ "@instructure/shared-types": "8.18.1-snapshot.1+669aa5892",
38
+ "@instructure/ui-a11y-content": "8.18.1-snapshot.1+669aa5892",
39
+ "@instructure/ui-a11y-utils": "8.18.1-snapshot.1+669aa5892",
40
+ "@instructure/ui-badge": "8.18.1-snapshot.1+669aa5892",
41
+ "@instructure/ui-dom-utils": "8.18.1-snapshot.1+669aa5892",
42
+ "@instructure/ui-focusable": "8.18.1-snapshot.1+669aa5892",
43
+ "@instructure/ui-icons": "8.18.1-snapshot.1+669aa5892",
44
+ "@instructure/ui-menu": "8.18.1-snapshot.1+669aa5892",
45
+ "@instructure/ui-prop-types": "8.18.1-snapshot.1+669aa5892",
46
+ "@instructure/ui-react-utils": "8.18.1-snapshot.1+669aa5892",
47
+ "@instructure/ui-testable": "8.18.1-snapshot.1+669aa5892",
48
+ "@instructure/ui-tooltip": "8.18.1-snapshot.1+669aa5892",
49
+ "@instructure/ui-utils": "8.18.1-snapshot.1+669aa5892",
50
+ "@instructure/ui-view": "8.18.1-snapshot.1+669aa5892",
51
51
  "prop-types": "^15"
52
52
  },
53
53
  "peerDependencies": {
@@ -57,5 +57,5 @@
57
57
  "access": "public"
58
58
  },
59
59
  "sideEffects": false,
60
- "gitHead": "96244a097dffef5f10bbe7979c580581c787083e"
60
+ "gitHead": "669aa58926b123028bcb9e39427d36910b78b0d1"
61
61
  }