@pocketprep/ui-kit 3.4.54 → 3.4.56

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.
@@ -372,8 +372,9 @@ export default class MobileMatrixChoicesContainer extends Vue {
372
372
  this.matrixRadioGrid &&
373
373
  this.matrixRadioGrid[rowIndex]
374
374
  ) {
375
- if (this.matrixRadioGrid[rowIndex] && this.matrixRadioGrid[rowIndex].value) {
376
- return this.matrixRadioGrid[rowIndex].value.startsWith('a')
375
+ const rowVal = this.matrixRadioGrid[rowIndex].value
376
+ if (rowVal) {
377
+ return rowVal.startsWith('a')
377
378
  }
378
379
  return false
379
380
  }
@@ -57,6 +57,17 @@
57
57
  </template>
58
58
  </QuestionContext>
59
59
  </slot>
60
+ <div
61
+ v-if="questionScenario && currentScenarioQuestionNumber && numberOfScenarioQuestions"
62
+ v-dark="isDarkMode"
63
+ v-breakpoint:questionEl="breakpoints"
64
+ tabindex="-1"
65
+ class="uikit-question__scenario-part-x-of-y-label"
66
+ :aria-label="`Scenario Part ${currentScenarioQuestionNumber} of ${numberOfScenarioQuestions}`"
67
+ aria-live="assertive"
68
+ >
69
+ Part {{ currentScenarioQuestionNumber }} of {{ numberOfScenarioQuestions }}
70
+ </div>
60
71
  <slot name="promptExperiment" />
61
72
  <div
62
73
  ref="prompt"
@@ -495,6 +506,7 @@ import type {
495
506
  TMatrixChoiceScores,
496
507
  TNamesRow,
497
508
  TViewNames,
509
+ IScenarioSerial,
498
510
  } from './question'
499
511
 
500
512
  @Component({
@@ -615,6 +627,29 @@ export default class Question extends Vue {
615
627
  return this.question.type === 'Matrix Checkbox' || this.question.type === 'Matrix Radio Button'
616
628
  }
617
629
 
630
+ get questionScenario () {
631
+ return this.question.questionScenario as Study.Class.QuestionScenarioJSON | undefined
632
+ }
633
+
634
+ get numberOfScenarioQuestions () {
635
+ return this.questionScenario?.questions.length
636
+ }
637
+
638
+ get currentScenarioQuestionNumber () {
639
+ if (this.questionScenario?.questions) {
640
+ const indexOfScenarioSerial = this.questionScenario.questions.findIndex(
641
+ (scenarioSerial: IScenarioSerial) => {
642
+ return scenarioSerial.serial === this.question.serial
643
+ }
644
+ )
645
+
646
+ return indexOfScenarioSerial !== -1 ? indexOfScenarioSerial + 1 : undefined
647
+ }
648
+
649
+ return undefined
650
+
651
+ }
652
+
618
653
  get passageImageUrl () {
619
654
  const imageUrl = this.question.passageImage?.url
620
655
 
@@ -1639,6 +1674,27 @@ export default class Question extends Vue {
1639
1674
  }
1640
1675
  }
1641
1676
 
1677
+ &__scenario-part-x-of-y-label {
1678
+ padding: 0 16px;
1679
+ margin-bottom: 4px;
1680
+ width: 100%;
1681
+ max-width: 490px;
1682
+ box-sizing: border-box;
1683
+ font-size: 14px;
1684
+ font-weight: 500;
1685
+ line-height: 19px;
1686
+ color: $slate;
1687
+
1688
+ &--dark {
1689
+ color: $fog;
1690
+ }
1691
+
1692
+ &--mobile {
1693
+ line-height: 20px;
1694
+ margin-bottom: 8px;
1695
+ }
1696
+ }
1697
+
1642
1698
  &__prompt {
1643
1699
  outline: none;
1644
1700
  font-weight: 600;
@@ -50,4 +50,8 @@ export interface IRadioOptions {
50
50
  choices: TMatrixChoiceKey[]
51
51
  value: TMatrixChoiceKey | null
52
52
  label?: string
53
+ }
54
+
55
+ export interface IScenarioSerial {
56
+ serial: string
53
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pocketprep/ui-kit",
3
- "version": "3.4.54",
3
+ "version": "3.4.56",
4
4
  "description": "Pocket Prep UI Kit",
5
5
  "author": "pocketprep",
6
6
  "scripts": {
@@ -78,7 +78,7 @@
78
78
  "vue-router": "4.2.5"
79
79
  },
80
80
  "devDependencies": {
81
- "@pocketprep/types": "1.14.10",
81
+ "@pocketprep/types": "1.14.20",
82
82
  "@tsconfig/node16": "1.0.3",
83
83
  "@types/node": "16.18.25",
84
84
  "@vitejs/plugin-vue": "4.6.2",