@instructure/quiz-core 20.10.1-rc.7 → 20.11.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 CHANGED
@@ -3,6 +3,17 @@
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.11.0](https://gerrit.instructure.com/quizzes-ui/compare/v20.10.0...v20.11.0) (2024-03-22)
7
+
8
+
9
+ ### Features
10
+
11
+ * **sub-account-bank-sharing:** Silently filter banks by subaccount with subaccount launch ([c0ed1ff](https://gerrit.instructure.com/quizzes-ui/commits/c0ed1ff3f93fd948f16d8073e223cbb46dab4a74))
12
+
13
+
14
+
15
+
16
+
6
17
  # [20.10.0](https://gerrit.instructure.com/quizzes-ui/compare/v20.9.0...v20.10.0) (2024-03-12)
7
18
 
8
19
 
@@ -11,12 +11,18 @@ import PropTypes from 'prop-types';
11
11
  import { IconButton } from '@instructure/ui-buttons';
12
12
  import { Menu } from '@instructure/ui-menu';
13
13
  import { IconExportLine, IconMoreSolid, IconImportLine, IconBankLine, IconPrinterLine, IconSpeedGraderLine } from '@instructure/ui-icons';
14
+ import { View } from '@instructure/ui-view';
15
+ import { Drilldown } from '@instructure/ui-drilldown';
16
+ import { TopNavBar } from '@instructure/ui-top-nav-bar';
14
17
  import PrintTrigger from "../../../../../common/components/shared/PrintTrigger/index.js";
15
18
  import { PRINT_CURRENT_PAGE, PRINT_BLANK } from '@instructure/quiz-common';
16
19
  import { withStyle, jsx } from '@instructure/emotion';
17
20
  import t from '@instructure/quiz-i18n/es/format-message';
18
21
  import generateStyle from "./styles.js";
19
22
  import generateComponentTheme from "./theme.js";
23
+
24
+ var _ref = jsx(IconSpeedGraderLine, null);
25
+
20
26
  export var BuildingButtons = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
21
27
  _inherits(BuildingButtons, _Component);
22
28
 
@@ -73,6 +79,16 @@ export var BuildingButtons = (_dec = withStyle(generateStyle, generateComponentT
73
79
  }
74
80
 
75
81
  _createClass(BuildingButtons, [{
82
+ key: "componentDidMount",
83
+ value: function componentDidMount() {
84
+ this.props.makeStyles();
85
+ }
86
+ }, {
87
+ key: "componentWillUnmount",
88
+ value: function componentWillUnmount() {
89
+ this.props.makeStyles();
90
+ }
91
+ }, {
76
92
  key: "renderSavingMessage",
77
93
  value: function renderSavingMessage() {
78
94
  if (this.props.quizSaving) {
@@ -86,6 +102,214 @@ export var BuildingButtons = (_dec = withStyle(generateStyle, generateComponentT
86
102
  value: function isBuildingPage() {
87
103
  return 'building' === this.props.app;
88
104
  }
105
+ }, {
106
+ key: "renderSpeedGraderButton",
107
+ value: function renderSpeedGraderButton() {
108
+ var key = 'speedgrader';
109
+ var text = t('Speedgrader');
110
+
111
+ if (this.props.iceTopNavBarEnabled) {
112
+ return jsx(Drilldown.Option, {
113
+ id: key,
114
+ key: key,
115
+ onOptionClick: this.openSpeedgraderLink
116
+ }, _ref, jsx(View, {
117
+ as: "span",
118
+ margin: "0 0 0 x-small"
119
+ }, text));
120
+ }
121
+
122
+ return jsx(Menu.Item, {
123
+ key: key,
124
+ onSelect: this.openSpeedgraderLink
125
+ }, jsx(IconSpeedGraderLine, {
126
+ css: this.props.styles.menuIcon
127
+ }), text);
128
+ }
129
+ }, {
130
+ key: "renderImportContentButton",
131
+ value: function renderImportContentButton() {
132
+ var key = 'import';
133
+ var text = t('Import Content');
134
+ var onClick = this.props.openModal;
135
+ var disabled = !this.props.canImport;
136
+ var menuItemDataAutomation = 'sdk-import-content-menuitem';
137
+ var iconDataAutomation = 'sdk-import-content-icon';
138
+
139
+ if (this.props.iceTopNavBarEnabled) {
140
+ return jsx(Drilldown.Option, {
141
+ id: key,
142
+ key: key,
143
+ disabled: disabled,
144
+ onOptionClick: onClick,
145
+ "data-automation": menuItemDataAutomation
146
+ }, jsx(IconImportLine, {
147
+ "data-automation": iconDataAutomation
148
+ }), jsx(View, {
149
+ as: "span",
150
+ margin: "0 0 0 x-small"
151
+ }, text));
152
+ }
153
+
154
+ return jsx(Menu.Item, {
155
+ key: key,
156
+ disabled: disabled,
157
+ onSelect: onClick,
158
+ "data-automation": menuItemDataAutomation
159
+ }, jsx(IconImportLine, {
160
+ css: this.props.styles.menuIcon,
161
+ "data-automation": iconDataAutomation
162
+ }), text);
163
+ }
164
+ }, {
165
+ key: "renderContentExportButton",
166
+ value: function renderContentExportButton() {
167
+ var key = 'export';
168
+ var text = t('Export Content');
169
+ var onClick = this.startQuizExportJob;
170
+ var disabled = !this.props.canExport;
171
+ var menuItemDataAutomation = 'sdk-export-content-menuitem';
172
+ var iconDataAutomation = 'sdk-export-content-icon';
173
+
174
+ if (this.props.iceTopNavBarEnabled) {
175
+ return jsx(Drilldown.Option, {
176
+ id: key,
177
+ key: key,
178
+ disabled: disabled,
179
+ onOptionClick: onClick,
180
+ "data-automation": menuItemDataAutomation
181
+ }, jsx(IconExportLine, {
182
+ "data-automation": iconDataAutomation
183
+ }), jsx(View, {
184
+ as: "span",
185
+ margin: "0 0 0 x-small"
186
+ }, text));
187
+ }
188
+
189
+ return jsx(Menu.Item, {
190
+ key: key,
191
+ disabled: disabled,
192
+ onSelect: onClick,
193
+ "data-automation": menuItemDataAutomation
194
+ }, jsx(IconExportLine, {
195
+ css: this.props.styles.menuIcon,
196
+ "data-automation": iconDataAutomation
197
+ }), text);
198
+ }
199
+ }, {
200
+ key: "renderManageItemBanksButton",
201
+ value: function renderManageItemBanksButton() {
202
+ var key = 'banks';
203
+ var text = t('Manage Item Banks');
204
+ var onClick = this.props.navigateToBanks;
205
+ var menuItemDataAutomation = 'sdk-manage-item-banks-menuitem';
206
+ var iconDataAutomation = 'sdk-manage-item-banks-icon';
207
+
208
+ if (this.props.iceTopNavBarEnabled) {
209
+ return jsx(Drilldown.Option, {
210
+ id: key,
211
+ key: key,
212
+ onOptionClick: onClick,
213
+ "data-automation": menuItemDataAutomation
214
+ }, jsx(IconBankLine, {
215
+ "data-automation": iconDataAutomation
216
+ }), jsx(View, {
217
+ as: "span",
218
+ margin: "0 0 0 x-small"
219
+ }, text));
220
+ }
221
+
222
+ return jsx(Menu.Item, {
223
+ key: key,
224
+ onSelect: onClick,
225
+ "data-automation": menuItemDataAutomation
226
+ }, jsx(IconBankLine, {
227
+ css: this.props.styles.menuIcon,
228
+ "data-automation": iconDataAutomation
229
+ }), text);
230
+ }
231
+ }, {
232
+ key: "renderPrintKeyButton",
233
+ value: function renderPrintKeyButton(handlePrint) {
234
+ var key = 'printKey';
235
+ var text = t('Print Key (With Answers)');
236
+
237
+ var onClick = function onClick() {
238
+ return handlePrint(PRINT_CURRENT_PAGE);
239
+ };
240
+
241
+ var disabled = !this.props.hasQuestions || this.props.isEditing;
242
+ var menuItemDataAutomation = 'sdk-print-key-menuitem';
243
+ var iconDataAutomation = 'sdk-print-icon';
244
+
245
+ if (this.props.iceTopNavBarEnabled) {
246
+ return jsx(Drilldown.Option, {
247
+ id: key,
248
+ key: key,
249
+ disabled: disabled,
250
+ onOptionClick: onClick // eslint-disable-line react/jsx-no-bind
251
+ ,
252
+ "data-automation": menuItemDataAutomation
253
+ }, jsx(IconPrinterLine, {
254
+ "data-automation": iconDataAutomation
255
+ }), jsx(View, {
256
+ as: "span",
257
+ margin: "0 0 0 x-small"
258
+ }, text));
259
+ }
260
+
261
+ return jsx(Menu.Item, {
262
+ key: key,
263
+ disabled: disabled,
264
+ onSelect: onClick // eslint-disable-line react/jsx-no-bind
265
+ ,
266
+ "data-automation": menuItemDataAutomation
267
+ }, jsx(IconPrinterLine, {
268
+ css: this.props.styles.menuIcon,
269
+ "data-automation": iconDataAutomation
270
+ }), text);
271
+ }
272
+ }, {
273
+ key: "renderPrintBlankButton",
274
+ value: function renderPrintBlankButton(handlePrint) {
275
+ var key = 'printBlank';
276
+ var text = t('Print Blank Quiz');
277
+
278
+ var onClick = function onClick() {
279
+ return handlePrint(PRINT_BLANK);
280
+ };
281
+
282
+ var disabled = !this.props.hasQuestions || this.props.isEditing;
283
+ var menuItemDataAutomation = 'sdk-print-blank-menuitem';
284
+ var iconDataAutomation = 'sdk-print-blank-icon';
285
+
286
+ if (this.props.iceTopNavBarEnabled) {
287
+ return jsx(Drilldown.Option, {
288
+ id: key,
289
+ key: key,
290
+ disabled: disabled,
291
+ onOptionClick: onClick // eslint-disable-line react/jsx-no-bind
292
+ ,
293
+ "data-automation": menuItemDataAutomation
294
+ }, jsx(IconPrinterLine, {
295
+ "data-automation": iconDataAutomation
296
+ }), jsx(View, {
297
+ as: "span",
298
+ margin: "0 0 0 x-small"
299
+ }, text));
300
+ }
301
+
302
+ return jsx(Menu.Item, {
303
+ key: key,
304
+ disabled: disabled,
305
+ onSelect: onClick // eslint-disable-line react/jsx-no-bind
306
+ ,
307
+ "data-automation": menuItemDataAutomation
308
+ }, jsx(IconPrinterLine, {
309
+ css: this.props.styles.menuIcon,
310
+ "data-automation": iconDataAutomation
311
+ }), text);
312
+ }
89
313
  }, {
90
314
  key: "renderMenu",
91
315
  value: function renderMenu(handlePrint) {
@@ -93,79 +317,40 @@ export var BuildingButtons = (_dec = withStyle(generateStyle, generateComponentT
93
317
  var menuItems = [];
94
318
 
95
319
  if (this.props.speedgraderLink) {
96
- menuItems.push(jsx(Menu.Item, {
97
- key: "speedgrader",
98
- onSelect: this.openSpeedgraderLink
99
- }, jsx(IconSpeedGraderLine, {
100
- css: this.props.styles.menuIcon
101
- }), t('Speedgrader')));
320
+ menuItems.push(this.renderSpeedGraderButton());
102
321
  }
103
322
 
104
- menuItems.push(jsx(Menu.Item, {
105
- key: "import",
106
- disabled: !this.props.canImport,
107
- onSelect: this.props.openModal,
108
- "data-automation": "sdk-import-content-menuitem"
109
- }, jsx(IconImportLine, {
110
- css: this.props.styles.menuIcon,
111
- "data-automation": "sdk-import-content-icon"
112
- }), t('Import Content')));
323
+ menuItems.push(this.renderImportContentButton());
113
324
 
114
325
  if (this.props.contentExportEnabled) {
115
- menuItems.push(jsx(Menu.Item, {
116
- key: "export",
117
- disabled: !this.props.canExport,
118
- onSelect: this.startQuizExportJob,
119
- "data-automation": "sdk-export-content-menuitem"
120
- }, jsx(IconExportLine, {
121
- css: this.props.styles.menuIcon,
122
- "data-automation": "sdk-export-content-icon"
123
- }), t('Export Content')));
326
+ menuItems.push(this.renderContentExportButton());
124
327
  }
125
328
 
126
329
  if (this.props.enableItemBanking) {
127
- menuItems.push(jsx(Menu.Item, {
128
- key: "banks",
129
- onSelect: this.props.navigateToBanks,
130
- "data-automation": "sdk-manage-item-banks-menuitem"
131
- }, jsx(IconBankLine, {
132
- css: this.props.styles.menuIcon,
133
- "data-automation": "sdk-manage-item-banks-icon"
134
- }), t('Manage Item Banks')));
330
+ menuItems.push(this.renderManageItemBanksButton());
135
331
  }
136
332
 
137
333
  if (this.props.printingEnabled) {
138
- {
139
- /* eslint-disable react/jsx-no-bind */
140
- }
141
- menuItems.push(jsx(Menu.Item, {
142
- key: "printKey",
143
- disabled: !this.props.hasQuestions || this.props.isEditing,
144
- onSelect: function onSelect() {
145
- return handlePrint(PRINT_CURRENT_PAGE);
146
- },
147
- "data-automation": "sdk-print-key-menuitem"
148
- }, jsx(IconPrinterLine, {
149
- css: this.props.styles.menuIcon,
150
- "data-automation": "sdk-print-icon"
151
- }), t('Print Key (With Answers)')));
152
- menuItems.push(jsx(Menu.Item, {
153
- key: "printBlank",
154
- disabled: !this.props.hasQuestions || this.props.isEditing,
155
- onSelect: function onSelect() {
156
- return handlePrint(PRINT_BLANK);
157
- },
158
- "data-automation": "sdk-print-blank-menuitem"
159
- }, jsx(IconPrinterLine, {
160
- css: this.props.styles.menuIcon,
161
- "data-automation": "sdk-print-blank-icon"
162
- }), t('Print Blank Quiz')));
163
- {
164
- /* eslint-enable react/jsx-no-bind */
165
- }
334
+ menuItems.push(this.renderPrintKeyButton(handlePrint));
335
+ menuItems.push(this.renderPrintBlankButton(handlePrint));
166
336
  }
167
337
 
168
338
  if (menuItems.length < 1) return;
339
+
340
+ if (this.props.iceTopNavBarEnabled) {
341
+ return jsx(TopNavBar.Item, {
342
+ id: this.props.id,
343
+ variant: "icon",
344
+ renderIcon: this.props.renderIcon,
345
+ showSubmenuChevron: false,
346
+ renderSubmenu: jsx(Drilldown, {
347
+ rootPageId: "root"
348
+ }, jsx(Drilldown.Page, {
349
+ id: "root"
350
+ }, menuItems))
351
+ }, t('More'));
352
+ }
353
+
169
354
  return jsx(Menu, {
170
355
  trigger: jsx(IconButton, {
171
356
  renderIcon: IconMoreSolid,
@@ -216,6 +401,10 @@ export var BuildingButtons = (_dec = withStyle(generateStyle, generateComponentT
216
401
  speedgraderLink: PropTypes.string,
217
402
  startExport: PropTypes.func.isRequired,
218
403
  contextUuid: PropTypes.string,
404
+ iceTopNavBarEnabled: PropTypes.bool,
405
+ id: PropTypes.string,
406
+ renderIcon: PropTypes.element,
407
+ makeStyles: PropTypes.func,
219
408
  styles: PropTypes.object
220
409
  }, _class2.defaultProps = {
221
410
  activeQuizId: null,
@@ -226,6 +415,9 @@ export var BuildingButtons = (_dec = withStyle(generateStyle, generateComponentT
226
415
  enableItemBanking: true,
227
416
  quizSaving: false,
228
417
  speedgraderLink: null,
229
- contextUuid: null
418
+ contextUuid: null,
419
+ iceTopNavBarEnabled: false,
420
+ id: 'MoreButton',
421
+ renderIcon: jsx(IconMoreSolid, null)
230
422
  }, _temp)) || _class);
231
423
  export default BuildingButtons;
@@ -1,15 +1,19 @@
1
- var generateStyle = function generateStyle(componentTheme) {
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+
3
+ var generateStyle = function generateStyle(componentTheme, props) {
4
+ var iceTopNavBarEnabled = props.iceTopNavBarEnabled;
2
5
  return {
3
6
  quizSaving: {
4
7
  color: componentTheme.quizSavingColor,
5
8
  margin: componentTheme.quizSavingMargin
6
9
  },
7
- buttonsHolder: {
8
- height: '100%',
10
+ buttonsHolder: _objectSpread({
11
+ height: '100%'
12
+ }, !iceTopNavBarEnabled && {
9
13
  marginRight: componentTheme.buttonsHolderMargin,
10
14
  display: 'flex',
11
15
  alignItems: 'center'
12
- },
16
+ }),
13
17
  menuIcon: {
14
18
  verticalAlign: 'middle',
15
19
  marginRight: componentTheme.menuIconMargin,
package/es/index.js CHANGED
@@ -31,7 +31,6 @@ export { Banks as BanksPage } from "./banks/components/Banks/index.js";
31
31
  export { Bank as BankPage } from "./banks/components/Bank/index.js";
32
32
  export { BankEntry as BankEntryPage } from "./banks/components/BankEntry/index.js";
33
33
  export { SDKBuildingButtons } from "./building/components/layout/header/SDKBuildingButtons/index.js";
34
- export { default as SDKBuildingButtonsICE } from "./building/components/layout/header/BuildingButtonsICE/index.js";
35
34
  export { Paginator } from "./common/components/shared/Paginator/index.js";
36
35
  export { SDKMenuButton } from "./common/components/SDKMenuButton.js";
37
36
  export { SDKTimer } from "./common/components/SDKTimer.js";