@instructure/quiz-core 20.5.2-rc.2 → 20.5.2-rc.3

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.
@@ -53,6 +53,10 @@ export var ChoiceGroupTypeTable = (_dec = withStyle(generateStyle, generateCompo
53
53
  }
54
54
  };
55
55
 
56
+ _this.getTranslatedEmptyMessage = function () {
57
+ return t('There are no entries for this open entry question.');
58
+ };
59
+
56
60
  _this.handleBodyToggle = function () {
57
61
  _this.setState({
58
62
  bodyExpanded: !_this.state.bodyExpanded
@@ -122,11 +126,29 @@ export var ChoiceGroupTypeTable = (_dec = withStyle(generateStyle, generateCompo
122
126
  })));
123
127
  };
124
128
 
129
+ _this.renderEmptyInfo = function () {
130
+ return jsx(Flex, {
131
+ direction: "column",
132
+ justifyItems: "start"
133
+ }, jsx(Flex.Item, {
134
+ shouldShrink: true,
135
+ shouldGrow: true,
136
+ padding: "none none x-small small"
137
+ }, jsx(Text, null, _this.getTranslatedEmptyMessage())));
138
+ };
139
+
125
140
  _this.render = function () {
141
+ var _this$props3 = _this.props,
142
+ styles = _this$props3.styles,
143
+ blank = _this$props3.blank;
144
+ var groupWrapper = styles.groupWrapper,
145
+ cardWrapper = styles.cardWrapper;
146
+ var areThereChoices = Array.isArray(blank.choices) && blank.choices.length > 0;
147
+ var bodyExpanded = _this.state.bodyExpanded;
126
148
  return jsx("div", {
127
- css: _this.props.styles.groupWrapper
149
+ css: groupWrapper
128
150
  }, jsx(Card, {
129
- css: _this.props.styles.cardWrapper
151
+ css: cardWrapper
130
152
  }, jsx(Flex, {
131
153
  direction: "column",
132
154
  justifyItems: "start"
@@ -142,10 +164,10 @@ export var ChoiceGroupTypeTable = (_dec = withStyle(generateStyle, generateCompo
142
164
  shouldShrink: true,
143
165
  padding: "x-small small x-small medium",
144
166
  overflowY: "hidden"
145
- }, _this.renderGroup()), _this.state.bodyExpanded && jsx(Flex.Item, {
167
+ }, _this.renderGroup()), bodyExpanded && jsx(Flex.Item, {
146
168
  shouldShrink: true,
147
169
  padding: "x-small small x-small small"
148
- }, _this.renderTable())))))));
170
+ }, areThereChoices ? _this.renderTable() : _this.renderEmptyInfo())))))));
149
171
  };
150
172
 
151
173
  return _this;
@@ -159,7 +181,7 @@ export var ChoiceGroupTypeTable = (_dec = withStyle(generateStyle, generateCompo
159
181
  blank_text: PropTypes.string.isRequired,
160
182
  blank_type: PropTypes.string.isRequired
161
183
  }).isRequired,
162
- blankInfo: PropTypes.node.isRequired,
184
+ blankInfo: PropTypes.node,
163
185
  index: PropTypes.number.isRequired,
164
186
  styles: PropTypes.object
165
187
  }.isRequired, _temp)) || _class);
@@ -76,6 +76,10 @@ var ChoiceGroupTypeTable = (_dec = (0, _emotion.withStyle)(_styles.default, _the
76
76
  }
77
77
  };
78
78
 
79
+ _this.getTranslatedEmptyMessage = function () {
80
+ return (0, _formatMessage.default)('There are no entries for this open entry question.');
81
+ };
82
+
79
83
  _this.handleBodyToggle = function () {
80
84
  _this.setState({
81
85
  bodyExpanded: !_this.state.bodyExpanded
@@ -145,11 +149,29 @@ var ChoiceGroupTypeTable = (_dec = (0, _emotion.withStyle)(_styles.default, _the
145
149
  })));
146
150
  };
147
151
 
152
+ _this.renderEmptyInfo = function () {
153
+ return (0, _emotion.jsx)(_uiFlex.Flex, {
154
+ direction: "column",
155
+ justifyItems: "start"
156
+ }, (0, _emotion.jsx)(_uiFlex.Flex.Item, {
157
+ shouldShrink: true,
158
+ shouldGrow: true,
159
+ padding: "none none x-small small"
160
+ }, (0, _emotion.jsx)(_uiText.Text, null, _this.getTranslatedEmptyMessage())));
161
+ };
162
+
148
163
  _this.render = function () {
164
+ var _this$props3 = _this.props,
165
+ styles = _this$props3.styles,
166
+ blank = _this$props3.blank;
167
+ var groupWrapper = styles.groupWrapper,
168
+ cardWrapper = styles.cardWrapper;
169
+ var areThereChoices = Array.isArray(blank.choices) && blank.choices.length > 0;
170
+ var bodyExpanded = _this.state.bodyExpanded;
149
171
  return (0, _emotion.jsx)("div", {
150
- css: _this.props.styles.groupWrapper
172
+ css: groupWrapper
151
173
  }, (0, _emotion.jsx)(_index2.default, {
152
- css: _this.props.styles.cardWrapper
174
+ css: cardWrapper
153
175
  }, (0, _emotion.jsx)(_uiFlex.Flex, {
154
176
  direction: "column",
155
177
  justifyItems: "start"
@@ -165,10 +187,10 @@ var ChoiceGroupTypeTable = (_dec = (0, _emotion.withStyle)(_styles.default, _the
165
187
  shouldShrink: true,
166
188
  padding: "x-small small x-small medium",
167
189
  overflowY: "hidden"
168
- }, _this.renderGroup()), _this.state.bodyExpanded && (0, _emotion.jsx)(_uiFlex.Flex.Item, {
190
+ }, _this.renderGroup()), bodyExpanded && (0, _emotion.jsx)(_uiFlex.Flex.Item, {
169
191
  shouldShrink: true,
170
192
  padding: "x-small small x-small small"
171
- }, _this.renderTable())))))));
193
+ }, areThereChoices ? _this.renderTable() : _this.renderEmptyInfo())))))));
172
194
  };
173
195
 
174
196
  return _this;
@@ -182,7 +204,7 @@ var ChoiceGroupTypeTable = (_dec = (0, _emotion.withStyle)(_styles.default, _the
182
204
  blank_text: _propTypes.default.string.isRequired,
183
205
  blank_type: _propTypes.default.string.isRequired
184
206
  }).isRequired,
185
- blankInfo: _propTypes.default.node.isRequired,
207
+ blankInfo: _propTypes.default.node,
186
208
  index: _propTypes.default.number.isRequired,
187
209
  styles: _propTypes.default.object
188
210
  }.isRequired, _temp)) || _class);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "20.5.2-rc.2+8427bde12",
3
+ "version": "20.5.2-rc.3+3b6ee3085",
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.5.2-rc.2+8427bde12",
48
- "@instructure/quiz-i18n": "20.5.2-rc.2+8427bde12",
49
- "@instructure/quiz-interactions": "20.5.2-rc.2+8427bde12",
50
- "@instructure/quiz-number-input": "20.5.2-rc.2+8427bde12",
51
- "@instructure/quiz-rce": "20.5.2-rc.2+8427bde12",
47
+ "@instructure/quiz-common": "20.5.2-rc.3+3b6ee3085",
48
+ "@instructure/quiz-i18n": "20.5.2-rc.3+3b6ee3085",
49
+ "@instructure/quiz-interactions": "20.5.2-rc.3+3b6ee3085",
50
+ "@instructure/quiz-number-input": "20.5.2-rc.3+3b6ee3085",
51
+ "@instructure/quiz-rce": "20.5.2-rc.3+3b6ee3085",
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.5.2-rc.2+8427bde12",
115
+ "instructure-validations": "20.5.2-rc.3+3b6ee3085",
116
116
  "ipaddr.js": "^1.5.4",
117
117
  "isomorphic-fetch": "^2.2.0",
118
118
  "isuuid": "^0.1.0",
@@ -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.5.2-rc.2+8427bde12",
166
+ "quiz-presets": "20.5.2-rc.3+3b6ee3085",
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": "8427bde127939d727962cc942f84156a8b97bfd4"
182
+ "gitHead": "3b6ee30853d581afdb98402502bc3d2ad12e1023"
183
183
  }