@pie-element/multiple-choice 13.1.1-next.0 → 13.2.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.
- package/CHANGELOG.json +1972 -0
- package/CHANGELOG.md +2696 -0
- package/LICENSE.md +5 -0
- package/PRINT.md +35 -0
- package/README.md +56 -0
- package/choice.png +0 -0
- package/configure/CHANGELOG.json +1387 -0
- package/configure/CHANGELOG.md +2046 -0
- package/{src/author/defaults.ts → configure/lib/defaults.js} +90 -55
- package/configure/lib/defaults.js.map +1 -0
- package/{src/author/index.ts → configure/lib/index.js} +51 -98
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/main.js +477 -0
- package/configure/lib/main.js.map +1 -0
- package/configure/lib/utils.js +18 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +22 -0
- package/controller/CHANGELOG.json +527 -0
- package/controller/CHANGELOG.md +1388 -0
- package/{src/controller/defaults.ts → controller/lib/defaults.js} +8 -11
- package/controller/lib/defaults.js.map +1 -0
- package/{src/controller/index.ts → controller/lib/index.js} +109 -123
- package/controller/lib/index.js.map +1 -0
- package/controller/lib/utils.js +15 -0
- package/controller/lib/utils.js.map +1 -0
- package/controller/package.json +15 -0
- package/docs/config-schema.json +2993 -0
- package/docs/config-schema.json.md +2217 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +61 -0
- package/docs/demo/index.html +1 -0
- package/docs/demo/session.js +7 -0
- package/docs/pie-schema.json +1332 -0
- package/docs/pie-schema.json.md +1015 -0
- package/lib/choice-input.js +380 -0
- package/lib/choice-input.js.map +1 -0
- package/lib/choice.js +197 -0
- package/lib/choice.js.map +1 -0
- package/lib/feedback-tick.js +134 -0
- package/lib/feedback-tick.js.map +1 -0
- package/{src/delivery/index.ts → lib/index.js} +129 -211
- package/lib/index.js.map +1 -0
- package/lib/main.js +63 -0
- package/lib/main.js.map +1 -0
- package/lib/multiple-choice.js +412 -0
- package/lib/multiple-choice.js.map +1 -0
- package/lib/print.js +94 -0
- package/lib/print.js.map +1 -0
- package/{src/delivery/session-updater.ts → lib/session-updater.js} +13 -17
- package/lib/session-updater.js.map +1 -0
- package/module/configure.js +1 -0
- package/module/controller.js +3045 -0
- package/module/demo.js +86 -0
- package/module/element.js +1 -0
- package/module/index.html +21 -0
- package/module/manifest.json +10 -0
- package/module/print-demo.js +124 -0
- package/module/print.html +18 -0
- package/module/print.js +1 -0
- package/package.json +26 -58
- package/dist/author/defaults.d.ts +0 -206
- package/dist/author/defaults.d.ts.map +0 -1
- package/dist/author/defaults.js +0 -151
- package/dist/author/index.d.ts +0 -27
- package/dist/author/index.d.ts.map +0 -1
- package/dist/author/index.js +0 -116
- package/dist/author/main.d.ts +0 -35
- package/dist/author/main.d.ts.map +0 -1
- package/dist/author/main.js +0 -290
- package/dist/author/utils.d.ts +0 -10
- package/dist/author/utils.d.ts.map +0 -1
- package/dist/author/utils.js +0 -7
- package/dist/controller/defaults.d.ts +0 -36
- package/dist/controller/defaults.d.ts.map +0 -1
- package/dist/controller/defaults.js +0 -29
- package/dist/controller/index.d.ts +0 -66
- package/dist/controller/index.d.ts.map +0 -1
- package/dist/controller/index.js +0 -124
- package/dist/controller/utils.d.ts +0 -11
- package/dist/controller/utils.d.ts.map +0 -1
- package/dist/controller/utils.js +0 -8
- package/dist/delivery/choice-input.d.ts +0 -45
- package/dist/delivery/choice-input.d.ts.map +0 -1
- package/dist/delivery/choice-input.js +0 -274
- package/dist/delivery/choice.d.ts +0 -21
- package/dist/delivery/choice.d.ts.map +0 -1
- package/dist/delivery/choice.js +0 -109
- package/dist/delivery/feedback-tick.d.ts +0 -21
- package/dist/delivery/feedback-tick.d.ts.map +0 -1
- package/dist/delivery/feedback-tick.js +0 -104
- package/dist/delivery/index.d.ts +0 -38
- package/dist/delivery/index.d.ts.map +0 -1
- package/dist/delivery/index.js +0 -217
- package/dist/delivery/main.d.ts +0 -32
- package/dist/delivery/main.d.ts.map +0 -1
- package/dist/delivery/main.js +0 -51
- package/dist/delivery/multiple-choice.d.ts +0 -63
- package/dist/delivery/multiple-choice.d.ts.map +0 -1
- package/dist/delivery/multiple-choice.js +0 -252
- package/dist/delivery/session-updater.d.ts +0 -11
- package/dist/delivery/session-updater.d.ts.map +0 -1
- package/dist/delivery/session-updater.js +0 -9
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.iife.d.ts +0 -9
- package/dist/index.iife.d.ts.map +0 -1
- package/dist/index.iife.js +0 -148
- package/dist/index.js +0 -2
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Hash.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_ListCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Map.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_MapCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Set.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_SetCache.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Stack.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Uint8Array.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_apply.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arraySome.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assignMergeValue.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assignValue.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assocIndexOf.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssign.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignValue.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js +0 -57
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseCreate.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseFor.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqual.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqualDeep.js +0 -30
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeys.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseMerge.js +0 -19
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseMergeDeep.js +0 -31
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseRest.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseSetToString.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTrim.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cacheHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneBuffer.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneTypedArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyObject.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbols.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbolsIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_createAssigner.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_createBaseFor.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalArrays.js +0 -35
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalByTag.js +0 -35
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalObjects.js +0 -32
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getMapData.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getNative.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getPrototype.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js +0 -23
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getValue.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashGet.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashHas.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js +0 -33
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneObject.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIterateeCall.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKeyable.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheClear.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheDelete.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheGet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheClear.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheDelete.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheGet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapToArray.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeCreate.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeys.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overArg.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overRest.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_root.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_safeGet.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheAdd.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToArray.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToString.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_shortOut.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackGet.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackSet.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_trimmedEndIndex.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/constant.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/debounce.js +0 -50
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/defaults.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/eq.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/identity.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArguments.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArray.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLikeObject.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEmpty.js +0 -21
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEqual.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isLength.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isMap.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObject.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isPlainObject.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/merge.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/now.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toNumber.js +0 -19
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toPlainObject.js +0 -8
- package/dist/print/index.d.ts +0 -16
- package/dist/print/index.d.ts.map +0 -1
- package/dist/print/index.js +0 -44
- package/src/author/main.tsx +0 -509
- package/src/author/utils.ts +0 -25
- package/src/controller/utils.ts +0 -22
- package/src/delivery/choice-input.tsx +0 -413
- package/src/delivery/choice.tsx +0 -203
- package/src/delivery/feedback-tick.tsx +0 -156
- package/src/delivery/main.tsx +0 -85
- package/src/delivery/multiple-choice.tsx +0 -485
- package/src/index.iife.ts +0 -16
- package/src/index.ts +0 -1
- package/src/print/index.tsx +0 -112
|
@@ -1,485 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
/**
|
|
3
|
-
* @synced-from pie-elements/packages/multiple-choice/src/multiple-choice.jsx
|
|
4
|
-
* @auto-generated
|
|
5
|
-
*
|
|
6
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
-
* Manual edits will be overwritten on next sync.
|
|
8
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import React from 'react';
|
|
12
|
-
import PropTypes from 'prop-types';
|
|
13
|
-
import CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';
|
|
14
|
-
import classNames from 'classnames';
|
|
15
|
-
import { styled } from '@mui/material/styles';
|
|
16
|
-
import Box from '@mui/material/Box';
|
|
17
|
-
import { color, Collapsible as CollapsibleImport, PreviewPrompt as PreviewPromptImport, transformDataHeadings } from '@pie-lib/render-ui';
|
|
18
|
-
|
|
19
|
-
function isRenderableReactInteropType(value: any) {
|
|
20
|
-
return (
|
|
21
|
-
typeof value === 'function' ||
|
|
22
|
-
(typeof value === 'object' && value !== null && typeof value.$$typeof === 'symbol')
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function unwrapReactInteropSymbol(maybeSymbol: any, namedExport?: string) {
|
|
27
|
-
if (!maybeSymbol) return maybeSymbol;
|
|
28
|
-
if (isRenderableReactInteropType(maybeSymbol)) return maybeSymbol;
|
|
29
|
-
if (isRenderableReactInteropType(maybeSymbol.default)) return maybeSymbol.default;
|
|
30
|
-
if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport])) {
|
|
31
|
-
return maybeSymbol[namedExport];
|
|
32
|
-
}
|
|
33
|
-
if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport]?.default)) {
|
|
34
|
-
return maybeSymbol[namedExport].default;
|
|
35
|
-
}
|
|
36
|
-
return maybeSymbol;
|
|
37
|
-
}
|
|
38
|
-
const PreviewPrompt = unwrapReactInteropSymbol(PreviewPromptImport, 'PreviewPrompt') || unwrapReactInteropSymbol(renderUi.PreviewPrompt, 'PreviewPrompt');
|
|
39
|
-
const Collapsible = unwrapReactInteropSymbol(CollapsibleImport, 'Collapsible') || unwrapReactInteropSymbol(renderUi.Collapsible, 'Collapsible');
|
|
40
|
-
import * as RenderUiNamespace from '@pie-lib/render-ui';
|
|
41
|
-
const renderUiNamespaceAny = RenderUiNamespace as any;
|
|
42
|
-
const renderUiDefaultMaybe = renderUiNamespaceAny['default'];
|
|
43
|
-
const renderUi =
|
|
44
|
-
renderUiDefaultMaybe && typeof renderUiDefaultMaybe === 'object'
|
|
45
|
-
? renderUiDefaultMaybe
|
|
46
|
-
: renderUiNamespaceAny;
|
|
47
|
-
import Translator from '@pie-lib/translator';
|
|
48
|
-
|
|
49
|
-
import Choice from './choice.js';
|
|
50
|
-
|
|
51
|
-
const { translator } = Translator;
|
|
52
|
-
|
|
53
|
-
const MainContainer: any = styled(Box)({
|
|
54
|
-
color: color.text(),
|
|
55
|
-
backgroundColor: color.background(),
|
|
56
|
-
'& *': {
|
|
57
|
-
'-webkit-font-smoothing': 'antialiased',
|
|
58
|
-
},
|
|
59
|
-
position: 'relative',
|
|
60
|
-
// remove border from legend tags inside main to override the OT default styles
|
|
61
|
-
'& legend': {
|
|
62
|
-
border: 'none !important',
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
const PartLabel: any = styled('h2')(({ theme }) => ({
|
|
67
|
-
display: 'block',
|
|
68
|
-
fontSize: 'inherit',
|
|
69
|
-
margin: '0',
|
|
70
|
-
fontWeight: 'normal',
|
|
71
|
-
paddingBottom: theme.spacing(2),
|
|
72
|
-
}));
|
|
73
|
-
|
|
74
|
-
const TeacherInstructions: any = styled(Box)(({ theme }) => ({
|
|
75
|
-
marginBottom: theme.spacing(2),
|
|
76
|
-
}));
|
|
77
|
-
|
|
78
|
-
const HorizontalLayout: any = styled(Box)({
|
|
79
|
-
display: 'flex',
|
|
80
|
-
flexDirection: 'row',
|
|
81
|
-
flexWrap: 'wrap',
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
const GridLayout: any = styled(Box)({
|
|
85
|
-
display: 'grid',
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
const StyledFieldset: any = styled('fieldset')({
|
|
89
|
-
border: '0px',
|
|
90
|
-
padding: '0.01em 0 0 0',
|
|
91
|
-
margin: '0px',
|
|
92
|
-
minWidth: '0px',
|
|
93
|
-
'&:focus': {
|
|
94
|
-
outline: 'none',
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
const SrOnly: any = styled('h3')({
|
|
99
|
-
position: 'absolute',
|
|
100
|
-
left: '-10000px',
|
|
101
|
-
top: 'auto',
|
|
102
|
-
width: '1px',
|
|
103
|
-
height: '1px',
|
|
104
|
-
overflow: 'hidden',
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
const ErrorText: any = styled('div')(({ theme }) => ({
|
|
108
|
-
fontSize: theme.typography.fontSize - 2,
|
|
109
|
-
color: theme.palette.error.main,
|
|
110
|
-
paddingTop: theme.spacing(1),
|
|
111
|
-
}));
|
|
112
|
-
|
|
113
|
-
export class MultipleChoice extends React.Component {
|
|
114
|
-
static propTypes = {
|
|
115
|
-
className: PropTypes.string,
|
|
116
|
-
mode: PropTypes.oneOf(['gather', 'view', 'evaluate']),
|
|
117
|
-
choiceMode: PropTypes.oneOf(['radio', 'checkbox']),
|
|
118
|
-
keyMode: PropTypes.oneOf(['numbers', 'letters', 'none']),
|
|
119
|
-
choices: PropTypes.array,
|
|
120
|
-
partLabel: PropTypes.string,
|
|
121
|
-
prompt: PropTypes.string,
|
|
122
|
-
teacherInstructions: PropTypes.string,
|
|
123
|
-
session: PropTypes.object,
|
|
124
|
-
disabled: PropTypes.bool,
|
|
125
|
-
onChoiceChanged: PropTypes.func,
|
|
126
|
-
responseCorrect: PropTypes.bool,
|
|
127
|
-
correctResponse: PropTypes.array,
|
|
128
|
-
choicesLayout: PropTypes.oneOf(['vertical', 'grid', 'horizontal']),
|
|
129
|
-
gridColumns: PropTypes.string,
|
|
130
|
-
alwaysShowCorrect: PropTypes.bool,
|
|
131
|
-
animationsDisabled: PropTypes.bool,
|
|
132
|
-
language: PropTypes.string,
|
|
133
|
-
selectedAnswerBackgroundColor: PropTypes.string,
|
|
134
|
-
selectedAnswerStrokeColor: PropTypes.string,
|
|
135
|
-
selectedAnswerStrokeWidth: PropTypes.string,
|
|
136
|
-
hoverAnswerBackgroundColor: PropTypes.string,
|
|
137
|
-
hoverAnswerStrokeColor: PropTypes.string,
|
|
138
|
-
hoverAnswerStrokeWidth: PropTypes.string,
|
|
139
|
-
onShowCorrectToggle: PropTypes.func,
|
|
140
|
-
isSelectionButtonBelow: PropTypes.bool,
|
|
141
|
-
minSelections: PropTypes.number,
|
|
142
|
-
maxSelections: PropTypes.number,
|
|
143
|
-
autoplayAudioEnabled: PropTypes.bool,
|
|
144
|
-
customAudioButton: {
|
|
145
|
-
playImage: PropTypes.string,
|
|
146
|
-
pauseImage: PropTypes.string,
|
|
147
|
-
},
|
|
148
|
-
options: PropTypes.object,
|
|
149
|
-
baseHeadingLevel: PropTypes.number,
|
|
150
|
-
includeSrHeading: PropTypes.bool,
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
constructor(props) {
|
|
154
|
-
super(props);
|
|
155
|
-
|
|
156
|
-
this.state = {
|
|
157
|
-
showCorrect: (this.props.options && this.props.alwaysShowCorrect) || false,
|
|
158
|
-
maxSelectionsErrorState: false,
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
this.onToggle = this.onToggle.bind(this);
|
|
162
|
-
this.firstInputRef = React.createRef();
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
isSelected(value) {
|
|
166
|
-
const sessionValue = this.props.session && this.props.session.value;
|
|
167
|
-
|
|
168
|
-
return sessionValue && sessionValue.indexOf && sessionValue.indexOf(value) >= 0;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// handleChange was added for accessibility. Please see comments and videos from PD-2441.
|
|
172
|
-
handleChange: any = (event) => {
|
|
173
|
-
const { value, checked } = event.target;
|
|
174
|
-
const { maxSelections, onChoiceChanged, session } = this.props;
|
|
175
|
-
|
|
176
|
-
if (session.value && session.value.length >= maxSelections) {
|
|
177
|
-
// show/hide max selections error when user select/deselect an answer
|
|
178
|
-
this.setState({ maxSelectionsErrorState: checked });
|
|
179
|
-
|
|
180
|
-
if (checked) {
|
|
181
|
-
// prevent selecting more answers
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
onChoiceChanged({ value, selected: checked, selector: 'Mouse' });
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
onToggle: any = () => {
|
|
190
|
-
if (this.props.mode === 'evaluate') {
|
|
191
|
-
this.setState({ showCorrect: !this.state.showCorrect }, () => {
|
|
192
|
-
if (this.props.onShowCorrectToggle) {
|
|
193
|
-
this.props.onShowCorrectToggle();
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
200
|
-
if (!nextProps.correctResponse && this.state.showCorrect !== false) {
|
|
201
|
-
this.setState({ showCorrect: false }, () => {
|
|
202
|
-
if (this.props.onShowCorrectToggle) {
|
|
203
|
-
this.props.onShowCorrectToggle();
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
if (nextProps.options && nextProps.alwaysShowCorrect && this.state.showCorrect !== true) {
|
|
209
|
-
this.setState({ showCorrect: true }, () => {
|
|
210
|
-
if (this.props.onShowCorrectToggle) {
|
|
211
|
-
this.props.onShowCorrectToggle();
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
indexToSymbol(index) {
|
|
218
|
-
if (this.props.keyMode === 'numbers') {
|
|
219
|
-
return `${index + 1}`;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if (this.props.keyMode === 'letters') {
|
|
223
|
-
return String.fromCharCode(97 + index).toUpperCase();
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
return '';
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
getCorrectness: any = (choice = {}) => {
|
|
230
|
-
const isCorrect = choice.correct;
|
|
231
|
-
const isChecked = this.isSelected(choice.value);
|
|
232
|
-
|
|
233
|
-
if (this.state.showCorrect) {
|
|
234
|
-
return isCorrect ? 'correct' : undefined;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
if (isCorrect) {
|
|
238
|
-
if (isChecked) {
|
|
239
|
-
// A correct answer is selected: marked with a green checkmark
|
|
240
|
-
return 'correct';
|
|
241
|
-
} else {
|
|
242
|
-
// A correct answer is NOT selected: marked with an orange X
|
|
243
|
-
return 'incorrect';
|
|
244
|
-
}
|
|
245
|
-
} else {
|
|
246
|
-
if (isChecked) {
|
|
247
|
-
// An incorrect answer is selected: marked with an orange X
|
|
248
|
-
return 'incorrect';
|
|
249
|
-
} else {
|
|
250
|
-
// An incorrect answer is NOT selected: not marked
|
|
251
|
-
return undefined;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
getChecked(choice) {
|
|
257
|
-
// check for print context: options prop is passed from print.js and alwaysShowCorrect is true
|
|
258
|
-
const isPrintMode = this.props.options && this.props.alwaysShowCorrect;
|
|
259
|
-
|
|
260
|
-
if (isPrintMode) {
|
|
261
|
-
return choice.correct || false;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// evaluate mode with show correct toggled
|
|
265
|
-
const isEvaluateMode = this.state.showCorrect && this.props.mode === 'evaluate';
|
|
266
|
-
|
|
267
|
-
if (isEvaluateMode) {
|
|
268
|
-
return choice.correct || false;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
// default behavior: show what the user has selected
|
|
272
|
-
return this.isSelected(choice.value);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
// renderHeading function was added for accessibility.
|
|
276
|
-
renderHeading() {
|
|
277
|
-
const { mode, choiceMode, includeSrHeading, baseHeadingLevel, partLabel } = this.props;
|
|
278
|
-
|
|
279
|
-
// When a part label is present the item is an EBSR part — the SR heading
|
|
280
|
-
// is provided by the EBSR element, not here.
|
|
281
|
-
const shouldRenderSrHeading = !partLabel && includeSrHeading !== false;
|
|
282
|
-
|
|
283
|
-
if (!shouldRenderSrHeading || mode !== 'gather') {
|
|
284
|
-
return null;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
const clampedLevel = baseHeadingLevel ? Math.min(6, baseHeadingLevel) : 2;
|
|
288
|
-
const HeadingTag = SrOnly.withComponent(`h${clampedLevel}`);
|
|
289
|
-
const label = choiceMode === 'radio' ? 'Multiple Choice Question' : 'Multiple Select Question';
|
|
290
|
-
|
|
291
|
-
return <HeadingTag>{label}</HeadingTag>;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
handleGroupFocus: any = (e) => {
|
|
295
|
-
const fieldset = e.currentTarget;
|
|
296
|
-
const activeEl = document.activeElement;
|
|
297
|
-
|
|
298
|
-
if (fieldset.contains(activeEl) && activeEl !== fieldset) {
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
// Only focus the first input if user is tabbing forward
|
|
303
|
-
if (!e.relatedTarget || fieldset.compareDocumentPosition(e.relatedTarget) & Node.DOCUMENT_POSITION_PRECEDING) {
|
|
304
|
-
if (this.firstInputRef?.current) {
|
|
305
|
-
this.firstInputRef.current.focus();
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
|
|
310
|
-
render() {
|
|
311
|
-
const {
|
|
312
|
-
mode,
|
|
313
|
-
disabled,
|
|
314
|
-
className,
|
|
315
|
-
choices = [],
|
|
316
|
-
choiceMode,
|
|
317
|
-
gridColumns,
|
|
318
|
-
partLabel,
|
|
319
|
-
prompt,
|
|
320
|
-
responseCorrect,
|
|
321
|
-
teacherInstructions,
|
|
322
|
-
alwaysShowCorrect,
|
|
323
|
-
animationsDisabled,
|
|
324
|
-
language,
|
|
325
|
-
isSelectionButtonBelow,
|
|
326
|
-
minSelections,
|
|
327
|
-
maxSelections,
|
|
328
|
-
autoplayAudioEnabled,
|
|
329
|
-
session,
|
|
330
|
-
customAudioButton,
|
|
331
|
-
options,
|
|
332
|
-
baseHeadingLevel,
|
|
333
|
-
} = this.props;
|
|
334
|
-
const { showCorrect, maxSelectionsErrorState } = this.state;
|
|
335
|
-
const isEvaluateMode = mode === 'evaluate';
|
|
336
|
-
const showCorrectAnswerToggle = isEvaluateMode && !responseCorrect;
|
|
337
|
-
const columnsStyle = gridColumns > 1 ? { gridTemplateColumns: `repeat(${gridColumns}, 1fr)` } : undefined;
|
|
338
|
-
const selections = (session.value && session.value.length) || 0;
|
|
339
|
-
|
|
340
|
-
// Heading levels are optional and only applied when baseHeadingLevel is provided.
|
|
341
|
-
const getContentHeadingLevel = () => {
|
|
342
|
-
if (!baseHeadingLevel) return undefined;
|
|
343
|
-
// SR heading (rendered or external) sits at baseHeadingLevel.
|
|
344
|
-
// Content is always one below that; part label (EBSR) sits between them.
|
|
345
|
-
let offset = 1; // content default: baseHeadingLevel + 1
|
|
346
|
-
if (partLabel) offset += 1; // part label at base + 1, content pushed to base + 2
|
|
347
|
-
return Math.min(6, baseHeadingLevel + offset);
|
|
348
|
-
};
|
|
349
|
-
const contentHeadingLevel = getContentHeadingLevel();
|
|
350
|
-
const transformPrompt = (html) => (html && contentHeadingLevel) ? transformDataHeadings(html, contentHeadingLevel) : html;
|
|
351
|
-
|
|
352
|
-
const teacherInstructionsDiv = (
|
|
353
|
-
<PreviewPrompt
|
|
354
|
-
tagName="div"
|
|
355
|
-
className="prompt"
|
|
356
|
-
defaultClassName="teacher-instructions"
|
|
357
|
-
prompt={teacherInstructions}
|
|
358
|
-
/>
|
|
359
|
-
);
|
|
360
|
-
|
|
361
|
-
const getMultipleChoiceMinSelectionErrorMessage = () => {
|
|
362
|
-
if (minSelections && maxSelections) {
|
|
363
|
-
return minSelections === maxSelections
|
|
364
|
-
? translator.t('translation:multipleChoice:minmaxSelections_equal', { lng: language, minSelections })
|
|
365
|
-
: translator.t('translation:multipleChoice:minmaxSelections_range', {
|
|
366
|
-
lng: language,
|
|
367
|
-
minSelections,
|
|
368
|
-
maxSelections,
|
|
369
|
-
});
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
if (minSelections) {
|
|
373
|
-
return translator.t('translation:multipleChoice:minSelections', { lng: language, minSelections });
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
return '';
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
const LayoutComponent = this.props.choicesLayout === 'grid'
|
|
380
|
-
? GridLayout
|
|
381
|
-
: this.props.choicesLayout === 'horizontal'
|
|
382
|
-
? HorizontalLayout
|
|
383
|
-
: Box;
|
|
384
|
-
|
|
385
|
-
return (
|
|
386
|
-
<MainContainer id={'main-container'} className={classNames(className, 'multiple-choice')}>
|
|
387
|
-
{partLabel && <PartLabel as={baseHeadingLevel ? `h${Math.min(6, baseHeadingLevel + 1)}` : 'h2'}>{partLabel}</PartLabel>}
|
|
388
|
-
|
|
389
|
-
{this.renderHeading()}
|
|
390
|
-
|
|
391
|
-
{teacherInstructions && (
|
|
392
|
-
<TeacherInstructions>
|
|
393
|
-
{!animationsDisabled ? (
|
|
394
|
-
<Collapsible
|
|
395
|
-
labels={{
|
|
396
|
-
hidden: 'Show Teacher Instructions',
|
|
397
|
-
visible: 'Hide Teacher Instructions',
|
|
398
|
-
}}
|
|
399
|
-
>
|
|
400
|
-
{teacherInstructionsDiv}
|
|
401
|
-
</Collapsible>
|
|
402
|
-
) : (
|
|
403
|
-
teacherInstructionsDiv
|
|
404
|
-
)}
|
|
405
|
-
</TeacherInstructions>
|
|
406
|
-
)}
|
|
407
|
-
|
|
408
|
-
<StyledFieldset
|
|
409
|
-
tabIndex={0}
|
|
410
|
-
onFocus={this.handleGroupFocus}
|
|
411
|
-
role={choiceMode === 'radio' ? 'radiogroup' : 'group'}
|
|
412
|
-
>
|
|
413
|
-
<PreviewPrompt
|
|
414
|
-
className="prompt"
|
|
415
|
-
defaultClassName="prompt"
|
|
416
|
-
prompt={transformPrompt(prompt)}
|
|
417
|
-
tagName={'legend'}
|
|
418
|
-
autoplayAudioEnabled={autoplayAudioEnabled}
|
|
419
|
-
customAudioButton={customAudioButton}
|
|
420
|
-
/>
|
|
421
|
-
|
|
422
|
-
{!(options && alwaysShowCorrect) && (
|
|
423
|
-
<CorrectAnswerToggle
|
|
424
|
-
show={showCorrectAnswerToggle}
|
|
425
|
-
toggled={showCorrect}
|
|
426
|
-
onToggle={this.onToggle.bind(this)}
|
|
427
|
-
language={language}
|
|
428
|
-
/>
|
|
429
|
-
)}
|
|
430
|
-
|
|
431
|
-
<LayoutComponent style={columnsStyle}>
|
|
432
|
-
{choices.map((choice, index) => (
|
|
433
|
-
<Choice
|
|
434
|
-
autoFocusRef={index === 0 ? this.firstInputRef : null}
|
|
435
|
-
choicesLayout={this.props.choicesLayout}
|
|
436
|
-
selectedAnswerBackgroundColor={this.props.selectedAnswerBackgroundColor}
|
|
437
|
-
selectedAnswerStrokeColor={this.props.selectedAnswerStrokeColor}
|
|
438
|
-
selectedAnswerStrokeWidth={this.props.selectedAnswerStrokeWidth}
|
|
439
|
-
hoverAnswerBackgroundColor={this.props.hoverAnswerBackgroundColor}
|
|
440
|
-
hoverAnswerStrokeColor={this.props.hoverAnswerStrokeColor}
|
|
441
|
-
hoverAnswerStrokeWidth={this.props.hoverAnswerStrokeWidth}
|
|
442
|
-
gridColumns={gridColumns}
|
|
443
|
-
key={`choice-${index}`}
|
|
444
|
-
choice={choice}
|
|
445
|
-
index={index}
|
|
446
|
-
choicesLength={choices.length}
|
|
447
|
-
showCorrect={showCorrect}
|
|
448
|
-
isEvaluateMode={isEvaluateMode}
|
|
449
|
-
choiceMode={choiceMode}
|
|
450
|
-
disabled={disabled}
|
|
451
|
-
tagName={partLabel ? `group-${partLabel}` : 'group'}
|
|
452
|
-
onChoiceChanged={this.handleChange}
|
|
453
|
-
hideTick={choice.hideTick}
|
|
454
|
-
checked={this.getChecked(choice)}
|
|
455
|
-
correctness={isEvaluateMode ? this.getCorrectness(choice) : undefined}
|
|
456
|
-
displayKey={this.indexToSymbol(index)}
|
|
457
|
-
isSelectionButtonBelow={isSelectionButtonBelow}
|
|
458
|
-
/>
|
|
459
|
-
))}
|
|
460
|
-
</LayoutComponent>
|
|
461
|
-
</StyledFieldset>
|
|
462
|
-
|
|
463
|
-
{choiceMode === 'checkbox' && selections < minSelections && (
|
|
464
|
-
<ErrorText>{getMultipleChoiceMinSelectionErrorMessage()}</ErrorText>
|
|
465
|
-
)}
|
|
466
|
-
{choiceMode === 'checkbox' && maxSelectionsErrorState && (
|
|
467
|
-
<ErrorText>
|
|
468
|
-
{translator.t(`translation:multipleChoice:maxSelections_${maxSelections === 1 ? 'one' : 'other'}`, {
|
|
469
|
-
lng: language,
|
|
470
|
-
maxSelections,
|
|
471
|
-
})}
|
|
472
|
-
</ErrorText>
|
|
473
|
-
)}
|
|
474
|
-
</MainContainer>
|
|
475
|
-
);
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
MultipleChoice.defaultProps = {
|
|
480
|
-
session: {
|
|
481
|
-
value: [],
|
|
482
|
-
},
|
|
483
|
-
};
|
|
484
|
-
|
|
485
|
-
export default MultipleChoice;
|
package/src/index.iife.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IIFE entry point for multiple-choice element
|
|
3
|
-
* This file is only used for IIFE builds and includes auto-registration
|
|
4
|
-
*
|
|
5
|
-
* @sync-generated - Auto-generated during sync from pie-elements
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import Element from './index.js';
|
|
9
|
-
|
|
10
|
-
// Auto-register the custom element for IIFE mode
|
|
11
|
-
if (typeof window !== 'undefined' && !customElements.get('multiple-choice-element')) {
|
|
12
|
-
customElements.define('multiple-choice-element', Element);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Export for IIFE global
|
|
16
|
-
export default Element;
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './delivery/index.js';
|
package/src/print/index.tsx
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
/**
|
|
3
|
-
* @synced-from pie-elements/packages/multiple-choice/src/print.js
|
|
4
|
-
* @auto-generated
|
|
5
|
-
*
|
|
6
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
-
* Manual edits will be overwritten on next sync.
|
|
8
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import React from 'react';
|
|
12
|
-
import { createRoot } from 'react-dom/client';
|
|
13
|
-
import { cloneDeep, debounce } from 'lodash-es';
|
|
14
|
-
import Main from '../delivery/main.js';
|
|
15
|
-
import { renderMath } from '@pie-element/shared-math-rendering-mathjax';
|
|
16
|
-
import debug from 'debug';
|
|
17
|
-
|
|
18
|
-
const log = debug('pie-element:multiple-choice:print');
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Live in same package as main element - so we can access some of the shared comps!
|
|
22
|
-
*
|
|
23
|
-
* - update pslb to build print if src/print.js is there
|
|
24
|
-
* - update demo el
|
|
25
|
-
* - get configure/controller building
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
const preparePrintModel = (model, opts) => {
|
|
29
|
-
const instr = opts.role === 'instructor';
|
|
30
|
-
|
|
31
|
-
model.prompt = model.promptEnabled !== false ? model.prompt : undefined;
|
|
32
|
-
model.teacherInstructions =
|
|
33
|
-
instr && model.teacherInstructionsEnabled !== false ? model.teacherInstructions : undefined;
|
|
34
|
-
model.showTeacherInstructions = instr;
|
|
35
|
-
model.alwaysShowCorrect = instr;
|
|
36
|
-
model.mode = instr ? 'evaluate' : model.mode;
|
|
37
|
-
|
|
38
|
-
model.disabled = true;
|
|
39
|
-
model.animationsDisabled = true;
|
|
40
|
-
model.lockChoiceOrder = true;
|
|
41
|
-
model.choicesLayout = model.choicesLayout || 'vertical';
|
|
42
|
-
|
|
43
|
-
const choices = cloneDeep(model.choices);
|
|
44
|
-
|
|
45
|
-
model.choices = choices.map((c) => {
|
|
46
|
-
c.rationale = instr && model.rationaleEnabled !== false ? c.rationale : undefined;
|
|
47
|
-
c.hideTick = instr;
|
|
48
|
-
c.feedback = undefined;
|
|
49
|
-
return c;
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
model.keyMode = model.choicePrefix || 'letters';
|
|
53
|
-
|
|
54
|
-
return model;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export default class MultipleChoicePrint extends HTMLElement {
|
|
58
|
-
constructor() {
|
|
59
|
-
super();
|
|
60
|
-
this._options = null;
|
|
61
|
-
this._model = null;
|
|
62
|
-
this._session = [];
|
|
63
|
-
this._root = null;
|
|
64
|
-
this._rerender = debounce(
|
|
65
|
-
() => {
|
|
66
|
-
if (this._model && this._session) {
|
|
67
|
-
const printModel = preparePrintModel(this._model, this._options);
|
|
68
|
-
|
|
69
|
-
const element =
|
|
70
|
-
this._options &&
|
|
71
|
-
React.createElement(Main, {
|
|
72
|
-
model: printModel,
|
|
73
|
-
session: {},
|
|
74
|
-
options: this._options,
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
if (!this._root) {
|
|
78
|
-
this._root = createRoot(this);
|
|
79
|
-
}
|
|
80
|
-
this._root.render(element);
|
|
81
|
-
// Use double requestAnimationFrame so React has committed to the DOM before we render math
|
|
82
|
-
requestAnimationFrame(() => {
|
|
83
|
-
requestAnimationFrame(() => {
|
|
84
|
-
log('render complete - render math');
|
|
85
|
-
renderMath(this);
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
} else {
|
|
89
|
-
log('skip');
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
50,
|
|
93
|
-
{ leading: false, trailing: true },
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
set options(o) {
|
|
97
|
-
this._options = o;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
set model(s) {
|
|
101
|
-
this._model = s;
|
|
102
|
-
this._rerender();
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
connectedCallback() {}
|
|
106
|
-
|
|
107
|
-
disconnectedCallback() {
|
|
108
|
-
if (this._root) {
|
|
109
|
-
this._root.unmount();
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|