@instructure/ui-top-nav-bar 8.48.1-snapshot-0 → 8.48.1-snapshot-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.
package/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [8.48.1-snapshot-0](https://github.com/instructure/instructure-ui/compare/v8.48.0...v8.48.1-snapshot-0) (2023-11-15)
6
+ ## [8.48.1-snapshot-2](https://github.com/instructure/instructure-ui/compare/v8.48.0...v8.48.1-snapshot-2) (2023-11-15)
7
7
 
8
8
  **Note:** Version bump only for package @instructure/ui-top-nav-bar
9
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-top-nav-bar",
3
- "version": "8.48.1-snapshot-0",
3
+ "version": "8.48.1-snapshot-2",
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,37 +24,37 @@
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
26
  "@babel/runtime": "^7.23.2",
27
- "@instructure/console": "8.48.1-snapshot-0",
28
- "@instructure/emotion": "8.48.1-snapshot-0",
29
- "@instructure/shared-types": "8.48.1-snapshot-0",
30
- "@instructure/ui-a11y-content": "8.48.1-snapshot-0",
31
- "@instructure/ui-avatar": "8.48.1-snapshot-0",
32
- "@instructure/ui-breadcrumb": "8.48.1-snapshot-0",
33
- "@instructure/ui-buttons": "8.48.1-snapshot-0",
34
- "@instructure/ui-dialog": "8.48.1-snapshot-0",
35
- "@instructure/ui-dom-utils": "8.48.1-snapshot-0",
36
- "@instructure/ui-drilldown": "8.48.1-snapshot-0",
37
- "@instructure/ui-icons": "8.48.1-snapshot-0",
38
- "@instructure/ui-link": "8.48.1-snapshot-0",
39
- "@instructure/ui-popover": "8.48.1-snapshot-0",
40
- "@instructure/ui-prop-types": "8.48.1-snapshot-0",
41
- "@instructure/ui-react-utils": "8.48.1-snapshot-0",
42
- "@instructure/ui-responsive": "8.48.1-snapshot-0",
43
- "@instructure/ui-testable": "8.48.1-snapshot-0",
44
- "@instructure/ui-tooltip": "8.48.1-snapshot-0",
45
- "@instructure/ui-tray": "8.48.1-snapshot-0",
46
- "@instructure/ui-truncate-list": "8.48.1-snapshot-0",
47
- "@instructure/ui-utils": "8.48.1-snapshot-0",
48
- "@instructure/ui-view": "8.48.1-snapshot-0",
27
+ "@instructure/console": "8.48.1-snapshot-2",
28
+ "@instructure/emotion": "8.48.1-snapshot-2",
29
+ "@instructure/shared-types": "8.48.1-snapshot-2",
30
+ "@instructure/ui-a11y-content": "8.48.1-snapshot-2",
31
+ "@instructure/ui-avatar": "8.48.1-snapshot-2",
32
+ "@instructure/ui-breadcrumb": "8.48.1-snapshot-2",
33
+ "@instructure/ui-buttons": "8.48.1-snapshot-2",
34
+ "@instructure/ui-dialog": "8.48.1-snapshot-2",
35
+ "@instructure/ui-dom-utils": "8.48.1-snapshot-2",
36
+ "@instructure/ui-drilldown": "8.48.1-snapshot-2",
37
+ "@instructure/ui-icons": "8.48.1-snapshot-2",
38
+ "@instructure/ui-link": "8.48.1-snapshot-2",
39
+ "@instructure/ui-popover": "8.48.1-snapshot-2",
40
+ "@instructure/ui-prop-types": "8.48.1-snapshot-2",
41
+ "@instructure/ui-react-utils": "8.48.1-snapshot-2",
42
+ "@instructure/ui-responsive": "8.48.1-snapshot-2",
43
+ "@instructure/ui-testable": "8.48.1-snapshot-2",
44
+ "@instructure/ui-tooltip": "8.48.1-snapshot-2",
45
+ "@instructure/ui-tray": "8.48.1-snapshot-2",
46
+ "@instructure/ui-truncate-list": "8.48.1-snapshot-2",
47
+ "@instructure/ui-utils": "8.48.1-snapshot-2",
48
+ "@instructure/ui-view": "8.48.1-snapshot-2",
49
49
  "prop-types": "^15.8.1"
50
50
  },
51
51
  "devDependencies": {
52
- "@instructure/ui-axe-check": "8.48.1-snapshot-0",
53
- "@instructure/ui-babel-preset": "8.48.1-snapshot-0",
54
- "@instructure/ui-color-utils": "8.48.1-snapshot-0",
55
- "@instructure/ui-test-locator": "8.48.1-snapshot-0",
56
- "@instructure/ui-test-utils": "8.48.1-snapshot-0",
57
- "@instructure/ui-themes": "8.48.1-snapshot-0",
52
+ "@instructure/ui-axe-check": "8.48.1-snapshot-2",
53
+ "@instructure/ui-babel-preset": "8.48.1-snapshot-2",
54
+ "@instructure/ui-color-utils": "8.48.1-snapshot-2",
55
+ "@instructure/ui-test-locator": "8.48.1-snapshot-2",
56
+ "@instructure/ui-test-utils": "8.48.1-snapshot-2",
57
+ "@instructure/ui-themes": "8.48.1-snapshot-2",
58
58
  "@testing-library/jest-dom": "^6.1.4",
59
59
  "@testing-library/react": "^14.1.0"
60
60
  },
@@ -18,6 +18,8 @@ render: false
18
18
  class PlaygroundExample extends React.Component {
19
19
  state = {
20
20
  rtlMode: false,
21
+ showBreadcrumb: false,
22
+ inverseColor: false,
21
23
  isSecondaryNavigation: false,
22
24
  hasBrandSection: true,
23
25
  hasMenuItemsSection: true,
@@ -287,15 +289,20 @@ class PlaygroundExample extends React.Component {
287
289
  },
288
290
  checkboxes: ['rtlMode']
289
291
  },
290
- inverseColor: {
291
- label: 'Inverse color mode',
292
+ secondaryNav: {
293
+ label: 'Secondary navigation',
292
294
  checkboxes: [
293
295
  'isSecondaryNavigation',
294
296
  ]
295
297
  },
298
+ breadcrumb: {
299
+ label: 'Display Breadcrumb',
300
+ checkboxes: ['showBreadcrumb']
301
+ },
296
302
  global: {
297
303
  label: 'Global settings',
298
304
  checkboxes: [
305
+ 'inverseColor',
299
306
  'hasBrandSection',
300
307
  'hasMenuItemsSection',
301
308
  'hasActionItemsSection',
@@ -365,7 +372,9 @@ class PlaygroundExample extends React.Component {
365
372
  const settingLabels = {
366
373
  exampleViewport: 'Toggle example viewport',
367
374
  rtlMode: 'RTL mode',
375
+ showBreadcrumb: 'Show Breadcrumb',
368
376
  isSecondaryNavigation: 'Display as secondary navigation',
377
+ inverseColor: '"inverseColor" prop',
369
378
  hasBrandSection: '"renderBrand" prop',
370
379
  hasMenuItemsSection: '"renderMenuItems" prop',
371
380
  hasActionItemsSection: '"renderActionItems" prop',
@@ -385,7 +394,8 @@ class PlaygroundExample extends React.Component {
385
394
  }
386
395
 
387
396
  const settingDescriptions = {
388
- isSecondaryNavigation: 'When the navbar is used as a secondary navigation (e.g.: under Canvas main navbar), using the inverse color mode is recommended',
397
+ isSecondaryNavigation: 'When the navbar is used as a secondary navigation (e.g.: under Canvas main navbar), using the inverse color mode is recommended. For using Breadcumbs in the navbar, inverse color is necessary.',
398
+ showBreadcrumb: 'Display a Breadcrumb in the navbar. Requires the `renderBrand` and `renderMenuItems` props to be null and `inverseColor` to be true.',
389
399
  hasBrandSection: 'Displays brand section',
390
400
  hasMenuItemsSection: 'Displays main navbar items',
391
401
  hasActionItemsSection: 'Displays action items',
@@ -426,28 +436,28 @@ class PlaygroundExample extends React.Component {
426
436
 
427
437
  const checkboxSettings = checkboxes.length ? (
428
438
  <CheckboxGroup
429
- description={label}
430
- name={name}
431
- key={name}
432
- layout="stacked"
433
- defaultValue={checkboxes.filter(setting => this.state[setting])}
439
+ description={label}
440
+ name={name}
441
+ key={name}
442
+ layout="stacked"
443
+ defaultValue={checkboxes.filter(setting => this.state[setting])}
434
444
  >
435
- {checkboxes.map((setting) => (
436
- <Checkbox
437
- key={`${setting}Setting`}
438
- variant="toggle"
439
- value={setting}
440
- label={settingLabels[setting] || `"${setting}" prop`}
441
- checked={this.state[setting]}
442
- messages={settingDescriptions[setting]
443
- ? [{ text: settingDescriptions[setting], type: 'hint' }]
444
- : undefined
445
- }
446
- onChange={() => {
447
- this.setState({ [setting]: !this.state[setting] })
448
- }}
449
- />
450
- ))}
445
+ {checkboxes.map((setting) => (
446
+ <Checkbox
447
+ key={`${setting}Setting`}
448
+ variant="toggle"
449
+ value={setting}
450
+ label={settingLabels[setting] || `"${setting}" prop`}
451
+ checked={false}
452
+ messages={settingDescriptions[setting]
453
+ ? [{ text: settingDescriptions[setting], type: 'hint' }]
454
+ : undefined
455
+ }
456
+ onChange={() => {
457
+ this.setState({ [setting]: !this.state[setting] })
458
+ }}
459
+ />
460
+ ))}
451
461
  </CheckboxGroup>
452
462
  ) : null
453
463
 
@@ -581,7 +591,7 @@ class PlaygroundExample extends React.Component {
581
591
 
582
592
  return (
583
593
  <TopNavBar
584
- inverseColor={this.state.isSecondaryNavigation}
594
+ inverseColor={this.state.inverseColor}
585
595
  mediaQueryMatch="element"
586
596
  >
587
597
  {({ currentLayout, inverseColor }) => {
@@ -832,6 +842,17 @@ class PlaygroundExample extends React.Component {
832
842
  </TopNavBar.Item>
833
843
  </TopNavBar.User>
834
844
  ) : undefined }
845
+ renderBreadcrumb={this.state.showBreadcrumb && (
846
+ <TopNavBar.Breadcrumb>
847
+ <Breadcrumb label="You are here:">
848
+ <Breadcrumb.Link href="#">Course page 1</Breadcrumb.Link>
849
+ <Breadcrumb.Link href="#">Course page 2</Breadcrumb.Link>
850
+ <Breadcrumb.Link href="#">Course page 3</Breadcrumb.Link>
851
+ <Breadcrumb.Link href="#">Course page 4</Breadcrumb.Link>
852
+ <Breadcrumb.Link href="#">Course page 5</Breadcrumb.Link>
853
+ </Breadcrumb>
854
+ </TopNavBar.Breadcrumb>
855
+ )}
835
856
  themeOverride={{
836
857
  // For example demo
837
858
  smallViewportZIndex: 9999,
@@ -1209,9 +1230,21 @@ example: true
1209
1230
 
1210
1231
  ##### TopNavBar.Breadcrumb
1211
1232
 
1212
- `<TopNavBar.Breadcrumb>` contains a Breadcrumb component with multiple links/pages.
1233
+ `<TopNavBar.Breadcrumb>` contains a `<Breadcrumb>` component with multiple links and a hamburger icon.
1234
+
1235
+ In order to use `<TopNavBar.Breadcrumb>` in desktop mode, the following conditions must be met:
1236
+
1237
+ 1. `inverseColor` should be set to `true` on `<TopNavBar>`.
1238
+ 2. `renderBrand` property should **not** be set on `<TopNavBar.Layout>`.
1239
+ 3. `renderMenuItems` property should **not** be set `<TopNavBar.Layout>`.
1240
+ 4. `renderBreadcrumb` property should be implemented on `<TopNavBar.Layout>`.
1241
+ 5. (optional) an `onClick` property can be passed to `<TopNavBar.Breadcrumb>` to handle the click event on the hamburger icon.
1242
+
1243
+ In small viewport mode, a link is shown for the last but one element of the `<Breadcrumb>` instead of all the crumbs and the hamburger icon. One has to set the following:
1213
1244
 
1214
- You can't use `<TopNavBar.Breadcrumb>` along with the brand logo or menu items.
1245
+ 1. `inverseColor` should be set to `true` on `<TopNavBar>`.
1246
+ 2. `renderBreadcrumb` property should be implemented on `<TopNavBar.Layout>`.
1247
+ 3. rest of the props starting with render should not be added.
1215
1248
 
1216
1249
  ```js
1217
1250
  ---
@@ -1231,13 +1264,13 @@ example: true
1231
1264
  dropdownMenuLabel: 'Main Menu',
1232
1265
  }}
1233
1266
  renderBreadcrumb={(
1234
- <TopNavBar.Breadcrumb>
1267
+ <TopNavBar.Breadcrumb onClick={console.log("Hamburger icon clicked.")}>
1235
1268
  <Breadcrumb label="You are here:">
1236
- <Breadcrumb.Link>Course page 1</Breadcrumb.Link>
1237
- <Breadcrumb.Link>Course page 2</Breadcrumb.Link>
1238
- <Breadcrumb.Link>Course page 3</Breadcrumb.Link>
1239
- <Breadcrumb.Link>Course page 4</Breadcrumb.Link>
1240
- <Breadcrumb.Link>Course page 5</Breadcrumb.Link>
1269
+ <Breadcrumb.Link href="#">Course page 1</Breadcrumb.Link>
1270
+ <Breadcrumb.Link href="#">Course page 2</Breadcrumb.Link>
1271
+ <Breadcrumb.Link href="#">Course page 3</Breadcrumb.Link>
1272
+ <Breadcrumb.Link href="#">Course page 4</Breadcrumb.Link>
1273
+ <Breadcrumb.Link href="#">Course page 5</Breadcrumb.Link>
1241
1274
  </Breadcrumb>
1242
1275
  </TopNavBar.Breadcrumb>
1243
1276
  )}
@@ -98,6 +98,7 @@ type CommonTopNavBarLayoutProps = {
98
98
  * Displays a hamburger icon with a breadcrumb.
99
99
  *
100
100
  * In __desktop__ mode it renders in the top left corner of the navbar.
101
+ * In __smallViewport__ mode it renders a link of the last but one crumb with a chevron icon.
101
102
  *
102
103
  * Accepts a `<TopNavBar.Breadcrumb>` component.
103
104
  */