@pie-element/inline-dropdown 9.0.0-beta.0 → 9.0.0-next.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.
@@ -9,9 +9,7 @@ exports.model = model;
9
9
  exports.normalize = void 0;
10
10
  exports.outcome = outcome;
11
11
  exports.validate = void 0;
12
- var _map = _interopRequireDefault(require("lodash/map"));
13
- var _reduce = _interopRequireDefault(require("lodash/reduce"));
14
- var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
12
+ var _lodashEs = require("lodash-es");
15
13
  var _controllerUtils = require("@pie-lib/controller-utils");
16
14
  var _defaults = _interopRequireDefault(require("./defaults"));
17
15
  var _utils = require("./utils");
@@ -39,8 +37,8 @@ async function model(question, session, env, updateSession) {
39
37
  const {
40
38
  value = {}
41
39
  } = session || {};
42
- let choices = (0, _reduce.default)(normalizedQuestion.choices, (obj, area, key) => {
43
- obj[key] = (0, _map.default)(area, choice => choice);
40
+ let choices = (0, _lodashEs.reduce)(normalizedQuestion.choices, (obj, area, key) => {
41
+ obj[key] = (0, _lodashEs.map)(area, choice => choice);
44
42
  return obj;
45
43
  }, {});
46
44
  let feedback = {};
@@ -49,7 +47,7 @@ async function model(question, session, env, updateSession) {
49
47
  const respAreaLength = Object.keys(allCorrectResponses).length;
50
48
  let correctResponses = 0;
51
49
  for (let i = 0; i < respAreaLength; i++) {
52
- const result = (0, _reduce.default)(allCorrectResponses, (obj, choices, key) => {
50
+ const result = (0, _lodashEs.reduce)(allCorrectResponses, (obj, choices, key) => {
53
51
  const answer = value && value[key] || '';
54
52
  const correctChoice = choices[i] || '';
55
53
  const isCorrect = answer && correctChoice && correctChoice === answer;
@@ -92,7 +90,7 @@ async function model(question, session, env, updateSession) {
92
90
  shuffledValues: Array.isArray(storedValues) ? storedValues : []
93
91
  }, us(key), 'value');
94
92
  }
95
- if (!(0, _isEmpty.default)(shuffledValues)) {
93
+ if (!(0, _lodashEs.isEmpty)(shuffledValues)) {
96
94
  if (session && updateSession && typeof updateSession === 'function') {
97
95
  updateSession(session.id, session.element, {
98
96
  shuffledValues
@@ -145,7 +143,7 @@ const getScore = (config, session) => {
145
143
  const allCorrectResponses = (0, _utils.getAllCorrectResponses)(config);
146
144
  let correctCount = 0;
147
145
  for (let i = 0; i < maxScore; i++) {
148
- const result = (0, _reduce.default)(allCorrectResponses, (total, choices, key) => {
146
+ const result = (0, _lodashEs.reduce)(allCorrectResponses, (total, choices, key) => {
149
147
  const answer = value && value[key] || '';
150
148
  const correctChoice = choices[i] || '';
151
149
  if (correctChoice && answer && correctChoice === answer) {
@@ -179,7 +177,7 @@ const getScore = (config, session) => {
179
177
  exports.getScore = getScore;
180
178
  function outcome(model, session, env = {}) {
181
179
  return new Promise(resolve => {
182
- if (!session || (0, _isEmpty.default)(session)) {
180
+ if (!session || (0, _lodashEs.isEmpty)(session)) {
183
181
  resolve({
184
182
  score: 0,
185
183
  empty: true
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_map","_interopRequireDefault","require","_reduce","_isEmpty","_controllerUtils","_defaults","_utils","getFeedback","correct","normalize","question","defaults","exports","model","session","env","updateSession","normalizedQuestion","value","choices","reduce","obj","area","key","map","choice","feedback","mode","allCorrectResponses","getAllCorrectResponses","respAreaLength","Object","keys","length","correctResponses","i","result","answer","correctChoice","isCorrect","lockChoiceOrder","lockChoices","shuffledValues","us","part","id","element","update","Promise","resolve","storedValues","getShuffledChoices","Array","isArray","isEmpty","catch","e","console","error","teacherInstructions","rationale","choicesWillNullRationales","acc","currentValue","role","rationaleEnabled","teacherInstructionsEnabled","choiceRationaleEnabled","out","disabled","prompt","promptEnabled","displayType","markup","responseCorrect","getScore","undefined","language","extraCSSRules","config","maxScore","correctCount","total","str","toFixed","parseFloat","outcome","score","empty","partialScoringEnabled","partialScoring","enabled","Math","floor","createCorrectResponseSession","forEach","correctChoices","filter","c","getInnerText","html","replaceAll","getContent","replace","validate","maxResponseAreas","maxResponseAreaChoices","errors","field","required","nbOfResponseAreas","match","responseAreasError","choiceKey","responseAreaChoicesError"],"sources":["../src/index.js"],"sourcesContent":["import map from 'lodash/map';\nimport reduce from 'lodash/reduce';\nimport isEmpty from 'lodash/isEmpty';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-lib/controller-utils';\nimport defaults from './defaults';\n\nimport { getAllCorrectResponses } from './utils';\n\nconst getFeedback = (correct) => {\n if (correct) {\n return 'correct';\n }\n\n return 'incorrect';\n};\n\nexport const normalize = (question) => ({ ...defaults, ...question });\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport async function model(question, session, env, updateSession) {\n const normalizedQuestion = normalize(question);\n const { value = {} } = session || {};\n let choices = reduce(\n normalizedQuestion.choices,\n (obj, area, key) => {\n obj[key] = map(area, (choice) => choice);\n\n return obj;\n },\n {},\n );\n\n let feedback = {};\n\n if (env.mode === 'evaluate') {\n const allCorrectResponses = getAllCorrectResponses(normalizedQuestion);\n const respAreaLength = Object.keys(allCorrectResponses).length;\n let correctResponses = 0;\n\n for (let i = 0; i < respAreaLength; i++) {\n const result = reduce(\n allCorrectResponses,\n (obj, choices, key) => {\n const answer = (value && value[key]) || '';\n const correctChoice = choices[i] || '';\n const isCorrect = answer && correctChoice && correctChoice === answer;\n\n obj.feedback[key] = getFeedback(isCorrect);\n\n if (isCorrect) {\n obj.correctResponses += 1;\n }\n\n return obj;\n },\n { correctResponses: 0, feedback: {} },\n );\n\n if (result.correctResponses >= correctResponses) {\n correctResponses = result.correctResponses;\n feedback = result.feedback;\n }\n\n if (result.correctResponses === respAreaLength) {\n break;\n }\n }\n }\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n if (!lockChoiceOrder) {\n const shuffledValues = {};\n const keys = Object.keys(choices);\n\n const us = (part) => (id, element, update) => {\n return new Promise((resolve) => {\n shuffledValues[part] = update.shuffledValues;\n resolve();\n });\n };\n\n let i;\n\n for (i = 0; i < keys.length; i++) {\n const key = keys[i];\n const storedValues = session?.shuffledValues?.[key];\n\n choices[key] = await getShuffledChoices(\n choices[key],\n // the shuffledValues structure was updated to an object like { choice_key: [] }\n // and we need to override shuffledValues if it's not an array\n { shuffledValues: Array.isArray(storedValues) ? storedValues : [] },\n us(key),\n 'value',\n );\n }\n\n if (!isEmpty(shuffledValues)) {\n if (session && updateSession && typeof updateSession === 'function') {\n updateSession(session.id, session.element, {\n shuffledValues,\n }).catch((e) => {\n // eslint-disable-next-line no-console\n console.error('update session failed', e);\n });\n }\n }\n }\n\n let teacherInstructions = null;\n let rationale = null;\n\n const choicesWillNullRationales = (Object.keys(choices) || []).reduce((acc, currentValue) => {\n acc[currentValue] = (choices[currentValue] || []).map((choice) => ({\n ...choice,\n rationale: null,\n }));\n\n return acc;\n }, {});\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n\n choices = normalizedQuestion.choiceRationaleEnabled ? normalizedQuestion.choices : choicesWillNullRationales;\n } else {\n rationale = null;\n teacherInstructions = null;\n choices = choicesWillNullRationales;\n }\n\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n displayType: normalizedQuestion.displayType,\n markup: normalizedQuestion.markup,\n choices,\n feedback,\n\n responseCorrect: env.mode === 'evaluate' ? getScore(normalizedQuestion, session) === 1 : undefined,\n rationale,\n teacherInstructions,\n language: normalizedQuestion.language,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n };\n\n return out;\n}\n\nexport const getScore = (config, session) => {\n const { value = {} } = session || {};\n const maxScore = config && config.choices ? Object.keys(config.choices).length : 0;\n const allCorrectResponses = getAllCorrectResponses(config);\n let correctCount = 0;\n\n for (let i = 0; i < maxScore; i++) {\n const result = reduce(\n allCorrectResponses,\n (total, choices, key) => {\n const answer = (value && value[key]) || '';\n const correctChoice = choices[i] || '';\n\n if (correctChoice && answer && correctChoice === answer) {\n return total;\n }\n\n return total - 1;\n },\n maxScore,\n );\n\n if (result > correctCount) {\n correctCount = result;\n }\n\n if (result === maxScore) {\n break;\n }\n }\n\n const str = (correctCount / maxScore).toFixed(2);\n\n return parseFloat(str);\n};\n\n/**\n *\n * The score is partial by default for checkbox mode, allOrNothing for radio mode.\n * To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring =\n * false. the value in `env` will override the value in `model`.\n * @param {Object} model - the main model\n * @param {boolean} model.partialScoring - is partial scoring enabled (if undefined set to to true)\n * @param {*} session\n * @param {Object} env\n * @param {boolean} env.partialScoring - is partial scoring enabled (if undefined default to true) This overrides\n * `model.partialScoring`.\n */\nexport function outcome(model, session, env = {}) {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ score: 0, empty: true });\n }\n\n const partialScoringEnabled = partialScoring.enabled(model, env);\n const score = getScore(model, session);\n\n resolve({\n score: partialScoringEnabled ? score : Math.floor(score),\n empty: false,\n });\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { choices } = question;\n const value = {};\n\n if (choices) {\n Object.keys(choices).forEach((key, i) => {\n const correctChoices = choices[key] && choices[key].filter((c) => c.correct);\n\n value[i] = correctChoices && correctChoices[0].value;\n });\n }\n\n resolve({\n id: '1',\n value,\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const { markup, choices } = model;\n const { maxResponseAreas, maxResponseAreaChoices } = config;\n const errors = {};\n\n ['teacherInstructions', 'prompt', 'rationale'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n const nbOfResponseAreas = ((markup || '').match(/\\{\\{(\\d+)\\}\\}/g) || []).length;\n\n if (nbOfResponseAreas > maxResponseAreas) {\n errors.responseAreasError = `No more than ${maxResponseAreas} response areas should be defined.`;\n } else if (nbOfResponseAreas < 1) {\n errors.responseAreasError = 'There should be defined at least 1 response area.';\n }\n\n (Object.keys(choices) || []).forEach((choiceKey) => {\n if (choices[choiceKey] && choices[choiceKey].length > maxResponseAreaChoices) {\n errors.responseAreaChoicesError = `No more than ${maxResponseAreaChoices} choices per response area should be defined.`;\n }\n });\n\n return errors;\n};\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAL,sBAAA,CAAAC,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AAEA,MAAMM,WAAW,GAAIC,OAAO,IAAK;EAC/B,IAAIA,OAAO,EAAE;IACX,OAAO,SAAS;EAClB;EAEA,OAAO,WAAW;AACpB,CAAC;AAEM,MAAMC,SAAS,GAAIC,QAAQ,KAAM;EAAE,GAAGC,iBAAQ;EAAE,GAAGD;AAAS,CAAC,CAAC;;AAErE;AACA;AACA;AACA;AACA;AACA;AACA;AANAE,OAAA,CAAAH,SAAA,GAAAA,SAAA;AAOO,eAAeI,KAAKA,CAACH,QAAQ,EAAEI,OAAO,EAAEC,GAAG,EAAEC,aAAa,EAAE;EAC/D,MAAMC,kBAAkB,GAAGR,SAAS,CAACC,QAAQ,CAAC;EAC9C,MAAM;IAAEQ,KAAK,GAAG,CAAC;EAAE,CAAC,GAAGJ,OAAO,IAAI,CAAC,CAAC;EACpC,IAAIK,OAAO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C,MAAM;IAAE4F,gBAAgB;IAAEC;EAAuB,CAAC,GAAG3B,MAAM;EAC3D,MAAM4B,MAAM,GAAG,CAAC,CAAC;EAEjB,CAAC,qBAAqB,EAAE,QAAQ,EAAE,WAAW,CAAC,CAACZ,OAAO,CAAEa,KAAK,IAAK;IAChE,IAAI7B,MAAM,CAAC6B,KAAK,CAAC,EAAEC,QAAQ,IAAI,CAACP,UAAU,CAACzF,KAAK,CAAC+F,KAAK,CAAC,CAAC,EAAE;MACxDD,MAAM,CAACC,KAAK,CAAC,GAAG,yBAAyB;IAC3C;EACF,CAAC,CAAC;EAEF,MAAME,iBAAiB,GAAG,CAAC,CAACrC,MAAM,IAAI,EAAE,EAAEsC,KAAK,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE9E,MAAM;EAE/E,IAAI6E,iBAAiB,GAAGL,gBAAgB,EAAE;IACxCE,MAAM,CAACK,kBAAkB,GAAG,gBAAgBP,gBAAgB,oCAAoC;EAClG,CAAC,MAAM,IAAIK,iBAAiB,GAAG,CAAC,EAAE;IAChCH,MAAM,CAACK,kBAAkB,GAAG,mDAAmD;EACjF;EAEA,CAACjF,MAAM,CAACC,IAAI,CAACb,OAAO,CAAC,IAAI,EAAE,EAAE4E,OAAO,CAAEkB,SAAS,IAAK;IAClD,IAAI9F,OAAO,CAAC8F,SAAS,CAAC,IAAI9F,OAAO,CAAC8F,SAAS,CAAC,CAAChF,MAAM,GAAGyE,sBAAsB,EAAE;MAC5EC,MAAM,CAACO,wBAAwB,GAAG,gBAAgBR,sBAAsB,+CAA+C;IACzH;EACF,CAAC,CAAC;EAEF,OAAOC,MAAM;AACf,CAAC;AAAC/F,OAAA,CAAA4F,QAAA,GAAAA,QAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_lodashEs","require","_controllerUtils","_defaults","_interopRequireDefault","_utils","getFeedback","correct","normalize","question","defaults","exports","model","session","env","updateSession","normalizedQuestion","value","choices","reduce","obj","area","key","map","choice","feedback","mode","allCorrectResponses","getAllCorrectResponses","respAreaLength","Object","keys","length","correctResponses","i","result","answer","correctChoice","isCorrect","lockChoiceOrder","lockChoices","shuffledValues","us","part","id","element","update","Promise","resolve","storedValues","getShuffledChoices","Array","isArray","isEmpty","catch","e","console","error","teacherInstructions","rationale","choicesWillNullRationales","acc","currentValue","role","rationaleEnabled","teacherInstructionsEnabled","choiceRationaleEnabled","out","disabled","prompt","promptEnabled","displayType","markup","responseCorrect","getScore","undefined","language","extraCSSRules","config","maxScore","correctCount","total","str","toFixed","parseFloat","outcome","score","empty","partialScoringEnabled","partialScoring","enabled","Math","floor","createCorrectResponseSession","forEach","correctChoices","filter","c","getInnerText","html","replaceAll","getContent","replace","validate","maxResponseAreas","maxResponseAreaChoices","errors","field","required","nbOfResponseAreas","match","responseAreasError","choiceKey","responseAreaChoicesError"],"sources":["../src/index.js"],"sourcesContent":["import { isEmpty, map, reduce } from 'lodash-es';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-lib/controller-utils';\nimport defaults from './defaults';\n\nimport { getAllCorrectResponses } from './utils';\n\nconst getFeedback = (correct) => {\n if (correct) {\n return 'correct';\n }\n\n return 'incorrect';\n};\n\nexport const normalize = (question) => ({ ...defaults, ...question });\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport async function model(question, session, env, updateSession) {\n const normalizedQuestion = normalize(question);\n const { value = {} } = session || {};\n let choices = reduce(\n normalizedQuestion.choices,\n (obj, area, key) => {\n obj[key] = map(area, (choice) => choice);\n\n return obj;\n },\n {},\n );\n\n let feedback = {};\n\n if (env.mode === 'evaluate') {\n const allCorrectResponses = getAllCorrectResponses(normalizedQuestion);\n const respAreaLength = Object.keys(allCorrectResponses).length;\n let correctResponses = 0;\n\n for (let i = 0; i < respAreaLength; i++) {\n const result = reduce(\n allCorrectResponses,\n (obj, choices, key) => {\n const answer = (value && value[key]) || '';\n const correctChoice = choices[i] || '';\n const isCorrect = answer && correctChoice && correctChoice === answer;\n\n obj.feedback[key] = getFeedback(isCorrect);\n\n if (isCorrect) {\n obj.correctResponses += 1;\n }\n\n return obj;\n },\n { correctResponses: 0, feedback: {} },\n );\n\n if (result.correctResponses >= correctResponses) {\n correctResponses = result.correctResponses;\n feedback = result.feedback;\n }\n\n if (result.correctResponses === respAreaLength) {\n break;\n }\n }\n }\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n if (!lockChoiceOrder) {\n const shuffledValues = {};\n const keys = Object.keys(choices);\n\n const us = (part) => (id, element, update) => {\n return new Promise((resolve) => {\n shuffledValues[part] = update.shuffledValues;\n resolve();\n });\n };\n\n let i;\n\n for (i = 0; i < keys.length; i++) {\n const key = keys[i];\n const storedValues = session?.shuffledValues?.[key];\n\n choices[key] = await getShuffledChoices(\n choices[key],\n // the shuffledValues structure was updated to an object like { choice_key: [] }\n // and we need to override shuffledValues if it's not an array\n { shuffledValues: Array.isArray(storedValues) ? storedValues : [] },\n us(key),\n 'value',\n );\n }\n\n if (!isEmpty(shuffledValues)) {\n if (session && updateSession && typeof updateSession === 'function') {\n updateSession(session.id, session.element, {\n shuffledValues,\n }).catch((e) => {\n // eslint-disable-next-line no-console\n console.error('update session failed', e);\n });\n }\n }\n }\n\n let teacherInstructions = null;\n let rationale = null;\n\n const choicesWillNullRationales = (Object.keys(choices) || []).reduce((acc, currentValue) => {\n acc[currentValue] = (choices[currentValue] || []).map((choice) => ({\n ...choice,\n rationale: null,\n }));\n\n return acc;\n }, {});\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;\n\n choices = normalizedQuestion.choiceRationaleEnabled ? normalizedQuestion.choices : choicesWillNullRationales;\n } else {\n rationale = null;\n teacherInstructions = null;\n choices = choicesWillNullRationales;\n }\n\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n displayType: normalizedQuestion.displayType,\n markup: normalizedQuestion.markup,\n choices,\n feedback,\n\n responseCorrect: env.mode === 'evaluate' ? getScore(normalizedQuestion, session) === 1 : undefined,\n rationale,\n teacherInstructions,\n language: normalizedQuestion.language,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n };\n\n return out;\n}\n\nexport const getScore = (config, session) => {\n const { value = {} } = session || {};\n const maxScore = config && config.choices ? Object.keys(config.choices).length : 0;\n const allCorrectResponses = getAllCorrectResponses(config);\n let correctCount = 0;\n\n for (let i = 0; i < maxScore; i++) {\n const result = reduce(\n allCorrectResponses,\n (total, choices, key) => {\n const answer = (value && value[key]) || '';\n const correctChoice = choices[i] || '';\n\n if (correctChoice && answer && correctChoice === answer) {\n return total;\n }\n\n return total - 1;\n },\n maxScore,\n );\n\n if (result > correctCount) {\n correctCount = result;\n }\n\n if (result === maxScore) {\n break;\n }\n }\n\n const str = (correctCount / maxScore).toFixed(2);\n\n return parseFloat(str);\n};\n\n/**\n *\n * The score is partial by default for checkbox mode, allOrNothing for radio mode.\n * To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring =\n * false. the value in `env` will override the value in `model`.\n * @param {Object} model - the main model\n * @param {boolean} model.partialScoring - is partial scoring enabled (if undefined set to to true)\n * @param {*} session\n * @param {Object} env\n * @param {boolean} env.partialScoring - is partial scoring enabled (if undefined default to true) This overrides\n * `model.partialScoring`.\n */\nexport function outcome(model, session, env = {}) {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ score: 0, empty: true });\n }\n\n const partialScoringEnabled = partialScoring.enabled(model, env);\n const score = getScore(model, session);\n\n resolve({\n score: partialScoringEnabled ? score : Math.floor(score),\n empty: false,\n });\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { choices } = question;\n const value = {};\n\n if (choices) {\n Object.keys(choices).forEach((key, i) => {\n const correctChoices = choices[key] && choices[key].filter((c) => c.correct);\n\n value[i] = correctChoices && correctChoices[0].value;\n });\n }\n\n resolve({\n id: '1',\n value,\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const { markup, choices } = model;\n const { maxResponseAreas, maxResponseAreaChoices } = config;\n const errors = {};\n\n ['teacherInstructions', 'prompt', 'rationale'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n const nbOfResponseAreas = ((markup || '').match(/\\{\\{(\\d+)\\}\\}/g) || []).length;\n\n if (nbOfResponseAreas > maxResponseAreas) {\n errors.responseAreasError = `No more than ${maxResponseAreas} response areas should be defined.`;\n } else if (nbOfResponseAreas < 1) {\n errors.responseAreasError = 'There should be defined at least 1 response area.';\n }\n\n (Object.keys(choices) || []).forEach((choiceKey) => {\n if (choices[choiceKey] && choices[choiceKey].length > maxResponseAreaChoices) {\n errors.responseAreaChoicesError = `No more than ${maxResponseAreaChoices} choices per response area should be defined.`;\n }\n });\n\n return errors;\n};\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAJ,OAAA;AAEA,MAAMK,WAAW,GAAIC,OAAO,IAAK;EAC/B,IAAIA,OAAO,EAAE;IACX,OAAO,SAAS;EAClB;EAEA,OAAO,WAAW;AACpB,CAAC;AAEM,MAAMC,SAAS,GAAIC,QAAQ,KAAM;EAAE,GAAGC,iBAAQ;EAAE,GAAGD;AA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AAE;MAC5EC,MAAM,CAACO,wBAAwB,GAAG,gBAAgBR,sBAAsB,+CAA+C;IACzH;EACF,CAAC,CAAC;EAEF,OAAOC,MAAM;AACf,CAAC;AAAC/F,OAAA,CAAA4F,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -1,18 +1,17 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.getAllCorrectResponses = void 0;
8
- var _forEach = _interopRequireDefault(require("lodash/forEach"));
7
+ var _lodashEs = require("lodash-es");
9
8
  const getAllCorrectResponses = ({
10
9
  choices,
11
10
  alternateResponse
12
11
  }) => {
13
12
  alternateResponse = alternateResponse || {};
14
13
  const correctAnswers = {};
15
- (0, _forEach.default)(choices, (respArea, key) => {
14
+ (0, _lodashEs.forEach)(choices, (respArea, key) => {
16
15
  if (!correctAnswers[key]) {
17
16
  correctAnswers[key] = [];
18
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["_forEach","_interopRequireDefault","require","getAllCorrectResponses","choices","alternateResponse","correctAnswers","forEach","respArea","key","choice","correct","push","value","exports"],"sources":["../src/utils.js"],"sourcesContent":["import forEach from 'lodash/forEach';\n\nexport const getAllCorrectResponses = ({ choices, alternateResponse }) => {\n alternateResponse = alternateResponse || {};\n const correctAnswers = {};\n\n forEach(choices, (respArea, key) => {\n if (!correctAnswers[key]) {\n correctAnswers[key] = [];\n }\n\n if (respArea) {\n respArea.forEach((choice) => {\n if (choice.correct) {\n correctAnswers[key].push(choice.value);\n\n if (alternateResponse[key]) {\n correctAnswers[key] = [...correctAnswers[key], ...alternateResponse[key]];\n }\n }\n });\n }\n });\n\n return correctAnswers;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEO,MAAMC,sBAAsB,GAAGA,CAAC;EAAEC,OAAO;EAAEC;AAAkB,CAAC,KAAK;EACxEA,iBAAiB,GAAGA,iBAAiB,IAAI,CAAC,CAAC;EAC3C,MAAMC,cAAc,GAAG,CAAC,CAAC;EAEzB,IAAAC,gBAAO,EAACH,OAAO,EAAE,CAACI,QAAQ,EAAEC,GAAG,KAAK;IAClC,IAAI,CAACH,cAAc,CAACG,GAAG,CAAC,EAAE;MACxBH,cAAc,CAACG,GAAG,CAAC,GAAG,EAAE;IAC1B;IAEA,IAAID,QAAQ,EAAE;MACZA,QAAQ,CAACD,OAAO,CAAEG,MAAM,IAAK;QAC3B,IAAIA,MAAM,CAACC,OAAO,EAAE;UAClBL,cAAc,CAACG,GAAG,CAAC,CAACG,IAAI,CAACF,MAAM,CAACG,KAAK,CAAC;UAEtC,IAAIR,iBAAiB,CAACI,GAAG,CAAC,EAAE;YAC1BH,cAAc,CAACG,GAAG,CAAC,GAAG,CAAC,GAAGH,cAAc,CAACG,GAAG,CAAC,EAAE,GAAGJ,iBAAiB,CAACI,GAAG,CAAC,CAAC;UAC3E;QACF;MACF,CAAC,CAAC;IACJ;EACF,CAAC,CAAC;EAEF,OAAOH,cAAc;AACvB,CAAC;AAACQ,OAAA,CAAAX,sBAAA,GAAAA,sBAAA","ignoreList":[]}
1
+ {"version":3,"file":"utils.js","names":["_lodashEs","require","getAllCorrectResponses","choices","alternateResponse","correctAnswers","forEach","respArea","key","choice","correct","push","value","exports"],"sources":["../src/utils.js"],"sourcesContent":["import { forEach } from 'lodash-es';\n\nexport const getAllCorrectResponses = ({ choices, alternateResponse }) => {\n alternateResponse = alternateResponse || {};\n const correctAnswers = {};\n\n forEach(choices, (respArea, key) => {\n if (!correctAnswers[key]) {\n correctAnswers[key] = [];\n }\n\n if (respArea) {\n respArea.forEach((choice) => {\n if (choice.correct) {\n correctAnswers[key].push(choice.value);\n\n if (alternateResponse[key]) {\n correctAnswers[key] = [...correctAnswers[key], ...alternateResponse[key]];\n }\n }\n });\n }\n });\n\n return correctAnswers;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAEO,MAAMC,sBAAsB,GAAGA,CAAC;EAAEC,OAAO;EAAEC;AAAkB,CAAC,KAAK;EACxEA,iBAAiB,GAAGA,iBAAiB,IAAI,CAAC,CAAC;EAC3C,MAAMC,cAAc,GAAG,CAAC,CAAC;EAEzB,IAAAC,iBAAO,EAACH,OAAO,EAAE,CAACI,QAAQ,EAAEC,GAAG,KAAK;IAClC,IAAI,CAACH,cAAc,CAACG,GAAG,CAAC,EAAE;MACxBH,cAAc,CAACG,GAAG,CAAC,GAAG,EAAE;IAC1B;IAEA,IAAID,QAAQ,EAAE;MACZA,QAAQ,CAACD,OAAO,CAAEG,MAAM,IAAK;QAC3B,IAAIA,MAAM,CAACC,OAAO,EAAE;UAClBL,cAAc,CAACG,GAAG,CAAC,CAACG,IAAI,CAACF,MAAM,CAACG,KAAK,CAAC;UAEtC,IAAIR,iBAAiB,CAACI,GAAG,CAAC,EAAE;YAC1BH,cAAc,CAACG,GAAG,CAAC,GAAG,CAAC,GAAGH,cAAc,CAACG,GAAG,CAAC,EAAE,GAAGJ,iBAAiB,CAACI,GAAG,CAAC,CAAC;UAC3E;QACF;MACF,CAAC,CAAC;IACJ;EACF,CAAC,CAAC;EAEF,OAAOH,cAAc;AACvB,CAAC;AAACQ,OAAA,CAAAX,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@pie-element/inline-dropdown-controller",
3
3
  "private": true,
4
- "version": "8.0.0-beta.0",
4
+ "version": "8.0.0-beta.1",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "module": "src/index.js",
8
8
  "author": "",
9
9
  "license": "ISC",
10
10
  "dependencies": {
11
- "@pie-lib/controller-utils": "0.22.4-next.0",
12
- "debug": "^3.1.0",
13
- "lodash": "^4.17.15",
11
+ "@pie-lib/controller-utils": "1.1.1-next.1",
12
+ "debug": "^4.1.1",
13
+ "lodash-es": "^4.17.23",
14
14
  "type-of": "^2.0.1"
15
15
  }
16
16
  }
@@ -10,7 +10,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
  var _reactDom = _interopRequireDefault(require("react-dom"));
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
- var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
13
+ var _lodashEs = require("lodash-es");
14
14
  var _correctAnswerToggle = _interopRequireDefault(require("@pie-lib/correct-answer-toggle"));
15
15
  var _maskMarkup = require("@pie-lib/mask-markup");
16
16
  var _renderUi = require("@pie-lib/render-ui");
@@ -67,7 +67,7 @@ class InlineDropdown extends _react.default.Component {
67
67
  });
68
68
  }
69
69
  UNSAFE_componentWillReceiveProps(nextProps) {
70
- if ((0, _isEmpty.default)(nextProps.feedback)) {
70
+ if ((0, _lodashEs.isEmpty)(nextProps.feedback)) {
71
71
  this.setState({
72
72
  showCorrectAnswer: false
73
73
  });
@@ -1 +1 @@
1
- {"version":3,"file":"inline-dropdown.js","names":["_react","_interopRequireDefault","require","_reactDom","_propTypes","_isEmpty","_correctAnswerToggle","_maskMarkup","_renderUi","_mathRendering","_styles","StyledUiLayout","styled","UiLayout","color","text","backgroundColor","background","StyledCollapsible","Collapsible","theme","marginBottom","spacing","ChoiceRationaleWrapper","ChoiceRationale","display","whiteSpace","ChoiceRationaleLabel","correct","incorrectWithIcon","SrOnly","position","left","top","width","height","overflow","InlineDropdown","React","Component","constructor","args","_defineProperty2","default","showCorrectAnswer","setState","state","UNSAFE_componentWillReceiveProps","nextProps","isEmpty","feedback","componentDidUpdate","domNode","ReactDOM","findDOMNode","renderMath","render","prompt","mode","model","rationale","teacherInstructions","choices","displayType","language","props","extraCSSRules","showCorrectAnswerToggle","choiceRationalesHaveText","showRationale","hasText","hasMedia","showTeacherInstructions","choiceRationales","Object","keys","map","key","reduce","acc","currentValue","push","createElement","style","labels","hidden","visible","PreviewPrompt","show","toggled","onToggle","toggleShowCorrect","_extends2","index","length","choice","label","dangerouslySetInnerHTML","__html","exports","PropTypes","string","disabled","bool","markup","object","isRequired","value","onChange","func","_default"],"sources":["../src/inline-dropdown.jsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport isEmpty from 'lodash/isEmpty';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { InlineDropdown as DropDown } from '@pie-lib/mask-markup';\nimport { color, Collapsible, hasText, hasMedia, PreviewPrompt, UiLayout } from '@pie-lib/render-ui';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport { styled } from '@mui/material/styles';\n\nconst StyledUiLayout = styled(UiLayout)({\n color: color.text(),\n backgroundColor: color.background(),\n});\n\nconst StyledCollapsible = styled(Collapsible)(({ theme }) => ({\n marginBottom: theme.spacing(2),\n}));\n\nconst ChoiceRationaleWrapper = styled('div')(({ theme }) => ({\n '&:not(:last-child)': {\n marginBottom: theme.spacing(2),\n },\n}));\n\nconst ChoiceRationale = styled('div')({\n display: 'flex',\n whiteSpace: 'break-spaces',\n});\n\nconst ChoiceRationaleLabel = styled('div')(({ correct }) => ({\n display: 'flex',\n ...(correct\n ? {\n color: color.correct(),\n }\n : {\n color: color.incorrectWithIcon(),\n }),\n}));\n\nconst SrOnly = styled('h2')({\n position: 'absolute',\n left: '-10000px',\n top: 'auto',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n});\n\nexport class InlineDropdown extends React.Component {\n static propTypes = {\n prompt: PropTypes.string,\n disabled: PropTypes.bool,\n markup: PropTypes.string,\n mode: PropTypes.string,\n displayType: PropTypes.string,\n rationale: PropTypes.string,\n teacherInstructions: PropTypes.string,\n model: PropTypes.object.isRequired,\n choices: PropTypes.object,\n value: PropTypes.object,\n feedback: PropTypes.object,\n onChange: PropTypes.func,\n language: PropTypes.string,\n };\n\n static defaultProps = {\n value: {},\n };\n\n state = {\n showCorrectAnswer: false,\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n if (isEmpty(nextProps.feedback)) {\n this.setState({ showCorrectAnswer: false });\n }\n }\n\n componentDidUpdate() {\n // eslint-disable-next-line\n const domNode = ReactDOM.findDOMNode(this);\n\n renderMath(domNode);\n }\n\n toggleShowCorrect = () => {\n this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });\n };\n\n render() {\n const { showCorrectAnswer } = this.state;\n const { prompt, mode, model, rationale, teacherInstructions, choices, displayType, language } = this.props;\n const { extraCSSRules } = model || {};\n const showCorrectAnswerToggle = mode === 'evaluate';\n let choiceRationalesHaveText = false;\n const showRationale = rationale && (hasText(rationale) || hasMedia(rationale));\n const showTeacherInstructions =\n teacherInstructions && (hasText(teacherInstructions) || hasMedia(teacherInstructions));\n\n const choiceRationales = (Object.keys(choices) || []).map((key) =>\n (choices[key] || []).reduce((acc, currentValue) => {\n if (currentValue.rationale && hasText(currentValue.rationale)) {\n choiceRationalesHaveText = true;\n\n acc.push(currentValue);\n }\n\n return acc;\n }, []),\n );\n\n return (\n <StyledUiLayout extraCSSRules={extraCSSRules} style={{ display: `${displayType}` }}>\n {mode === 'gather' && <SrOnly>Inline Dropdown Question</SrOnly>}\n\n {showTeacherInstructions && (\n <StyledCollapsible\n labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}\n >\n <PreviewPrompt prompt={teacherInstructions} />\n </StyledCollapsible>\n )}\n\n {prompt && <PreviewPrompt prompt={prompt} />}\n\n <CorrectAnswerToggle\n show={showCorrectAnswerToggle}\n toggled={showCorrectAnswer}\n onToggle={this.toggleShowCorrect}\n language={language}\n />\n\n <DropDown {...this.props} showCorrectAnswer={showCorrectAnswer} />\n\n {choiceRationalesHaveText && (\n <StyledCollapsible\n labels={{ hidden: 'Show Rationale for choices', visible: 'Hide Rationale for choices' }}\n >\n {choiceRationales.map((choices, index) => (\n <ChoiceRationaleWrapper key={index}>\n {choices?.length > 0 &&\n choices.map((choice) => (\n <ChoiceRationale key={choice.label}>\n <ChoiceRationaleLabel\n correct={choice.correct}\n dangerouslySetInnerHTML={{ __html: `${choice.label}: ` }}\n />\n <PreviewPrompt prompt={choice.rationale} />\n </ChoiceRationale>\n ))}\n </ChoiceRationaleWrapper>\n ))}\n </StyledCollapsible>\n )}\n\n {showRationale && (\n <Collapsible labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}>\n <PreviewPrompt prompt={rationale} />\n </Collapsible>\n )}\n </StyledUiLayout>\n );\n }\n}\n\nexport default InlineDropdown;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,QAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,oBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,cAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAEA,MAAMS,cAAc,GAAG,IAAAC,cAAM,EAACC,kBAAQ,CAAC,CAAC;EACtCC,KAAK,EAAEA,eAAK,CAACC,IAAI,CAAC,CAAC;EACnBC,eAAe,EAAEF,eAAK,CAACG,UAAU,CAAC;AACpC,CAAC,CAAC;AAEF,MAAMC,iBAAiB,GAAG,IAAAN,cAAM,EAACO,qBAAW,CAAC,CAAC,CAAC;EAAEC;AAAM,CAAC,MAAM;EAC5DC,YAAY,EAAED,KAAK,CAACE,OAAO,CAAC,CAAC;AAC/B,CAAC,CAAC,CAAC;AAEH,MAAMC,sBAAsB,GAAG,IAAAX,cAAM,EAAC,KAAK,CAAC,CAAC,CAAC;EAAEQ;AAAM,CAAC,MAAM;EAC3D,oBAAoB,EAAE;IACpBC,YAAY,EAAED,KAAK,CAACE,OAAO,CAAC,CAAC;EAC/B;AACF,CAAC,CAAC,CAAC;AA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,kBAAS,CAACC,MAAM;EACrC1C,KAAK,EAAEyC,kBAAS,CAACK,MAAM,CAACC,UAAU;EAClC5C,OAAO,EAAEsC,kBAAS,CAACK,MAAM;EACzBE,KAAK,EAAEP,kBAAS,CAACK,MAAM;EACvBvD,QAAQ,EAAEkD,kBAAS,CAACK,MAAM;EAC1BG,QAAQ,EAAER,kBAAS,CAACS,IAAI;EACxB7C,QAAQ,EAAEoC,kBAAS,CAACC;AACtB,CAAC;AAAA,IAAA3D,gBAAA,CAAAC,OAAA,EAfUN,cAAc,kBAiBH;EACpBsE,KAAK,EAAE,CAAC;AACV,CAAC;AAAA,IAAAG,QAAA,GAAAX,OAAA,CAAAxD,OAAA,GAmGYN,cAAc","ignoreList":[]}
1
+ {"version":3,"file":"inline-dropdown.js","names":["_react","_interopRequireDefault","require","_reactDom","_propTypes","_lodashEs","_correctAnswerToggle","_maskMarkup","_renderUi","_mathRendering","_styles","StyledUiLayout","styled","UiLayout","color","text","backgroundColor","background","StyledCollapsible","Collapsible","theme","marginBottom","spacing","ChoiceRationaleWrapper","ChoiceRationale","display","whiteSpace","ChoiceRationaleLabel","correct","incorrectWithIcon","SrOnly","position","left","top","width","height","overflow","InlineDropdown","React","Component","constructor","args","_defineProperty2","default","showCorrectAnswer","setState","state","UNSAFE_componentWillReceiveProps","nextProps","isEmpty","feedback","componentDidUpdate","domNode","ReactDOM","findDOMNode","renderMath","render","prompt","mode","model","rationale","teacherInstructions","choices","displayType","language","props","extraCSSRules","showCorrectAnswerToggle","choiceRationalesHaveText","showRationale","hasText","hasMedia","showTeacherInstructions","choiceRationales","Object","keys","map","key","reduce","acc","currentValue","push","createElement","style","labels","hidden","visible","PreviewPrompt","show","toggled","onToggle","toggleShowCorrect","_extends2","index","length","choice","label","dangerouslySetInnerHTML","__html","exports","PropTypes","string","disabled","bool","markup","object","isRequired","value","onChange","func","_default"],"sources":["../src/inline-dropdown.jsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport { isEmpty } from 'lodash-es';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { InlineDropdown as DropDown } from '@pie-lib/mask-markup';\nimport { color, Collapsible, hasText, hasMedia, PreviewPrompt, UiLayout } from '@pie-lib/render-ui';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport { styled } from '@mui/material/styles';\n\nconst StyledUiLayout = styled(UiLayout)({\n color: color.text(),\n backgroundColor: color.background(),\n});\n\nconst StyledCollapsible = styled(Collapsible)(({ theme }) => ({\n marginBottom: theme.spacing(2),\n}));\n\nconst ChoiceRationaleWrapper = styled('div')(({ theme }) => ({\n '&:not(:last-child)': {\n marginBottom: theme.spacing(2),\n },\n}));\n\nconst ChoiceRationale = styled('div')({\n display: 'flex',\n whiteSpace: 'break-spaces',\n});\n\nconst ChoiceRationaleLabel = styled('div')(({ correct }) => ({\n display: 'flex',\n ...(correct\n ? {\n color: color.correct(),\n }\n : {\n color: color.incorrectWithIcon(),\n }),\n}));\n\nconst SrOnly = styled('h2')({\n position: 'absolute',\n left: '-10000px',\n top: 'auto',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n});\n\nexport class InlineDropdown extends React.Component {\n static propTypes = {\n prompt: PropTypes.string,\n disabled: PropTypes.bool,\n markup: PropTypes.string,\n mode: PropTypes.string,\n displayType: PropTypes.string,\n rationale: PropTypes.string,\n teacherInstructions: PropTypes.string,\n model: PropTypes.object.isRequired,\n choices: PropTypes.object,\n value: PropTypes.object,\n feedback: PropTypes.object,\n onChange: PropTypes.func,\n language: PropTypes.string,\n };\n\n static defaultProps = {\n value: {},\n };\n\n state = {\n showCorrectAnswer: false,\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n if (isEmpty(nextProps.feedback)) {\n this.setState({ showCorrectAnswer: false });\n }\n }\n\n componentDidUpdate() {\n // eslint-disable-next-line\n const domNode = ReactDOM.findDOMNode(this);\n\n renderMath(domNode);\n }\n\n toggleShowCorrect = () => {\n this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });\n };\n\n render() {\n const { showCorrectAnswer } = this.state;\n const { prompt, mode, model, rationale, teacherInstructions, choices, displayType, language } = this.props;\n const { extraCSSRules } = model || {};\n const showCorrectAnswerToggle = mode === 'evaluate';\n let choiceRationalesHaveText = false;\n const showRationale = rationale && (hasText(rationale) || hasMedia(rationale));\n const showTeacherInstructions =\n teacherInstructions && (hasText(teacherInstructions) || hasMedia(teacherInstructions));\n\n const choiceRationales = (Object.keys(choices) || []).map((key) =>\n (choices[key] || []).reduce((acc, currentValue) => {\n if (currentValue.rationale && hasText(currentValue.rationale)) {\n choiceRationalesHaveText = true;\n\n acc.push(currentValue);\n }\n\n return acc;\n }, []),\n );\n\n return (\n <StyledUiLayout extraCSSRules={extraCSSRules} style={{ display: `${displayType}` }}>\n {mode === 'gather' && <SrOnly>Inline Dropdown Question</SrOnly>}\n\n {showTeacherInstructions && (\n <StyledCollapsible\n labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}\n >\n <PreviewPrompt prompt={teacherInstructions} />\n </StyledCollapsible>\n )}\n\n {prompt && <PreviewPrompt prompt={prompt} />}\n\n <CorrectAnswerToggle\n show={showCorrectAnswerToggle}\n toggled={showCorrectAnswer}\n onToggle={this.toggleShowCorrect}\n language={language}\n />\n\n <DropDown {...this.props} showCorrectAnswer={showCorrectAnswer} />\n\n {choiceRationalesHaveText && (\n <StyledCollapsible\n labels={{ hidden: 'Show Rationale for choices', visible: 'Hide Rationale for choices' }}\n >\n {choiceRationales.map((choices, index) => (\n <ChoiceRationaleWrapper key={index}>\n {choices?.length > 0 &&\n choices.map((choice) => (\n <ChoiceRationale key={choice.label}>\n <ChoiceRationaleLabel\n correct={choice.correct}\n dangerouslySetInnerHTML={{ __html: `${choice.label}: ` }}\n />\n <PreviewPrompt prompt={choice.rationale} />\n </ChoiceRationale>\n ))}\n </ChoiceRationaleWrapper>\n ))}\n </StyledCollapsible>\n )}\n\n {showRationale && (\n <Collapsible labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}>\n <PreviewPrompt prompt={rationale} />\n </Collapsible>\n )}\n </StyledUiLayout>\n );\n }\n}\n\nexport default InlineDropdown;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,cAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAEA,MAAMS,cAAc,GAAG,IAAAC,cAAM,EAACC,kBAAQ,CAAC,CAAC;EACtCC,KAAK,EAAEA,eAAK,CAACC,IAAI,CAAC,CAAC;EACnBC,eAAe,EAAEF,eAAK,CAACG,UAAU,CAAC;AACpC,CAAC,CAAC;AAEF,MAAMC,iBAAiB,GAAG,IAAAN,cAAM,EAACO,qBAAW,CAAC,CAAC,CAAC;EAAEC;AAAM,CAAC,MAAM;EAC5DC,YAAY,EAAED,KAAK,CAACE,OAAO,CAAC,CAAC;AAC/B,CAAC,CAAC,CAAC;AAEH,MAAMC,sBAAsB,GAAG,IAAAX,cAAM,EAAC,KAAK,CAAC,CAAC,CAAC;EAAEQ;AAAM,CAAC,MAAM;EAC3D,oBAAoB,EAAE;IACpBC,YAAY,EAAED,KAAK,CAACE,OAAO,CAAC,CAAC;EAC/B;AACF,CAAC,CAAC,CAAC;AAEH,MAAME,eAAe,GAAG,IAAAZ,cAAM,EAAC,KAAK,CAAC,CAAC;EACpCa,OAAO,EAAE,MAAM;EACfC,UAAU,EAAE;AACd,CAAC,CAAC;AAEF,MAAMC,oBAAoB,GAAG,IAAAf,cAAM,EAAC,KAAK,CAAC,CAAC,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S,CAACK,MAAM;EAC1BG,QAAQ,EAAER,kBAAS,CAACS,IAAI;EACxB7C,QAAQ,EAAEoC,kBAAS,CAACC;AACtB,CAAC;AAAA,IAAA3D,gBAAA,CAAAC,OAAA,EAfUN,cAAc,kBAiBH;EACpBsE,KAAK,EAAE,CAAC;AACV,CAAC;AAAA,IAAAG,QAAA,GAAAX,OAAA,CAAAxD,OAAA,GAmGYN,cAAc","ignoreList":[]}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "repository": "pie-framework/pie-elements",
7
- "version": "9.0.0-beta.0",
7
+ "version": "9.0.0-next.0+67da381",
8
8
  "description": "",
9
9
  "scripts": {
10
10
  "postpublish": "../../scripts/postpublish"
@@ -15,18 +15,18 @@
15
15
  "@mui/icons-material": "^7.3.4",
16
16
  "@mui/material": "^7.3.4",
17
17
  "@pie-framework/pie-player-events": "^0.1.0",
18
- "@pie-lib/correct-answer-toggle": "2.25.4-next.0",
19
- "@pie-lib/mask-markup": "1.33.4-next.0",
20
- "@pie-lib/math-rendering": "3.22.3-next.0",
21
- "@pie-lib/render-ui": "4.35.4-next.0",
22
- "lodash": "^4.17.10",
23
- "prop-types": "^15.6.1",
24
- "react": "18.2.0",
25
- "react-dom": "18.2.0"
18
+ "@pie-lib/correct-answer-toggle": "3.1.1-next.1",
19
+ "@pie-lib/mask-markup": "2.1.1-next.3",
20
+ "@pie-lib/math-rendering": "4.1.1-next.1",
21
+ "@pie-lib/render-ui": "5.1.1-next.1",
22
+ "lodash-es": "^4.17.23",
23
+ "prop-types": "^15.8.1",
24
+ "react": "18.3.1",
25
+ "react-dom": "18.3.1"
26
26
  },
27
27
  "author": "",
28
28
  "license": "ISC",
29
- "gitHead": "f7170c384c729616bce308c461c7443d6bc65ccc",
29
+ "gitHead": "67da3818d2af966110c6e85f6e8e238b79515eb2",
30
30
  "main": "lib/index.js",
31
31
  "module": "src/index.js"
32
32
  }