@instructure/quiz-core 20.9.1-rc.7 → 20.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/es/banks/components/Bank/presenter.js +24 -6
- package/es/banks/components/Bank/styles.js +3 -0
- package/es/banks/components/Bank/theme.js +3 -2
- package/es/banks/components/BankEntry/presenter.js +35 -12
- package/es/banks/components/BankEntry/styles.js +3 -0
- package/es/banks/components/BankEntry/theme.js +3 -0
- package/es/banks/components/Banks/presenter.js +16 -4
- package/es/banks/components/Banks/styles.js +5 -3
- package/es/banks/components/Banks/theme.js +3 -2
- package/es/banks/components/HeaderBreadCrumb/index.js +106 -0
- package/es/banks/components/NavWrapper/presenter.js +51 -41
- package/es/common/components/shared/return_button/ReturnButton.js +15 -2
- package/lib/banks/components/Bank/presenter.js +39 -20
- package/lib/banks/components/Bank/styles.js +3 -0
- package/lib/banks/components/Bank/theme.js +3 -2
- package/lib/banks/components/BankEntry/presenter.js +54 -30
- package/lib/banks/components/BankEntry/styles.js +3 -0
- package/lib/banks/components/BankEntry/theme.js +3 -0
- package/lib/banks/components/Banks/presenter.js +26 -13
- package/lib/banks/components/Banks/styles.js +5 -3
- package/lib/banks/components/Banks/theme.js +3 -2
- package/lib/banks/components/HeaderBreadCrumb/index.js +131 -0
- package/lib/banks/components/NavWrapper/presenter.js +53 -39
- package/lib/common/components/shared/return_button/ReturnButton.js +16 -2
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
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
|
+
# [20.10.0](https://gerrit.instructure.com/quizzes-ui/compare/v20.9.0...v20.10.0) (2024-03-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **AsyncSearch:** do not error on single result blur ([7d9df03](https://gerrit.instructure.com/quizzes-ui/commits/7d9df037951d6e2565087a758c70b5daafed5eed))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **sub-account-bank-sharing:** Add account search to bank browsing page ([20c0e20](https://gerrit.instructure.com/quizzes-ui/commits/20c0e2073b0f835529113e082eadb37f25b68d8a))
|
|
17
|
+
* **TopNavBar:** Add new TopNavBar to bank pages ([b9c04a9](https://gerrit.instructure.com/quizzes-ui/commits/b9c04a9078137128a8237c782958ab7c844c5367))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
# [20.9.0](https://gerrit.instructure.com/quizzes-ui/compare/v20.8.0...v20.9.0) (2024-03-05)
|
|
7
24
|
|
|
8
25
|
|
|
@@ -23,6 +23,7 @@ import { AccessibleContent } from '@instructure/ui-a11y-content';
|
|
|
23
23
|
import { withStyle, jsx } from '@instructure/emotion';
|
|
24
24
|
import { Checkbox } from '@instructure/ui-checkbox';
|
|
25
25
|
import { View } from '@instructure/ui-view';
|
|
26
|
+
import { HeaderBreadCrumb } from "../HeaderBreadCrumb/index.js";
|
|
26
27
|
import BankRecord from "../../../common/records/Bank.js";
|
|
27
28
|
import Page from "../../../common/components/layout/Page/index.js";
|
|
28
29
|
import PaginatedCollection from "../../../common/components/shared/PaginatedCollection/index.js";
|
|
@@ -75,6 +76,12 @@ export var Bank = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
75
76
|
_this.createBankEntryButton = c;
|
|
76
77
|
};
|
|
77
78
|
|
|
79
|
+
_this.renderBankBreadCrumbLink = function () {
|
|
80
|
+
return jsx(BreadcrumbLink, {
|
|
81
|
+
key: "bank"
|
|
82
|
+
}, _this.props.bank.title);
|
|
83
|
+
};
|
|
84
|
+
|
|
78
85
|
_this.toggleCheckbox = function () {
|
|
79
86
|
// disable until request resolves
|
|
80
87
|
_this.setState({
|
|
@@ -310,10 +317,12 @@ export var Bank = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
310
317
|
navigateToBuild: navigateToBuild,
|
|
311
318
|
renderHeaderMenu: this.renderHeaderMenu,
|
|
312
319
|
returnToUrl: isScopeEmpty ? null : returnToUrl,
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
320
|
+
scope: scope,
|
|
321
|
+
isCompact: this.props.isCompact,
|
|
322
|
+
iceTopNavBarEnabled: this.props.iceTopNavBarEnabled,
|
|
323
|
+
menuItemPath: "/banks/".concat(this.props.bankId) // eslint-disable-line react/jsx-no-literals
|
|
324
|
+
|
|
325
|
+
}, this.renderBankBreadCrumbLink());
|
|
317
326
|
}
|
|
318
327
|
}, {
|
|
319
328
|
key: "renderName",
|
|
@@ -453,7 +462,14 @@ export var Bank = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
453
462
|
value: function render() {
|
|
454
463
|
return jsx(Page, null, this.renderModals(), this.renderNav(), jsx("div", {
|
|
455
464
|
css: this.props.styles.content
|
|
456
|
-
}, this.
|
|
465
|
+
}, this.props.iceTopNavBarEnabled && jsx("div", {
|
|
466
|
+
css: this.props.styles.breadcrumb
|
|
467
|
+
}, jsx(HeaderBreadCrumb, {
|
|
468
|
+
returnToUrl: this.props.returnToUrl,
|
|
469
|
+
scope: this.props.scope,
|
|
470
|
+
navigateToBanks: this.props.navigateToBanks,
|
|
471
|
+
navigateToBuild: this.props.navigateToBuild
|
|
472
|
+
}, this.renderBankBreadCrumbLink())), this.renderName(), this.renderCheckbox(), jsx("div", {
|
|
457
473
|
css: this.props.styles.topMenu
|
|
458
474
|
}, this.renderTopLeftMenu(), this.renderTopRightMenu()), this.renderSearch(), jsx(PaginatedCollection, {
|
|
459
475
|
empty: this.emptyLoadText(),
|
|
@@ -505,6 +521,7 @@ export var Bank = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
505
521
|
showShareBankFromTray: PropTypes.bool,
|
|
506
522
|
updateSharedBankPermission: PropTypes.func.isRequired,
|
|
507
523
|
withConfirm: PropTypes.func.isRequired,
|
|
524
|
+
iceTopNavBarEnabled: PropTypes.bool,
|
|
508
525
|
// eslint-disable-next-line react/require-default-props,react/forbid-prop-types
|
|
509
526
|
styles: PropTypes.object
|
|
510
527
|
}, _class2.defaultProps = {
|
|
@@ -522,6 +539,7 @@ export var Bank = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
522
539
|
returnToUrl: null,
|
|
523
540
|
isQuizContentLocked: false,
|
|
524
541
|
showShareBankFromTray: false,
|
|
525
|
-
courseSharedBank: null
|
|
542
|
+
courseSharedBank: null,
|
|
543
|
+
iceTopNavBarEnabled: false
|
|
526
544
|
}, _temp)) || _class);
|
|
527
545
|
export default Bank;
|
|
@@ -15,6 +15,9 @@ var generateStyle = function generateStyle(componentTheme) {
|
|
|
15
15
|
}, mq, {
|
|
16
16
|
padding: "".concat(componentTheme.phoneContentPadding, " 0")
|
|
17
17
|
}),
|
|
18
|
+
breadcrumb: {
|
|
19
|
+
marginBottom: "".concat(componentTheme.breadCrumbMarginBottom)
|
|
20
|
+
},
|
|
18
21
|
topMenu: menuStyles,
|
|
19
22
|
topLeftMenu: _objectSpread(_objectSpread({}, menuStyles), {}, {
|
|
20
23
|
flex: '50%'
|
|
@@ -4,9 +4,10 @@ var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
|
4
4
|
breakpoints = _ref.breakpoints;
|
|
5
5
|
return {
|
|
6
6
|
contentBackgroundColor: colors.white,
|
|
7
|
-
contentPaddingTopBottom: spacing.
|
|
7
|
+
contentPaddingTopBottom: spacing.medium,
|
|
8
8
|
contentPaddingLeftRight: spacing.medium,
|
|
9
|
-
|
|
9
|
+
breadCrumbMarginBottom: spacing.large,
|
|
10
|
+
bankNamePaddingBottom: spacing.large,
|
|
10
11
|
phoneBreakPoint: "max-width: ".concat(breakpoints.medium),
|
|
11
12
|
phoneContentPadding: spacing.small,
|
|
12
13
|
filtersMarginTop: spacing.large
|
|
@@ -27,6 +27,7 @@ import { IconDiscussionLine, IconDiscussionSolid } from '@instructure/ui-icons';
|
|
|
27
27
|
import { PresentationContent, ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
28
28
|
import { TextInput } from '@instructure/ui-text-input';
|
|
29
29
|
import { withStyle, jsx } from '@instructure/emotion';
|
|
30
|
+
import { HeaderBreadCrumb } from "../HeaderBreadCrumb/index.js";
|
|
30
31
|
import EntrySave from "../../../common/components/resources/entry/EntrySave/index.js";
|
|
31
32
|
import ItemEdit from "../../../common/components/resources/item/ItemEdit/index.js";
|
|
32
33
|
import ItemFeedbackModal from "../../../building/components/resources/ItemFeedbackModal/index.js";
|
|
@@ -284,6 +285,22 @@ export var BankEntry = (_dec = withStyle(generateStyle, generateComponentTheme),
|
|
|
284
285
|
return this.isItemEntry() ? t('Edit Question') : t('Edit Stimulus');
|
|
285
286
|
}
|
|
286
287
|
}
|
|
288
|
+
}, {
|
|
289
|
+
key: "renderBankBreadCrumbLink",
|
|
290
|
+
value: function renderBankBreadCrumbLink() {
|
|
291
|
+
return jsx(BreadcrumbLink, {
|
|
292
|
+
key: "bank",
|
|
293
|
+
onClick: this.navigateToBank,
|
|
294
|
+
ref: this.setNavToBankRef
|
|
295
|
+
}, this.props.bank.title);
|
|
296
|
+
}
|
|
297
|
+
}, {
|
|
298
|
+
key: "renderBankEntryBreadCrumbLink",
|
|
299
|
+
value: function renderBankEntryBreadCrumbLink() {
|
|
300
|
+
return jsx(BreadcrumbLink, {
|
|
301
|
+
key: "bankEntry"
|
|
302
|
+
}, this.entryLinkName());
|
|
303
|
+
}
|
|
287
304
|
}, {
|
|
288
305
|
key: "renderNav",
|
|
289
306
|
value: function renderNav() {
|
|
@@ -292,22 +309,19 @@ export var BankEntry = (_dec = withStyle(generateStyle, generateComponentTheme),
|
|
|
292
309
|
closeTray = _this$props.closeTray,
|
|
293
310
|
navigateToBanks = _this$props.navigateToBanks,
|
|
294
311
|
navigateToBuild = _this$props.navigateToBuild,
|
|
295
|
-
returnToUrl = _this$props.returnToUrl
|
|
296
|
-
bank = _this$props.bank;
|
|
312
|
+
returnToUrl = _this$props.returnToUrl;
|
|
297
313
|
var isScopeEmpty = !Object.keys(scope).length;
|
|
298
314
|
return jsx(NavWrapper, {
|
|
299
315
|
closeTray: closeTray,
|
|
300
316
|
navigateToBanks: navigateToBanks,
|
|
301
317
|
navigateToBuild: navigateToBuild,
|
|
302
318
|
returnToUrl: isScopeEmpty ? null : returnToUrl,
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
},
|
|
309
|
-
key: "bankEntry"
|
|
310
|
-
}, this.entryLinkName()));
|
|
319
|
+
scope: scope,
|
|
320
|
+
isCompact: this.props.isCompact,
|
|
321
|
+
iceTopNavBarEnabled: this.props.iceTopNavBarEnabled,
|
|
322
|
+
menuItemPath: "/banks/".concat(this.props.bankId, "/bank_entries/").concat(this.props.bankEntryId || 'new') // eslint-disable-line react/jsx-no-literals
|
|
323
|
+
|
|
324
|
+
}, this.renderBankBreadCrumbLink(), this.renderBankEntryBreadCrumbLink());
|
|
311
325
|
}
|
|
312
326
|
}, {
|
|
313
327
|
key: "renderTitle",
|
|
@@ -629,7 +643,14 @@ export var BankEntry = (_dec = withStyle(generateStyle, generateComponentTheme),
|
|
|
629
643
|
|
|
630
644
|
return jsx(Page, null, this.renderNav(), jsx("div", {
|
|
631
645
|
css: this.props.styles.content
|
|
632
|
-
}, this.
|
|
646
|
+
}, this.props.iceTopNavBarEnabled && jsx("div", {
|
|
647
|
+
css: this.props.styles.breadcrumb
|
|
648
|
+
}, jsx(HeaderBreadCrumb, {
|
|
649
|
+
returnToUrl: this.props.returnToUrl,
|
|
650
|
+
scope: this.props.scope,
|
|
651
|
+
navigateToBanks: this.props.navigateToBanks,
|
|
652
|
+
navigateToBuild: this.props.navigateToBuild
|
|
653
|
+
}, this.renderBankBreadCrumbLink(), this.renderBankEntryBreadCrumbLink())), this.renderHeader(entry), this.renderEntry(entry), !this.props.isCompact && jsx(ItemFeedbackModal, {
|
|
633
654
|
parentId: this.props.bankId,
|
|
634
655
|
parentType: PARENT_TYPE_BANK
|
|
635
656
|
})));
|
|
@@ -683,6 +704,7 @@ export var BankEntry = (_dec = withStyle(generateStyle, generateComponentTheme),
|
|
|
683
704
|
updateItem: PropTypes.func.isRequired,
|
|
684
705
|
updateStimulus: PropTypes.func.isRequired,
|
|
685
706
|
useBankTags: PropTypes.bool,
|
|
707
|
+
iceTopNavBarEnabled: PropTypes.bool,
|
|
686
708
|
// eslint-disable-next-line react/require-default-props,react/forbid-prop-types
|
|
687
709
|
styles: PropTypes.object
|
|
688
710
|
}, _class2.defaultProps = {
|
|
@@ -696,6 +718,7 @@ export var BankEntry = (_dec = withStyle(generateStyle, generateComponentTheme),
|
|
|
696
718
|
pendingDeletionTags: Immutable.List(),
|
|
697
719
|
tagAssociations: Immutable.List(),
|
|
698
720
|
tagInput: null,
|
|
699
|
-
useBankTags: false
|
|
721
|
+
useBankTags: false,
|
|
722
|
+
iceTopNavBarEnabled: false
|
|
700
723
|
}, _temp)) || _class);
|
|
701
724
|
export default BankEntry;
|
|
@@ -10,6 +10,9 @@ var generateStyle = function generateStyle(componentTheme) {
|
|
|
10
10
|
padding: "".concat(componentTheme.contentPaddingTopBottom, " ").concat(componentTheme.contentPaddingLeftRight),
|
|
11
11
|
backgroundColor: componentTheme.contentBackgroundColor
|
|
12
12
|
},
|
|
13
|
+
breadcrumb: {
|
|
14
|
+
marginBottom: "".concat(componentTheme.breadCrumbMarginBottom)
|
|
15
|
+
},
|
|
13
16
|
entryRow: {
|
|
14
17
|
marginBottom: componentTheme.entryRowMargin
|
|
15
18
|
},
|
|
@@ -5,6 +5,9 @@ var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
|
5
5
|
borders = _ref.borders;
|
|
6
6
|
return {
|
|
7
7
|
contentBackgroundColor: colors.white,
|
|
8
|
+
contentPaddingTopBottom: 0,
|
|
9
|
+
contentPaddingLeftRight: 0,
|
|
10
|
+
breadCrumbMarginBottom: spacing.large,
|
|
8
11
|
entryRowMargin: spacing.small,
|
|
9
12
|
headerRowColor: colors.ash,
|
|
10
13
|
headerRowPadding: spacing.small,
|
|
@@ -23,6 +23,7 @@ import { Grid } from '@instructure/ui-grid';
|
|
|
23
23
|
import { View } from '@instructure/ui-view';
|
|
24
24
|
import debounce from 'lodash/fp/debounce';
|
|
25
25
|
import Page from "../../../common/components/layout/Page/index.js";
|
|
26
|
+
import { HeaderBreadCrumb } from "../HeaderBreadCrumb/index.js";
|
|
26
27
|
import PaginatedCollection from "../../../common/components/shared/PaginatedCollection/index.js";
|
|
27
28
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
28
29
|
import { BANKS_BANK_FILTERS, BANKS_BANK_PAGINATION, CREATE_BANK_MODAL, SHARED_WITH_ACCOUNT } from '@instructure/quiz-common';
|
|
@@ -378,7 +379,7 @@ export var Banks = (_dec = withStyle(generateStyle, generateComponentTheme), _de
|
|
|
378
379
|
key: "renderHeader",
|
|
379
380
|
value: function renderHeader() {
|
|
380
381
|
return jsx("div", {
|
|
381
|
-
css: [this.props.styles.
|
|
382
|
+
css: [this.props.styles.header, !this.props.improvedBankSharingEnabled ? this.props.styles.borderedBottom : {}]
|
|
382
383
|
}, jsx(Heading, {
|
|
383
384
|
as: this.props.isCompact ? 'h2' : 'h1',
|
|
384
385
|
level: "h1"
|
|
@@ -406,7 +407,10 @@ export var Banks = (_dec = withStyle(generateStyle, generateComponentTheme), _de
|
|
|
406
407
|
closeTray: closeTray,
|
|
407
408
|
navigateToBuild: navigateToBuild,
|
|
408
409
|
returnToUrl: isScopeEmpty ? null : returnToUrl,
|
|
409
|
-
|
|
410
|
+
scope: scope,
|
|
411
|
+
isCompact: this.props.isCompact,
|
|
412
|
+
iceTopNavBarEnabled: this.props.iceTopNavBarEnabled,
|
|
413
|
+
menuItemPath: "/banks"
|
|
410
414
|
});
|
|
411
415
|
}
|
|
412
416
|
}, {
|
|
@@ -424,7 +428,13 @@ export var Banks = (_dec = withStyle(generateStyle, generateComponentTheme), _de
|
|
|
424
428
|
value: function render() {
|
|
425
429
|
return jsx(Page, null, this.renderNav(), jsx("div", {
|
|
426
430
|
css: this.props.styles.content
|
|
427
|
-
}, this.
|
|
431
|
+
}, this.props.iceTopNavBarEnabled && jsx("div", {
|
|
432
|
+
css: this.props.styles.breadcrumb
|
|
433
|
+
}, jsx(HeaderBreadCrumb, {
|
|
434
|
+
returnToUrl: this.props.returnToUrl,
|
|
435
|
+
scope: this.props.scope,
|
|
436
|
+
navigateToBuild: this.props.navigateToBuild
|
|
437
|
+
})), this.renderHeader(), this.props.improvedBankSharingEnabled && this.renderFilters(), this.renderBanksSearchResults(), jsx(CreateBankModal, {
|
|
428
438
|
itemBanksScope: this.props.scope
|
|
429
439
|
})));
|
|
430
440
|
}
|
|
@@ -494,6 +504,7 @@ export var Banks = (_dec = withStyle(generateStyle, generateComponentTheme), _de
|
|
|
494
504
|
itemBankSearchTableEnabled: PropTypes.bool,
|
|
495
505
|
setUI: PropTypes.func.isRequired,
|
|
496
506
|
subAccountBankSharingEnabled: PropTypes.bool,
|
|
507
|
+
iceTopNavBarEnabled: PropTypes.bool,
|
|
497
508
|
// eslint-disable-next-line react/require-default-props,react/forbid-prop-types
|
|
498
509
|
styles: PropTypes.object
|
|
499
510
|
}, _class2.defaultProps = {
|
|
@@ -521,7 +532,8 @@ export var Banks = (_dec = withStyle(generateStyle, generateComponentTheme), _de
|
|
|
521
532
|
newItemBankFilterNamesEnabled: false,
|
|
522
533
|
usedByCourseEnabled: false,
|
|
523
534
|
itemBankSearchTableEnabled: false,
|
|
524
|
-
subAccountBankSharingEnabled: false
|
|
535
|
+
subAccountBankSharingEnabled: false,
|
|
536
|
+
iceTopNavBarEnabled: false
|
|
525
537
|
}, _class2.contextTypes = {
|
|
526
538
|
locale: PropTypes.string
|
|
527
539
|
}, _temp)) || _class);
|
|
@@ -4,11 +4,14 @@ var generateStyle = function generateStyle(componentTheme) {
|
|
|
4
4
|
padding: "".concat(componentTheme.contentPaddingTopBottom, " ").concat(componentTheme.contentPaddingLeftRight),
|
|
5
5
|
backgroundColor: componentTheme.contentBackgroundColor
|
|
6
6
|
},
|
|
7
|
+
breadcrumb: {
|
|
8
|
+
marginBottom: "".concat(componentTheme.breadCrumbMarginBottom)
|
|
9
|
+
},
|
|
7
10
|
header: {
|
|
8
11
|
display: 'flex',
|
|
9
12
|
flexDirection: 'row',
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
justifyContent: 'space-between',
|
|
14
|
+
paddingBottom: "".concat(componentTheme.headerPaddingBottom)
|
|
12
15
|
},
|
|
13
16
|
borderedBottom: {
|
|
14
17
|
borderBottom: "".concat(componentTheme.headerBorderWidth, " solid ").concat(componentTheme.headerBorderColor)
|
|
@@ -17,7 +20,6 @@ var generateStyle = function generateStyle(componentTheme) {
|
|
|
17
20
|
paddingBottom: '2rem'
|
|
18
21
|
},
|
|
19
22
|
filtersRow: {
|
|
20
|
-
marginTop: '1.5rem',
|
|
21
23
|
display: 'flex',
|
|
22
24
|
flexDirection: 'row'
|
|
23
25
|
}
|
|
@@ -4,9 +4,10 @@ var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
|
4
4
|
borders = _ref.borders;
|
|
5
5
|
return {
|
|
6
6
|
contentBackgroundColor: colors.white,
|
|
7
|
-
contentPaddingTopBottom: spacing.
|
|
7
|
+
contentPaddingTopBottom: spacing.medium,
|
|
8
8
|
contentPaddingLeftRight: spacing.xLarge,
|
|
9
|
-
|
|
9
|
+
breadCrumbMarginBottom: spacing.large,
|
|
10
|
+
headerPaddingBottom: spacing.large,
|
|
10
11
|
headerBorderWidth: borders.widthSmall,
|
|
11
12
|
headerBorderColor: colors.tiara
|
|
12
13
|
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React, { Component } from 'react';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import t from '@instructure/quiz-i18n/es/format-message';
|
|
8
|
+
import { Breadcrumb, BreadcrumbLink } from '@instructure/ui-breadcrumb';
|
|
9
|
+
import ReactDOM from 'react-dom';
|
|
10
|
+
export var HeaderBreadCrumb = /*#__PURE__*/function (_Component) {
|
|
11
|
+
_inherits(HeaderBreadCrumb, _Component);
|
|
12
|
+
|
|
13
|
+
var _super = _createSuper(HeaderBreadCrumb);
|
|
14
|
+
|
|
15
|
+
function HeaderBreadCrumb() {
|
|
16
|
+
var _this;
|
|
17
|
+
|
|
18
|
+
_classCallCheck(this, HeaderBreadCrumb);
|
|
19
|
+
|
|
20
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
21
|
+
args[_key] = arguments[_key];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
25
|
+
|
|
26
|
+
_this.setItemBanksRef = function (node) {
|
|
27
|
+
_this.itemBanksRef = node;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return _this;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
_createClass(HeaderBreadCrumb, [{
|
|
34
|
+
key: "componentDidMount",
|
|
35
|
+
value: function componentDidMount() {
|
|
36
|
+
if (this.props.navigateToBuild && this.props.navigateToBanks && this.itemBanksRef) {
|
|
37
|
+
ReactDOM.findDOMNode(this.itemBanksRef).focus();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
key: "render",
|
|
42
|
+
value: function render() {
|
|
43
|
+
var _this$props = this.props,
|
|
44
|
+
returnToUrl = _this$props.returnToUrl,
|
|
45
|
+
scope = _this$props.scope,
|
|
46
|
+
navigateToBanks = _this$props.navigateToBanks,
|
|
47
|
+
renderIcon = _this$props.renderIcon,
|
|
48
|
+
setItemBanksRef = _this$props.setItemBanksRef,
|
|
49
|
+
children = _this$props.children;
|
|
50
|
+
var isScopeEmpty = !Object.keys(scope).length;
|
|
51
|
+
var canvasReferrerLinkText = isScopeEmpty ? null : scope.title;
|
|
52
|
+
var canvasReferrerLink = returnToUrl && canvasReferrerLinkText && /*#__PURE__*/React.createElement(BreadcrumbLink, {
|
|
53
|
+
key: "Context",
|
|
54
|
+
href: returnToUrl,
|
|
55
|
+
target: "_top"
|
|
56
|
+
}, canvasReferrerLinkText);
|
|
57
|
+
var banksLink = /*#__PURE__*/React.createElement(BreadcrumbLink, {
|
|
58
|
+
key: "Banks",
|
|
59
|
+
onClick: navigateToBanks,
|
|
60
|
+
renderIcon: renderIcon,
|
|
61
|
+
ref: setItemBanksRef || this.setItemBanksRef
|
|
62
|
+
}, t('Item Banks')); // If Breadcrumb has multiple children (even if 2nd is null), it will
|
|
63
|
+
// render the `>` icon, which we don't want if there are no children.
|
|
64
|
+
|
|
65
|
+
var breadCrumbLinks = [banksLink];
|
|
66
|
+
|
|
67
|
+
if (children) {
|
|
68
|
+
breadCrumbLinks = breadCrumbLinks.concat(children);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (canvasReferrerLink) breadCrumbLinks.unshift(canvasReferrerLink);
|
|
72
|
+
return /*#__PURE__*/React.createElement(Breadcrumb, {
|
|
73
|
+
label: t('You are here:'),
|
|
74
|
+
size: this.props.isCompact ? 'small' : 'medium'
|
|
75
|
+
}, breadCrumbLinks);
|
|
76
|
+
}
|
|
77
|
+
}]);
|
|
78
|
+
|
|
79
|
+
HeaderBreadCrumb.displayName = "HeaderBreadCrumb";
|
|
80
|
+
return HeaderBreadCrumb;
|
|
81
|
+
}(Component);
|
|
82
|
+
HeaderBreadCrumb.propTypes = {
|
|
83
|
+
returnToUrl: PropTypes.string,
|
|
84
|
+
scope: PropTypes.objectOf(PropTypes.shape({
|
|
85
|
+
type: PropTypes.string,
|
|
86
|
+
uuid: PropTypes.string,
|
|
87
|
+
title: PropTypes.string
|
|
88
|
+
})),
|
|
89
|
+
navigateToBuild: PropTypes.func,
|
|
90
|
+
navigateToBanks: PropTypes.func,
|
|
91
|
+
isCompact: PropTypes.bool,
|
|
92
|
+
setItemBanksRef: PropTypes.func,
|
|
93
|
+
renderIcon: PropTypes.node,
|
|
94
|
+
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])
|
|
95
|
+
};
|
|
96
|
+
HeaderBreadCrumb.defaultProps = {
|
|
97
|
+
returnToUrl: null,
|
|
98
|
+
scope: {},
|
|
99
|
+
navigateToBuild: null,
|
|
100
|
+
navigateToBanks: null,
|
|
101
|
+
isCompact: false,
|
|
102
|
+
setItemBanksRef: null,
|
|
103
|
+
renderIcon: null,
|
|
104
|
+
children: null
|
|
105
|
+
};
|
|
106
|
+
export default HeaderBreadCrumb;
|
|
@@ -11,19 +11,17 @@ import ReactDOM from 'react-dom';
|
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
12
|
import { Children } from '@instructure/ui-prop-types';
|
|
13
13
|
import { ReturnButton } from "../../../common/components/shared/return_button/ReturnButton.js";
|
|
14
|
+
import { NavBar } from "../../../common/components/layout/navbar/index.js";
|
|
15
|
+
import { SecondaryNavBarButton } from "../../../common/components/layout/navbar/SecondaryNavBarButton/index.js";
|
|
16
|
+
import { HeaderBreadCrumb } from "../HeaderBreadCrumb/index.js";
|
|
14
17
|
import { CloseButton, Button } from '@instructure/ui-buttons';
|
|
15
|
-
import {
|
|
18
|
+
import { BreadcrumbLink } from '@instructure/ui-breadcrumb';
|
|
16
19
|
import { IconBankLine } from '@instructure/ui-icons';
|
|
17
20
|
import { View } from '@instructure/ui-view';
|
|
18
21
|
import { withStyle, jsx, Global } from '@instructure/emotion';
|
|
19
22
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
20
23
|
import generateStyle from "./styles.js";
|
|
21
24
|
import generateComponentTheme from "./theme.js";
|
|
22
|
-
|
|
23
|
-
var _ref = jsx(IconBankLine, {
|
|
24
|
-
size: "x-small"
|
|
25
|
-
});
|
|
26
|
-
|
|
27
25
|
var NavWrapper = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
28
26
|
_inherits(NavWrapper, _Component);
|
|
29
27
|
|
|
@@ -63,43 +61,29 @@ var NavWrapper = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(
|
|
|
63
61
|
ReactDOM.findDOMNode(this.itemBanksRef).focus();
|
|
64
62
|
}
|
|
65
63
|
}
|
|
66
|
-
}, {
|
|
67
|
-
key: "renderBreadcrumbLinks",
|
|
68
|
-
value: function renderBreadcrumbLinks() {
|
|
69
|
-
var _this$props = this.props,
|
|
70
|
-
returnToUrl = _this$props.returnToUrl,
|
|
71
|
-
canvasReferrerLinkText = _this$props.canvasReferrerLinkText;
|
|
72
|
-
var canvasReferrerLink = returnToUrl && canvasReferrerLinkText && jsx(BreadcrumbLink, {
|
|
73
|
-
key: "Context",
|
|
74
|
-
href: returnToUrl,
|
|
75
|
-
target: "_top"
|
|
76
|
-
}, canvasReferrerLinkText);
|
|
77
|
-
var banksLinks = jsx(BreadcrumbLink, {
|
|
78
|
-
ref: this.setItemBanksRef,
|
|
79
|
-
renderIcon: _ref,
|
|
80
|
-
key: "Banks",
|
|
81
|
-
onClick: this.props.navigateToBanks
|
|
82
|
-
}, t('Item Banks')); // If Breadcrumb has multiple children (even if 2nd is null), it will
|
|
83
|
-
// render the `>` icon, which we don't want if there are no children.
|
|
84
|
-
|
|
85
|
-
var breadCrumbLinks = [banksLinks];
|
|
86
|
-
if (this.props.children) breadCrumbLinks.push(this.props.children);
|
|
87
|
-
if (canvasReferrerLink) breadCrumbLinks.unshift(canvasReferrerLink);
|
|
88
|
-
return breadCrumbLinks;
|
|
89
|
-
}
|
|
90
64
|
}, {
|
|
91
65
|
key: "renderReturnButton",
|
|
92
66
|
value: function renderReturnButton() {
|
|
93
|
-
var _this$
|
|
94
|
-
navigateToBuild = _this$
|
|
95
|
-
closeTray = _this$
|
|
96
|
-
returnToUrl = _this$
|
|
67
|
+
var _this$props = this.props,
|
|
68
|
+
navigateToBuild = _this$props.navigateToBuild,
|
|
69
|
+
closeTray = _this$props.closeTray,
|
|
70
|
+
returnToUrl = _this$props.returnToUrl,
|
|
71
|
+
iceTopNavBarEnabled = _this$props.iceTopNavBarEnabled;
|
|
97
72
|
|
|
98
73
|
if (!closeTray && returnToUrl) {
|
|
99
74
|
return jsx(ReturnButton, {
|
|
100
|
-
returnToUrl: returnToUrl
|
|
75
|
+
returnToUrl: returnToUrl,
|
|
76
|
+
iceTopNavBarEnabled: iceTopNavBarEnabled
|
|
101
77
|
});
|
|
102
78
|
} else if (navigateToBuild) {
|
|
79
|
+
if (iceTopNavBarEnabled) {
|
|
80
|
+
return jsx(SecondaryNavBarButton, {
|
|
81
|
+
id: "ReturnButton",
|
|
82
|
+
variant: "button",
|
|
83
|
+
onClick: navigateToBuild
|
|
84
|
+
}, t('Return'));
|
|
85
|
+
}
|
|
86
|
+
|
|
103
87
|
return jsx(Button, {
|
|
104
88
|
onClick: navigateToBuild
|
|
105
89
|
}, t('Return'));
|
|
@@ -120,6 +104,16 @@ var NavWrapper = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(
|
|
|
120
104
|
}, {
|
|
121
105
|
key: "render",
|
|
122
106
|
value: function render() {
|
|
107
|
+
if (this.props.iceTopNavBarEnabled) {
|
|
108
|
+
return jsx(NavBar, {
|
|
109
|
+
menuItems: [{
|
|
110
|
+
path: this.props.menuItemPath,
|
|
111
|
+
text: 'Item Banks'
|
|
112
|
+
}],
|
|
113
|
+
actionItems: [this.renderReturnButton()]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
123
117
|
return jsx(View, null, jsx(Global, {
|
|
124
118
|
styles: {
|
|
125
119
|
'body.tox-fullscreen .nav': {
|
|
@@ -130,10 +124,17 @@ var NavWrapper = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(
|
|
|
130
124
|
css: this.props.styles.nav
|
|
131
125
|
}, this.renderCloseButton(), jsx("div", {
|
|
132
126
|
css: this.props.styles.crumbs
|
|
133
|
-
}, jsx(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
127
|
+
}, jsx(HeaderBreadCrumb, {
|
|
128
|
+
returnToUrl: this.props.returnToUrl,
|
|
129
|
+
navigateToBanks: this.props.navigateToBanks,
|
|
130
|
+
navigateToBuild: this.props.navigateToBuild,
|
|
131
|
+
scope: this.props.scope,
|
|
132
|
+
isCompact: this.props.isCompact,
|
|
133
|
+
setItemBanksRef: this.setItemBanksRef,
|
|
134
|
+
renderIcon: jsx(IconBankLine, {
|
|
135
|
+
size: this.props.isCompact ? 'x-small' : null
|
|
136
|
+
})
|
|
137
|
+
}, this.props.children)), this.renderReturnButton(), this.props.renderHeaderMenu()));
|
|
137
138
|
}
|
|
138
139
|
}]);
|
|
139
140
|
|
|
@@ -147,7 +148,14 @@ var NavWrapper = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(
|
|
|
147
148
|
renderHeaderMenu: PropTypes.func,
|
|
148
149
|
trayOpen: PropTypes.bool.isRequired,
|
|
149
150
|
returnToUrl: PropTypes.string,
|
|
150
|
-
|
|
151
|
+
scope: PropTypes.shape({
|
|
152
|
+
type: PropTypes.string,
|
|
153
|
+
uuid: PropTypes.string,
|
|
154
|
+
title: PropTypes.string
|
|
155
|
+
}).isRequired,
|
|
156
|
+
isCompact: PropTypes.bool,
|
|
157
|
+
iceTopNavBarEnabled: PropTypes.bool,
|
|
158
|
+
menuItemPath: PropTypes.string,
|
|
151
159
|
// eslint-disable-next-line react/require-default-props,react/forbid-prop-types
|
|
152
160
|
styles: PropTypes.object
|
|
153
161
|
}, _class2.defaultProps = {
|
|
@@ -157,6 +165,8 @@ var NavWrapper = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(
|
|
|
157
165
|
navigateToBuild: null,
|
|
158
166
|
renderHeaderMenu: Function.prototype,
|
|
159
167
|
returnToUrl: null,
|
|
160
|
-
|
|
168
|
+
isCompact: false,
|
|
169
|
+
iceTopNavBarEnabled: false,
|
|
170
|
+
menuItemPath: ''
|
|
161
171
|
}, _temp)) || _class);
|
|
162
172
|
export default NavWrapper;
|
|
@@ -6,6 +6,7 @@ import React, { Component } from 'react';
|
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { Button } from '@instructure/ui-buttons';
|
|
8
8
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
9
|
+
import { SecondaryNavBarButton } from "../../layout/navbar/SecondaryNavBarButton/index.js";
|
|
9
10
|
export var ReturnButton = /*#__PURE__*/function (_Component) {
|
|
10
11
|
_inherits(ReturnButton, _Component);
|
|
11
12
|
|
|
@@ -24,6 +25,16 @@ export var ReturnButton = /*#__PURE__*/function (_Component) {
|
|
|
24
25
|
return null;
|
|
25
26
|
}
|
|
26
27
|
|
|
28
|
+
if (this.props.iceTopNavBarEnabled) {
|
|
29
|
+
return /*#__PURE__*/React.createElement(SecondaryNavBarButton, {
|
|
30
|
+
id: "ReturnButton",
|
|
31
|
+
variant: "button",
|
|
32
|
+
"data-automation": "sdk-return-button",
|
|
33
|
+
href: this.props.returnToUrl,
|
|
34
|
+
target: "_top"
|
|
35
|
+
}, this.props.text);
|
|
36
|
+
}
|
|
37
|
+
|
|
27
38
|
return /*#__PURE__*/React.createElement(Button, {
|
|
28
39
|
"data-automation": "sdk-return-button",
|
|
29
40
|
href: this.props.returnToUrl,
|
|
@@ -37,10 +48,12 @@ export var ReturnButton = /*#__PURE__*/function (_Component) {
|
|
|
37
48
|
}(Component);
|
|
38
49
|
ReturnButton.propTypes = {
|
|
39
50
|
returnToUrl: PropTypes.string,
|
|
40
|
-
text: PropTypes.string
|
|
51
|
+
text: PropTypes.string,
|
|
52
|
+
iceTopNavBarEnabled: PropTypes.bool
|
|
41
53
|
};
|
|
42
54
|
ReturnButton.defaultProps = {
|
|
43
55
|
returnToUrl: void 0,
|
|
44
|
-
text: t('Return')
|
|
56
|
+
text: t('Return'),
|
|
57
|
+
iceTopNavBarEnabled: false
|
|
45
58
|
};
|
|
46
59
|
export default ReturnButton;
|