@pocketprep/ui-kit 3.4.90 → 3.5.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/dist/@pocketprep/ui-kit.js +14834 -16036
- package/dist/@pocketprep/ui-kit.js.map +1 -1
- package/dist/@pocketprep/ui-kit.umd.cjs +12 -12
- package/dist/@pocketprep/ui-kit.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/lib/components/Bundles/BundleSearch.vue +41 -11
- package/lib/components/Pagination/QuestionReviewPagination.vue +21 -19
- package/lib/components/Quiz/Question/ChoicesContainer.vue +95 -129
- package/lib/components/Quiz/Question/DropdownExplanation.vue +39 -53
- package/lib/components/Quiz/Question/Explanation.vue +47 -57
- package/lib/components/Quiz/Question/MatrixChoicesContainer.vue +211 -224
- package/lib/components/Quiz/Question/MatrixRadioGroup.vue +5 -4
- package/lib/components/Quiz/Question/MobileMatrixChoicesContainer.vue +321 -319
- package/lib/components/Quiz/Question/MobileMatrixRadioGroup.vue +7 -6
- package/lib/components/Quiz/Question/PassageAndImage.vue +32 -43
- package/lib/components/Quiz/Question/PassageAndImageDropdown.vue +32 -43
- package/lib/components/Quiz/Question/Paywall.vue +28 -39
- package/lib/components/Quiz/Question/QuestionContext.vue +23 -31
- package/lib/components/Quiz/Question/StatsSummary.vue +10 -20
- package/lib/components/Quiz/Question/Summary.vue +54 -64
- package/lib/components/Quiz/Question/composables.ts +71 -0
- package/lib/components/Quiz/Question/injectionSymbols.ts +69 -0
- package/lib/components/Quiz/Question.vue +788 -988
- package/lib/components/Quiz/QuizContainer.vue +36 -34
- package/lib/components/Quiz/question.d.ts +4 -4
- package/lib/directives.ts +27 -22
- package/lib/styles/_breakpoints.scss +6 -12
- package/package.json +4 -4
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import RadioButton from '../../Forms/RadioButton.vue'
|
|
3
3
|
import { dark as vDark } from '../../../directives'
|
|
4
|
+
import type { TMatrixChoiceKey } from '../question'
|
|
4
5
|
|
|
5
6
|
interface Props {
|
|
6
7
|
isDarkMode: boolean
|
|
7
|
-
choices
|
|
8
|
-
labels
|
|
8
|
+
choices?: TMatrixChoiceKey[]
|
|
9
|
+
labels?: string[]
|
|
9
10
|
showAnswers: boolean
|
|
10
11
|
disabled: boolean
|
|
11
12
|
}
|
|
@@ -16,13 +17,13 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
16
17
|
disabled: false,
|
|
17
18
|
})
|
|
18
19
|
|
|
19
|
-
const selectedChoice = defineModel<
|
|
20
|
+
const selectedChoice = defineModel<TMatrixChoiceKey | null>({ default: null })
|
|
20
21
|
|
|
21
|
-
const selectChoice = (choiceKey:
|
|
22
|
+
const selectChoice = (choiceKey: TMatrixChoiceKey) => {
|
|
22
23
|
selectedChoice.value = choiceKey
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
const radioButtonColor = (choice:
|
|
26
|
+
const radioButtonColor = (choice: TMatrixChoiceKey) => {
|
|
26
27
|
if (props.showAnswers) {
|
|
27
28
|
if (choice === selectedChoice.value && selectedChoice.value?.startsWith('a')) {
|
|
28
29
|
return 'green'
|
|
@@ -52,7 +53,7 @@ const stripHtmlTags = (string?: string) => {
|
|
|
52
53
|
|
|
53
54
|
<template>
|
|
54
55
|
<ul
|
|
55
|
-
v-if="choices.length"
|
|
56
|
+
v-if="choices && choices.length"
|
|
56
57
|
class="uikit-mobile-matrix-radio-group"
|
|
57
58
|
v-dark="isDarkMode"
|
|
58
59
|
role="radiogroup"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
v-if="showPassageAndImage"
|
|
4
|
-
v-breakpoint
|
|
4
|
+
v-breakpoint="breakpointsWithEl"
|
|
5
5
|
class="uikit-question-passage-and-image"
|
|
6
6
|
>
|
|
7
7
|
<div
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
<img
|
|
21
21
|
v-if="passageImageUrl"
|
|
22
22
|
v-dark="isDarkMode"
|
|
23
|
-
v-breakpoint
|
|
23
|
+
v-breakpoint="breakpointsWithEl"
|
|
24
24
|
class="uikit-question-passage-and-image__image"
|
|
25
25
|
:src="passageImageUrl"
|
|
26
26
|
:alt="`${passageImageAlt}. Extended image description below.`"
|
|
27
27
|
>
|
|
28
28
|
<PocketButton
|
|
29
29
|
v-if="passageImageLongAlt"
|
|
30
|
-
v-breakpoint
|
|
30
|
+
v-breakpoint="breakpointsWithEl"
|
|
31
31
|
type="tertiary-small"
|
|
32
32
|
class="uikit-question-passage-and-image__toggle-passage-image-description"
|
|
33
33
|
:is-dark-mode="isDarkMode"
|
|
@@ -66,49 +66,38 @@
|
|
|
66
66
|
</div>
|
|
67
67
|
</template>
|
|
68
68
|
|
|
69
|
-
<script lang="ts">
|
|
70
|
-
import { Component, Emit, Prop, Vue } from 'vue-facing-decorator'
|
|
71
|
-
import type { Study } from '@pocketprep/types'
|
|
69
|
+
<script setup lang="ts">
|
|
72
70
|
import Icon from '../../Icons/Icon.vue'
|
|
73
71
|
import PocketButton from '../../Buttons/Button.vue'
|
|
74
|
-
import {
|
|
75
|
-
import
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
'tablet-landscape': 1439,
|
|
101
|
-
} }) breakpoints!: TBreakPointsObject
|
|
102
|
-
|
|
103
|
-
@Emit('emitTogglePassageImageLongAlt')
|
|
104
|
-
emitTogglePassageImageLongAlt () {
|
|
105
|
-
return
|
|
106
|
-
}
|
|
72
|
+
import { dark as vDark, breakpoint as vBreakpoint } from '../../../directives'
|
|
73
|
+
import { useQuestionContext } from './composables'
|
|
74
|
+
|
|
75
|
+
const emit = defineEmits<{
|
|
76
|
+
'emitTogglePassageImageLongAlt': []
|
|
77
|
+
'emitMoveFocusToPrompt': []
|
|
78
|
+
}>()
|
|
79
|
+
|
|
80
|
+
const {
|
|
81
|
+
// questionEl is used by the breakpoint directive
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
83
|
+
questionEl,
|
|
84
|
+
question,
|
|
85
|
+
showPassageImageLongAlt,
|
|
86
|
+
showPassageAndImage,
|
|
87
|
+
passageImageUrl,
|
|
88
|
+
passageImageLongAlt,
|
|
89
|
+
passageImageAlt,
|
|
90
|
+
passageAndImageTitle,
|
|
91
|
+
isDarkMode,
|
|
92
|
+
breakpointsWithEl,
|
|
93
|
+
} = useQuestionContext()
|
|
94
|
+
|
|
95
|
+
const emitTogglePassageImageLongAlt = () => {
|
|
96
|
+
emit('emitTogglePassageImageLongAlt')
|
|
97
|
+
}
|
|
107
98
|
|
|
108
|
-
|
|
109
|
-
emitMoveFocusToPrompt
|
|
110
|
-
return
|
|
111
|
-
}
|
|
99
|
+
const emitMoveFocusToPrompt = () => {
|
|
100
|
+
emit('emitMoveFocusToPrompt')
|
|
112
101
|
}
|
|
113
102
|
</script>
|
|
114
103
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div
|
|
3
3
|
v-if="question.passage || passageImageUrl"
|
|
4
4
|
ref="uikit-question-passage-and-image-dropdown"
|
|
5
|
-
v-breakpoint
|
|
5
|
+
v-breakpoint="breakpointsWithEl"
|
|
6
6
|
v-dark="isDarkMode"
|
|
7
7
|
class="uikit-question-passage-and-image-dropdown"
|
|
8
8
|
>
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
</div>
|
|
46
46
|
<div
|
|
47
47
|
v-if="showPassageImageDropdown"
|
|
48
|
-
v-breakpoint
|
|
48
|
+
v-breakpoint="breakpointsWithEl"
|
|
49
49
|
class="uikit-question-passage-and-image-dropdown__passage-and-image-dropdown-container"
|
|
50
50
|
>
|
|
51
51
|
<div
|
|
52
52
|
v-if="question.passage"
|
|
53
|
-
v-breakpoint
|
|
53
|
+
v-breakpoint="breakpointsWithEl"
|
|
54
54
|
class="uikit-question-passage-and-image-dropdown__passage-dropdown-passage"
|
|
55
55
|
:class="{
|
|
56
56
|
'uikit-question-passage-and-image-dropdown__passage-dropdown-passage--with-image': passageImageUrl,
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
>
|
|
70
70
|
<PocketButton
|
|
71
71
|
v-if="passageImageLongAlt"
|
|
72
|
-
v-breakpoint
|
|
72
|
+
v-breakpoint="breakpointsWithEl"
|
|
73
73
|
type="tertiary-small"
|
|
74
74
|
class="uikit-question-passage-and-image-dropdown__toggle-img-dropdown-img-description"
|
|
75
75
|
:class="{
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
<div
|
|
99
99
|
v-if="showPassageImageLongAlt"
|
|
100
100
|
ref="uikit-question-passage-and-image-dropdown__img-dropdown-img-description"
|
|
101
|
-
v-breakpoint
|
|
101
|
+
v-breakpoint="breakpointsWithEl"
|
|
102
102
|
v-dark="isDarkMode"
|
|
103
103
|
class="uikit-question-passage-and-image-dropdown__img-dropdown-img-description"
|
|
104
104
|
tabindex="-1"
|
|
@@ -108,46 +108,35 @@
|
|
|
108
108
|
</div>
|
|
109
109
|
</template>
|
|
110
110
|
|
|
111
|
-
<script lang="ts">
|
|
112
|
-
import { Component, Emit, Prop, Vue } from 'vue-facing-decorator'
|
|
113
|
-
import type { Study } from '@pocketprep/types'
|
|
111
|
+
<script setup lang="ts">
|
|
114
112
|
import Icon from '../../Icons/Icon.vue'
|
|
115
113
|
import PocketButton from '../../Buttons/Button.vue'
|
|
116
|
-
import {
|
|
117
|
-
import
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
'tablet-landscape': 1439,
|
|
143
|
-
} }) breakpoints!: TBreakPointsObject
|
|
144
|
-
|
|
145
|
-
showPassageImageDropdown = false
|
|
146
|
-
|
|
147
|
-
@Emit('togglePassageImageLongAltDropdown')
|
|
148
|
-
togglePassageImageLongAltDropdown () {
|
|
149
|
-
return
|
|
150
|
-
}
|
|
114
|
+
import { dark as vDark, breakpoint as vBreakpoint } from '../../../directives'
|
|
115
|
+
import { useQuestionContext } from './composables'
|
|
116
|
+
import { ref } from 'vue'
|
|
117
|
+
|
|
118
|
+
const emit = defineEmits<{
|
|
119
|
+
'togglePassageImageLongAltDropdown': []
|
|
120
|
+
}>()
|
|
121
|
+
|
|
122
|
+
const {
|
|
123
|
+
// questionEl is used by the breakpoint directive
|
|
124
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
125
|
+
questionEl,
|
|
126
|
+
question,
|
|
127
|
+
isDarkMode,
|
|
128
|
+
passageImageUrl,
|
|
129
|
+
passageImageAlt,
|
|
130
|
+
passageImageLongAlt,
|
|
131
|
+
showPassageImageLongAlt,
|
|
132
|
+
passageAndImageTitle,
|
|
133
|
+
breakpointsWithEl,
|
|
134
|
+
} = useQuestionContext()
|
|
135
|
+
|
|
136
|
+
const showPassageImageDropdown = ref(false)
|
|
137
|
+
|
|
138
|
+
const togglePassageImageLongAltDropdown = () => {
|
|
139
|
+
emit('togglePassageImageLongAltDropdown')
|
|
151
140
|
}
|
|
152
141
|
</script>
|
|
153
142
|
|
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
>
|
|
5
5
|
<div
|
|
6
6
|
v-dark="isDarkMode"
|
|
7
|
-
v-breakpoint
|
|
7
|
+
v-breakpoint="breakpointsWithEl"
|
|
8
8
|
class="uikit-question-paywall__paywall"
|
|
9
9
|
:class="{ 'uikit-question-paywall__paywall--review': reviewMode }"
|
|
10
10
|
>
|
|
11
11
|
<img
|
|
12
|
-
v-breakpoint
|
|
12
|
+
v-breakpoint="breakpointsWithEl"
|
|
13
13
|
:src="isDarkMode ? paywallImages['dark'] : paywallImages['light']"
|
|
14
14
|
alt=""
|
|
15
15
|
class="uikit-question-paywall__paywall-image"
|
|
16
16
|
>
|
|
17
17
|
<div
|
|
18
18
|
v-dark="isDarkMode"
|
|
19
|
-
v-breakpoint
|
|
19
|
+
v-breakpoint="breakpointsWithEl"
|
|
20
20
|
class="uikit-question-paywall__paywall-text"
|
|
21
21
|
>
|
|
22
22
|
You need a Premium Subscription to view this question's answer and explanation.
|
|
@@ -32,48 +32,37 @@
|
|
|
32
32
|
</div>
|
|
33
33
|
</template>
|
|
34
34
|
|
|
35
|
-
<script lang="ts">
|
|
36
|
-
import {
|
|
37
|
-
import Icon from '../../Icons/Icon.vue'
|
|
35
|
+
<script setup lang="ts">
|
|
36
|
+
import { computed } from 'vue'
|
|
38
37
|
import PocketButton from '../../Buttons/Button.vue'
|
|
39
|
-
import { dark, breakpoint } from '../../../directives'
|
|
40
|
-
import type { TBreakPointsObject } from './../question'
|
|
41
38
|
import PaywallImageLight from '../../../assets/question/paywall-light.png'
|
|
42
39
|
import PaywallImageDark from '../../../assets/question/paywall-dark.png'
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
get paywallImages () {
|
|
65
|
-
return {
|
|
66
|
-
light: PaywallImageLight,
|
|
67
|
-
dark: PaywallImageDark,
|
|
68
|
-
}
|
|
40
|
+
import { dark as vDark, breakpoint as vBreakpoint } from '../../../directives'
|
|
41
|
+
import { useQuestionContext } from './composables'
|
|
42
|
+
|
|
43
|
+
const emit = defineEmits<{
|
|
44
|
+
'upgradeClicked': []
|
|
45
|
+
}>()
|
|
46
|
+
|
|
47
|
+
const {
|
|
48
|
+
// questionEl is used by the breakpoint directive
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
50
|
+
questionEl,
|
|
51
|
+
isDarkMode,
|
|
52
|
+
reviewMode,
|
|
53
|
+
breakpointsWithEl,
|
|
54
|
+
} = useQuestionContext()
|
|
55
|
+
|
|
56
|
+
const paywallImages = computed(() => {
|
|
57
|
+
return {
|
|
58
|
+
light: PaywallImageLight,
|
|
59
|
+
dark: PaywallImageDark,
|
|
69
60
|
}
|
|
61
|
+
})
|
|
70
62
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return true
|
|
74
|
-
}
|
|
63
|
+
const emitUpgradeClick = () => {
|
|
64
|
+
emit('upgradeClicked')
|
|
75
65
|
}
|
|
76
|
-
|
|
77
66
|
</script>
|
|
78
67
|
|
|
79
68
|
<style lang="scss">
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
ref="uikit-question-context"
|
|
4
|
-
v-breakpoint
|
|
4
|
+
v-breakpoint="breakpointsWithEl"
|
|
5
5
|
class="uikit-question-context"
|
|
6
6
|
tabindex="-1"
|
|
7
7
|
>
|
|
@@ -51,44 +51,36 @@
|
|
|
51
51
|
</h2>
|
|
52
52
|
<div
|
|
53
53
|
class="uikit-question-context__tag"
|
|
54
|
-
v-breakpoint
|
|
54
|
+
v-breakpoint="breakpointsWithEl"
|
|
55
55
|
>
|
|
56
56
|
<slot name="tag" />
|
|
57
57
|
</div>
|
|
58
58
|
</div>
|
|
59
59
|
</template>
|
|
60
60
|
|
|
61
|
-
<script lang="ts">
|
|
62
|
-
import { Component, Vue, Prop } from 'vue-facing-decorator'
|
|
61
|
+
<script setup lang="ts">
|
|
63
62
|
import Icon from '../../Icons/Icon.vue'
|
|
64
|
-
import { dark, breakpoint } from '../../../directives'
|
|
65
|
-
import
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
63
|
+
import { dark as vDark, breakpoint as vBreakpoint } from '../../../directives'
|
|
64
|
+
import { useQuestionContext } from './composables'
|
|
65
|
+
|
|
66
|
+
const {
|
|
67
|
+
// questionEl is used by the breakpoint directive
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
69
|
+
questionEl,
|
|
70
|
+
breakpointsWithEl,
|
|
71
|
+
quizLength,
|
|
72
|
+
quizMode,
|
|
73
|
+
questionNumber,
|
|
74
|
+
isDarkMode,
|
|
75
|
+
isCorrect,
|
|
76
|
+
contextIconType,
|
|
77
|
+
showAnswers,
|
|
78
|
+
showMatrixAnswers,
|
|
79
|
+
} = useQuestionContext()
|
|
80
|
+
|
|
81
|
+
defineExpose({
|
|
82
|
+
questionEl,
|
|
75
83
|
})
|
|
76
|
-
export default class QuestionContext extends Vue {
|
|
77
|
-
@Prop() quizLength!: number
|
|
78
|
-
@Prop({ default: 'quick10' }) quizMode!: TQuizMode
|
|
79
|
-
@Prop() questionNumber!: number
|
|
80
|
-
@Prop({ default: false }) isDarkMode!: boolean
|
|
81
|
-
@Prop({ default: false }) isCorrect!: boolean
|
|
82
|
-
@Prop() contextIconType!: TContextIcon
|
|
83
|
-
@Prop({ default: null }) questionEl!: Element | null
|
|
84
|
-
@Prop({ default: false }) showAnswers!: boolean
|
|
85
|
-
@Prop({ default: false }) showMatrixAnswers!: boolean
|
|
86
|
-
@Prop({ default: {
|
|
87
|
-
'mobile': 767,
|
|
88
|
-
'tablet-portrait': 1023,
|
|
89
|
-
'tablet-landscape': 1439,
|
|
90
|
-
} }) breakpoints!: TBreakPointsObject
|
|
91
|
-
}
|
|
92
84
|
|
|
93
85
|
</script>
|
|
94
86
|
|
|
@@ -28,27 +28,17 @@
|
|
|
28
28
|
</div>
|
|
29
29
|
</template>
|
|
30
30
|
|
|
31
|
-
<script lang="ts">
|
|
32
|
-
import {
|
|
33
|
-
import
|
|
34
|
-
import { dark, breakpoint } from '../../../directives'
|
|
35
|
-
import type { TChoiceScores, TMatrixChoiceScores } from './../question'
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
@Component({
|
|
39
|
-
directives: {
|
|
40
|
-
dark,
|
|
41
|
-
breakpoint,
|
|
42
|
-
},
|
|
43
|
-
})
|
|
44
|
-
export default class StatsSummary extends Vue {
|
|
45
|
-
@Prop({ default: null }) globalMetrics!: Study.Class.GlobalQuestionMetricJSON | null
|
|
46
|
-
@Prop() choiceScores!: TChoiceScores
|
|
47
|
-
@Prop({ default: false }) isDarkMode!: boolean
|
|
48
|
-
@Prop({ default: false }) isMatrixQuestion!: boolean
|
|
49
|
-
@Prop() matrixChoiceScores!: TMatrixChoiceScores
|
|
50
|
-
}
|
|
31
|
+
<script setup lang="ts">
|
|
32
|
+
import { dark as vDark } from '../../../directives'
|
|
33
|
+
import { useQuestionContext } from './composables'
|
|
51
34
|
|
|
35
|
+
const {
|
|
36
|
+
globalMetrics,
|
|
37
|
+
choiceScores,
|
|
38
|
+
isDarkMode,
|
|
39
|
+
isMatrixQuestion,
|
|
40
|
+
matrixChoiceScores,
|
|
41
|
+
} = useQuestionContext()
|
|
52
42
|
</script>
|
|
53
43
|
|
|
54
44
|
<style lang="scss">
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
v-dark="isDarkMode"
|
|
4
|
-
v-breakpoint
|
|
4
|
+
v-breakpoint="breakpointsWithEl"
|
|
5
5
|
ref="uikit-question-summary"
|
|
6
6
|
class="uikit-question-summary"
|
|
7
7
|
:class="{
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
{{ isQuestionCorrect ? 'Correct': isUnanswered ? 'Unanswered' : 'Incorrect' }}
|
|
14
14
|
</div>
|
|
15
15
|
<PocketButton
|
|
16
|
-
v-breakpoint
|
|
16
|
+
v-breakpoint="breakpointsWithEl"
|
|
17
17
|
type="tertiary-small"
|
|
18
18
|
class="uikit-question-summary__summary-toggle-explanation"
|
|
19
19
|
:class="{ 'uikit-question-summary__summary-toggle-explanation--review-mode': reviewMode }"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
tabindex="-1"
|
|
29
29
|
>{{ showExplanation ? 'Hide' : 'Show' }} Explanation</span>
|
|
30
30
|
<Icon
|
|
31
|
-
v-breakpoint
|
|
31
|
+
v-breakpoint="breakpointsWithEl"
|
|
32
32
|
type="accordionArrow"
|
|
33
33
|
class="uikit-question-summary__summary-toggle-explanation-icon"
|
|
34
34
|
:class="{
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
</PocketButton>
|
|
39
39
|
<div
|
|
40
40
|
v-if="showExplanation"
|
|
41
|
-
v-breakpoint
|
|
41
|
+
v-breakpoint="breakpointsWithEl"
|
|
42
42
|
ref="uikit-question-summary__summary-dropdown-explanation"
|
|
43
43
|
class="uikit-question-summary__summary-dropdown-explanation"
|
|
44
44
|
:class="{
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
>
|
|
62
62
|
<PocketButton
|
|
63
63
|
v-if="explanationImageLongAlt"
|
|
64
|
-
v-breakpoint
|
|
64
|
+
v-breakpoint="breakpointsWithEl"
|
|
65
65
|
type="tertiary-small"
|
|
66
66
|
class="uikit-question-summary__toggle-summary-dropdown-explanation-img-description"
|
|
67
67
|
:class="{
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
v-if="showExplanationImageLongAlt"
|
|
92
92
|
ref="uikit-question-summary__summary-dropdown-explanation-img-description"
|
|
93
93
|
v-dark="isDarkMode"
|
|
94
|
-
v-breakpoint
|
|
94
|
+
v-breakpoint="breakpointsWithEl"
|
|
95
95
|
class="uikit-question-summary__summary-dropdown-explanation-img-description"
|
|
96
96
|
tabindex="-1"
|
|
97
97
|
v-html="explanationImageLongAlt"
|
|
@@ -121,71 +121,61 @@
|
|
|
121
121
|
</div>
|
|
122
122
|
</template>
|
|
123
123
|
|
|
124
|
-
<script lang="ts">
|
|
125
|
-
import {
|
|
126
|
-
import type { Study } from '@pocketprep/types'
|
|
124
|
+
<script setup lang="ts">
|
|
125
|
+
import { computed } from 'vue'
|
|
127
126
|
import Icon from '../../Icons/Icon.vue'
|
|
128
127
|
import PocketButton from '../../Buttons/Button.vue'
|
|
129
|
-
import { breakpoint, dark } from '../../../directives'
|
|
130
|
-
import type { TBreakPointsObject } from './../question'
|
|
131
128
|
import { highlightKeywordsInText } from '../../../utils'
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
129
|
+
import { dark as vDark, breakpoint as vBreakpoint } from '../../../directives'
|
|
130
|
+
import { useQuestionContext } from './composables'
|
|
131
|
+
|
|
132
|
+
const emit = defineEmits<{
|
|
133
|
+
'toggleSummaryExplanation': []
|
|
134
|
+
'toggleSummaryExplanationImageLongAlt': []
|
|
135
|
+
}>()
|
|
136
|
+
|
|
137
|
+
const {
|
|
138
|
+
// questionEl is used by the breakpoint directive
|
|
139
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
140
|
+
questionEl,
|
|
141
|
+
question,
|
|
142
|
+
showExplanation,
|
|
143
|
+
showExplanationImageLongAlt,
|
|
144
|
+
explanationImageUrl,
|
|
145
|
+
explanationImageAlt,
|
|
146
|
+
explanationImageLongAlt,
|
|
147
|
+
reference,
|
|
148
|
+
hideReferences,
|
|
149
|
+
isCorrect,
|
|
150
|
+
isMatrixQuestionCorrect,
|
|
151
|
+
isUnanswered,
|
|
152
|
+
reviewMode,
|
|
153
|
+
isDarkMode,
|
|
154
|
+
isMatrixQuestion,
|
|
155
|
+
breakpointsWithEl,
|
|
156
|
+
keywordDefinitions,
|
|
157
|
+
} = useQuestionContext()
|
|
158
|
+
|
|
159
|
+
const isQuestionCorrect = computed(() => {
|
|
160
|
+
return (!isMatrixQuestion.value && isCorrect.value) ||
|
|
161
|
+
(isMatrixQuestion.value && isMatrixQuestionCorrect.value && !isUnanswered.value)
|
|
142
162
|
})
|
|
143
|
-
export default class Summary extends Vue {
|
|
144
|
-
@Prop() question!: Study.Class.QuestionJSON
|
|
145
|
-
@Prop({ default: false }) showExplanation!: boolean
|
|
146
|
-
@Prop({ default: false }) showExplanationImageLongAlt!: boolean
|
|
147
|
-
@Prop({ default: null }) explanationImageUrl!: string | null
|
|
148
|
-
@Prop({ default: undefined }) explanationImageAlt!: string | undefined
|
|
149
|
-
@Prop({ default: undefined }) explanationImageLongAlt!: string | undefined
|
|
150
|
-
@Prop({ default: undefined }) reference!: string | undefined
|
|
151
|
-
@Prop({ default: false }) hideReferences!: boolean
|
|
152
|
-
@Prop({ default: false }) isCorrect!: boolean
|
|
153
|
-
@Prop({ default: false }) isMatrixQuestionCorrect!: boolean
|
|
154
|
-
@Prop({ default: false }) isUnanswered!: boolean
|
|
155
|
-
@Prop({ default: false }) reviewMode!: boolean
|
|
156
|
-
@Prop({ default: false }) isDarkMode!: boolean
|
|
157
|
-
@Prop({ default: false }) isMatrixQuestion!: boolean
|
|
158
|
-
@Prop({ default: null }) questionEl!: Element | null
|
|
159
|
-
@Prop({ default: {
|
|
160
|
-
'mobile': 767,
|
|
161
|
-
'tablet-portrait': 1023,
|
|
162
|
-
'tablet-landscape': 1439,
|
|
163
|
-
} }) breakpoints!: TBreakPointsObject
|
|
164
|
-
@Prop({ default: [] }) keywordDefinitions!: { keyword: string; definition: string }[]
|
|
165
|
-
|
|
166
|
-
get isQuestionCorrect () {
|
|
167
|
-
return (!this.isMatrixQuestion && this.isCorrect) ||
|
|
168
|
-
(this.isMatrixQuestion && this.isMatrixQuestionCorrect && !this.isUnanswered)
|
|
169
|
-
}
|
|
170
163
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
164
|
+
const summary = computed(() => {
|
|
165
|
+
return highlightKeywordsInText({
|
|
166
|
+
text: question.value.explanation || '',
|
|
167
|
+
keywordDefinitions: keywordDefinitions.value,
|
|
168
|
+
isDarkMode: isDarkMode.value,
|
|
169
|
+
location: 'explanation',
|
|
170
|
+
})
|
|
171
|
+
})
|
|
179
172
|
|
|
180
|
-
|
|
181
|
-
toggleSummaryExplanation
|
|
182
|
-
|
|
183
|
-
}
|
|
173
|
+
const toggleSummaryExplanation = () => {
|
|
174
|
+
emit('toggleSummaryExplanation')
|
|
175
|
+
}
|
|
184
176
|
|
|
185
|
-
|
|
186
|
-
toggleSummaryExplanationImageLongAlt
|
|
187
|
-
return
|
|
188
|
-
}
|
|
177
|
+
const toggleSummaryExplanationImageLongAlt = () => {
|
|
178
|
+
emit('toggleSummaryExplanationImageLongAlt')
|
|
189
179
|
}
|
|
190
180
|
</script>
|
|
191
181
|
|