@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.
@@ -25,6 +25,12 @@ var _uiPropTypes = require("@instructure/ui-prop-types");
25
25
 
26
26
  var _ReturnButton = require("../../../common/components/shared/return_button/ReturnButton.js");
27
27
 
28
+ var _index = require("../../../common/components/layout/navbar/index.js");
29
+
30
+ var _index2 = require("../../../common/components/layout/navbar/SecondaryNavBarButton/index.js");
31
+
32
+ var _index3 = require("../HeaderBreadCrumb/index.js");
33
+
28
34
  var _uiButtons = require("@instructure/ui-buttons");
29
35
 
30
36
  var _uiBreadcrumb = require("@instructure/ui-breadcrumb");
@@ -43,10 +49,6 @@ var _theme = _interopRequireDefault(require("./theme.js"));
43
49
 
44
50
  var _dec, _class, _class2, _temp;
45
51
 
46
- var _ref = (0, _emotion.jsx)(_uiIcons.IconBankLine, {
47
- size: "x-small"
48
- });
49
-
50
52
  var NavWrapper = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
51
53
  (0, _inherits2.default)(NavWrapper, _Component);
52
54
 
@@ -86,43 +88,29 @@ var NavWrapper = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
86
88
  _reactDom.default.findDOMNode(this.itemBanksRef).focus();
87
89
  }
88
90
  }
89
- }, {
90
- key: "renderBreadcrumbLinks",
91
- value: function renderBreadcrumbLinks() {
92
- var _this$props = this.props,
93
- returnToUrl = _this$props.returnToUrl,
94
- canvasReferrerLinkText = _this$props.canvasReferrerLinkText;
95
- var canvasReferrerLink = returnToUrl && canvasReferrerLinkText && (0, _emotion.jsx)(_uiBreadcrumb.BreadcrumbLink, {
96
- key: "Context",
97
- href: returnToUrl,
98
- target: "_top"
99
- }, canvasReferrerLinkText);
100
- var banksLinks = (0, _emotion.jsx)(_uiBreadcrumb.BreadcrumbLink, {
101
- ref: this.setItemBanksRef,
102
- renderIcon: _ref,
103
- key: "Banks",
104
- onClick: this.props.navigateToBanks
105
- }, (0, _formatMessage.default)('Item Banks')); // If Breadcrumb has multiple children (even if 2nd is null), it will
106
- // render the `>` icon, which we don't want if there are no children.
107
-
108
- var breadCrumbLinks = [banksLinks];
109
- if (this.props.children) breadCrumbLinks.push(this.props.children);
110
- if (canvasReferrerLink) breadCrumbLinks.unshift(canvasReferrerLink);
111
- return breadCrumbLinks;
112
- }
113
91
  }, {
114
92
  key: "renderReturnButton",
115
93
  value: function renderReturnButton() {
116
- var _this$props2 = this.props,
117
- navigateToBuild = _this$props2.navigateToBuild,
118
- closeTray = _this$props2.closeTray,
119
- returnToUrl = _this$props2.returnToUrl;
94
+ var _this$props = this.props,
95
+ navigateToBuild = _this$props.navigateToBuild,
96
+ closeTray = _this$props.closeTray,
97
+ returnToUrl = _this$props.returnToUrl,
98
+ iceTopNavBarEnabled = _this$props.iceTopNavBarEnabled;
120
99
 
121
100
  if (!closeTray && returnToUrl) {
122
101
  return (0, _emotion.jsx)(_ReturnButton.ReturnButton, {
123
- returnToUrl: returnToUrl
102
+ returnToUrl: returnToUrl,
103
+ iceTopNavBarEnabled: iceTopNavBarEnabled
124
104
  });
125
105
  } else if (navigateToBuild) {
106
+ if (iceTopNavBarEnabled) {
107
+ return (0, _emotion.jsx)(_index2.SecondaryNavBarButton, {
108
+ id: "ReturnButton",
109
+ variant: "button",
110
+ onClick: navigateToBuild
111
+ }, (0, _formatMessage.default)('Return'));
112
+ }
113
+
126
114
  return (0, _emotion.jsx)(_uiButtons.Button, {
127
115
  onClick: navigateToBuild
128
116
  }, (0, _formatMessage.default)('Return'));
@@ -143,6 +131,16 @@ var NavWrapper = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
143
131
  }, {
144
132
  key: "render",
145
133
  value: function render() {
134
+ if (this.props.iceTopNavBarEnabled) {
135
+ return (0, _emotion.jsx)(_index.NavBar, {
136
+ menuItems: [{
137
+ path: this.props.menuItemPath,
138
+ text: 'Item Banks'
139
+ }],
140
+ actionItems: [this.renderReturnButton()]
141
+ });
142
+ }
143
+
146
144
  return (0, _emotion.jsx)(_uiView.View, null, (0, _emotion.jsx)(_emotion.Global, {
147
145
  styles: {
148
146
  'body.tox-fullscreen .nav': {
@@ -153,10 +151,17 @@ var NavWrapper = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
153
151
  css: this.props.styles.nav
154
152
  }, this.renderCloseButton(), (0, _emotion.jsx)("div", {
155
153
  css: this.props.styles.crumbs
156
- }, (0, _emotion.jsx)(_uiBreadcrumb.Breadcrumb, {
157
- size: "small",
158
- label: (0, _formatMessage.default)('You are here:')
159
- }, this.renderBreadcrumbLinks())), this.renderReturnButton(), this.props.renderHeaderMenu()));
154
+ }, (0, _emotion.jsx)(_index3.HeaderBreadCrumb, {
155
+ returnToUrl: this.props.returnToUrl,
156
+ navigateToBanks: this.props.navigateToBanks,
157
+ navigateToBuild: this.props.navigateToBuild,
158
+ scope: this.props.scope,
159
+ isCompact: this.props.isCompact,
160
+ setItemBanksRef: this.setItemBanksRef,
161
+ renderIcon: (0, _emotion.jsx)(_uiIcons.IconBankLine, {
162
+ size: this.props.isCompact ? 'x-small' : null
163
+ })
164
+ }, this.props.children)), this.renderReturnButton(), this.props.renderHeaderMenu()));
160
165
  }
161
166
  }]);
162
167
  NavWrapper.displayName = "NavWrapper";
@@ -169,7 +174,14 @@ var NavWrapper = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
169
174
  renderHeaderMenu: _propTypes.default.func,
170
175
  trayOpen: _propTypes.default.bool.isRequired,
171
176
  returnToUrl: _propTypes.default.string,
172
- canvasReferrerLinkText: _propTypes.default.string,
177
+ scope: _propTypes.default.shape({
178
+ type: _propTypes.default.string,
179
+ uuid: _propTypes.default.string,
180
+ title: _propTypes.default.string
181
+ }).isRequired,
182
+ isCompact: _propTypes.default.bool,
183
+ iceTopNavBarEnabled: _propTypes.default.bool,
184
+ menuItemPath: _propTypes.default.string,
173
185
  // eslint-disable-next-line react/require-default-props,react/forbid-prop-types
174
186
  styles: _propTypes.default.object
175
187
  }, _class2.defaultProps = {
@@ -179,7 +191,9 @@ var NavWrapper = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
179
191
  navigateToBuild: null,
180
192
  renderHeaderMenu: Function.prototype,
181
193
  returnToUrl: null,
182
- canvasReferrerLinkText: null
194
+ isCompact: false,
195
+ iceTopNavBarEnabled: false,
196
+ menuItemPath: ''
183
197
  }, _temp)) || _class);
184
198
  var _default = NavWrapper;
185
199
  exports.default = _default;
@@ -25,6 +25,8 @@ var _uiButtons = require("@instructure/ui-buttons");
25
25
 
26
26
  var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
27
27
 
28
+ var _index = require("../../layout/navbar/SecondaryNavBarButton/index.js");
29
+
28
30
  var ReturnButton = /*#__PURE__*/function (_Component) {
29
31
  (0, _inherits2.default)(ReturnButton, _Component);
30
32
 
@@ -42,6 +44,16 @@ var ReturnButton = /*#__PURE__*/function (_Component) {
42
44
  return null;
43
45
  }
44
46
 
47
+ if (this.props.iceTopNavBarEnabled) {
48
+ return /*#__PURE__*/_react.default.createElement(_index.SecondaryNavBarButton, {
49
+ id: "ReturnButton",
50
+ variant: "button",
51
+ "data-automation": "sdk-return-button",
52
+ href: this.props.returnToUrl,
53
+ target: "_top"
54
+ }, this.props.text);
55
+ }
56
+
45
57
  return /*#__PURE__*/_react.default.createElement(_uiButtons.Button, {
46
58
  "data-automation": "sdk-return-button",
47
59
  href: this.props.returnToUrl,
@@ -56,11 +68,13 @@ var ReturnButton = /*#__PURE__*/function (_Component) {
56
68
  exports.ReturnButton = ReturnButton;
57
69
  ReturnButton.propTypes = {
58
70
  returnToUrl: _propTypes.default.string,
59
- text: _propTypes.default.string
71
+ text: _propTypes.default.string,
72
+ iceTopNavBarEnabled: _propTypes.default.bool
60
73
  };
61
74
  ReturnButton.defaultProps = {
62
75
  returnToUrl: void 0,
63
- text: (0, _formatMessage.default)('Return')
76
+ text: (0, _formatMessage.default)('Return'),
77
+ iceTopNavBarEnabled: false
64
78
  };
65
79
  var _default = ReturnButton;
66
80
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "20.9.1-rc.7+7d9df0379",
3
+ "version": "20.10.0",
4
4
  "license": "MIT",
5
5
  "description": "The Quiz React SDK by Instructure Inc.",
6
6
  "author": "Instructure, Inc. Engineering and Product Design",
@@ -44,11 +44,11 @@
44
44
  "@instructure/emotion": "^8.51.0",
45
45
  "@instructure/grading-utils": "^1.0.0",
46
46
  "@instructure/outcomes-ui": "^3.1.0",
47
- "@instructure/quiz-common": "20.9.1-rc.7+7d9df0379",
48
- "@instructure/quiz-i18n": "20.9.1-rc.7+7d9df0379",
49
- "@instructure/quiz-interactions": "20.9.1-rc.7+7d9df0379",
50
- "@instructure/quiz-number-input": "20.9.1-rc.7+7d9df0379",
51
- "@instructure/quiz-rce": "20.9.1-rc.7+7d9df0379",
47
+ "@instructure/quiz-common": "^20.10.0",
48
+ "@instructure/quiz-i18n": "^20.10.0",
49
+ "@instructure/quiz-interactions": "^20.10.0",
50
+ "@instructure/quiz-number-input": "^20.10.0",
51
+ "@instructure/quiz-rce": "^20.10.0",
52
52
  "@instructure/ui-a11y-content": "^8.51.0",
53
53
  "@instructure/ui-alerts": "^8.51.0",
54
54
  "@instructure/ui-avatar": "^8.51.0",
@@ -112,7 +112,7 @@
112
112
  "file-saver": "~2.0.5",
113
113
  "humps": "^2.0.0",
114
114
  "immutable": "^3.8.1",
115
- "instructure-validations": "20.9.1-rc.7+7d9df0379",
115
+ "instructure-validations": "^20.10.0",
116
116
  "ipaddr.js": "^1.5.4",
117
117
  "isomorphic-fetch": "^2.2.0",
118
118
  "isuuid": "^0.1.0",
@@ -143,7 +143,7 @@
143
143
  "uuid": "^3.2.1"
144
144
  },
145
145
  "devDependencies": {
146
- "@instructure/quiz-scripts": "20.9.0",
146
+ "@instructure/quiz-scripts": "^20.10.0",
147
147
  "@instructure/ui-axe-check": "^8.51.0",
148
148
  "@instructure/ui-babel-preset": "^7.22.1",
149
149
  "@instructure/ui-karma-config": "^7.22.1",
@@ -163,7 +163,7 @@
163
163
  "intl": "^1.2.4",
164
164
  "jquery": "^2.2.3",
165
165
  "most-subject": "^5.3.0",
166
- "quiz-presets": "20.9.1-rc.7+7d9df0379",
166
+ "quiz-presets": "^20.10.0",
167
167
  "react": "^16.8.6",
168
168
  "react-addons-test-utils": "^15.6.2",
169
169
  "react-dom": "^16.8.6",
@@ -179,5 +179,5 @@
179
179
  "publishConfig": {
180
180
  "access": "public"
181
181
  },
182
- "gitHead": "7d9df037951d6e2565087a758c70b5daafed5eed"
182
+ "gitHead": "bfab54e6bcf1812fe3b695aeda7de71fc6dc5ff1"
183
183
  }