@pocketprep/ui-kit 3.4.75 → 3.4.77

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.
@@ -28,6 +28,8 @@ defineProps<{
28
28
  .uikit-radio-btn {
29
29
  width: 18px;
30
30
  height: 18px;
31
+ min-height: 18px;
32
+ min-width: 18px;
31
33
  border: 1px solid $steel;
32
34
  background: $white;
33
35
  border-radius: 18px;
@@ -406,16 +406,10 @@ export default class MatrixChoicesContainer extends Vue {
406
406
  return matrixChoiceKeys
407
407
  }
408
408
 
409
- @Emit('emitAnsweredMatrixRowIndex')
410
- emitAnsweredMatrixRowIndex (answeredRowIndexes: number[]) {
411
- return answeredRowIndexes
412
- }
413
-
414
409
  @Watch('matrixCheckboxGrid', { deep: true })
415
410
  matrixCheckboxGridChange () {
416
411
  if (this.matrixChoiceLayout && this.matrixCheckboxGrid) {
417
412
  const selectedCheckboxChoices: TMatrixChoiceKey[] = []
418
- const answeredCheckBoxRowIndexes: number[] = []
419
413
 
420
414
  this.matrixCheckboxGrid.forEach((row, rowIndex) => {
421
415
  row.forEach((choice, choiceIndex) => {
@@ -426,14 +420,10 @@ export default class MatrixChoicesContainer extends Vue {
426
420
  ) {
427
421
  const choiceKey = this.matrixChoiceLayout[rowIndex][choiceIndex] as TMatrixChoiceKey
428
422
  selectedCheckboxChoices.push(choiceKey)
429
- if (!answeredCheckBoxRowIndexes.some(index => index === rowIndex)) {
430
- answeredCheckBoxRowIndexes.push(rowIndex)
431
- }
432
423
  }
433
424
  })
434
425
  })
435
426
  this.emitSelectedMatrixChoice(selectedCheckboxChoices)
436
- this.emitAnsweredMatrixRowIndex(answeredCheckBoxRowIndexes)
437
427
  }
438
428
  }
439
429
 
@@ -441,16 +431,11 @@ export default class MatrixChoicesContainer extends Vue {
441
431
  matrixRadioGridChange () {
442
432
  if (this.matrixChoiceLayout && this.matrixRadioGrid) {
443
433
  const selectedRadioButtonChoices: TMatrixChoiceKey[] = []
444
- const answeredRadioBtnRowIndexes: number[] = []
445
434
 
446
435
  this.matrixRadioGrid.forEach((row, rowIndex) => {
447
436
  const choiceKey = row.value
448
437
  if (choiceKey && this.matrixChoiceLayout[rowIndex]) {
449
438
  selectedRadioButtonChoices.push(choiceKey)
450
- if (!answeredRadioBtnRowIndexes.some(index => index === rowIndex)) {
451
- answeredRadioBtnRowIndexes.push(rowIndex)
452
- }
453
- this.emitAnsweredMatrixRowIndex(answeredRadioBtnRowIndexes)
454
439
  }
455
440
  })
456
441
  this.emitSelectedMatrixChoice(selectedRadioButtonChoices)
@@ -475,16 +475,11 @@ export default class MobileMatrixChoicesContainer extends Vue {
475
475
  return matrixChoiceKeys
476
476
  }
477
477
 
478
- @Emit('emitAnsweredMatrixRowIndex')
479
- emitAnsweredMatrixRowIndex (answeredRowIndexes: number[]) {
480
- return answeredRowIndexes
481
- }
482
478
 
483
479
  @Watch('matrixCheckboxGrid', { deep: true })
484
480
  matrixCheckboxGridChange () {
485
481
  if (this.matrixChoiceLayout && this.matrixCheckboxGrid && (!this.reviewMode || !this.showMatrixAnswers)) {
486
482
  const selectedCheckboxChoices: TMatrixChoiceKey[] = []
487
- const answeredCheckBoxRowIndexes: number[] = []
488
483
 
489
484
  this.matrixCheckboxGrid.forEach((row, rowIndex) => {
490
485
  row.forEach((choice, choiceIndex) => {
@@ -495,15 +490,11 @@ export default class MobileMatrixChoicesContainer extends Vue {
495
490
  ) {
496
491
  const choiceKey = this.matrixChoiceLayout[rowIndex][choiceIndex] as TMatrixChoiceKey
497
492
  selectedCheckboxChoices.push(choiceKey)
498
- if (!answeredCheckBoxRowIndexes.some(index => index === rowIndex)) {
499
- answeredCheckBoxRowIndexes.push(rowIndex)
500
- }
501
493
  }
502
494
  })
503
495
  })
504
496
 
505
497
  this.emitSelectedMatrixChoice(selectedCheckboxChoices)
506
- this.emitAnsweredMatrixRowIndex(answeredCheckBoxRowIndexes)
507
498
  }
508
499
  }
509
500
 
@@ -511,19 +502,14 @@ export default class MobileMatrixChoicesContainer extends Vue {
511
502
  matrixRadioGridChange () {
512
503
  if (this.matrixChoiceLayout && this.matrixRadioGrid && (!this.reviewMode || !this.showMatrixAnswers)) {
513
504
  const selectedRadioButtonChoices: TMatrixChoiceKey[] = []
514
- const answeredRadioBtnRowIndexes: number[] = []
515
505
 
516
- this.matrixRadioGrid.forEach((row, index) => {
506
+ this.matrixRadioGrid.forEach((row) => {
517
507
  if (row.value) {
518
508
  selectedRadioButtonChoices.push(row.value)
519
- if (!answeredRadioBtnRowIndexes.some(rowIndex => rowIndex === index)) {
520
- answeredRadioBtnRowIndexes.push(index)
521
- }
522
509
  }
523
510
  })
524
511
 
525
512
  this.emitSelectedMatrixChoice(selectedRadioButtonChoices)
526
- this.emitAnsweredMatrixRowIndex(answeredRadioBtnRowIndexes)
527
513
  }
528
514
  }
529
515
 
@@ -102,9 +102,9 @@ const stripText = (string?: string) => {
102
102
 
103
103
  &__option {
104
104
  display: flex;
105
- align-items: center;
106
- padding-left: 15px;
107
- min-height: 47px;
105
+ align-items: flex-start;
106
+ align-self: stretch;
107
+ padding: 11px 15px 12px 15px;
108
108
  max-width: 325px;
109
109
  border: 0.5px solid rgba($pewter, 0.85);
110
110
  border-top: none;
@@ -258,7 +258,6 @@
258
258
  :breakpoints="breakpoints"
259
259
  :is-teach-group-review="isTeachGroupReview"
260
260
  @emitSelectedMatrixChoice="selectMatrixChoice"
261
- @emitAnsweredMatrixRowIndex="answeredMatrixRowIndex"
262
261
  >
263
262
  <template #motivationalMoment="{
264
263
  isCorrect,
@@ -295,7 +294,6 @@
295
294
  :question-el="questionEl"
296
295
  :breakpoints="breakpoints"
297
296
  @emitSelectedMatrixChoice="selectMatrixChoice"
298
- @emitAnsweredMatrixRowIndex="answeredMatrixRowIndex"
299
297
  >
300
298
  <template
301
299
  #motivationalMoment="{
@@ -399,7 +397,7 @@
399
397
  </PocketButton>
400
398
  <PocketButton
401
399
  v-else-if="isMatrixQuestion && !showMatrixAnswers && !hideAnswer"
402
- :disabled="!allMatrixRowsAreAnswered"
400
+ :disabled="!isMatrixQuestionAnswered"
403
401
  :is-dark-mode="isDarkMode"
404
402
  @click="clickCheckMatrixAnswer"
405
403
  >
@@ -579,8 +577,6 @@ export default class Question extends Vue {
579
577
  choiceStrikes: TChoiceKey[] = []
580
578
  selectedChoices: TChoiceKey[] = []
581
579
  selectedMatrixChoices: TMatrixChoiceKey[] = []
582
- answeredMatrixRowIndexes: number[] = []
583
- allMatrixRowsAreAnswered = false
584
580
  showAnswers = false
585
581
  showMatrixAnswers = false
586
582
  showExplanation = false
@@ -828,11 +824,33 @@ export default class Question extends Vue {
828
824
  return scores
829
825
  }
830
826
 
827
+ get isMatrixQuestionAnswered () {
828
+ // Matrix questions are answered if each row has a selected choice
829
+ if (this.isMatrixQuestion) {
830
+ const answeredRowNums = this.selectedMatrixChoices.map(choice => {
831
+ if (choice as TMatrixChoiceKey) {
832
+ return Number(choice.split('_')[0]?.slice(1))
833
+ }
834
+ return
835
+ })
836
+
837
+ const matrixRows = this.question.matrixChoiceLayout || []
838
+ const isEveryRowAnswered = matrixRows.every((row, index) => {
839
+ const rowNum = index + 1
840
+ const hasSelectedChoiceForRow = answeredRowNums.includes(rowNum)
841
+ return hasSelectedChoiceForRow
842
+ })
843
+ return isEveryRowAnswered
844
+ }
845
+ return false
846
+ }
847
+
831
848
  get isUnanswered () {
832
849
  if (!this.isMatrixQuestion) {
833
850
  return this.selectedChoices.length === 0
834
851
  }
835
- return (this.selectedMatrixChoices.length === 0 || !this.allMatrixRowsAreAnswered)
852
+
853
+ return !this.isMatrixQuestionAnswered
836
854
  }
837
855
 
838
856
  get prompt () {
@@ -1191,14 +1209,6 @@ export default class Question extends Vue {
1191
1209
  this.selectedMatrixChoices = matrixChoiceKeys
1192
1210
  }
1193
1211
 
1194
- answeredMatrixRowIndex (answeredRowIndexes: number[]) {
1195
- if (this.showMatrixAnswers) {
1196
- return
1197
- }
1198
- this.answeredMatrixRowIndexes = answeredRowIndexes
1199
- this.allMatrixRowsAreAnswered = this.answeredMatrixRowIndexes.length === this.question.matrixLabels?.rows.length
1200
- }
1201
-
1202
1212
  togglePassageImageLongAlt () {
1203
1213
  this.showPassageImageLongAlt = !this.showPassageImageLongAlt
1204
1214
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pocketprep/ui-kit",
3
- "version": "3.4.75",
3
+ "version": "3.4.77",
4
4
  "description": "Pocket Prep UI Kit",
5
5
  "author": "pocketprep",
6
6
  "scripts": {