@pocketprep/ui-kit 3.4.57 → 3.4.59

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.
@@ -49,7 +49,7 @@
49
49
  class="uikit-question-matrix-choices-container__choices"
50
50
  :class="{
51
51
  'uikit-question-matrix-choices-container__choices--two-columns':
52
- numberOfMatrixColumnLabels === 2
52
+ numberOfMatrixColumnLabels === 2
53
53
  }"
54
54
  v-dark="isDarkMode"
55
55
  v-breakpoint:questionEl="breakpoints"
@@ -60,7 +60,7 @@
60
60
  class="uikit-question-matrix-choices-container__choice-text"
61
61
  :class="{
62
62
  'uikit-question-matrix-choices-container__choice-text--two-columns':
63
- numberOfMatrixColumnLabels === 2
63
+ numberOfMatrixColumnLabels === 2
64
64
  }"
65
65
  v-dark="isDarkMode"
66
66
  v-breakpoint:questionEl="breakpoints"
@@ -90,20 +90,33 @@
90
90
  :is-dark-mode="isDarkMode"
91
91
  :disabled="showMatrixAnswers || reviewMode"
92
92
  :checkbox-check-styles="checkboxCheckStyling(rowIndex, columnIndex)"
93
- />
94
- <Checkbox
95
- v-else
96
- v-model="matrixCheckboxGrid[rowIndex][columnIndex]"
97
- :is-dark-mode="isDarkMode"
98
- :disabled="showMatrixAnswers || reviewMode"
99
93
  :checkbox-styles="checkboxContainerStyling(rowIndex, columnIndex)"
100
94
  />
95
+ <div
96
+ v-else
97
+ class="uikit-question-matrix-choices-container__clickable-checkbox"
98
+ :class="{
99
+ 'uikit-question-matrix-choices-container__clickable-checkbox--review':
100
+ showMatrixAnswers || reviewMode
101
+ }"
102
+ @click="!(showMatrixAnswers || reviewMode) && checkboxClicked(rowIndex, columnIndex)"
103
+ @keypress.enter="!(showMatrixAnswers || reviewMode) &&
104
+ checkboxClicked(rowIndex, columnIndex)"
105
+ >
106
+ <Checkbox
107
+ :model-value="matrixCheckboxGrid[rowIndex][columnIndex]"
108
+ :is-dark-mode="isDarkMode"
109
+ :disabled="showMatrixAnswers || reviewMode"
110
+ :checkbox-styles="checkboxContainerStyling(rowIndex, columnIndex)"
111
+ />
112
+ </div>
101
113
  <Icon
102
114
  v-if="
103
115
  (showMatrixAnswers || reviewMode) &&
104
116
  (incorrectlySelectedChoice(rowIndex, columnIndex) ||
105
117
  correctAnswerButNotSelected(rowIndex, columnIndex))"
106
118
  class="uikit-question-matrix-choices-container__incorrect-answer-icon"
119
+ v-dark="isDarkMode"
107
120
  type="incorrect"
108
121
  />
109
122
  </div>
@@ -130,11 +143,13 @@
130
143
  <template v-if="optionIcon.isVisible">
131
144
  <Icon
132
145
  v-if="optionIcon.isCorrect"
146
+ v-dark="isDarkMode"
133
147
  type="correct"
134
148
  class="uikit-question-matrix-choices-container__correct-answer-icon"
135
149
  />
136
150
  <Icon
137
151
  v-else
152
+ v-dark="isDarkMode"
138
153
  type="incorrect"
139
154
  class="uikit-question-matrix-choices-container__incorrect-answer-icon"
140
155
  />
@@ -333,6 +348,13 @@ export default class MatrixChoicesContainer extends Vue {
333
348
  border: `1px solid ${this.brandColors.steel} !important`,
334
349
  }
335
350
  }
351
+
352
+ if (isReviewMode && this.correctAnswerButNotSelected(rowIndex, columnIndex)) {
353
+ return {
354
+ background: 'transparent !important',
355
+ border: `1px solid ${this.brandColors.slate} !important`,
356
+ }
357
+ }
336
358
  }
337
359
 
338
360
  checkboxCheckStyling (rowIndex: number, columnIndex: number) {
@@ -345,6 +367,12 @@ export default class MatrixChoicesContainer extends Vue {
345
367
  }
346
368
  }
347
369
 
370
+ checkboxClicked (rowIndex: number, columnIndex: number) {
371
+ if (this.matrixCheckboxGrid && this.matrixCheckboxGrid[rowIndex]) {
372
+ this.matrixCheckboxGrid[rowIndex][columnIndex] = !this.matrixCheckboxGrid[rowIndex][columnIndex]
373
+ }
374
+ }
375
+
348
376
  @Emit('emitSelectedMatrixChoice')
349
377
  emitSelectedMatrixChoice (matrixChoiceKeys: TMatrixChoiceKey[]) {
350
378
  return matrixChoiceKeys
@@ -426,7 +454,7 @@ export default class MatrixChoicesContainer extends Vue {
426
454
  &__columns {
427
455
  display: flex;
428
456
  padding: 0px 1px 0px 14px;
429
- align-items: center;
457
+ align-items: flex-end;
430
458
  width: 100%;
431
459
  height: 32px;
432
460
  margin-bottom: 16px;
@@ -464,7 +492,7 @@ export default class MatrixChoicesContainer extends Vue {
464
492
  hyphens: auto;
465
493
 
466
494
  &:not(:last-child) {
467
- margin-right: 8px;
495
+ margin-right: 11px;
468
496
  }
469
497
 
470
498
  &--tablet-landscape {
@@ -473,6 +501,12 @@ export default class MatrixChoicesContainer extends Vue {
473
501
  }
474
502
  }
475
503
 
504
+ &--tablet-portrait {
505
+ &:not(:last-child) {
506
+ margin-right: 14px;
507
+ }
508
+ }
509
+
476
510
  &--two-columns {
477
511
  &:not(:last-child) {
478
512
  margin-right: 24px;
@@ -533,7 +567,7 @@ export default class MatrixChoicesContainer extends Vue {
533
567
  padding: 12px 10px 12px 14px;
534
568
  position: relative;
535
569
  transition: 0.1s padding ease;
536
- align-items: center;
570
+ align-items: flex-start;
537
571
  gap: 16px;
538
572
  margin-bottom: 9px;
539
573
 
@@ -586,7 +620,6 @@ export default class MatrixChoicesContainer extends Vue {
586
620
  &__checkbox {
587
621
  width: 56px;
588
622
  display: flex;
589
- align-items: center;
590
623
 
591
624
  &--two-columns {
592
625
  width: 80px;
@@ -597,18 +630,46 @@ export default class MatrixChoicesContainer extends Vue {
597
630
  }
598
631
  }
599
632
 
633
+ &__clickable-checkbox {
634
+ width: 36px;
635
+ height: 36px;
636
+ cursor: pointer;
637
+ display: flex;
638
+ align-items: center;
639
+ justify-content: center;
640
+ margin-top: -8px;
641
+ margin-left: -8px;
642
+
643
+ &--review {
644
+ cursor: default;
645
+ display: block;
646
+ margin-top: 0;
647
+ margin-left: 0;
648
+ width: 20px;
649
+ }
650
+ }
651
+
600
652
  &__correct-answer-icon {
601
653
  margin-left: 6px;
602
654
  width: 21px;
603
655
  height: 22px;
604
656
  color: $cadaverous;
657
+
658
+ &--dark {
659
+ color: $jungle-green;
660
+ }
605
661
  }
606
662
 
607
663
  &__incorrect-answer-icon {
608
664
  margin-left: 6px;
665
+ margin-top: -2px;
609
666
  width: 21px;
610
667
  height: 22px;
611
668
  color: $pepper;
669
+
670
+ &--dark {
671
+ color: $rosa;
672
+ }
612
673
  }
613
674
  }
614
675
  </style>
@@ -34,11 +34,13 @@
34
34
  >
35
35
  <Icon
36
36
  v-if="(showMatrixAnswers || reviewMode) && correctRow(rowIndex)"
37
+ v-dark="isDarkMode"
37
38
  class="uikit-question-mobile-matrix-choices-container__row-label-correct-icon"
38
39
  type="check"
39
40
  />
40
41
  <Icon
41
42
  v-if="(showMatrixAnswers || reviewMode) && !correctRow(rowIndex)"
43
+ v-dark="isDarkMode"
42
44
  class="uikit-question-mobile-matrix-choices-container__row-label-incorrect-icon"
43
45
  type="incorrect"
44
46
  />
@@ -80,7 +82,6 @@
80
82
  stripText(selectedColumnHeaders[rowIndex][colHeaderIndex]) :
81
83
  `${stripText(selectedColumnHeaders[rowIndex][colHeaderIndex])},`
82
84
  }}
83
-
84
85
  </div>
85
86
  </template>
86
87
  </div>
@@ -98,6 +99,9 @@
98
99
  v-dark="isDarkMode"
99
100
  v-for="(column, columnIndex) in matrixColumnLabels"
100
101
  :key="columnIndex"
102
+ @click="!(showMatrixAnswers || reviewMode) && checkboxRowClicked(rowIndex, columnIndex)"
103
+ @keypress.enter="!(showMatrixAnswers || reviewMode) &&
104
+ checkboxRowClicked(rowIndex, columnIndex)"
101
105
  >
102
106
  <Checkbox
103
107
  v-if="(showMatrixAnswers || reviewMode) &&
@@ -106,10 +110,11 @@
106
110
  :is-dark-mode="isDarkMode"
107
111
  :disabled="showMatrixAnswers || reviewMode"
108
112
  :checkbox-check-styles="checkboxCheckStyling(rowIndex, columnIndex)"
113
+ :checkbox-styles="checkboxContainerStyling(rowIndex, columnIndex)"
109
114
  />
110
115
  <Checkbox
111
116
  v-else
112
- v-model="matrixCheckboxGrid[rowIndex][columnIndex]"
117
+ :model-value="matrixCheckboxGrid[rowIndex][columnIndex]"
113
118
  :is-dark-mode="isDarkMode"
114
119
  :disabled="showMatrixAnswers || reviewMode"
115
120
  :checkbox-styles="checkboxContainerStyling(rowIndex, columnIndex)"
@@ -251,9 +256,9 @@ export default class MobileMatrixChoicesContainer extends Vue {
251
256
  }
252
257
  }
253
258
 
254
- selectedChoiceKey (rowIndex: number, colIndex: number) {
259
+ selectedChoiceKey (rowIndex: number, columnIndex: number) {
255
260
  const row = rowIndex += 1
256
- const column = colIndex += 1
261
+ const column = columnIndex += 1
257
262
  if (this.selectedMatrixChoices.length && this.matrixAnswerKeys.length) {
258
263
  const matrixSelectedChoiceKey = this.selectedMatrixChoices.find((choice) => {
259
264
  const substring = choice.substring(1)
@@ -289,9 +294,9 @@ export default class MobileMatrixChoicesContainer extends Vue {
289
294
  }
290
295
  }
291
296
 
292
- correctlySelectedChoice (rowIndex: number, colIndex: number) {
297
+ correctlySelectedChoice (rowIndex: number, columnIndex: number) {
293
298
  if (this.selectedMatrixChoices && this.matrixAnswerKeys) {
294
- const selectedChoice = this.selectedChoiceKey(rowIndex, colIndex)
299
+ const selectedChoice = this.selectedChoiceKey(rowIndex, columnIndex)
295
300
  if (selectedChoice && selectedChoice.startsWith('a') && this.matrixAnswerKeys.includes(selectedChoice)) {
296
301
  return true
297
302
  }
@@ -299,9 +304,9 @@ export default class MobileMatrixChoicesContainer extends Vue {
299
304
  return false
300
305
  }
301
306
 
302
- incorrectlySelectedChoice (rowIndex: number, colIndex: number) {
307
+ incorrectlySelectedChoice (rowIndex: number, columnIndex: number) {
303
308
  if (this.selectedMatrixChoices && this.matrixAnswerKeys) {
304
- const selectedChoice = this.selectedChoiceKey(rowIndex, colIndex)
309
+ const selectedChoice = this.selectedChoiceKey(rowIndex, columnIndex)
305
310
  if (selectedChoice && selectedChoice.startsWith('d')) {
306
311
  return true
307
312
  }
@@ -309,9 +314,9 @@ export default class MobileMatrixChoicesContainer extends Vue {
309
314
  return false
310
315
  }
311
316
 
312
- correctAnswerButNotSelected (rowIndex: number, colIndex: number) {
313
- const selectedChoice = this.selectedChoiceKey(rowIndex, colIndex)
314
- const answerKey = this.matrixAnswerKeys.find(choice => choice === `a${rowIndex + 1}_${colIndex + 1}`)
317
+ correctAnswerButNotSelected (rowIndex: number, columnIndex: number) {
318
+ const selectedChoice = this.selectedChoiceKey(rowIndex, columnIndex)
319
+ const answerKey = this.matrixAnswerKeys.find(choice => choice === `a${rowIndex + 1}_${columnIndex + 1}`)
315
320
  return answerKey && !selectedChoice
316
321
  }
317
322
 
@@ -334,6 +339,13 @@ export default class MobileMatrixChoicesContainer extends Vue {
334
339
  border: `1px solid ${this.brandColors.steel} !important`,
335
340
  }
336
341
  }
342
+
343
+ if (isReviewMode && this.correctAnswerButNotSelected(rowIndex, columnIndex)) {
344
+ return {
345
+ background: 'transparent !important',
346
+ border: `1px solid ${this.brandColors.slate} !important`,
347
+ }
348
+ }
337
349
  }
338
350
 
339
351
  checkboxCheckStyling (rowIndex: number, columnIndex: number) {
@@ -386,11 +398,11 @@ export default class MobileMatrixChoicesContainer extends Vue {
386
398
  const checkboxGrid = this.defaultCheckboxGrid
387
399
  this.selectedMatrixChoices.forEach(choice => {
388
400
  const rowIndex = Number(choice.substring(1, choice.indexOf('_'))) - 1
389
- const colIndex = Number(choice.split('_').pop()) - 1
401
+ const columnIndex = Number(choice.split('_').pop()) - 1
390
402
  if (checkboxGrid && checkboxGrid[rowIndex]) {
391
- checkboxGrid[rowIndex][colIndex] = true
392
- if (this.selectedColumnHeaders[rowIndex] && this.question.matrixLabels?.columns[colIndex]) {
393
- const columnHeader = this.question.matrixLabels?.columns[colIndex]
403
+ checkboxGrid[rowIndex][columnIndex] = true
404
+ if (this.selectedColumnHeaders[rowIndex] && this.question.matrixLabels?.columns[columnIndex]) {
405
+ const columnHeader = this.question.matrixLabels?.columns[columnIndex]
394
406
  this.selectedColumnHeaders[rowIndex].push(columnHeader)
395
407
  }
396
408
  }
@@ -402,9 +414,9 @@ export default class MobileMatrixChoicesContainer extends Vue {
402
414
  const radioBtnGrid = this.matrixRadioGrid
403
415
  this.selectedMatrixChoices.forEach(choice => {
404
416
  const rowIndex = Number(choice.substring(1, choice.indexOf('_'))) - 1
405
- const colIndex = Number(choice.split('_').pop()) - 1
406
- if (this.selectedColumnHeaders[rowIndex] && this.question.matrixLabels?.columns[colIndex]) {
407
- const columnHeader = this.question.matrixLabels?.columns[colIndex]
417
+ const columnIndex = Number(choice.split('_').pop()) - 1
418
+ if (this.selectedColumnHeaders[rowIndex] && this.question.matrixLabels?.columns[columnIndex]) {
419
+ const columnHeader = this.question.matrixLabels?.columns[columnIndex]
408
420
  this.selectedColumnHeaders[rowIndex].push(columnHeader)
409
421
  }
410
422
  if (radioBtnGrid && radioBtnGrid[rowIndex]) {
@@ -414,6 +426,12 @@ export default class MobileMatrixChoicesContainer extends Vue {
414
426
  return radioBtnGrid
415
427
  }
416
428
 
429
+ checkboxRowClicked (rowIndex: number, columnIndex: number) {
430
+ if (this.matrixCheckboxGrid && this.matrixCheckboxGrid[rowIndex]) {
431
+ this.matrixCheckboxGrid[rowIndex][columnIndex] = !this.matrixCheckboxGrid[rowIndex][columnIndex]
432
+ }
433
+ }
434
+
417
435
  @Emit('emitSelectedMatrixChoice')
418
436
  emitSelectedMatrixChoice (matrixChoiceKeys: TMatrixChoiceKey[]) {
419
437
  return matrixChoiceKeys
@@ -529,7 +547,7 @@ export default class MobileMatrixChoicesContainer extends Vue {
529
547
  }
530
548
 
531
549
  &__choices-container {
532
- cursor: default;
550
+ cursor: pointer;
533
551
  position: relative;
534
552
  outline: none;
535
553
  transition: 0.1s width ease;
@@ -604,6 +622,8 @@ export default class MobileMatrixChoicesContainer extends Vue {
604
622
 
605
623
  &__row-label-correct-icon,
606
624
  &__row-label-incorrect-icon {
625
+ width: 21px;
626
+ height: 22px;
607
627
  position: absolute;
608
628
  right: 0;
609
629
  margin-right: 12px;
@@ -58,6 +58,7 @@ const stripText = (string?: string) => {
58
58
  role="radio"
59
59
  v-for="(choice, index) in choices"
60
60
  :key="choice"
61
+ @click="!disabled && !showAnswers && selectChoice(choice)"
61
62
  >
62
63
  <RadioButton
63
64
  class="uikit-mobile-matrix-radio-group__radio-btn"
@@ -4,6 +4,9 @@
4
4
  v-breakpoint:questionEl="breakpoints"
5
5
  ref="uikit-question-summary"
6
6
  class="uikit-question-summary"
7
+ :class="{
8
+ 'uikit-question-summary--matrix-question-review-mode': isMatrixQuestion && reviewMode,
9
+ }"
7
10
  >
8
11
  <div class="uikit-question-summary__summary-title">
9
12
  {{ isQuestionCorrect ? 'Correct': isUnanswered ? 'Unanswered' : 'Incorrect' }}
@@ -37,6 +40,10 @@
37
40
  v-breakpoint:questionEl="breakpoints"
38
41
  ref="uikit-question-summary__summary-dropdown-explanation"
39
42
  class="uikit-question-summary__summary-dropdown-explanation"
43
+ :class="{
44
+ 'uikit-question-summary__summary-dropdown-explanation--matrix-question-review-mode':
45
+ isMatrixQuestion && reviewMode,
46
+ }"
40
47
  >
41
48
  <slot name="explanationTopExperiment"></slot>
42
49
  <div
@@ -201,6 +208,10 @@ export default class Summary extends Vue {
201
208
  box-shadow: 0 1px 4px 0 rgba($jet, 0.3);
202
209
  }
203
210
 
211
+ &--matrix-question-review-mode#{&}--tablet-landscape {
212
+ display: inline-block;
213
+ }
214
+
204
215
  &--tablet-portrait {
205
216
  display: inline-block;
206
217
  }
@@ -290,6 +301,10 @@ export default class Summary extends Vue {
290
301
  &__summary-dropdown-explanation {
291
302
  display: none;
292
303
 
304
+ &--matrix-question-review-mode#{&}--tablet-landscape {
305
+ display: inline-block;
306
+ }
307
+
293
308
  &--tablet-portrait {
294
309
  display: block;
295
310
  }
@@ -31,6 +31,7 @@
31
31
  'uikit-question__main--show-side': (showExplanation && !showPaywall) || showPassageAndImage,
32
32
  'uikit-question__main--unanswered': showAnswers && !isMCR && isUnanswered && !isCorrect,
33
33
  'uikit-question__main--mcr': isMCR,
34
+ 'uikit-question__main--matrix-question-review-mode': isMatrixQuestion && reviewMode,
34
35
  }"
35
36
  >
36
37
  <slot name="context">
@@ -394,8 +395,8 @@
394
395
  Check Answer
395
396
  </PocketButton>
396
397
  <PocketButton
397
- v-if="!showMatrixAnswers && !hideAnswer && isMatrixQuestion && allMatrixRowsAreAnswered"
398
- :disabled="!selectedMatrixChoices.length"
398
+ v-else-if="isMatrixQuestion && !showMatrixAnswers && !hideAnswer"
399
+ :disabled="!allMatrixRowsAreAnswered"
399
400
  :is-dark-mode="isDarkMode"
400
401
  @click="clickCheckMatrixAnswer"
401
402
  >
@@ -432,6 +433,7 @@
432
433
  class="uikit-question__right-side"
433
434
  :class="{
434
435
  'uikit-question__right-side--explanation': showExplanation && !showPaywall,
436
+ 'uikit-question__right-side--matrix-question-review-mode': isMatrixQuestion && reviewMode,
435
437
  }"
436
438
  >
437
439
  <PassageAndImage
@@ -1561,6 +1563,11 @@ export default class Question extends Vue {
1561
1563
  overflow-y: visible;
1562
1564
  padding: 0 17px;
1563
1565
  }
1566
+
1567
+ &--matrix-question-review-mode#{&}--tablet-landscape:not(&--tablet-portrait) {
1568
+ width: 100%;
1569
+ padding-right: 0;
1570
+ }
1564
1571
  }
1565
1572
 
1566
1573
  &__right-side {
@@ -1576,6 +1583,10 @@ export default class Question extends Vue {
1576
1583
  display: none;
1577
1584
  }
1578
1585
 
1586
+ &--matrix-question-review-mode#{&}--tablet-landscape {
1587
+ display: none;
1588
+ }
1589
+
1579
1590
  &--explanation {
1580
1591
  padding-top: 58px;
1581
1592
  padding-right: 11px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pocketprep/ui-kit",
3
- "version": "3.4.57",
3
+ "version": "3.4.59",
4
4
  "description": "Pocket Prep UI Kit",
5
5
  "author": "pocketprep",
6
6
  "scripts": {