@pocketprep/ui-kit 3.4.8 → 3.4.9
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 +4305 -4268
- package/dist/@pocketprep/ui-kit.js.map +1 -1
- package/dist/@pocketprep/ui-kit.umd.cjs +8 -8
- package/dist/@pocketprep/ui-kit.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/lib/components/Quiz/Question/ChoicesContainer.vue +6 -18
- package/lib/components/Quiz/Question/StatsSummary.vue +104 -0
- package/lib/components/Quiz/Question.vue +8 -75
- package/package.json +1 -1
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
class="uikit-question-choices-container__choice-container"
|
|
12
12
|
:class="{
|
|
13
13
|
'uikit-question-choices-container__choice-container--hover':
|
|
14
|
-
!showAnswers &&
|
|
14
|
+
!showAnswers && hoverChoiceKey === choice.key,
|
|
15
15
|
'uikit-question-choices-container__choice-container--focus':
|
|
16
|
-
!showAnswers &&
|
|
16
|
+
!showAnswers && focusChoiceKey === choice.key,
|
|
17
17
|
'uikit-question-choices-container__choice-container--selected': !showAnswers
|
|
18
18
|
&& selectedChoices.includes(choice.key),
|
|
19
19
|
'uikit-question-choices-container__choice-container--correct':
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
}"
|
|
30
30
|
@mousedown.prevent
|
|
31
31
|
@mouseover="emitChoiceMouseOver(choice.key)"
|
|
32
|
-
@mouseleave="
|
|
32
|
+
@mouseleave="emitChoiceMouseLeave"
|
|
33
33
|
@focusin="emitChoiceFocusIn(choice.key)"
|
|
34
34
|
@focusout="emitChoiceFocusOut($event)"
|
|
35
35
|
@click.stop="emitSelectedChoice(choice.key)"
|
|
@@ -181,7 +181,7 @@
|
|
|
181
181
|
:aria-checked="choiceStrikes.includes(choice.key) ? 'true' : 'false'"
|
|
182
182
|
:class="{
|
|
183
183
|
'uikit-question-choices-container__strikethrough--visible': !showAnswers
|
|
184
|
-
&& [
|
|
184
|
+
&& [ hoverChoiceKey, focusChoiceKey ].includes(choice.key),
|
|
185
185
|
'uikit-question-choices-container__strikethrough--active': choiceStrikes.includes(choice.key),
|
|
186
186
|
}"
|
|
187
187
|
@mousedown.prevent
|
|
@@ -324,14 +324,6 @@ export default class ChoicesContainer extends Vue {
|
|
|
324
324
|
'tablet-landscape': 1439,
|
|
325
325
|
} }) breakpoints!: TBreakPointsObject
|
|
326
326
|
|
|
327
|
-
choiceKeyHover: TChoiceKey | null = null
|
|
328
|
-
choiceKeyFocus: TChoiceKey | null = null
|
|
329
|
-
|
|
330
|
-
mounted () {
|
|
331
|
-
this.choiceKeyHover = this.hoverChoiceKey
|
|
332
|
-
this.choiceKeyFocus = this.focusChoiceKey
|
|
333
|
-
}
|
|
334
|
-
|
|
335
327
|
stripText (string?: string) {
|
|
336
328
|
return string?.replace(/<[^\s>]+[^>]*>/gi, ' ').trim()
|
|
337
329
|
}
|
|
@@ -339,25 +331,21 @@ export default class ChoicesContainer extends Vue {
|
|
|
339
331
|
|
|
340
332
|
@Emit('emitChoiceFocusIn')
|
|
341
333
|
emitChoiceFocusIn (choiceKey: TChoiceKey) {
|
|
342
|
-
this.choiceKeyFocus = choiceKey
|
|
343
334
|
return choiceKey
|
|
344
335
|
}
|
|
345
336
|
|
|
346
337
|
@Emit('emitChoiceFocusOut')
|
|
347
338
|
emitChoiceFocusOut (event: FocusEvent) {
|
|
348
|
-
this.choiceKeyFocus = null
|
|
349
339
|
return event
|
|
350
340
|
}
|
|
351
341
|
|
|
352
342
|
@Emit('emitChoiceMouseOver')
|
|
353
343
|
emitChoiceMouseOver (choiceKey: TChoiceKey) {
|
|
354
|
-
this.choiceKeyHover = choiceKey
|
|
355
344
|
return choiceKey
|
|
356
345
|
}
|
|
357
346
|
|
|
358
|
-
@Emit('
|
|
359
|
-
|
|
360
|
-
this.choiceKeyHover = null
|
|
347
|
+
@Emit('emitChoiceMouseLeave')
|
|
348
|
+
emitChoiceMouseLeave () {
|
|
361
349
|
return
|
|
362
350
|
}
|
|
363
351
|
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
v-if="globalMetrics"
|
|
4
|
+
class="uikit-question-stats-summary"
|
|
5
|
+
>
|
|
6
|
+
<div v-dark="isDarkMode" class="uikit-question-stats-summary__stats-summary-total">
|
|
7
|
+
<div class="uikit-question-stats-summary__stats-summary-value">
|
|
8
|
+
{{ choiceScores.totalAnswered }}
|
|
9
|
+
</div>
|
|
10
|
+
<div v-dark="isDarkMode" class="uikit-question-stats-summary__stats-summary-label">
|
|
11
|
+
Studiers Answered
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
<div v-dark="isDarkMode" class="uikit-question-stats-summary__stats-summary-correct">
|
|
15
|
+
<div class="uikit-question-stats-summary__stats-summary-value">
|
|
16
|
+
{{ Math.round((choiceScores.answeredCorrectly / choiceScores.totalAnswered) * 100) }}%
|
|
17
|
+
</div>
|
|
18
|
+
<div v-dark="isDarkMode" class="uikit-question-stats-summary__stats-summary-label">
|
|
19
|
+
Answered Correctly
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script lang="ts">
|
|
26
|
+
import { Component, Vue, Prop } from 'vue-facing-decorator'
|
|
27
|
+
import type { Study } from '@pocketprep/types'
|
|
28
|
+
import { dark, breakpoint } from '../../../directives'
|
|
29
|
+
import type { TChoiceScores } from './../question'
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@Component({
|
|
33
|
+
directives: {
|
|
34
|
+
dark,
|
|
35
|
+
breakpoint,
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
export default class StatsSummary extends Vue {
|
|
39
|
+
@Prop({ default: null }) globalMetrics!: Study.Class.GlobalQuestionMetricJSON | null
|
|
40
|
+
@Prop() choiceScores!: TChoiceScores
|
|
41
|
+
@Prop({ default: false }) isDarkMode!: boolean
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<style lang="scss">
|
|
47
|
+
@import '../../../styles/colors';
|
|
48
|
+
@import '../../../styles/breakpoints';
|
|
49
|
+
|
|
50
|
+
.uikit-question-stats-summary {
|
|
51
|
+
margin-top: 24px;
|
|
52
|
+
display: flex;
|
|
53
|
+
width: 100%;
|
|
54
|
+
max-width: 492px;
|
|
55
|
+
padding-bottom: 50px;
|
|
56
|
+
|
|
57
|
+
&__stats-summary-total {
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
align-items: center;
|
|
61
|
+
flex: 1;
|
|
62
|
+
margin-right: 16px;
|
|
63
|
+
background-color: rgba($sky-blue, 0.8);
|
|
64
|
+
padding: 9px 0;
|
|
65
|
+
border-radius: 6px;
|
|
66
|
+
|
|
67
|
+
&--dark {
|
|
68
|
+
background-color: $brand-black;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&__stats-summary-correct {
|
|
73
|
+
display: flex;
|
|
74
|
+
flex-direction: column;
|
|
75
|
+
align-items: center;
|
|
76
|
+
flex: 1;
|
|
77
|
+
background-color: rgba($cadaverous, 0.13);
|
|
78
|
+
padding: 9px 0;
|
|
79
|
+
border-radius: 6px;
|
|
80
|
+
|
|
81
|
+
&--dark {
|
|
82
|
+
background-color: $brand-black;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&__stats-summary-value {
|
|
87
|
+
font-weight: 600;
|
|
88
|
+
font-size: 26px;
|
|
89
|
+
letter-spacing: 0.26px;
|
|
90
|
+
line-height: 31px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&__stats-summary-label {
|
|
94
|
+
color: $ash;
|
|
95
|
+
font-size: 13px;
|
|
96
|
+
line-height: 16px;
|
|
97
|
+
text-align: center;
|
|
98
|
+
|
|
99
|
+
&--dark {
|
|
100
|
+
color: $white;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
</style>
|
|
@@ -176,7 +176,7 @@
|
|
|
176
176
|
:question-el="questionEl"
|
|
177
177
|
:breakpoints="breakpoints"
|
|
178
178
|
@emitChoiceMouseOver="choiceMouseOver"
|
|
179
|
-
@
|
|
179
|
+
@emitChoiceMouseLeave="choiceMouseLeave"
|
|
180
180
|
@emitChoiceFocusIn="choiceFocusIn"
|
|
181
181
|
@emitChoiceFocusOut="choiceFocusOut"
|
|
182
182
|
@emitHandleTouchStart="handleTouchStart"
|
|
@@ -234,27 +234,13 @@
|
|
|
234
234
|
@toggleSummaryExplanationImageLongAlt="toggleExplanationImageLongAlt"
|
|
235
235
|
/>
|
|
236
236
|
<slot name="metricsTiles">
|
|
237
|
-
<
|
|
237
|
+
<StatsSummary
|
|
238
238
|
v-if="globalMetrics"
|
|
239
239
|
class="uikit-question__stats-summary"
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
</div>
|
|
245
|
-
<div v-dark="isDarkMode" class="uikit-question__stats-summary-label">
|
|
246
|
-
Studiers Answered
|
|
247
|
-
</div>
|
|
248
|
-
</div>
|
|
249
|
-
<div v-dark="isDarkMode" class="uikit-question__stats-summary-correct">
|
|
250
|
-
<div class="uikit-question__stats-summary-value">
|
|
251
|
-
{{ Math.round((choiceScores.answeredCorrectly / choiceScores.totalAnswered) * 100) }}%
|
|
252
|
-
</div>
|
|
253
|
-
<div v-dark="isDarkMode" class="uikit-question__stats-summary-label">
|
|
254
|
-
Answered Correctly
|
|
255
|
-
</div>
|
|
256
|
-
</div>
|
|
257
|
-
</div>
|
|
240
|
+
:global-metrics="globalMetrics"
|
|
241
|
+
:choice-scores="choiceScores"
|
|
242
|
+
:is-dark-mode="isDarkMode"
|
|
243
|
+
/>
|
|
258
244
|
</slot>
|
|
259
245
|
<div
|
|
260
246
|
v-breakpoint:questionEl="breakpoints"
|
|
@@ -485,6 +471,7 @@ import DropdownExplanation from '../Quiz/Question/DropdownExplanation.vue'
|
|
|
485
471
|
import Paywall from '../Quiz/Question/Paywall.vue'
|
|
486
472
|
import Summary from '../Quiz/Question/Summary.vue'
|
|
487
473
|
import ChoicesContainer from '../Quiz/Question/ChoicesContainer.vue'
|
|
474
|
+
import StatsSummary from '../Quiz/Question/StatsSummary.vue'
|
|
488
475
|
import type { Study } from '@pocketprep/types'
|
|
489
476
|
import { breakpoint, dark } from '../../directives'
|
|
490
477
|
import { studyModes } from '../../utils'
|
|
@@ -502,6 +489,7 @@ import type { Ref, TQuizMode, TChoiceKey, TChoice, TChoiceScores, TNamesRow, TVi
|
|
|
502
489
|
DropdownExplanation,
|
|
503
490
|
Summary,
|
|
504
491
|
ChoicesContainer,
|
|
492
|
+
StatsSummary,
|
|
505
493
|
},
|
|
506
494
|
directives: {
|
|
507
495
|
breakpoint,
|
|
@@ -2111,61 +2099,6 @@ export default class Question extends Vue {
|
|
|
2111
2099
|
}
|
|
2112
2100
|
}
|
|
2113
2101
|
|
|
2114
|
-
&__stats-summary {
|
|
2115
|
-
margin-top: 24px;
|
|
2116
|
-
display: flex;
|
|
2117
|
-
width: 100%;
|
|
2118
|
-
max-width: 492px;
|
|
2119
|
-
padding-bottom: 50px;
|
|
2120
|
-
}
|
|
2121
|
-
|
|
2122
|
-
&__stats-summary-total {
|
|
2123
|
-
display: flex;
|
|
2124
|
-
flex-direction: column;
|
|
2125
|
-
align-items: center;
|
|
2126
|
-
flex: 1;
|
|
2127
|
-
margin-right: 16px;
|
|
2128
|
-
background-color: rgba($sky-blue, 0.8);
|
|
2129
|
-
padding: 9px 0;
|
|
2130
|
-
border-radius: 6px;
|
|
2131
|
-
|
|
2132
|
-
&--dark {
|
|
2133
|
-
background-color: $brand-black;
|
|
2134
|
-
}
|
|
2135
|
-
}
|
|
2136
|
-
|
|
2137
|
-
&__stats-summary-correct {
|
|
2138
|
-
display: flex;
|
|
2139
|
-
flex-direction: column;
|
|
2140
|
-
align-items: center;
|
|
2141
|
-
flex: 1;
|
|
2142
|
-
background-color: rgba($cadaverous, 0.13);
|
|
2143
|
-
padding: 9px 0;
|
|
2144
|
-
border-radius: 6px;
|
|
2145
|
-
|
|
2146
|
-
&--dark {
|
|
2147
|
-
background-color: $brand-black;
|
|
2148
|
-
}
|
|
2149
|
-
}
|
|
2150
|
-
|
|
2151
|
-
&__stats-summary-value {
|
|
2152
|
-
font-weight: 600;
|
|
2153
|
-
font-size: 26px;
|
|
2154
|
-
letter-spacing: 0.26px;
|
|
2155
|
-
line-height: 31px;
|
|
2156
|
-
}
|
|
2157
|
-
|
|
2158
|
-
&__stats-summary-label {
|
|
2159
|
-
color: $ash;
|
|
2160
|
-
font-size: 13px;
|
|
2161
|
-
line-height: 16px;
|
|
2162
|
-
text-align: center;
|
|
2163
|
-
|
|
2164
|
-
&--dark {
|
|
2165
|
-
color: $white;
|
|
2166
|
-
}
|
|
2167
|
-
}
|
|
2168
|
-
|
|
2169
2102
|
&__action-container {
|
|
2170
2103
|
display: flex;
|
|
2171
2104
|
justify-content: center;
|