@pie-element/select-text 13.2.2-beta.6 → 13.2.2-beta.7

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,10 @@
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
+ ## [13.2.2-beta.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/select-text@13.2.2-beta.6...@pie-element/select-text@13.2.2-beta.7) (2026-09-24)
7
+
8
+ **Note:** Version bump only for package @pie-element/select-text
9
+
6
10
  ## [13.2.2-beta.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/select-text@13.2.2-beta.5...@pie-element/select-text@13.2.2-beta.6) (2026-09-24)
7
11
 
8
12
  **Note:** Version bump only for package @pie-element/select-text
@@ -3,6 +3,10 @@
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
+ # [11.4.0-beta.13](https://github.com/pie-framework/pie-elements/compare/@pie-element/select-text-configure@11.4.0-beta.12...@pie-element/select-text-configure@11.4.0-beta.13) (2026-09-24)
7
+
8
+ **Note:** Version bump only for package @pie-element/select-text-configure
9
+
6
10
  # [11.4.0-beta.12](https://github.com/pie-framework/pie-elements/compare/@pie-element/select-text-configure@11.4.0-beta.11...@pie-element/select-text-configure@11.4.0-beta.12) (2026-09-24)
7
11
 
8
12
  **Note:** Version bump only for package @pie-element/select-text-configure
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _default = exports.default = {
8
+ model: {
9
+ feedbackEnabled: false,
10
+ highlightChoices: false,
11
+ maxSelections: 0,
12
+ mode: 'sentence',
13
+ partialScoring: false,
14
+ prompt: '',
15
+ promptEnabled: true,
16
+ rationale: '',
17
+ rationaleEnabled: true,
18
+ scoringType: 'auto',
19
+ studentInstructionsEnabled: true,
20
+ teacherInstructions: '',
21
+ teacherInstructionsEnabled: true,
22
+ text: '',
23
+ tokens: [],
24
+ toolbarEditorPosition: 'bottom'
25
+ },
26
+ configuration: {
27
+ baseInputConfiguration: {
28
+ h3: {
29
+ disabled: true
30
+ },
31
+ audio: {
32
+ disabled: false
33
+ },
34
+ video: {
35
+ disabled: false
36
+ },
37
+ image: {
38
+ disabled: false
39
+ },
40
+ textAlign: {
41
+ disabled: true
42
+ },
43
+ showParagraphs: {
44
+ disabled: false
45
+ },
46
+ separateParagraphs: {
47
+ disabled: true
48
+ }
49
+ },
50
+ selectionCount: {
51
+ settings: true,
52
+ label: 'Selection count'
53
+ },
54
+ correctAnswer: {
55
+ settings: true,
56
+ label: 'Correct Answers'
57
+ },
58
+ selections: {
59
+ settings: true,
60
+ label: 'Selections Available'
61
+ },
62
+ highlightChoices: {
63
+ settings: true,
64
+ label: 'Highlight choices'
65
+ },
66
+ rationale: {
67
+ settings: true,
68
+ label: 'Rationale',
69
+ inputConfiguration: {
70
+ audio: {
71
+ disabled: false
72
+ },
73
+ video: {
74
+ disabled: false
75
+ },
76
+ image: {
77
+ disabled: false
78
+ }
79
+ },
80
+ required: false
81
+ },
82
+ scoringType: {
83
+ settings: false,
84
+ label: 'Scoring Type'
85
+ },
86
+ studentInstructions: {
87
+ settings: false,
88
+ label: 'Student Instructions'
89
+ },
90
+ teacherInstructions: {
91
+ settings: true,
92
+ label: 'Teacher Instructions',
93
+ inputConfiguration: {
94
+ audio: {
95
+ disabled: false
96
+ },
97
+ video: {
98
+ disabled: false
99
+ },
100
+ image: {
101
+ disabled: false
102
+ }
103
+ },
104
+ required: false
105
+ },
106
+ prompt: {
107
+ label: 'Prompt',
108
+ settings: true,
109
+ inputConfiguration: {
110
+ audio: {
111
+ disabled: false
112
+ },
113
+ video: {
114
+ disabled: false
115
+ },
116
+ image: {
117
+ disabled: false
118
+ }
119
+ },
120
+ required: false
121
+ },
122
+ text: {
123
+ settings: true,
124
+ label: 'Content'
125
+ },
126
+ tokens: {
127
+ settings: true,
128
+ label: 'Tokens'
129
+ },
130
+ feedback: {
131
+ settings: true,
132
+ label: 'Feedback'
133
+ },
134
+ spellCheck: {
135
+ label: 'Spellcheck',
136
+ settings: false,
137
+ enabled: true
138
+ },
139
+ partialScoring: {
140
+ settings: false,
141
+ label: 'Allow Partial Scoring'
142
+ },
143
+ mode: {
144
+ settings: true,
145
+ label: 'Mode'
146
+ },
147
+ minTokens: 2,
148
+ maxImageWidth: {
149
+ teacherInstructions: 300,
150
+ prompt: 300,
151
+ rationale: 300
152
+ },
153
+ maxImageHeight: {
154
+ teacherInstructions: 300,
155
+ prompt: 300,
156
+ rationale: 300
157
+ },
158
+ withRubric: {
159
+ settings: false,
160
+ label: 'Add Rubric'
161
+ },
162
+ mathMlOptions: {
163
+ mmlOutput: false,
164
+ mmlEditing: false
165
+ },
166
+ language: {
167
+ settings: false,
168
+ label: 'Specify Language',
169
+ enabled: false
170
+ },
171
+ languageChoices: {
172
+ label: 'Language Choices',
173
+ options: []
174
+ }
175
+ }
176
+ };
177
+ //# sourceMappingURL=defaultConfiguration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultConfiguration.js","names":["model","feedbackEnabled","highlightChoices","maxSelections","mode","partialScoring","prompt","promptEnabled","rationale","rationaleEnabled","scoringType","studentInstructionsEnabled","teacherInstructions","teacherInstructionsEnabled","text","tokens","toolbarEditorPosition","configuration","baseInputConfiguration","h3","disabled","audio","video","image","textAlign","showParagraphs","separateParagraphs","selectionCount","settings","label","correctAnswer","selections","inputConfiguration","required","studentInstructions","feedback","spellCheck","enabled","minTokens","maxImageWidth","maxImageHeight","withRubric","mathMlOptions","mmlOutput","mmlEditing","language","languageChoices","options"],"sources":["../src/defaultConfiguration.js"],"sourcesContent":["export default {\n model: {\n feedbackEnabled: false,\n highlightChoices: false,\n maxSelections: 0,\n mode: 'sentence',\n partialScoring: false,\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n scoringType: 'auto',\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n text: '',\n tokens: [],\n toolbarEditorPosition: 'bottom',\n },\n configuration: {\n baseInputConfiguration: {\n h3: { disabled: true },\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n textAlign: { disabled: true },\n showParagraphs: { disabled: false },\n separateParagraphs: { disabled: true },\n },\n selectionCount: {\n settings: true,\n label: 'Selection count',\n },\n correctAnswer: {\n settings: true,\n label: 'Correct Answers',\n },\n selections: {\n settings: true,\n label: 'Selections Available',\n },\n highlightChoices: {\n settings: true,\n label: 'Highlight choices',\n },\n rationale: {\n settings: true,\n label: 'Rationale',\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n required: false,\n },\n scoringType: {\n settings: false,\n label: 'Scoring Type',\n },\n studentInstructions: {\n settings: false,\n label: 'Student Instructions',\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions',\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n required: false,\n },\n prompt: {\n label: 'Prompt',\n settings: true,\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n required: false,\n },\n text: {\n settings: true,\n label: 'Content',\n },\n tokens: {\n settings: true,\n label: 'Tokens',\n },\n feedback: {\n settings: true,\n label: 'Feedback',\n },\n spellCheck: {\n label: 'Spellcheck',\n settings: false,\n enabled: true,\n },\n partialScoring: {\n settings: false,\n label: 'Allow Partial Scoring',\n },\n mode: {\n settings: true,\n label: 'Mode',\n },\n minTokens: 2,\n maxImageWidth: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n },\n maxImageHeight: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n },\n withRubric: {\n settings: false,\n label: 'Add Rubric',\n },\n mathMlOptions: {\n mmlOutput: false,\n mmlEditing: false,\n },\n language: {\n settings: false,\n label: 'Specify Language',\n enabled: false,\n },\n languageChoices: {\n label: 'Language Choices',\n options: [],\n },\n },\n};\n"],"mappings":"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","ignoreList":[]}
@@ -0,0 +1,406 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = exports.Design = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+ var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
12
+ var _styles = require("@mui/material/styles");
13
+ var _lodashEs = require("lodash-es");
14
+ var _textSelect = require("@pie-lib/text-select");
15
+ var _configUi = require("@pie-lib/config-ui");
16
+ var _Chip = _interopRequireDefault(require("@mui/material/Chip"));
17
+ var _Info = _interopRequireDefault(require("@mui/icons-material/Info"));
18
+ var _debug = _interopRequireDefault(require("debug"));
19
+ var _editableHtmlTipTap = _interopRequireDefault(require("@pie-lib/editable-html-tip-tap"));
20
+ var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
21
+ var _utils = require("./utils");
22
+ const {
23
+ Panel,
24
+ toggle,
25
+ radio,
26
+ dropdown
27
+ } = _configUi.settings;
28
+ const StyledInputContainer = (0, _styles.styled)(_configUi.InputContainer)(({
29
+ theme
30
+ }) => ({
31
+ width: '100%',
32
+ paddingTop: theme.spacing(2),
33
+ marginBottom: theme.spacing(2)
34
+ }));
35
+ const StyledEditableHtml = (0, _styles.styled)(_editableHtmlTipTap.default)({
36
+ width: '100%'
37
+ });
38
+ const ErrorText = (0, _styles.styled)('div')(({
39
+ theme
40
+ }) => ({
41
+ fontSize: theme.typography.fontSize - 2,
42
+ color: theme.palette.error.main,
43
+ paddingTop: theme.spacing(1)
44
+ }));
45
+ const StyledTextField = (0, _styles.styled)(_TextField.default)({
46
+ width: '100%'
47
+ });
48
+ const TokenizerContainer = (0, _styles.styled)(_configUi.InputContainer)(({
49
+ theme
50
+ }) => ({
51
+ paddingRight: 0,
52
+ marginRight: 0,
53
+ position: 'relative',
54
+ '&:after': {
55
+ position: 'absolute',
56
+ bottom: 0,
57
+ left: 0,
58
+ right: 0,
59
+ height: '1px',
60
+ content: '""',
61
+ backgroundColor: theme.palette.primary.main
62
+ },
63
+ marginBottom: theme.spacing(1)
64
+ }));
65
+ const StyledTooltip = (0, _styles.styled)(_Tooltip.default)(({
66
+ theme
67
+ }) => ({
68
+ '& .MuiTooltip-tooltip': {
69
+ fontSize: theme.typography.fontSize - 2,
70
+ whiteSpace: 'pre',
71
+ maxWidth: '500px'
72
+ }
73
+ }));
74
+ const StyledTokenizer = (0, _styles.styled)(_textSelect.Tokenizer)(({
75
+ theme
76
+ }) => ({
77
+ marginTop: theme.spacing(2)
78
+ }));
79
+ const StyledChip = (0, _styles.styled)(_Chip.default)(({
80
+ theme
81
+ }) => ({
82
+ marginTop: theme.spacing(0.5),
83
+ marginRight: theme.spacing(2)
84
+ }));
85
+ const TokensDetails = (0, _styles.styled)('div')(({
86
+ theme
87
+ }) => ({
88
+ display: 'flex',
89
+ alignItems: 'center',
90
+ flexWrap: 'wrap',
91
+ marginBottom: theme.spacing(2.5)
92
+ }));
93
+ const StyledNumberTextField = (0, _styles.styled)(_configUi.NumberTextField)(({
94
+ theme
95
+ }) => ({
96
+ width: '180px',
97
+ margin: `${theme.spacing(0.5)} auto 0`
98
+ }));
99
+ const log = (0, _debug.default)('@pie-element:select-text:configure');
100
+ class Design extends _react.default.Component {
101
+ constructor(props) {
102
+ super(props);
103
+ (0, _defineProperty2.default)(this, "updateText", (0, _lodashEs.debounce)(val => {
104
+ this.apply(u => {
105
+ u.text = val;
106
+ u.tokens = [];
107
+ });
108
+ }, 200));
109
+ (0, _defineProperty2.default)(this, "changeText", event => this.updateText(event.target.value));
110
+ (0, _defineProperty2.default)(this, "changeTokens", (tokens, mode) => {
111
+ this.apply(u => {
112
+ u.tokens = tokens;
113
+ u.mode = mode;
114
+ const correctTokenCount = tokens.filter(t => t.correct).length;
115
+ const max = isFinite(u.maxSelections) ? u.maxSelections : 0;
116
+ u.maxSelections = Math.max(max, correctTokenCount);
117
+ });
118
+ });
119
+ (0, _defineProperty2.default)(this, "changeMaxSelections", (event, max) => {
120
+ this.apply(u => u.maxSelections = max);
121
+ });
122
+ (0, _defineProperty2.default)(this, "apply", fn => {
123
+ const {
124
+ onModelChanged,
125
+ model
126
+ } = this.props;
127
+ const update = (0, _lodashEs.cloneDeep)(model);
128
+ fn(update);
129
+ onModelChanged(update);
130
+ });
131
+ (0, _defineProperty2.default)(this, "changeFeedback", feedback => {
132
+ this.apply(u => u.feedback = feedback);
133
+ });
134
+ (0, _defineProperty2.default)(this, "changePartialScoring", partialScoring => {
135
+ const {
136
+ onModelChanged,
137
+ model
138
+ } = this.props;
139
+ const update = (0, _lodashEs.cloneDeep)(model);
140
+ update.partialScoring = partialScoring;
141
+ onModelChanged(update);
142
+ });
143
+ (0, _defineProperty2.default)(this, "onPromptChanged", prompt => {
144
+ const {
145
+ onModelChanged,
146
+ model
147
+ } = this.props;
148
+ const update = (0, _lodashEs.cloneDeep)(model);
149
+ update.prompt = prompt;
150
+ onModelChanged(update);
151
+ });
152
+ (0, _defineProperty2.default)(this, "onTeacherInstructionsChanged", teacherInstructions => {
153
+ const {
154
+ onModelChanged,
155
+ model
156
+ } = this.props;
157
+ const update = (0, _lodashEs.cloneDeep)(model);
158
+ update.teacherInstructions = teacherInstructions;
159
+ onModelChanged(update);
160
+ });
161
+ (0, _defineProperty2.default)(this, "onRationaleChanged", rationale => {
162
+ const {
163
+ onModelChanged,
164
+ model
165
+ } = this.props;
166
+ onModelChanged({
167
+ ...model,
168
+ rationale
169
+ });
170
+ });
171
+ const {
172
+ model: _model
173
+ } = this.props;
174
+ this.state = {
175
+ text: _model && _model.text || ''
176
+ };
177
+ }
178
+ UNSAFE_componentWillReceiveProps(nProps) {
179
+ const {
180
+ model
181
+ } = nProps;
182
+ if (model && model.text) {
183
+ this.setState({
184
+ text: model.text
185
+ });
186
+ }
187
+ }
188
+ render() {
189
+ const {
190
+ text: textValue
191
+ } = this.state;
192
+ const {
193
+ configuration,
194
+ imageSupport,
195
+ model,
196
+ onConfigurationChanged,
197
+ onModelChanged,
198
+ uploadSoundSupport
199
+ } = this.props;
200
+ const {
201
+ baseInputConfiguration = {},
202
+ correctAnswer = {},
203
+ contentDimensions = {},
204
+ feedback = {},
205
+ highlightChoices = {},
206
+ mode = {},
207
+ partialScoring = {},
208
+ prompt = {},
209
+ rationale = {},
210
+ selectionCount = {},
211
+ selections = {},
212
+ settingsPanelDisabled,
213
+ scoringType = {},
214
+ spellCheck = {},
215
+ studentInstructions = {},
216
+ teacherInstructions = {},
217
+ text = {},
218
+ tokens = {},
219
+ maxImageWidth = {},
220
+ maxImageHeight = {},
221
+ withRubric = {},
222
+ mathMlOptions = {},
223
+ language = {},
224
+ languageChoices = {}
225
+ } = configuration || {};
226
+ const {
227
+ errors,
228
+ extraCSSRules,
229
+ feedbackEnabled,
230
+ promptEnabled,
231
+ rationaleEnabled,
232
+ spellCheckEnabled,
233
+ teacherInstructionsEnabled,
234
+ toolbarEditorPosition
235
+ } = model || {};
236
+ const {
237
+ prompt: promptError,
238
+ rationale: rationaleError,
239
+ selectionsError,
240
+ teacherInstructions: teacherInstructionsError,
241
+ tokensError
242
+ } = errors || {};
243
+ const validationMessage = (0, _utils.generateValidationMessage)(configuration);
244
+ const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
245
+ const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
246
+ let {
247
+ tokens: tokensModel
248
+ } = model;
249
+ tokensModel = tokensModel || [];
250
+ const toolbarOpts = {
251
+ position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
252
+ };
253
+ log('[render] maxSelections:', model.maxSelections);
254
+ const panelSettings = {
255
+ partialScoring: partialScoring.settings && toggle(partialScoring.label),
256
+ highlightChoices: highlightChoices.settings && toggle(highlightChoices.label),
257
+ feedbackEnabled: feedback.settings && toggle(feedback.label),
258
+ 'language.enabled': language.settings && toggle(language.label, true),
259
+ language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options)
260
+ };
261
+ const panelProperties = {
262
+ teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
263
+ studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
264
+ promptEnabled: prompt.settings && toggle(prompt.label),
265
+ rationaleEnabled: rationale.settings && toggle(rationale.label),
266
+ spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
267
+ scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),
268
+ rubricEnabled: withRubric?.settings && toggle(withRubric?.label)
269
+ };
270
+ const getPluginProps = (props = {}) => ({
271
+ ...baseInputConfiguration,
272
+ ...props
273
+ });
274
+ return /*#__PURE__*/_react.default.createElement(_configUi.layout.ConfigLayout, {
275
+ extraCSSRules: extraCSSRules,
276
+ dimensions: contentDimensions,
277
+ hideSettings: settingsPanelDisabled,
278
+ settings: /*#__PURE__*/_react.default.createElement(Panel, {
279
+ model: model,
280
+ configuration: configuration,
281
+ onChangeModel: model => onModelChanged(model),
282
+ onChangeConfiguration: onConfigurationChanged,
283
+ groups: {
284
+ Settings: panelSettings,
285
+ Properties: panelProperties
286
+ }
287
+ })
288
+ }, teacherInstructionsEnabled && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
289
+ label: teacherInstructions.label
290
+ }, /*#__PURE__*/_react.default.createElement(StyledEditableHtml, {
291
+ markup: model.teacherInstructions || '',
292
+ onChange: this.onTeacherInstructionsChanged,
293
+ imageSupport: imageSupport,
294
+ nonEmpty: false,
295
+ error: teacherInstructionsError,
296
+ toolbarOpts: toolbarOpts,
297
+ pluginProps: getPluginProps(configuration?.teacherInstructions?.inputConfiguration),
298
+ spellCheck: spellCheckEnabled,
299
+ maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
300
+ maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
301
+ uploadSoundSupport: uploadSoundSupport,
302
+ languageCharactersProps: [{
303
+ language: 'spanish'
304
+ }, {
305
+ language: 'special'
306
+ }],
307
+ mathMlOptions: mathMlOptions
308
+ }), teacherInstructionsError && /*#__PURE__*/_react.default.createElement(ErrorText, null, teacherInstructionsError)), promptEnabled && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
309
+ label: prompt.label || ''
310
+ }, /*#__PURE__*/_react.default.createElement(StyledEditableHtml, {
311
+ markup: model.prompt,
312
+ onChange: this.onPromptChanged,
313
+ imageSupport: imageSupport,
314
+ error: promptError,
315
+ toolbarOpts: toolbarOpts,
316
+ pluginProps: getPluginProps(configuration?.prompt?.inputConfiguration),
317
+ spellCheck: spellCheckEnabled,
318
+ maxImageWidth: defaultImageMaxWidth,
319
+ maxImageHeight: defaultImageMaxHeight,
320
+ uploadSoundSupport: uploadSoundSupport,
321
+ languageCharactersProps: [{
322
+ language: 'spanish'
323
+ }, {
324
+ language: 'special'
325
+ }],
326
+ mathMlOptions: mathMlOptions
327
+ }), promptError && /*#__PURE__*/_react.default.createElement(ErrorText, null, promptError)), text.settings && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
328
+ label: text.label || ''
329
+ }, /*#__PURE__*/_react.default.createElement(StyledTextField, {
330
+ variant: "standard",
331
+ multiline: true,
332
+ defaultValue: textValue,
333
+ onChange: this.changeText,
334
+ spellCheck: spellCheckEnabled
335
+ })), tokens.settings && /*#__PURE__*/_react.default.createElement(TokenizerContainer, {
336
+ label: tokens.label || ''
337
+ }, /*#__PURE__*/_react.default.createElement(StyledTooltip, {
338
+ disableFocusListener: true,
339
+ disableTouchListener: true,
340
+ placement: 'right',
341
+ title: validationMessage
342
+ }, /*#__PURE__*/_react.default.createElement(_Info.default, {
343
+ fontSize: 'small',
344
+ color: 'primary',
345
+ style: {
346
+ position: 'absolute',
347
+ left: '48px',
348
+ top: '-3px'
349
+ }
350
+ })), /*#__PURE__*/_react.default.createElement(StyledTokenizer, {
351
+ text: model.text,
352
+ tokens: tokensModel,
353
+ onChange: this.changeTokens
354
+ })), tokensError && /*#__PURE__*/_react.default.createElement(ErrorText, null, tokensError), selectionsError && /*#__PURE__*/_react.default.createElement(ErrorText, null, selectionsError), /*#__PURE__*/_react.default.createElement(TokensDetails, null, mode.settings && /*#__PURE__*/_react.default.createElement(StyledChip, {
355
+ label: `${mode.label}: ${model.mode ? model.mode : 'None'}`
356
+ }), selections.settings && /*#__PURE__*/_react.default.createElement(StyledChip, {
357
+ label: `${selections.label}: ${tokensModel.length}`
358
+ }), correctAnswer.settings && /*#__PURE__*/_react.default.createElement(StyledChip, {
359
+ label: `${correctAnswer.label}: ${tokensModel.filter(t => t.correct).length}`
360
+ }), selectionCount.settings && /*#__PURE__*/_react.default.createElement(StyledNumberTextField, {
361
+ min: tokensModel.filter(t => t.correct).length || 0,
362
+ label: `${selectionCount.label} (0:any)`,
363
+ max: tokensModel.length,
364
+ value: model.maxSelections,
365
+ onChange: this.changeMaxSelections
366
+ })), rationaleEnabled && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
367
+ label: rationale.label || ''
368
+ }, /*#__PURE__*/_react.default.createElement(StyledEditableHtml, {
369
+ markup: model.rationale || '',
370
+ onChange: this.onRationaleChanged,
371
+ imageSupport: imageSupport,
372
+ error: rationaleError,
373
+ toolbarOpts: toolbarOpts,
374
+ pluginProps: getPluginProps(configuration?.rationale?.inputConfiguration),
375
+ spellCheck: spellCheckEnabled,
376
+ maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
377
+ maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
378
+ uploadSoundSupport: uploadSoundSupport,
379
+ languageCharactersProps: [{
380
+ language: 'spanish'
381
+ }, {
382
+ language: 'special'
383
+ }],
384
+ mathMlOptions: mathMlOptions
385
+ }), rationaleError && /*#__PURE__*/_react.default.createElement(ErrorText, null, rationaleError)), feedbackEnabled && /*#__PURE__*/_react.default.createElement(_configUi.FeedbackConfig, {
386
+ feedback: model.feedback,
387
+ onChange: this.changeFeedback,
388
+ toolbarOpts: toolbarOpts
389
+ }));
390
+ }
391
+ }
392
+ exports.Design = Design;
393
+ (0, _defineProperty2.default)(Design, "propTypes", {
394
+ model: _propTypes.default.object.isRequired,
395
+ configuration: _propTypes.default.object.isRequired,
396
+ onModelChanged: _propTypes.default.func.isRequired,
397
+ onConfigurationChanged: _propTypes.default.func.isRequired,
398
+ imageSupport: _propTypes.default.shape({
399
+ add: _propTypes.default.func.isRequired,
400
+ delete: _propTypes.default.func.isRequired
401
+ }),
402
+ uploadSoundSupport: _propTypes.default.object
403
+ });
404
+ (0, _defineProperty2.default)(Design, "defaultProps", {});
405
+ var _default = exports.default = Design;
406
+ //# sourceMappingURL=design.js.map