@instructure/quiz-core 20.36.2 → 20.38.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.
Files changed (161) hide show
  1. package/es/banks/components/AddToBankModal/presenter.js +1 -2
  2. package/es/banks/components/AsyncSearch/index.js +1 -2
  3. package/es/banks/components/BankEntry/presenter.js +1 -2
  4. package/es/banks/components/BankSearch/presenter.js +1 -3
  5. package/es/banks/components/Banks/index.js +0 -1
  6. package/es/banks/components/Banks/presenter.js +5 -9
  7. package/es/banks/components/CopyMoveBankEntryModal/presenter.js +1 -2
  8. package/es/banks/components/CreateBankModal/presenter.js +1 -2
  9. package/es/banks/components/EditBankModal/presenter.js +1 -2
  10. package/es/banks/components/NavWrapper/externalStyles.js +5 -0
  11. package/es/banks/components/NavWrapper/styles.js +4 -3
  12. package/es/banks/components/SharingModal/RootAccountSharing.js +1 -2
  13. package/es/banks/components/SharingModal/ShareList/index.js +1 -2
  14. package/es/banks/components/SharingModal/index.js +0 -2
  15. package/es/banks/components/SharingModal/presenter.js +18 -78
  16. package/es/building/api/stimuli.js +2 -1
  17. package/es/building/components/resources/DeleteStimulusModal/presenter.js +14 -7
  18. package/es/building/components/resources/quizEntry/QuizEntry/presenter.js +11 -4
  19. package/es/building/components/resources/quizEntry/QuizEntryEdit/Footer/presenter.js +1 -2
  20. package/es/building/components/resources/quizEntry/QuizEntryEdit/Header/index.js +40 -23
  21. package/es/building/components/resources/quizEntry/QuizEntryEdit/Header/styles.js +1 -29
  22. package/es/building/components/resources/quizEntry/QuizEntryEdit/Header/theme.js +1 -5
  23. package/es/common/actions/modifications.js +3 -2
  24. package/es/common/components/AccessCodeTextInput/AccessCodeTextInput.stories.js +11 -0
  25. package/es/common/components/AccessCodeTextInput/index.js +47 -0
  26. package/es/common/components/ImportModal/presenter.js +1 -2
  27. package/es/common/components/MaskedTextInput/MaskedTextInput.stories.js +19 -0
  28. package/es/common/components/MaskedTextInput/index.js +64 -0
  29. package/es/common/components/layout/Page/styles.js +7 -4
  30. package/es/common/components/layout/Page/theme.js +1 -2
  31. package/es/common/components/layout/header/Calculator/presenter.js +2 -2
  32. package/es/common/components/layout/navbar/externalStyles.js +7 -0
  33. package/es/common/components/layout/navbar/styles.js +4 -5
  34. package/es/common/components/layout/sidebar/Sidebar/externalStyles.js +10 -0
  35. package/es/common/components/layout/sidebar/Sidebar/index.js +26 -4
  36. package/es/common/components/layout/sidebar/Sidebar/styles.js +4 -6
  37. package/es/common/components/layout/sidebar/SidebarItem/presenter.js +13 -7
  38. package/es/common/components/layout/sidebar/Stimulus/presenter.js +14 -7
  39. package/es/common/components/resources/item/ItemEdit/presenter.js +2 -4
  40. package/es/common/components/resources/quiz/AddContent/Body/presenter.js +2 -2
  41. package/es/common/components/resources/quiz/instructions/styles.js +8 -6
  42. package/es/common/components/resources/quiz/instructions/theme.js +1 -2
  43. package/es/common/components/resources/stimulus/Stimulus/presenter.js +3 -2
  44. package/es/common/components/resources/stimulus/StimulusEdit/presenter.js +14 -4
  45. package/es/common/components/resources/stimulus/StimulusEdit/styles.js +1 -5
  46. package/es/common/components/resources/stimulus/StimulusEdit/theme.js +0 -2
  47. package/es/common/components/resources/stimulus/StimulusEditInfo/presenter.js +51 -37
  48. package/es/common/components/resources/stimulus/StimulusShow/index.js +10 -4
  49. package/es/common/components/resources/stimulus/StimulusShow/styles.js +0 -7
  50. package/es/common/components/resources/stimulus/StimulusShow/theme.js +0 -3
  51. package/es/common/components/shared/GenericAsyncSearch/GenericAsyncSearch.js +1 -2
  52. package/es/common/components/shared/InteractionTypes/index.js +4 -1
  53. package/es/common/components/shared/InteractionTypes/presenter.js +38 -15
  54. package/es/common/components/shared/TagSelect/presenter.js +1 -2
  55. package/es/common/components/shared/TimeUnitsInput/index.js +11 -9
  56. package/es/common/components/shared/drag_and_drop/dragAndDropUtils.js +3 -0
  57. package/es/common/records/QuizEntry.js +5 -0
  58. package/es/common/records/Stimulus.js +2 -1
  59. package/es/common/reducers/modifications.js +6 -3
  60. package/es/common/util/warningHelpers.js +15 -5
  61. package/es/index.js +3 -1
  62. package/es/moderating/components/resources/AccommodationsModal/ExtraTimeSettings/index.js +2 -2
  63. package/es/moderating/components/resources/AccommodationsModal/index.js +5 -13
  64. package/es/moderating/components/resources/ModerateTable/presenter.js +5 -4
  65. package/es/moderating/components/sidebar/ModerateTray/presenter.js +21 -31
  66. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/MatchingType/MatchingTypeTable/presenter.js +1 -2
  67. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/NumericType/ChoiceTypeWithInfo/presenter.js +1 -1
  68. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/NumericType/presenter.js +1 -2
  69. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/RichFillBlankType/ChoiceGroupTypeTable/presenter.js +1 -2
  70. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/AfsTableWrapper/presenter.js +1 -2
  71. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/AggregationTable/presenter.js +1 -2
  72. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/ChoiceTypeTable/presenter.js +1 -2
  73. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/ExpandableCard/presenter.js +1 -2
  74. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/presenter.js +1 -2
  75. package/es/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/presenter.js +1 -2
  76. package/es/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +1 -2
  77. package/es/reporting/components/resources/ReportCard/index.js +1 -2
  78. package/es/reporting/components/resources/StudentAnalysis/ReportCard/presenter.js +1 -2
  79. package/es/reporting/components/resources/common/AnalysisUpdateDate/index.js +1 -1
  80. package/es/taking/api/taking.js +4 -0
  81. package/lib/banks/components/AddToBankModal/presenter.js +1 -2
  82. package/lib/banks/components/AsyncSearch/index.js +8 -9
  83. package/lib/banks/components/BankEntry/presenter.js +1 -2
  84. package/lib/banks/components/BankSearch/presenter.js +4 -6
  85. package/lib/banks/components/Banks/index.js +0 -1
  86. package/lib/banks/components/Banks/presenter.js +9 -13
  87. package/lib/banks/components/CopyMoveBankEntryModal/presenter.js +1 -2
  88. package/lib/banks/components/CreateBankModal/presenter.js +1 -2
  89. package/lib/banks/components/EditBankModal/presenter.js +1 -2
  90. package/lib/banks/components/NavWrapper/externalStyles.js +12 -0
  91. package/lib/banks/components/NavWrapper/styles.js +5 -3
  92. package/lib/banks/components/SharingModal/RootAccountSharing.js +3 -4
  93. package/lib/banks/components/SharingModal/ShareList/index.js +3 -4
  94. package/lib/banks/components/SharingModal/index.js +0 -2
  95. package/lib/banks/components/SharingModal/presenter.js +20 -80
  96. package/lib/building/api/stimuli.js +2 -1
  97. package/lib/building/components/resources/DeleteStimulusModal/presenter.js +14 -7
  98. package/lib/building/components/resources/quizEntry/QuizEntry/presenter.js +11 -4
  99. package/lib/building/components/resources/quizEntry/QuizEntryEdit/Footer/presenter.js +3 -4
  100. package/lib/building/components/resources/quizEntry/QuizEntryEdit/Header/index.js +39 -22
  101. package/lib/building/components/resources/quizEntry/QuizEntryEdit/Header/styles.js +1 -29
  102. package/lib/building/components/resources/quizEntry/QuizEntryEdit/Header/theme.js +1 -5
  103. package/lib/common/actions/modifications.js +3 -2
  104. package/lib/common/components/AccessCodeTextInput/AccessCodeTextInput.stories.js +20 -0
  105. package/lib/common/components/AccessCodeTextInput/index.js +57 -0
  106. package/lib/common/components/ImportModal/presenter.js +1 -2
  107. package/lib/common/components/MaskedTextInput/MaskedTextInput.stories.js +29 -0
  108. package/lib/common/components/MaskedTextInput/index.js +74 -0
  109. package/lib/common/components/layout/Page/styles.js +7 -4
  110. package/lib/common/components/layout/Page/theme.js +1 -2
  111. package/lib/common/components/layout/header/Calculator/presenter.js +2 -2
  112. package/lib/common/components/layout/navbar/externalStyles.js +14 -0
  113. package/lib/common/components/layout/navbar/styles.js +5 -5
  114. package/lib/common/components/layout/sidebar/Sidebar/externalStyles.js +17 -0
  115. package/lib/common/components/layout/sidebar/Sidebar/index.js +25 -3
  116. package/lib/common/components/layout/sidebar/Sidebar/styles.js +4 -6
  117. package/lib/common/components/layout/sidebar/SidebarItem/presenter.js +15 -9
  118. package/lib/common/components/layout/sidebar/Stimulus/presenter.js +16 -9
  119. package/lib/common/components/resources/item/ItemEdit/presenter.js +2 -4
  120. package/lib/common/components/resources/quiz/AddContent/Body/presenter.js +2 -2
  121. package/lib/common/components/resources/quiz/instructions/styles.js +8 -6
  122. package/lib/common/components/resources/quiz/instructions/theme.js +1 -2
  123. package/lib/common/components/resources/stimulus/Stimulus/presenter.js +3 -2
  124. package/lib/common/components/resources/stimulus/StimulusEdit/presenter.js +14 -4
  125. package/lib/common/components/resources/stimulus/StimulusEdit/styles.js +1 -5
  126. package/lib/common/components/resources/stimulus/StimulusEdit/theme.js +0 -2
  127. package/lib/common/components/resources/stimulus/StimulusEditInfo/presenter.js +56 -42
  128. package/lib/common/components/resources/stimulus/StimulusShow/index.js +9 -3
  129. package/lib/common/components/resources/stimulus/StimulusShow/styles.js +0 -7
  130. package/lib/common/components/resources/stimulus/StimulusShow/theme.js +0 -3
  131. package/lib/common/components/shared/GenericAsyncSearch/GenericAsyncSearch.js +3 -4
  132. package/lib/common/components/shared/InteractionTypes/index.js +4 -1
  133. package/lib/common/components/shared/InteractionTypes/presenter.js +38 -15
  134. package/lib/common/components/shared/TagSelect/presenter.js +4 -5
  135. package/lib/common/components/shared/TimeUnitsInput/index.js +12 -10
  136. package/lib/common/components/shared/drag_and_drop/dragAndDropUtils.js +3 -0
  137. package/lib/common/records/QuizEntry.js +5 -0
  138. package/lib/common/records/Stimulus.js +2 -1
  139. package/lib/common/reducers/modifications.js +6 -3
  140. package/lib/common/util/warningHelpers.js +15 -5
  141. package/lib/index.js +22 -6
  142. package/lib/moderating/components/resources/AccommodationsModal/ExtraTimeSettings/index.js +7 -7
  143. package/lib/moderating/components/resources/AccommodationsModal/index.js +5 -13
  144. package/lib/moderating/components/resources/ModerateTable/presenter.js +7 -6
  145. package/lib/moderating/components/sidebar/ModerateTray/presenter.js +21 -31
  146. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/MatchingType/MatchingTypeTable/presenter.js +6 -7
  147. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/NumericType/ChoiceTypeWithInfo/presenter.js +9 -9
  148. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/NumericType/presenter.js +2 -3
  149. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/RichFillBlankType/ChoiceGroupTypeTable/presenter.js +5 -6
  150. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/AfsTableWrapper/presenter.js +4 -5
  151. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/AggregationTable/presenter.js +3 -4
  152. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/ChoiceTypeTable/presenter.js +3 -4
  153. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/ExpandableCard/presenter.js +8 -9
  154. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/presenter.js +20 -21
  155. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/presenter.js +9 -10
  156. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +20 -21
  157. package/lib/reporting/components/resources/ReportCard/index.js +1 -2
  158. package/lib/reporting/components/resources/StudentAnalysis/ReportCard/presenter.js +9 -10
  159. package/lib/reporting/components/resources/common/AnalysisUpdateDate/index.js +2 -2
  160. package/lib/taking/api/taking.js +4 -0
  161. package/package.json +9 -12
@@ -10,15 +10,15 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
10
10
  import { IconTextLeftLine } from '@instructure/ui-icons';
11
11
  import { jsx } from '@instructure/emotion';
12
12
  import { Link } from '@instructure/ui-link';
13
- import { Flex } from '@instructure/ui-flex';
14
- import { ScreenReaderContent } from '@instructure/ui-a11y-content';
15
13
  import Collection from "./Collection/index.js";
16
14
  import Title from "./Title/index.js";
17
15
  import Summary from "./Summary/index.js";
18
16
  import generateStyle from "./styles.js";
19
17
  import generateComponentTheme from "./theme.js";
20
18
  import t from '@instructure/quiz-i18n/es/format-message';
21
- import { END_EDITING_TRIGGER_CLASSNAME, withStyleOverrides } from '@instructure/quiz-common';
19
+ import { Flex, END_EDITING_TRIGGER_CLASSNAME, withStyleOverrides } from '@instructure/quiz-common';
20
+ import { Tooltip } from '@instructure/ui-tooltip';
21
+ import { ScreenReaderContent } from '@instructure/ui-a11y-content';
22
22
  export var DISPLAY_AS_SUMMARY_LIMIT = 5;
23
23
  var _ref = jsx(IconTextLeftLine, {
24
24
  color: "primary"
@@ -78,16 +78,23 @@ export var SidebarStimulus = (_dec = withStyleOverrides(generateStyle, generateC
78
78
  key: "renderButton",
79
79
  value: function renderButton() {
80
80
  var displayPosition = this.props.displayPosition;
81
- return jsx(Link, {
81
+ var textForNavigation = t('Navigate to stimulus at position {displayPosition}', {
82
+ displayPosition: displayPosition
83
+ });
84
+ return jsx(Tooltip, {
85
+ renderTip: this.props.sidebarOpen ? '' : jsx("span", {
86
+ "aria-hidden": "true"
87
+ }, textForNavigation),
88
+ placement: "start",
89
+ on: this.props.sidebarOpen ? [] : ['hover', 'focus']
90
+ }, jsx(Link, {
82
91
  href: "#",
83
92
  margin: "small",
84
93
  forceButtonRole: false,
85
94
  onClick: this.scrollToItem,
86
95
  renderIcon: _ref,
87
96
  className: END_EDITING_TRIGGER_CLASSNAME
88
- }, jsx(ScreenReaderContent, null, t('Navigate to stimulus at position { displayPosition }', {
89
- displayPosition: displayPosition
90
- })));
97
+ }, jsx(ScreenReaderContent, null, textForNavigation)));
91
98
  }
92
99
  }, {
93
100
  key: "renderClosed",
@@ -7,16 +7,14 @@ import PropTypes from 'prop-types';
7
7
  import ImmutablePropTypes from 'react-immutable-proptypes';
8
8
  import OutcomeAlignments from '@instructure/outcomes-ui/es/containers/OutcomeAlignments';
9
9
  import OutcomeCount from '@instructure/outcomes-ui/es/containers/OutcomeCount';
10
- import { FormFieldGroup } from '@instructure/ui-form-field';
11
10
  import { ScreenReaderContent } from '@instructure/ui-a11y-content';
12
11
  import CustomPropTypes from "../../../../../common/util/CustomPropTypes.js";
13
12
  import componentForItem from "../../../../util/componentForItem.js";
14
- import { liveRegion, COMPONENT_EDIT } from '@instructure/quiz-common';
13
+ import { liveRegion, COMPONENT_EDIT, FormFieldGroup } from '@instructure/quiz-common';
15
14
  import t from '@instructure/quiz-i18n/es/format-message';
16
15
  import { propsForInteractionEdit } from "../../../../util/interactionTypePropsHelper.js";
17
16
  import elementsForSelectors from "../../../../../common/util/ElementsForSelectors.js";
18
17
  import { toErrors } from "../../../../util/instUIMessages.js";
19
- import { featureOn } from "../../../../../common/util/featureCheck.js";
20
18
  export var ItemEdit = /*#__PURE__*/function (_Component) {
21
19
  _inherits(ItemEdit, _Component);
22
20
  var _super = _createSuper(ItemEdit);
@@ -64,7 +62,7 @@ export var ItemEdit = /*#__PURE__*/function (_Component) {
64
62
  var launchContextUuid = this.props.scope.launch_context_uuid;
65
63
  var launchContextTitle = this.props.scope.title;
66
64
  // If editing within a quiz, there is no account launch context
67
- if (featureOn('sub_account_bank_sharing') && rootAccountName) {
65
+ if (rootAccountName) {
68
66
  launchContexts.push({
69
67
  uuid: this.props.rootAccountUuid,
70
68
  name: rootAccountName
@@ -39,11 +39,11 @@ export var AddContentBody = (_dec = withStyleOverrides(generateStyle, generateCo
39
39
  _this.props.setUi(BUILD_TRAY_POSITION, _this.props.position);
40
40
  _this.props.setUi(BUILD_TRAY_STIMULUS_ID, _this.props.parentEntryId);
41
41
  };
42
- _this.addStimulus = function () {
42
+ _this.addStimulus = function (isPassage) {
43
43
  if (_this.props.editingQuizEntry) {
44
44
  _this.props.setNextQuizEntry(null, _this.props.quizId, _this.props.position);
45
45
  } else {
46
- _this.props.createStimulus(_this.props.quizId, _this.props.position);
46
+ _this.props.createStimulus(_this.props.quizId, _this.props.position, isPassage);
47
47
  }
48
48
  _this.props.onAddItem();
49
49
  };
@@ -4,20 +4,22 @@ var generateStyle = function generateStyle(componentTheme) {
4
4
  position: 'relative',
5
5
  width: '100%',
6
6
  boxSizing: 'border-box',
7
- paddingLeft: componentTheme.wrapperPadding,
8
- paddingRight: componentTheme.wrapperPadding,
7
+ padding: componentTheme.wrapperPadding,
9
8
  '&::after': {
10
9
  clear: 'both',
11
10
  content: '""',
12
11
  display: 'table'
13
12
  },
14
13
  '.user_content p': {
15
- margin: componentTheme.userContentMargin,
14
+ margin: "".concat(componentTheme.userContentMargin, " 0"),
16
15
  '&:first-of-type': {
17
- marginTop: componentTheme.userContentZeroMargin
16
+ margin: "0 0 ".concat(componentTheme.userContentMargin)
18
17
  },
19
- '&:last-child': {
20
- marginBottom: componentTheme.userContentMargin
18
+ '&:last-of-type': {
19
+ margin: "".concat(componentTheme.userContentMargin, " 0 0")
20
+ },
21
+ '&:only-child': {
22
+ margin: 0
21
23
  }
22
24
  }
23
25
  },
@@ -4,8 +4,7 @@ var generateComponentTheme = function generateComponentTheme(_ref) {
4
4
  return {
5
5
  wrapperPadding: spacing.large,
6
6
  textFontSize: typography.fontSizeMedium,
7
- userContentMargin: spacing.mediumSmall,
8
- userContentZeroMargin: 0
7
+ userContentMargin: spacing.mediumSmall
9
8
  };
10
9
  };
11
10
  export default generateComponentTheme;
@@ -121,6 +121,7 @@ export var Stimulus = (_dec = withStyleOverrides(generateStyle, generateComponen
121
121
  }, {
122
122
  key: "renderPanels",
123
123
  value: function renderPanels(propsForDnDZone) {
124
+ var isPassage = this.props.stimulus.passage;
124
125
  return jsx("div", {
125
126
  css: this.props.styles.stimulus,
126
127
  ref: this.props.dndRef,
@@ -129,9 +130,9 @@ export var Stimulus = (_dec = withStyleOverrides(generateStyle, generateComponen
129
130
  css: this.props.styles.leftPanel
130
131
  }, this.renderStimulusPanel()), jsx("div", {
131
132
  css: this.props.styles.itemPanel
132
- }, jsx("div", null), this.renderChildQuizEntries(), jsx(DragAndDropZone, Object.assign({}, propsForDnDZone, {
133
+ }, jsx("div", null), this.renderChildQuizEntries(), !isPassage && jsx(DragAndDropZone, Object.assign({}, propsForDnDZone, {
133
134
  location: "in"
134
- })), this.props.childEntries.size === 0 && !this.isQuizContentLocked() && jsx(AddContentPopover, {
135
+ })), this.props.childEntries.size === 0 && !this.isQuizContentLocked() && !isPassage && jsx(AddContentPopover, {
135
136
  allowStimulusCreation: false,
136
137
  stimulusId: this.props.stimulus.id,
137
138
  parentEntryId: this.props.quizEntry.id,
@@ -15,6 +15,8 @@ import ReactDOM from 'react-dom';
15
15
  import { Button } from '@instructure/ui-buttons';
16
16
  import { ToggleDetails } from '@instructure/ui-toggle-details';
17
17
  import { jsx } from '@instructure/emotion';
18
+ import { Text } from '@instructure/ui-text';
19
+ import { View } from '@instructure/ui-view';
18
20
  import { FILE_UPLOAD_SUCCESS, SHOULD_CLONE_ITEM, DELETED_QUIZ_ENTRY, withStyleOverrides } from '@instructure/quiz-common';
19
21
  import { propsForStimulusVersioningWrapper, propsForBankEntryVersioningWrapper } from "../../../../util/warningHelpers.js";
20
22
  import AddToBankModal from "../../../../../banks/components/AddToBankModal/index.js";
@@ -318,7 +320,13 @@ export var StimulusEdit = (_dec = withStyleOverrides(generateStyle, generateComp
318
320
  }, {
319
321
  key: "renderAddToBankOptions",
320
322
  value: function renderAddToBankOptions() {
321
- return jsx("div", null, jsx(ToggleDetails, {
323
+ var _this$props$stimulus;
324
+ var paddingTopStyle = ((_this$props$stimulus = this.props.stimulus) === null || _this$props$stimulus === void 0 ? void 0 : _this$props$stimulus.passage) ? {
325
+ padding: 'small 0 0'
326
+ } : {};
327
+ return jsx(View, Object.assign({
328
+ as: "div"
329
+ }, paddingTopStyle), jsx(ToggleDetails, {
322
330
  variant: "filled",
323
331
  key: "itemBanking",
324
332
  summary: t('Item Banking')
@@ -338,14 +346,16 @@ export var StimulusEdit = (_dec = withStyleOverrides(generateStyle, generateComp
338
346
  }, {
339
347
  key: "renderStimulusEdit",
340
348
  value: function renderStimulusEdit() {
349
+ var stimulusLabel = this.props.stimulus.passage ? t('Passage') : t('Stimulus');
341
350
  return jsx("div", null, jsx("div", {
342
351
  css: this.props.styles.stimulus,
343
352
  ref: this.handleRef
344
353
  }, jsx("div", {
345
354
  css: this.props.styles.header
346
- }, jsx("div", {
347
- css: this.props.styles.stimulusLabel
348
- }, t('Stimulus')), jsx(ActionButtons, {
355
+ }, jsx(Text, {
356
+ size: "small",
357
+ color: "secondary"
358
+ }, stimulusLabel), jsx(ActionButtons, {
349
359
  connectDragSource: this.props.connectDragSource,
350
360
  displayPosition: this.props.displayPosition,
351
361
  onDelete: this.handleDeleteStimulus,
@@ -1,4 +1,4 @@
1
- var generateStyle = function generateStyle(componentTheme) {
1
+ var generateStyle = function generateStyle(componentTheme, props) {
2
2
  return {
3
3
  stimulus: {
4
4
  paddingTop: componentTheme.stimulusPadding,
@@ -23,10 +23,6 @@ var generateStyle = function generateStyle(componentTheme) {
23
23
  height: '100%',
24
24
  padding: componentTheme.stimulusContentPadding
25
25
  },
26
- stimulusLabel: {
27
- color: componentTheme.stimulusLabelColor,
28
- fontSize: componentTheme.stimulusLabelFontSize
29
- },
30
26
  stimulusButtons: {
31
27
  flex: '0 0 auto',
32
28
  display: 'inline-flex',
@@ -9,8 +9,6 @@ var generateComponentTheme = function generateComponentTheme(_ref) {
9
9
  optionPadding: spacing.small,
10
10
  stimulusContentPadding: spacing.small,
11
11
  stimulusContentPaddingBottom: spacing.small,
12
- stimulusLabelColor: colors.ash,
13
- stimulusLabelFontSize: typography.fontSizeSmall,
14
12
  stimulusButtonsColor: colors.oxford,
15
13
  stimulusButtonsZIndex: '3333'
16
14
  };
@@ -8,16 +8,13 @@ import { Component } from 'react';
8
8
  import PropTypes from 'prop-types';
9
9
  import ImmutablePropTypes from 'react-immutable-proptypes';
10
10
  import { ScreenReaderContent } from '@instructure/ui-a11y-content';
11
- import { TextInput } from '@instructure/ui-text-input';
12
- import { FormField, FormFieldGroup } from '@instructure/ui-form-field';
13
11
  import { jsx } from '@instructure/emotion';
14
12
  import { Heading } from '@instructure/ui-heading';
15
13
  import { RichContentInput, RCE_SINGLE_LINE_HEIGHT } from '@instructure/quiz-rce';
16
14
  import { toErrors } from "../../../../util/instUIMessages.js";
17
- import { SimpleSelect } from '@instructure/ui-simple-select';
18
15
  import { IconUpdownLine } from '@instructure/ui-icons';
19
16
  import { ToggleDetails } from '@instructure/ui-toggle-details';
20
- import { TOP, withStyleOverrides } from '@instructure/quiz-common';
17
+ import { SimpleSelect, TextInput, TOP, withStyleOverrides, FormFieldGroup, FormField } from '@instructure/quiz-common';
21
18
  import t from '@instructure/quiz-i18n/es/format-message';
22
19
  import generateStyle from "./styles.js";
23
20
  import generateComponentTheme from "./theme.js";
@@ -61,8 +58,12 @@ export var StimulusEditInfo = (_dec = withStyleOverrides(generateStyle, generate
61
58
  }
62
59
  _createClass(StimulusEditInfo, [{
63
60
  key: "headerText",
64
- value: function headerText() {
65
- return this.props.stimulus.isTemporary() ? t('Add Stimulus') : t('Edit Stimulus');
61
+ value: function headerText(stimulus) {
62
+ if (stimulus.isTemporary()) {
63
+ return stimulus.passage ? t('Add Passage') : t('Add Stimulus');
64
+ } else {
65
+ return stimulus.passage ? t('Edit Passage') : t('Edit Stimulus');
66
+ }
66
67
  }
67
68
  }, {
68
69
  key: "renderOptionalLabel",
@@ -95,6 +96,43 @@ export var StimulusEditInfo = (_dec = withStyleOverrides(generateStyle, generate
95
96
  value: "top"
96
97
  }, t('Questions below'))));
97
98
  }
99
+ }, {
100
+ key: "renderInstructions",
101
+ value: function renderInstructions(stimulus) {
102
+ if (stimulus.passage) {
103
+ return null;
104
+ }
105
+ return jsx("div", {
106
+ css: this.props.styles.section
107
+ }, jsx(TextInput, {
108
+ renderLabel: this.renderOptionalLabel(t('Instructions')),
109
+ onChange: this.onTextInputChange('instructions'),
110
+ value: stimulus.get('instructions'),
111
+ "data-automation": "sdk-stimulus-instructions-input"
112
+ }));
113
+ }
114
+ }, {
115
+ key: "renderOptions",
116
+ value: function renderOptions(stimulus) {
117
+ if (stimulus.passage) {
118
+ return null;
119
+ }
120
+ return jsx("div", {
121
+ css: this.props.styles.section
122
+ }, jsx(ToggleDetails, {
123
+ defaultExpanded: true,
124
+ variant: "filled",
125
+ key: "options",
126
+ summary: t('Options')
127
+ }, this.props.stimulusOrientationEnabled ? this.renderStimulusOrientationSelect() : null, jsx("div", {
128
+ css: this.props.styles.section
129
+ }, jsx(TextInput, {
130
+ renderLabel: this.renderOptionalLabel(t('Source URL'), t('(optional - not visible to students)')),
131
+ onChange: this.onTextInputChange('sourceUrl'),
132
+ value: stimulus.get('sourceUrl'),
133
+ "data-automation": "sdk-source-url-input"
134
+ }))));
135
+ }
98
136
  }, {
99
137
  key: "render",
100
138
  value: function render() {
@@ -107,56 +145,32 @@ export var StimulusEditInfo = (_dec = withStyleOverrides(generateStyle, generate
107
145
  }, jsx(Heading, {
108
146
  level: "h3",
109
147
  as: "h2"
110
- }, this.headerText()), jsx("div", {
148
+ }, this.headerText(stimulus)), jsx("div", {
111
149
  css: this.props.styles.section
112
150
  }, jsx(TextInput, {
113
151
  messages: this.inputErrors('title'),
114
152
  renderLabel: t('Title'),
115
- type: "text",
153
+ isRequired: true,
116
154
  ref: this.props.setTitleRef,
117
155
  onChange: this.onTextInputChange('title'),
118
156
  value: stimulus.get('title'),
119
157
  "data-automation": "sdk-stimulus-title-input"
120
- })), jsx("div", {
121
- css: this.props.styles.section
122
- }, jsx(TextInput, {
123
- renderLabel: this.renderOptionalLabel(t('Instructions')),
124
- type: "text",
125
- onChange: this.onTextInputChange('instructions'),
126
- value: stimulus.get('instructions'),
127
- "data-automation": "sdk-stimulus-instructions-input"
128
- })), jsx("div", {
158
+ })), this.renderInstructions(stimulus), jsx("div", {
129
159
  css: this.props.styles.section
130
160
  }, jsx(FormField, {
131
- id: stimulusBodyId,
132
- label: t('Content')
161
+ id: stimulusBodyId
133
162
  }, jsx(RichContentInput, {
134
163
  actsAsInput: true,
135
- label: "",
164
+ label: t('Content'),
165
+ isRequired: true,
136
166
  messages: this.inputErrors('body'),
137
- placeholder: t('Add Stimulus Content...'),
138
167
  textareaId: textAreaId,
139
168
  defaultContent: stimulus.get('body'),
140
169
  onKeyUp: this.onBodyChange,
141
170
  onBlur: this.onBodyChange,
142
171
  onChange: this.onBodyChange,
143
172
  height: RCE_SINGLE_LINE_HEIGHT
144
- }))), jsx("div", {
145
- css: this.props.styles.section
146
- }, jsx(ToggleDetails, {
147
- defaultExpanded: true,
148
- variant: "filled",
149
- key: "options",
150
- summary: t('Options')
151
- }, this.props.stimulusOrientationEnabled ? this.renderStimulusOrientationSelect() : null, jsx("div", {
152
- css: this.props.styles.section
153
- }, jsx(TextInput, {
154
- renderLabel: this.renderOptionalLabel(t('Source URL'), t('(optional - not visible to students)')),
155
- type: "text",
156
- onChange: this.onTextInputChange('sourceUrl'),
157
- value: stimulus.get('sourceUrl'),
158
- "data-automation": "sdk-source-url-input"
159
- })))));
173
+ }))), this.renderOptions(stimulus));
160
174
  }
161
175
  }]);
162
176
  StimulusEditInfo.displayName = "StimulusEditInfo";
@@ -10,13 +10,14 @@ import PropTypes from 'prop-types';
10
10
  import ImmutablePropTypes from 'react-immutable-proptypes';
11
11
  import { IconBankLine } from '@instructure/ui-icons';
12
12
  import { jsx } from '@instructure/emotion';
13
+ import { Text } from '@instructure/ui-text';
13
14
  import StimulusShowInfo from "../StimulusShowInfo/index.js";
14
15
  import ActionButtons from "../../../../../building/components/resources/ActionButtons/index.js";
15
16
  import t from '@instructure/quiz-i18n/es/format-message';
16
17
  import generateStyle from "./styles.js";
17
18
  import generateComponentTheme from "./theme.js";
18
19
  import Overlay from "../../../shared/overlay/index.js";
19
- import { withStyleOverrides } from '@instructure/quiz-common';
20
+ import { Flex, withStyleOverrides } from '@instructure/quiz-common';
20
21
  var _ref = jsx(IconBankLine, null);
21
22
  export var StimulusShow = (_dec = withStyleOverrides(generateStyle, generateComponentTheme), _dec(_class = (_StimulusShow = /*#__PURE__*/function (_Component) {
22
23
  _inherits(StimulusShow, _Component);
@@ -43,6 +44,7 @@ export var StimulusShow = (_dec = withStyleOverrides(generateStyle, generateComp
43
44
  }, {
44
45
  key: "render",
45
46
  value: function render() {
47
+ var stimulusLabel = this.props.stimulus.passage ? t('Passage') : t('Stimulus');
46
48
  return jsx(Overlay, {
47
49
  onClick: this.switchOnEditing,
48
50
  wrapperStyles: this.props.styles.stimulusWrapper,
@@ -54,9 +56,13 @@ export var StimulusShow = (_dec = withStyleOverrides(generateStyle, generateComp
54
56
  css: this.props.styles.header
55
57
  }, jsx("div", {
56
58
  css: this.props.styles.leftHeader
57
- }, this.renderBankIcon(), jsx("div", {
58
- css: this.props.styles.stimulusLabel
59
- }, t('Stimulus'))), jsx(ActionButtons, {
59
+ }, this.renderBankIcon(), jsx(Flex, {
60
+ margin: "0 x-small"
61
+ }, jsx(Text, {
62
+ size: "small",
63
+ color: "secondary",
64
+ margin: "0 x-small"
65
+ }, stimulusLabel))), jsx(ActionButtons, {
60
66
  connectDragSource: this.props.connectDragSource,
61
67
  displayPosition: this.props.displayPosition,
62
68
  onDelete: this.props.openDeleteStimulusModal,
@@ -16,13 +16,6 @@ var generateStyle = function generateStyle(componentTheme) {
16
16
  display: 'flex',
17
17
  overflow: 'hidden'
18
18
  },
19
- stimulusLabel: {
20
- color: componentTheme.stimulusLabelColor,
21
- fontSize: componentTheme.stimulusLabelFontSize,
22
- margin: "0 ".concat(componentTheme.stimulusLabelMargin),
23
- overflow: 'hidden',
24
- textOverflow: 'ellipsis'
25
- },
26
19
  stimulusContent: {
27
20
  height: '10%0',
28
21
  padding: "".concat(componentTheme.stimulusContentPaddingTop, " ").concat(componentTheme.stimulusContentPaddingLeftRight, " ").concat(componentTheme.stimulusContentPaddingBottom)
@@ -5,9 +5,6 @@ var generateComponentTheme = function generateComponentTheme(_ref) {
5
5
  return {
6
6
  stimulusPadding: spacing.large,
7
7
  headerPadding: spacing.small,
8
- stimulusLabelColor: colors.ash,
9
- stimulusLabelFontSize: typography.fontSizeSmall,
10
- stimulusLabelMargin: spacing.xSmall,
11
8
  stimulusContentPaddingTop: spacing.large,
12
9
  stimulusContentPaddingBottom: spacing.small,
13
10
  stimulusContentPaddingLeftRight: spacing.small
@@ -5,10 +5,9 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React, { Component } from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import debounce from 'lodash/fp/debounce';
8
- import { Select } from '@instructure/ui-select';
9
8
  import { Spinner } from '@instructure/ui-spinner';
10
9
  import t from '@instructure/quiz-i18n/es/format-message';
11
- import { SELECT_EMPTY_OPTION } from '@instructure/quiz-common';
10
+ import { SELECT_EMPTY_OPTION, Select } from '@instructure/quiz-common';
12
11
  export var GenericAsyncSearch = /*#__PURE__*/function (_Component) {
13
12
  _inherits(GenericAsyncSearch, _Component);
14
13
  var _super = _createSuper(GenericAsyncSearch);
@@ -1,6 +1,9 @@
1
1
  import { connect } from "../../../react-redux.js";
2
2
  import InteractionTypes from "./presenter.js";
3
+ import { featureOn } from "../../../../common/util/featureCheck.js";
3
4
  function mapStateToProps(state) {
4
- return {};
5
+ return {
6
+ allowPassageCreation: featureOn('passage')
7
+ };
5
8
  }
6
9
  export default connect(mapStateToProps)(InteractionTypes);
@@ -32,21 +32,37 @@ export var InteractionTypes = (_dec = withStyleOverrides(generateStyle, generate
32
32
  _this = _super.call.apply(_super, [this].concat(args));
33
33
  _this.renderInteractionTypeButton = function (intType, i) {
34
34
  var onClick, Icon, name, title, automation;
35
- if (intType.name === 'Stimulus') {
36
- onClick = _this.props.addStimulus;
37
- Icon = IconPlusLine;
38
- name = t('Stimulus');
39
- title = t('Add Stimulus');
40
- automation = 'sdk-interaction-button-stimulus';
41
- } else {
42
- onClick = partial(_this.props.addItem, intType);
43
- var metadata = interactionTypeMetadata(intType);
44
- Icon = metadata.icon;
45
- name = metadata.name;
46
- title = t('Add {name} Question', {
47
- name: name
48
- });
49
- automation = "sdk-interaction-button-".concat(intType.slug);
35
+ switch (intType.name) {
36
+ case 'Stimulus':
37
+ onClick = function onClick() {
38
+ return _this.props.addStimulus(false);
39
+ };
40
+ Icon = IconPlusLine;
41
+ name = t('Stimulus');
42
+ title = t('Add Stimulus');
43
+ automation = 'sdk-interaction-button-stimulus';
44
+ break;
45
+ case 'Passage':
46
+ onClick = function onClick() {
47
+ return _this.props.addStimulus(true);
48
+ };
49
+ Icon = IconPlusLine;
50
+ name = t('Passage');
51
+ title = t('Add Passage');
52
+ automation = 'sdk-interaction-button-passage';
53
+ break;
54
+ default:
55
+ {
56
+ onClick = partial(_this.props.addItem, intType);
57
+ var metadata = interactionTypeMetadata(intType);
58
+ Icon = metadata.icon;
59
+ name = metadata.name;
60
+ title = t('Add {name} Question', {
61
+ name: name
62
+ });
63
+ automation = "sdk-interaction-button-".concat(intType.slug);
64
+ break;
65
+ }
50
66
  }
51
67
  return jsx(Button, {
52
68
  key: intType.slug,
@@ -116,6 +132,12 @@ export var InteractionTypes = (_dec = withStyleOverrides(generateStyle, generate
116
132
  }, _this.renderInteractionTypeButton({
117
133
  name: 'Stimulus',
118
134
  slug: 'stimulus'
135
+ })), _this.props.allowPassageCreation && jsx(Grid.Col, {
136
+ width: 12 / _this.props.columns,
137
+ key: "passage"
138
+ }, _this.renderInteractionTypeButton({
139
+ name: 'Passage',
140
+ slug: 'passage'
119
141
  })));
120
142
  return [dividerRow, stimulusRow];
121
143
  }
@@ -139,6 +161,7 @@ export var InteractionTypes = (_dec = withStyleOverrides(generateStyle, generate
139
161
  addItem: PropTypes.func.isRequired,
140
162
  addStimulus: PropTypes.func.isRequired,
141
163
  allowStimulusCreation: PropTypes.bool,
164
+ allowPassageCreation: PropTypes.bool,
142
165
  types: ImmutablePropTypes.list,
143
166
  styles: PropTypes.object
144
167
  }, _InteractionTypes.defaultProps = {
@@ -5,11 +5,10 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
5
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
6
  import React, { Component } from 'react';
7
7
  import PropTypes from 'prop-types';
8
- import { Select } from '@instructure/ui-select';
9
8
  import TagWrapper from "../TagWrapper/index.js";
10
9
  import differenceBy from 'lodash/differenceBy';
11
10
  import t from '@instructure/quiz-i18n/es/format-message';
12
- import { SELECT_EMPTY_OPTION } from '@instructure/quiz-common';
11
+ import { SELECT_EMPTY_OPTION, Select } from '@instructure/quiz-common';
13
12
  var tagShape = PropTypes.shape({
14
13
  id: PropTypes.string,
15
14
  value: PropTypes.string.isRequired
@@ -4,10 +4,9 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React, { Component } from 'react';
6
6
  import PropTypes from 'prop-types';
7
- import { FormFieldGroup } from '@instructure/ui-form-field';
7
+ import { FormFieldGroup } from '@instructure/quiz-common';
8
8
  import { ScreenReaderContent } from '@instructure/ui-a11y-content';
9
9
  import { View } from '@instructure/ui-view';
10
- import Errors from "../../../../common/components/shared/errors/Errors.js";
11
10
  import { List } from 'immutable';
12
11
  import { breakdownSeconds, DAY_IN_SECONDS, HOUR_IN_SECONDS, MINUTE_IN_SECONDS } from "../FormattedDuration/index.js";
13
12
  import t from '@instructure/quiz-i18n/es/format-message';
@@ -138,7 +137,8 @@ export var TimeUnitsInput = /*#__PURE__*/function (_Component) {
138
137
  newHours = _breakdownSeconds4.hours,
139
138
  newMinutes = _breakdownSeconds4.minutes;
140
139
  if (_this.state.shouldResetOnNormalize) {
141
- _this.props.onReset();
140
+ var _this$props$onReset, _this$props;
141
+ (_this$props$onReset = (_this$props = _this.props).onReset) === null || _this$props$onReset === void 0 ? void 0 : _this$props$onReset.call(_this$props);
142
142
  }
143
143
  _this.setState({
144
144
  days: newDays,
@@ -169,7 +169,12 @@ export var TimeUnitsInput = /*#__PURE__*/function (_Component) {
169
169
  daysError && errorArray.push(daysError);
170
170
  hoursError && errorArray.push(hoursError);
171
171
  minutesError && errorArray.push(minutesError);
172
- return List(errorArray);
172
+ return errorArray.map(function (error) {
173
+ return {
174
+ type: 'error',
175
+ text: error
176
+ };
177
+ });
173
178
  };
174
179
  return _this;
175
180
  }
@@ -240,7 +245,8 @@ export var TimeUnitsInput = /*#__PURE__*/function (_Component) {
240
245
  description: /*#__PURE__*/React.createElement(ScreenReaderContent, null, this.props.description),
241
246
  layout: "columns",
242
247
  vAlign: "top",
243
- startAt: "small"
248
+ startAt: "small",
249
+ messages: this.getErrorList()
244
250
  }, this.props.includeDays && /*#__PURE__*/React.createElement(NumberInput, {
245
251
  renderLabel: this.props.daysLabel,
246
252
  min: 0,
@@ -273,10 +279,6 @@ export var TimeUnitsInput = /*#__PURE__*/function (_Component) {
273
279
  }] : null,
274
280
  "data-automation": this.props.minutesDataAutomation,
275
281
  width: this.props.inputWidth
276
- })), /*#__PURE__*/React.createElement(View, {
277
- display: "block"
278
- }, /*#__PURE__*/React.createElement(Errors, {
279
- errorList: this.getErrorList()
280
282
  })));
281
283
  }
282
284
  }]);
@@ -30,6 +30,9 @@ export var posObjFromQuizEntry = cachePreviousArgs(function (quizEntryDragging,
30
30
  // handle dragging items over stimulus
31
31
  if (!quizEntryDragging.hasStimulus && quizEntryHovered.hasStimulus && (onRightHalf || inSidebar)) {
32
32
  if (deepInsideEntry && quizEntryHovered.getNestedEntries().size === 0) {
33
+ if (quizEntryHovered.isPassage) {
34
+ return null;
35
+ }
33
36
  newPositionObj.intoEmptyStimulus = true;
34
37
  return newPositionObj;
35
38
  } else if (deepInsideEntry) {
@@ -357,6 +357,11 @@ export var QuizEntry = (_dec = withStateCache(function () {
357
357
  get: function get() {
358
358
  return this.entryType === 'Stimulus';
359
359
  }
360
+ }, {
361
+ key: "isPassage",
362
+ get: function get() {
363
+ return Boolean(this.isStimulus && this.getEntry() && this.getEntry().passage);
364
+ }
360
365
  }, {
361
366
  key: "isItem",
362
367
  get: function get() {
@@ -71,6 +71,7 @@ export var Stimulus = /*#__PURE__*/function (_ReduxRecord) {
71
71
  body: '',
72
72
  sourceUrl: '',
73
73
  status: 'mutable',
74
- orientation: 'left'
74
+ orientation: 'left',
75
+ passage: false
75
76
  }));
76
77
  export default Stimulus;