@instructure/quiz-core 20.9.1-rc.4 → 20.9.1-rc.6
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/es/banks/components/{SharingModal/asyncSearch.js → AsyncSearch/index.js} +17 -6
- package/es/banks/components/Banks/index.js +8 -4
- package/es/banks/components/Banks/presenter.js +60 -19
- package/es/banks/components/Banks/styles.js +0 -5
- package/es/banks/components/SharingModal/presenter.js +1 -1
- package/es/common/components/layout/Page/index.js +24 -22
- package/es/common/components/layout/Page/styles.js +26 -0
- package/es/common/components/layout/Page/theme.js +4 -3
- package/es/common/components/layout/header/HeaderMenuButton/presenter.js +16 -21
- package/es/common/components/layout/header/HeaderMenuButton/styles.js +27 -0
- package/es/common/components/layout/header/HeaderMenuButton/theme.js +4 -2
- package/es/common/components/layout/sidebar/Stimulus/Summary/presenter.js +23 -28
- package/es/common/components/layout/sidebar/Stimulus/Summary/styles.js +30 -0
- package/es/common/components/layout/sidebar/Stimulus/Summary/theme.js +4 -2
- package/es/common/reducers/ui.js +1 -1
- package/lib/banks/components/{SharingModal/asyncSearch.js → AsyncSearch/index.js} +17 -6
- package/lib/banks/components/Banks/index.js +7 -3
- package/lib/banks/components/Banks/presenter.js +63 -18
- package/lib/banks/components/Banks/styles.js +0 -5
- package/lib/banks/components/SharingModal/presenter.js +2 -2
- package/lib/common/components/layout/Page/index.js +22 -24
- package/lib/common/components/layout/Page/styles.js +37 -0
- package/lib/common/components/layout/Page/theme.js +6 -4
- package/lib/common/components/layout/header/HeaderMenuButton/presenter.js +13 -21
- package/lib/common/components/layout/header/HeaderMenuButton/styles.js +37 -0
- package/lib/common/components/layout/header/HeaderMenuButton/theme.js +6 -3
- package/lib/common/components/layout/sidebar/Stimulus/Summary/presenter.js +22 -29
- package/lib/common/components/layout/sidebar/Stimulus/Summary/styles.js +38 -0
- package/lib/common/components/layout/sidebar/Stimulus/Summary/theme.js +6 -3
- package/lib/common/reducers/ui.js +1 -1
- package/package.json +9 -9
|
@@ -372,6 +372,10 @@ export var AsyncSearch = /*#__PURE__*/function (_Component) {
|
|
|
372
372
|
}, {
|
|
373
373
|
key: "placeholder",
|
|
374
374
|
value: function placeholder() {
|
|
375
|
+
if (this.props.placeholderLabel) {
|
|
376
|
+
return this.props.placeholderLabel;
|
|
377
|
+
}
|
|
378
|
+
|
|
375
379
|
if (this.props.searchType === SHARED_WITH_ACCOUNT) {
|
|
376
380
|
return t('Enter subaccount name');
|
|
377
381
|
} else if (this.props.searchType === SHARED_WITH_COURSE) {
|
|
@@ -388,7 +392,7 @@ export var AsyncSearch = /*#__PURE__*/function (_Component) {
|
|
|
388
392
|
isShowingOptions = _this$state.isShowingOptions;
|
|
389
393
|
return /*#__PURE__*/React.createElement(Select, {
|
|
390
394
|
"data-automation": "sdk-item-bank-share-input",
|
|
391
|
-
renderLabel:
|
|
395
|
+
renderLabel: this.props.searchLabel,
|
|
392
396
|
placeholder: this.placeholder(),
|
|
393
397
|
inputValue: inputValue,
|
|
394
398
|
isShowingOptions: isShowingOptions,
|
|
@@ -413,9 +417,9 @@ AsyncSearch.propTypes = {
|
|
|
413
417
|
improvedBankSharingEnabled: PropTypes.bool.isRequired,
|
|
414
418
|
minChars: PropTypes.number,
|
|
415
419
|
onSelectionChange: PropTypes.func.isRequired,
|
|
416
|
-
getShareableCourses: PropTypes.func
|
|
417
|
-
getShareableUsers: PropTypes.func
|
|
418
|
-
getShareableSubaccounts: PropTypes.func
|
|
420
|
+
getShareableCourses: PropTypes.func,
|
|
421
|
+
getShareableUsers: PropTypes.func,
|
|
422
|
+
getShareableSubaccounts: PropTypes.func,
|
|
419
423
|
searchType: PropTypes.string,
|
|
420
424
|
selectedOption: PropTypes.arrayOf(PropTypes.shape({
|
|
421
425
|
avatar: PropTypes.string,
|
|
@@ -423,7 +427,9 @@ AsyncSearch.propTypes = {
|
|
|
423
427
|
title: PropTypes.string,
|
|
424
428
|
uuid: PropTypes.string.isRequired
|
|
425
429
|
})).isRequired,
|
|
426
|
-
selectionFilter: PropTypes.func
|
|
430
|
+
selectionFilter: PropTypes.func,
|
|
431
|
+
searchLabel: PropTypes.string,
|
|
432
|
+
placeholderLabel: PropTypes.string
|
|
427
433
|
};
|
|
428
434
|
AsyncSearch.defaultProps = {
|
|
429
435
|
debounceDelay: 500,
|
|
@@ -431,6 +437,11 @@ AsyncSearch.defaultProps = {
|
|
|
431
437
|
searchType: null,
|
|
432
438
|
selectionFilter: function selectionFilter(value) {
|
|
433
439
|
return value;
|
|
434
|
-
}
|
|
440
|
+
},
|
|
441
|
+
getShareableCourses: null,
|
|
442
|
+
getShareableUsers: null,
|
|
443
|
+
getShareableSubaccounts: null,
|
|
444
|
+
searchLabel: t('Share With'),
|
|
445
|
+
placeholder: null
|
|
435
446
|
};
|
|
436
447
|
export default AsyncSearch;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { bindActionCreators } from 'redux';
|
|
2
2
|
import { Map } from 'immutable';
|
|
3
3
|
import { Banks as BanksPresenter } from "./presenter.js";
|
|
4
|
-
import { clear, merge } from "../../../common/actions/ui.js";
|
|
4
|
+
import { set as setUI, clear, merge } from "../../../common/actions/ui.js";
|
|
5
5
|
import { connect } from "../../../common/react-redux.js";
|
|
6
6
|
import { getBanks } from "../../../banks/api/banks.js";
|
|
7
7
|
import * as modalActions from "../../../common/actions/modal.js";
|
|
@@ -15,15 +15,18 @@ function mapStateToProps(state, props) {
|
|
|
15
15
|
var sortBy = pageData.get('sortBy', 'name');
|
|
16
16
|
var sortOrder = pageData.get('sortOrder', 'ascending');
|
|
17
17
|
var searchTerms = pageData.get('searchTerms', null);
|
|
18
|
+
var searchSelection = pageData.get('searchSelection', []);
|
|
18
19
|
return {
|
|
19
20
|
itemBankSearchTableEnabled: featureOn('item_bank_search_table'),
|
|
20
|
-
|
|
21
|
+
improvedBankSharingEnabled: featureOn('improved_bank_sharing'),
|
|
21
22
|
newItemBankFilterNamesEnabled: featureOn('new_item_bank_filter_names'),
|
|
22
23
|
usedByCourseEnabled: featureOn('filter_item_banks_used_by_course'),
|
|
24
|
+
subAccountBankSharingEnabled: featureOn('sub_account_bank_sharing'),
|
|
23
25
|
scopeType: scopeType,
|
|
24
26
|
sortBy: sortBy,
|
|
25
27
|
sortOrder: sortOrder,
|
|
26
|
-
searchTerms: searchTerms
|
|
28
|
+
searchTerms: searchTerms,
|
|
29
|
+
searchSelection: searchSelection
|
|
27
30
|
};
|
|
28
31
|
}
|
|
29
32
|
|
|
@@ -33,7 +36,8 @@ function mapDispatchToProps(dispatch) {
|
|
|
33
36
|
getBanks: bindActionCreators(getBanks, dispatch),
|
|
34
37
|
openModal: bindActionCreators(modalActions.openModal, dispatch),
|
|
35
38
|
clear: bindActionCreators(clear, dispatch),
|
|
36
|
-
merge: bindActionCreators(merge, dispatch)
|
|
39
|
+
merge: bindActionCreators(merge, dispatch),
|
|
40
|
+
setUI: bindActionCreators(setUI, dispatch)
|
|
37
41
|
};
|
|
38
42
|
}
|
|
39
43
|
|
|
@@ -9,6 +9,7 @@ var _dec, _class, _class2, _temp;
|
|
|
9
9
|
/** @jsx jsx */
|
|
10
10
|
import React, { Component } from 'react';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
|
+
import isEqual from 'lodash/isEqual';
|
|
12
13
|
import { Heading } from '@instructure/ui-heading';
|
|
13
14
|
import { Img } from '@instructure/ui-img';
|
|
14
15
|
import { AccessibleContent, ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
@@ -18,17 +19,20 @@ import { Button } from '@instructure/ui-buttons';
|
|
|
18
19
|
import { TextInput } from '@instructure/ui-text-input';
|
|
19
20
|
import { SimpleSelect } from '@instructure/ui-simple-select';
|
|
20
21
|
import { withStyle, jsx } from '@instructure/emotion';
|
|
22
|
+
import { Grid } from '@instructure/ui-grid';
|
|
23
|
+
import { View } from '@instructure/ui-view';
|
|
21
24
|
import debounce from 'lodash/fp/debounce';
|
|
22
25
|
import Page from "../../../common/components/layout/Page/index.js";
|
|
23
26
|
import PaginatedCollection from "../../../common/components/shared/PaginatedCollection/index.js";
|
|
24
27
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
25
|
-
import { BANKS_BANK_FILTERS, BANKS_BANK_PAGINATION, CREATE_BANK_MODAL } from '@instructure/quiz-common';
|
|
28
|
+
import { BANKS_BANK_FILTERS, BANKS_BANK_PAGINATION, CREATE_BANK_MODAL, SHARED_WITH_ACCOUNT } from '@instructure/quiz-common';
|
|
26
29
|
import BanksList from "../../../banks/components/BanksList/index.js";
|
|
27
30
|
import CreateBankModal from "../../../banks/components/CreateBankModal/index.js";
|
|
28
31
|
import NavWrapper from "../NavWrapper/index.js";
|
|
29
32
|
import noResults from '../noResults.svg';
|
|
30
33
|
import generateStyle from "./styles.js";
|
|
31
34
|
import generateComponentTheme from "./theme.js";
|
|
35
|
+
import AsyncSearch from "../AsyncSearch/index.js";
|
|
32
36
|
var sortOrderIcons = {
|
|
33
37
|
ascending: IconArrowUpLine,
|
|
34
38
|
descending: IconArrowDownLine
|
|
@@ -89,6 +93,12 @@ export var Banks = (_dec = withStyle(generateStyle, generateComponentTheme), _de
|
|
|
89
93
|
params['search'] = _this.props.searchTerms;
|
|
90
94
|
}
|
|
91
95
|
|
|
96
|
+
if (_this.props.searchSelection.length > 0) {
|
|
97
|
+
params['account_uuids'] = _this.props.searchSelection.map(function (account) {
|
|
98
|
+
return account.uuid;
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
92
102
|
return params;
|
|
93
103
|
};
|
|
94
104
|
|
|
@@ -166,6 +176,10 @@ export var Banks = (_dec = withStyle(generateStyle, generateComponentTheme), _de
|
|
|
166
176
|
_this.search(value);
|
|
167
177
|
};
|
|
168
178
|
|
|
179
|
+
_this.handleSearchSelectionChange = function (searchSelection) {
|
|
180
|
+
_this.props.setUI([BANKS_BANK_FILTERS, 'searchSelection'], searchSelection);
|
|
181
|
+
};
|
|
182
|
+
|
|
169
183
|
_this.renderRecords = function (recordIds) {
|
|
170
184
|
return jsx(BanksList, {
|
|
171
185
|
createBankButton: _this.createBankButton,
|
|
@@ -190,7 +204,7 @@ export var Banks = (_dec = withStyle(generateStyle, generateComponentTheme), _de
|
|
|
190
204
|
};
|
|
191
205
|
|
|
192
206
|
_this.emptyPage = function () {
|
|
193
|
-
if (_this.props.searchTerms) {
|
|
207
|
+
if (_this.props.searchTerms || _this.props.searchSelection.length > 0) {
|
|
194
208
|
var message;
|
|
195
209
|
|
|
196
210
|
if (_this.props.scopeType === 'course') {
|
|
@@ -224,7 +238,7 @@ export var Banks = (_dec = withStyle(generateStyle, generateComponentTheme), _de
|
|
|
224
238
|
_createClass(Banks, [{
|
|
225
239
|
key: "componentDidUpdate",
|
|
226
240
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
227
|
-
if (prevProps.sortBy !== this.props.sortBy || prevProps.sortOrder !== this.props.sortOrder || prevProps.searchTerms !== this.props.searchTerms || prevProps.scopeType !== this.props.scopeType) {
|
|
241
|
+
if (prevProps.sortBy !== this.props.sortBy || prevProps.sortOrder !== this.props.sortOrder || prevProps.searchTerms !== this.props.searchTerms || prevProps.scopeType !== this.props.scopeType || !isEqual(prevProps.searchSelection, this.props.searchSelection)) {
|
|
228
242
|
this.props.clear(BANKS_BANK_PAGINATION);
|
|
229
243
|
}
|
|
230
244
|
}
|
|
@@ -269,12 +283,20 @@ export var Banks = (_dec = withStyle(generateStyle, generateComponentTheme), _de
|
|
|
269
283
|
display: false
|
|
270
284
|
}];
|
|
271
285
|
var searchFiltersSelectOptionIdPrefix = 'banks-search-filters-select-option-';
|
|
272
|
-
var searchFilters = jsx(
|
|
273
|
-
|
|
286
|
+
var searchFilters = jsx(View, {
|
|
287
|
+
as: "div",
|
|
288
|
+
width: "100%"
|
|
289
|
+
}, jsx(Grid, {
|
|
290
|
+
startAt: "medium",
|
|
291
|
+
colSpacing: "small",
|
|
292
|
+
rowSpacing: "small",
|
|
293
|
+
vAlign: "bottom"
|
|
294
|
+
}, jsx(Grid.Row, null, jsx(Grid.Col, {
|
|
295
|
+
width: "auto"
|
|
274
296
|
}, jsx(SimpleSelect, {
|
|
275
297
|
onChange: this.handleBanksParentChange,
|
|
276
298
|
value: this.props.scopeType,
|
|
277
|
-
renderLabel:
|
|
299
|
+
renderLabel: t('Filter By'),
|
|
278
300
|
width: "13rem"
|
|
279
301
|
}, scopeOptions.map(function (option) {
|
|
280
302
|
return jsx(SimpleSelect.Option, {
|
|
@@ -282,16 +304,27 @@ export var Banks = (_dec = withStyle(generateStyle, generateComponentTheme), _de
|
|
|
282
304
|
key: option.slug,
|
|
283
305
|
value: option.slug
|
|
284
306
|
}, option.translation);
|
|
285
|
-
}))), jsx(
|
|
286
|
-
|
|
307
|
+
}))), jsx(Grid.Col, {
|
|
308
|
+
width: 4
|
|
287
309
|
}, jsx(TextInput, {
|
|
288
|
-
renderLabel:
|
|
310
|
+
renderLabel: t('Bank'),
|
|
289
311
|
type: "search",
|
|
290
312
|
value: this.state.searchTerms,
|
|
291
313
|
onChange: this.handleSearchInputChange,
|
|
292
|
-
placeholder: t('Search
|
|
314
|
+
placeholder: t('Search Banks'),
|
|
293
315
|
"data-automation": "sdk-search-bank-textinput"
|
|
294
|
-
}))
|
|
316
|
+
})), this.props.subAccountBankSharingEnabled && jsx(Grid.Col, {
|
|
317
|
+
width: 4
|
|
318
|
+
}, jsx(AsyncSearch, {
|
|
319
|
+
getShareableSubaccounts: this.props.getShareableSubaccounts,
|
|
320
|
+
improvedBankSharingEnabled: this.props.improvedBankSharingEnabled,
|
|
321
|
+
minChars: this.props.minChars,
|
|
322
|
+
onSelectionChange: this.handleSearchSelectionChange,
|
|
323
|
+
searchType: SHARED_WITH_ACCOUNT,
|
|
324
|
+
selectedOption: this.props.searchSelection,
|
|
325
|
+
searchLabel: t('Account'),
|
|
326
|
+
placeholderLabel: t('Search Accounts')
|
|
327
|
+
})))));
|
|
295
328
|
var sortingFiltersSelectOptionIdPrefix = 'banks-sorting-filters-select-option-';
|
|
296
329
|
var sortingFilters = jsx(React.Fragment, null, jsx("div", {
|
|
297
330
|
display: "inline-block",
|
|
@@ -345,7 +378,7 @@ export var Banks = (_dec = withStyle(generateStyle, generateComponentTheme), _de
|
|
|
345
378
|
key: "renderHeader",
|
|
346
379
|
value: function renderHeader() {
|
|
347
380
|
return jsx("div", {
|
|
348
|
-
css: [this.props.styles.filters, !this.props.
|
|
381
|
+
css: [this.props.styles.filters, !this.props.improvedBankSharingEnabled ? this.props.styles.borderedBottom : {}]
|
|
349
382
|
}, jsx(Heading, {
|
|
350
383
|
as: this.props.isCompact ? 'h2' : 'h1',
|
|
351
384
|
level: "h1"
|
|
@@ -391,7 +424,7 @@ export var Banks = (_dec = withStyle(generateStyle, generateComponentTheme), _de
|
|
|
391
424
|
value: function render() {
|
|
392
425
|
return jsx(Page, null, this.renderNav(), jsx("div", {
|
|
393
426
|
css: this.props.styles.content
|
|
394
|
-
}, this.renderHeader(), this.props.
|
|
427
|
+
}, this.renderHeader(), this.props.improvedBankSharingEnabled && this.renderFilters(), this.renderBanksSearchResults(), jsx(CreateBankModal, {
|
|
395
428
|
itemBanksScope: this.props.scope
|
|
396
429
|
})));
|
|
397
430
|
}
|
|
@@ -412,8 +445,8 @@ export var Banks = (_dec = withStyle(generateStyle, generateComponentTheme), _de
|
|
|
412
445
|
account_name: PropTypes.string
|
|
413
446
|
}),
|
|
414
447
|
// from consumer
|
|
415
|
-
clear: PropTypes.func,
|
|
416
|
-
|
|
448
|
+
clear: PropTypes.func.isRequired,
|
|
449
|
+
improvedBankSharingEnabled: PropTypes.bool,
|
|
417
450
|
getBanks: PropTypes.func.isRequired,
|
|
418
451
|
getCourseInfo: PropTypes.func,
|
|
419
452
|
// from consumer
|
|
@@ -449,10 +482,18 @@ export var Banks = (_dec = withStyle(generateStyle, generateComponentTheme), _de
|
|
|
449
482
|
}).isRequired,
|
|
450
483
|
scopeType: PropTypes.string,
|
|
451
484
|
searchTerms: PropTypes.string,
|
|
485
|
+
searchSelection: PropTypes.arrayOf(PropTypes.shape({
|
|
486
|
+
avatar: PropTypes.string,
|
|
487
|
+
fullName: PropTypes.string,
|
|
488
|
+
title: PropTypes.string,
|
|
489
|
+
uuid: PropTypes.string.isRequired
|
|
490
|
+
})),
|
|
452
491
|
sortBy: PropTypes.string,
|
|
453
492
|
sortOrder: PropTypes.string,
|
|
454
493
|
usedByCourseEnabled: PropTypes.bool,
|
|
455
494
|
itemBankSearchTableEnabled: PropTypes.bool,
|
|
495
|
+
setUI: PropTypes.func.isRequired,
|
|
496
|
+
subAccountBankSharingEnabled: PropTypes.bool,
|
|
456
497
|
// eslint-disable-next-line react/require-default-props,react/forbid-prop-types
|
|
457
498
|
styles: PropTypes.object
|
|
458
499
|
}, _class2.defaultProps = {
|
|
@@ -469,18 +510,18 @@ export var Banks = (_dec = withStyle(generateStyle, generateComponentTheme), _de
|
|
|
469
510
|
isCompact: false,
|
|
470
511
|
navigateToBuild: null,
|
|
471
512
|
onShare: function onShare() {},
|
|
472
|
-
clear: function clear() {},
|
|
473
|
-
merge: function merge() {},
|
|
474
513
|
scope: {},
|
|
475
514
|
returnToUrl: null,
|
|
476
|
-
|
|
515
|
+
improvedBankSharingEnabled: false,
|
|
477
516
|
scopeType: 'user',
|
|
478
517
|
sortBy: 'name',
|
|
479
518
|
sortOrder: 'ascending',
|
|
480
519
|
searchTerms: null,
|
|
520
|
+
searchSelection: [],
|
|
481
521
|
newItemBankFilterNamesEnabled: false,
|
|
482
522
|
usedByCourseEnabled: false,
|
|
483
|
-
itemBankSearchTableEnabled: false
|
|
523
|
+
itemBankSearchTableEnabled: false,
|
|
524
|
+
subAccountBankSharingEnabled: false
|
|
484
525
|
}, _class2.contextTypes = {
|
|
485
526
|
locale: PropTypes.string
|
|
486
527
|
}, _temp)) || _class);
|
|
@@ -31,7 +31,7 @@ import { withStyle, jsx } from '@instructure/emotion';
|
|
|
31
31
|
import elementsForSelectors from "../../../common/util/ElementsForSelectors.js";
|
|
32
32
|
import CustomPropTypes from "../../../common/util/CustomPropTypes.js";
|
|
33
33
|
import ShareList from "./ShareList/index.js";
|
|
34
|
-
import AsyncSearch from "
|
|
34
|
+
import AsyncSearch from "../AsyncSearch/index.js";
|
|
35
35
|
import Spinner from "../../../common/components/shared/spinner/Spinner.js";
|
|
36
36
|
import generateStyle from "./styles.js";
|
|
37
37
|
import generateComponentTheme from "./theme.js";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
1
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
2
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
3
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
@@ -6,21 +5,13 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
6
5
|
|
|
7
6
|
var _dec, _class, _class2, _temp;
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
/** @jsx jsx */
|
|
9
|
+
import { Component } from 'react';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
template: function template(theme) {
|
|
16
|
-
return "\n\n.KVDkV_gasz{display:flex;font-family:".concat(theme.fontFamily || 'inherit', ";height:100%;margin:0}\n\n@media screen and (--phoneBreakPoint){.KVDkV_caGd{-webkit-overflow-scrolling:touch}}\n\n.KVDkV_caGd{transition:").concat(theme.contentTransition || 'inherit', ";width:100%}\n\n.KVDkV_dxaC{overflow-x:hidden;overflow-y:auto}\n\n@media print{.KVDkV_gasz{display:block}}");
|
|
17
|
-
},
|
|
18
|
-
'wrapper': 'KVDkV_gasz',
|
|
19
|
-
'content': 'KVDkV_caGd',
|
|
20
|
-
'scrollable': 'KVDkV_dxaC'
|
|
21
|
-
};
|
|
22
|
-
import theme from "./theme.js";
|
|
23
|
-
export var Page = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
11
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
12
|
+
import generateStyle from "./styles.js";
|
|
13
|
+
import generateComponentTheme from "./theme.js";
|
|
14
|
+
export var Page = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
24
15
|
_inherits(Page, _Component);
|
|
25
16
|
|
|
26
17
|
var _super = _createSuper(Page);
|
|
@@ -32,6 +23,16 @@ export var Page = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
|
|
|
32
23
|
}
|
|
33
24
|
|
|
34
25
|
_createClass(Page, [{
|
|
26
|
+
key: "componentDidMount",
|
|
27
|
+
value: function componentDidMount() {
|
|
28
|
+
this.props.makeStyles();
|
|
29
|
+
}
|
|
30
|
+
}, {
|
|
31
|
+
key: "componentDidUpdate",
|
|
32
|
+
value: function componentDidUpdate() {
|
|
33
|
+
this.props.makeStyles();
|
|
34
|
+
}
|
|
35
|
+
}, {
|
|
35
36
|
key: "shouldRenderSidebar",
|
|
36
37
|
value: function shouldRenderSidebar() {
|
|
37
38
|
return this.props.sidebarComponent != null && this.props.sidebarOpen != null;
|
|
@@ -39,7 +40,7 @@ export var Page = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
|
|
|
39
40
|
}, {
|
|
40
41
|
key: "renderSidebar",
|
|
41
42
|
value: function renderSidebar() {
|
|
42
|
-
return
|
|
43
|
+
return jsx(this.props.sidebarComponent, {
|
|
43
44
|
role: this.props.sidebarRole,
|
|
44
45
|
sidebarOpen: this.props.sidebarOpen,
|
|
45
46
|
toggleSidebar: this.props.toggleSidebar
|
|
@@ -48,15 +49,14 @@ export var Page = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
|
|
|
48
49
|
}, {
|
|
49
50
|
key: "render",
|
|
50
51
|
value: function render() {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}, this.shouldRenderSidebar() ? this.renderSidebar() : null, /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
return jsx("div", {
|
|
53
|
+
css: this.props.styles.wrapper
|
|
54
|
+
}, this.shouldRenderSidebar() ? this.renderSidebar() : null, jsx("div", {
|
|
55
55
|
// this component is focusable for SkipToContent
|
|
56
56
|
tabIndex: "-1",
|
|
57
57
|
ref: this.props.childrenWrapperRef,
|
|
58
58
|
role: this.props.contentRole,
|
|
59
|
-
|
|
59
|
+
css: this.props.styles.childrenWrapper
|
|
60
60
|
}, this.props.children));
|
|
61
61
|
}
|
|
62
62
|
}]);
|
|
@@ -70,7 +70,9 @@ export var Page = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
|
|
|
70
70
|
sidebarComponent: PropTypes.func,
|
|
71
71
|
sidebarOpen: PropTypes.bool,
|
|
72
72
|
sidebarRole: PropTypes.string,
|
|
73
|
-
toggleSidebar: PropTypes.func
|
|
73
|
+
toggleSidebar: PropTypes.func,
|
|
74
|
+
styles: PropTypes.object,
|
|
75
|
+
makeStyles: PropTypes.func
|
|
74
76
|
}, _class2.defaultProps = {
|
|
75
77
|
childrenWrapperRef: function childrenWrapperRef() {},
|
|
76
78
|
contentRole: 'main',
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
|
|
4
|
+
var generateStyle = function generateStyle(componentTheme, props) {
|
|
5
|
+
var printMq = '@media print';
|
|
6
|
+
var isScrollable = props.sidebarComponent != null && props.sidebarOpen != null;
|
|
7
|
+
return {
|
|
8
|
+
wrapper: _defineProperty({
|
|
9
|
+
display: 'flex',
|
|
10
|
+
fontFamily: componentTheme.fontFamily,
|
|
11
|
+
height: '100%',
|
|
12
|
+
margin: '0'
|
|
13
|
+
}, printMq, {
|
|
14
|
+
display: 'block'
|
|
15
|
+
}),
|
|
16
|
+
childrenWrapper: _objectSpread(_objectSpread({}, isScrollable && {
|
|
17
|
+
overflowX: 'hidden',
|
|
18
|
+
overflowY: 'auto'
|
|
19
|
+
}), {}, {
|
|
20
|
+
transition: componentTheme.contentTransition,
|
|
21
|
+
width: '100%'
|
|
22
|
+
})
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default generateStyle;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
2
2
|
var typography = _ref.typography,
|
|
3
3
|
breakpoints = _ref.breakpoints,
|
|
4
4
|
transitions = _ref.transitions;
|
|
5
5
|
return {
|
|
6
6
|
fontFamily: typography.fontFamily,
|
|
7
|
-
phoneBreakPoint: "max-width: ".concat(breakpoints.medium),
|
|
8
7
|
contentTransition: "transform ".concat(transitions.duration)
|
|
9
8
|
};
|
|
10
|
-
}
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default generateComponentTheme;
|
|
@@ -6,25 +6,19 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
6
6
|
|
|
7
7
|
var _dec, _class, _class2, _temp;
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
/** @jsx jsx */
|
|
10
|
+
import { Component } from 'react';
|
|
10
11
|
import PropTypes from 'prop-types';
|
|
11
12
|
import { IconHamburgerLine } from '@instructure/ui-icons';
|
|
12
13
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
13
|
-
import {
|
|
14
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
14
15
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
'menuButton': 'cUqra_cdzo'
|
|
22
|
-
};
|
|
23
|
-
import theme from "./theme.js";
|
|
24
|
-
|
|
25
|
-
var _ref = /*#__PURE__*/React.createElement(IconHamburgerLine, null);
|
|
26
|
-
|
|
27
|
-
export var HeaderMenuButton = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
16
|
+
import generateStyle from "./styles.js";
|
|
17
|
+
import generateComponentTheme from "./theme.js";
|
|
18
|
+
|
|
19
|
+
var _ref = jsx(IconHamburgerLine, null);
|
|
20
|
+
|
|
21
|
+
export var HeaderMenuButton = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
28
22
|
_inherits(HeaderMenuButton, _Component);
|
|
29
23
|
|
|
30
24
|
var _super = _createSuper(HeaderMenuButton);
|
|
@@ -62,14 +56,14 @@ export var HeaderMenuButton = (_dec = themeable(theme, styles), _dec(_class = (_
|
|
|
62
56
|
return null;
|
|
63
57
|
}
|
|
64
58
|
|
|
65
|
-
return
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
-
|
|
59
|
+
return jsx("div", {
|
|
60
|
+
css: this.props.styles.title
|
|
61
|
+
}, jsx("button", {
|
|
62
|
+
css: this.props.styles.menuButton,
|
|
69
63
|
onClick: this.toggleNavigator,
|
|
70
64
|
tabIndex: "0",
|
|
71
65
|
"data-automation": "sdk-hamburger-button"
|
|
72
|
-
}, _ref,
|
|
66
|
+
}, _ref, jsx(ScreenReaderContent, null, sidebarOpen ? t('Hide Question Navigator Menu') : t('Show Question Navigator Menu'))));
|
|
73
67
|
}
|
|
74
68
|
}]);
|
|
75
69
|
|
|
@@ -79,6 +73,7 @@ export var HeaderMenuButton = (_dec = themeable(theme, styles), _dec(_class = (_
|
|
|
79
73
|
sidebarMenuClick: PropTypes.func.isRequired,
|
|
80
74
|
hidden: PropTypes.bool.isRequired,
|
|
81
75
|
sidebarOpen: PropTypes.bool.isRequired,
|
|
82
|
-
screenreaderNotification: PropTypes.func.isRequired
|
|
76
|
+
screenreaderNotification: PropTypes.func.isRequired,
|
|
77
|
+
styles: PropTypes.object
|
|
83
78
|
}, _temp)) || _class);
|
|
84
79
|
export default HeaderMenuButton;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
|
|
3
|
+
var generateStyle = function generateStyle(componentTheme) {
|
|
4
|
+
var mq = "@media screen and (".concat(componentTheme.phoneBreakPoint, ")");
|
|
5
|
+
return {
|
|
6
|
+
title: _defineProperty({
|
|
7
|
+
/* default to none - since toggle moved to sidebar on non mobile */
|
|
8
|
+
display: 'none',
|
|
9
|
+
height: 'inherit'
|
|
10
|
+
}, mq, {
|
|
11
|
+
display: 'flex',
|
|
12
|
+
alignItems: 'center'
|
|
13
|
+
}),
|
|
14
|
+
menuButton: {
|
|
15
|
+
border: 'none',
|
|
16
|
+
fontSize: componentTheme.menuButtonFontSize,
|
|
17
|
+
color: componentTheme.menuButtonColor,
|
|
18
|
+
background: 'transparent',
|
|
19
|
+
height: 'inherit',
|
|
20
|
+
'&:hover': {
|
|
21
|
+
opacity: componentTheme.menuButtonHoverOpacity
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default generateStyle;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
2
2
|
var breakpoints = _ref.breakpoints,
|
|
3
3
|
colors = _ref.colors,
|
|
4
4
|
typography = _ref.typography;
|
|
@@ -8,4 +8,6 @@ export default function generator(_ref) {
|
|
|
8
8
|
menuButtonColor: colors.licorice,
|
|
9
9
|
menuButtonHoverOpacity: '0.6'
|
|
10
10
|
};
|
|
11
|
-
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default generateComponentTheme;
|
|
@@ -5,25 +5,16 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
5
5
|
|
|
6
6
|
var _dec, _class, _class2, _temp;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/** @jsx jsx */
|
|
9
|
+
import { Component } from 'react';
|
|
9
10
|
import PropTypes from 'prop-types';
|
|
10
11
|
import { Text } from '@instructure/ui-text';
|
|
11
|
-
import {
|
|
12
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
12
13
|
import { DISPLAY_AS_SUMMARY_LIMIT } from "../presenter.js";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
template: function template(theme) {
|
|
16
|
-
return "\n\n.dhBxf_cltt{flex-grow:2}\n\n.dhBxf_eXht{flex-grow:1;text-align:right}\n\n[dir=ltr] .dhBxf_eXht,[dir=rtl] .dhBxf_eXht{text-align:right}\n\n.dhBxf_flYR{flex-grow:1}\n\n.dhBxf_dMbU{border:dotted ".concat(theme.itemContainerBorderWidth || 'inherit', ";border-color:").concat(theme.itemContainerBorderColor || 'inherit', ";color:").concat(theme.itemContainerColor || 'inherit', ";display:flex;padding:").concat(theme.itemContainerPadding || 'inherit', ";width:100%}\n\n.dhBxf_doNn{display:flex;flex-grow:1;margin:").concat(theme.summaryMargin || 'inherit', ";margin-left:").concat(theme.summaryMarginLeft || 'inherit', "}");
|
|
17
|
-
},
|
|
18
|
-
'middleSection': 'dhBxf_cltt',
|
|
19
|
-
'endSection': 'dhBxf_eXht',
|
|
20
|
-
'questionCount': 'dhBxf_flYR',
|
|
21
|
-
'itemsContainer': 'dhBxf_dMbU',
|
|
22
|
-
'summary': 'dhBxf_doNn'
|
|
23
|
-
};
|
|
24
|
-
import theme from "./theme.js";
|
|
14
|
+
import generateStyle from "./styles.js";
|
|
15
|
+
import generateComponentTheme from "./theme.js";
|
|
25
16
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
26
|
-
export var Summary = (_dec =
|
|
17
|
+
export var Summary = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
27
18
|
_inherits(Summary, _Component);
|
|
28
19
|
|
|
29
20
|
var _super = _createSuper(Summary);
|
|
@@ -100,7 +91,7 @@ export var Summary = (_dec = themeable(theme, styles), _dec(_class = (_temp = _c
|
|
|
100
91
|
isShowingItems = _this$props2.isShowingItems;
|
|
101
92
|
|
|
102
93
|
if (!isDragging) {
|
|
103
|
-
return
|
|
94
|
+
return jsx(Text, {
|
|
104
95
|
size: "small",
|
|
105
96
|
weight: "light"
|
|
106
97
|
}, isShowingItems ? t('Collapse') : t('Expand'));
|
|
@@ -116,26 +107,29 @@ export var Summary = (_dec = themeable(theme, styles), _dec(_class = (_temp = _c
|
|
|
116
107
|
}
|
|
117
108
|
|
|
118
109
|
var id = "stimulus-summary-content-".concat(this.props.stimulusId);
|
|
119
|
-
return
|
|
110
|
+
return jsx("div", {
|
|
120
111
|
role: "button",
|
|
121
112
|
tabIndex: "0",
|
|
122
113
|
"aria-expanded": this.props.isShowingItems,
|
|
123
114
|
"aria-controls": id,
|
|
124
|
-
|
|
115
|
+
"data-testid": "summary",
|
|
116
|
+
css: this.props.styles.summary,
|
|
125
117
|
onClick: this.handleShowItems,
|
|
126
118
|
onKeyDown: this.handleKeyDown
|
|
127
|
-
},
|
|
119
|
+
}, jsx("div", {
|
|
128
120
|
id: id,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
121
|
+
css: this.props.styles.itemsContainer,
|
|
122
|
+
"data-testid": "items-container"
|
|
123
|
+
}, jsx("div", {
|
|
124
|
+
css: this.props.styles.questionCount,
|
|
125
|
+
"data-testid": "question-count"
|
|
126
|
+
}, jsx(Text, {
|
|
133
127
|
size: "small",
|
|
134
128
|
weight: "light"
|
|
135
|
-
}, this.getCountText())),
|
|
136
|
-
|
|
137
|
-
}),
|
|
138
|
-
|
|
129
|
+
}, this.getCountText())), jsx("div", {
|
|
130
|
+
css: this.props.styles.middleSection
|
|
131
|
+
}), jsx("div", {
|
|
132
|
+
css: this.props.styles.endSection
|
|
139
133
|
}, this.renderEndSectionContent())));
|
|
140
134
|
}
|
|
141
135
|
}]);
|
|
@@ -152,7 +146,8 @@ export var Summary = (_dec = themeable(theme, styles), _dec(_class = (_temp = _c
|
|
|
152
146
|
isShowingItems: PropTypes.bool,
|
|
153
147
|
stimulusId: PropTypes.string.isRequired,
|
|
154
148
|
// from connected component
|
|
155
|
-
setSidebarStimulusIsShowing: PropTypes.func.isRequired
|
|
149
|
+
setSidebarStimulusIsShowing: PropTypes.func.isRequired,
|
|
150
|
+
styles: PropTypes.object
|
|
156
151
|
}, _class2.defaultProps = {
|
|
157
152
|
isDragging: false,
|
|
158
153
|
isShowingItems: false
|