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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,9 +3,12 @@
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.1.1-snapshot-3](https://github.com/instructure/instructure-ui/compare/v9.1.0...v9.1.1-snapshot-3) (2024-06-20)
6
+ ## [9.1.1-snapshot-5](https://github.com/instructure/instructure-ui/compare/v9.1.0...v9.1.1-snapshot-5) (2024-06-25)
7
7
 
8
- **Note:** Version bump only for package @instructure/ui-top-nav-bar
8
+
9
+ ### Bug Fixes
10
+
11
+ * **ui-top-nav-bar:** fix topnavbar item width changing ([88993e2](https://github.com/instructure/instructure-ui/commit/88993e2729f74d8991bcd4d1d215efeac0d7e510))
9
12
 
10
13
 
11
14
 
@@ -343,7 +343,9 @@ let TopNavBarItem = (_dec = withDeterministicId(), _dec2 = withStyle(generateSty
343
343
  css: styles === null || styles === void 0 ? void 0 : styles.content
344
344
  }, this.hasAvatar && !this.isAvatarOnlyVariant && jsx("span", {
345
345
  css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.avatarContainer
346
- }, this.renderAvatar()), content, this.submenuIcon));
346
+ }, this.renderAvatar()), jsx("span", {
347
+ css: styles === null || styles === void 0 ? void 0 : styles.contentText
348
+ }, content), this.submenuIcon));
347
349
  return jsx("div", {
348
350
  css: styles === null || styles === void 0 ? void 0 : styles.container
349
351
  }, this.props.tooltip ? this.wrapButtonInTooltip(button, children) : button);
@@ -33,6 +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
+ var _props$children;
36
37
  const status = props.status,
37
38
  variant = props.variant,
38
39
  renderSubmenu = props.renderSubmenu,
@@ -91,13 +92,24 @@ const generateStyle = (componentTheme, props, state) => {
91
92
  alignItems: 'center',
92
93
  color: inverseColor ? componentTheme.colorInverse : componentTheme.color,
93
94
  ...(isActive && {
94
- fontWeight: componentTheme.activeItemFontWeight,
95
- letterSpacing: -0.1818
95
+ fontWeight: componentTheme.activeItemFontWeight
96
96
  }),
97
97
  '*': {
98
98
  pointerEvents: 'none'
99
99
  }
100
100
  },
101
+ contentText: {
102
+ textAlign: 'center',
103
+ '&::before': {
104
+ display: 'block',
105
+ content: `"${(_props$children = props.children) === null || _props$children === void 0 ? void 0 : _props$children.toString()}"`,
106
+ fontWeight: componentTheme.activeItemFontWeight,
107
+ height: '0px',
108
+ color: 'transparent',
109
+ overflow: 'hidden',
110
+ visibility: 'hidden'
111
+ }
112
+ },
101
113
  avatarContainer: {
102
114
  label: 'topNavBarItem__avatarContainer',
103
115
  display: 'flex',
@@ -356,7 +356,9 @@ let TopNavBarItem = exports.TopNavBarItem = (_dec = (0, _withDeterministicId.wit
356
356
  css: styles === null || styles === void 0 ? void 0 : styles.content
357
357
  }, this.hasAvatar && !this.isAvatarOnlyVariant && (0, _emotion.jsx)("span", {
358
358
  css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.avatarContainer
359
- }, this.renderAvatar()), content, this.submenuIcon));
359
+ }, this.renderAvatar()), (0, _emotion.jsx)("span", {
360
+ css: styles === null || styles === void 0 ? void 0 : styles.contentText
361
+ }, content), this.submenuIcon));
360
362
  return (0, _emotion.jsx)("div", {
361
363
  css: styles === null || styles === void 0 ? void 0 : styles.container
362
364
  }, this.props.tooltip ? this.wrapButtonInTooltip(button, children) : button);
@@ -39,6 +39,7 @@ exports.default = void 0;
39
39
  * @return {Object} The final style object, which will be used in the component
40
40
  */
41
41
  const generateStyle = (componentTheme, props, state) => {
42
+ var _props$children;
42
43
  const status = props.status,
43
44
  variant = props.variant,
44
45
  renderSubmenu = props.renderSubmenu,
@@ -97,13 +98,24 @@ const generateStyle = (componentTheme, props, state) => {
97
98
  alignItems: 'center',
98
99
  color: inverseColor ? componentTheme.colorInverse : componentTheme.color,
99
100
  ...(isActive && {
100
- fontWeight: componentTheme.activeItemFontWeight,
101
- letterSpacing: -0.1818
101
+ fontWeight: componentTheme.activeItemFontWeight
102
102
  }),
103
103
  '*': {
104
104
  pointerEvents: 'none'
105
105
  }
106
106
  },
107
+ contentText: {
108
+ textAlign: 'center',
109
+ '&::before': {
110
+ display: 'block',
111
+ content: `"${(_props$children = props.children) === null || _props$children === void 0 ? void 0 : _props$children.toString()}"`,
112
+ fontWeight: componentTheme.activeItemFontWeight,
113
+ height: '0px',
114
+ color: 'transparent',
115
+ overflow: 'hidden',
116
+ visibility: 'hidden'
117
+ }
118
+ },
107
119
  avatarContainer: {
108
120
  label: 'topNavBarItem__avatarContainer',
109
121
  display: 'flex',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-top-nav-bar",
3
- "version": "9.1.1-snapshot-3",
3
+ "version": "9.1.1-snapshot-5",
4
4
  "description": "A UI component library made by Instructure Inc.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -24,38 +24,38 @@
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
26
  "@babel/runtime": "^7.24.5",
27
- "@instructure/console": "9.1.1-snapshot-3",
28
- "@instructure/emotion": "9.1.1-snapshot-3",
29
- "@instructure/shared-types": "9.1.1-snapshot-3",
30
- "@instructure/ui-a11y-content": "9.1.1-snapshot-3",
31
- "@instructure/ui-avatar": "9.1.1-snapshot-3",
32
- "@instructure/ui-breadcrumb": "9.1.1-snapshot-3",
33
- "@instructure/ui-buttons": "9.1.1-snapshot-3",
34
- "@instructure/ui-dialog": "9.1.1-snapshot-3",
35
- "@instructure/ui-dom-utils": "9.1.1-snapshot-3",
36
- "@instructure/ui-drilldown": "9.1.1-snapshot-3",
37
- "@instructure/ui-icons": "9.1.1-snapshot-3",
38
- "@instructure/ui-link": "9.1.1-snapshot-3",
39
- "@instructure/ui-popover": "9.1.1-snapshot-3",
40
- "@instructure/ui-prop-types": "9.1.1-snapshot-3",
41
- "@instructure/ui-react-utils": "9.1.1-snapshot-3",
42
- "@instructure/ui-responsive": "9.1.1-snapshot-3",
43
- "@instructure/ui-testable": "9.1.1-snapshot-3",
44
- "@instructure/ui-tooltip": "9.1.1-snapshot-3",
45
- "@instructure/ui-tray": "9.1.1-snapshot-3",
46
- "@instructure/ui-truncate-list": "9.1.1-snapshot-3",
47
- "@instructure/ui-utils": "9.1.1-snapshot-3",
48
- "@instructure/ui-view": "9.1.1-snapshot-3",
27
+ "@instructure/console": "9.1.1-snapshot-5",
28
+ "@instructure/emotion": "9.1.1-snapshot-5",
29
+ "@instructure/shared-types": "9.1.1-snapshot-5",
30
+ "@instructure/ui-a11y-content": "9.1.1-snapshot-5",
31
+ "@instructure/ui-avatar": "9.1.1-snapshot-5",
32
+ "@instructure/ui-breadcrumb": "9.1.1-snapshot-5",
33
+ "@instructure/ui-buttons": "9.1.1-snapshot-5",
34
+ "@instructure/ui-dialog": "9.1.1-snapshot-5",
35
+ "@instructure/ui-dom-utils": "9.1.1-snapshot-5",
36
+ "@instructure/ui-drilldown": "9.1.1-snapshot-5",
37
+ "@instructure/ui-icons": "9.1.1-snapshot-5",
38
+ "@instructure/ui-link": "9.1.1-snapshot-5",
39
+ "@instructure/ui-popover": "9.1.1-snapshot-5",
40
+ "@instructure/ui-prop-types": "9.1.1-snapshot-5",
41
+ "@instructure/ui-react-utils": "9.1.1-snapshot-5",
42
+ "@instructure/ui-responsive": "9.1.1-snapshot-5",
43
+ "@instructure/ui-testable": "9.1.1-snapshot-5",
44
+ "@instructure/ui-tooltip": "9.1.1-snapshot-5",
45
+ "@instructure/ui-tray": "9.1.1-snapshot-5",
46
+ "@instructure/ui-truncate-list": "9.1.1-snapshot-5",
47
+ "@instructure/ui-utils": "9.1.1-snapshot-5",
48
+ "@instructure/ui-view": "9.1.1-snapshot-5",
49
49
  "prop-types": "^15.8.1"
50
50
  },
51
51
  "devDependencies": {
52
- "@instructure/ui-axe-check": "9.1.1-snapshot-3",
53
- "@instructure/ui-babel-preset": "9.1.1-snapshot-3",
54
- "@instructure/ui-color-utils": "9.1.1-snapshot-3",
55
- "@instructure/ui-scripts": "9.1.1-snapshot-3",
56
- "@instructure/ui-test-locator": "9.1.1-snapshot-3",
57
- "@instructure/ui-test-utils": "9.1.1-snapshot-3",
58
- "@instructure/ui-themes": "9.1.1-snapshot-3",
52
+ "@instructure/ui-axe-check": "9.1.1-snapshot-5",
53
+ "@instructure/ui-babel-preset": "9.1.1-snapshot-5",
54
+ "@instructure/ui-color-utils": "9.1.1-snapshot-5",
55
+ "@instructure/ui-scripts": "9.1.1-snapshot-5",
56
+ "@instructure/ui-test-locator": "9.1.1-snapshot-5",
57
+ "@instructure/ui-test-utils": "9.1.1-snapshot-5",
58
+ "@instructure/ui-themes": "9.1.1-snapshot-5",
59
59
  "@testing-library/jest-dom": "^6.4.5",
60
60
  "@testing-library/react": "^15.0.7",
61
61
  "@testing-library/user-event": "^14.5.2"
@@ -493,7 +493,7 @@ class TopNavBarItem extends Component<TopNavBarItemProps, TopNavBarItemState> {
493
493
  {this.renderAvatar()}
494
494
  </span>
495
495
  )}
496
- {content}
496
+ <span css={styles?.contentText}>{content}</span>
497
497
  {this.submenuIcon}
498
498
  </div>
499
499
  )}
@@ -269,6 +269,7 @@ type TopNavBarItemStyle = ComponentStyle<
269
269
  | 'topNavBarItem'
270
270
  | 'container'
271
271
  | 'content'
272
+ | 'contentText'
272
273
  | 'avatarContainer'
273
274
  | 'submenuTriggerContainer'
274
275
  | 'submenuIcon'
@@ -108,14 +108,25 @@ const generateStyle = (
108
108
  color: inverseColor ? componentTheme.colorInverse : componentTheme.color,
109
109
 
110
110
  ...(isActive && {
111
- fontWeight: componentTheme.activeItemFontWeight,
112
- letterSpacing: -0.1818
111
+ fontWeight: componentTheme.activeItemFontWeight
113
112
  }),
114
113
 
115
114
  '*': {
116
115
  pointerEvents: 'none'
117
116
  }
118
117
  },
118
+ contentText: {
119
+ textAlign: 'center',
120
+ '&::before': {
121
+ display: 'block',
122
+ content: `"${props.children?.toString()}"`,
123
+ fontWeight: componentTheme.activeItemFontWeight,
124
+ height: '0px',
125
+ color: 'transparent',
126
+ overflow: 'hidden',
127
+ visibility: 'hidden'
128
+ }
129
+ },
119
130
  avatarContainer: {
120
131
  label: 'topNavBarItem__avatarContainer',
121
132
  display: 'flex',