@pocketprep/ui-kit 3.4.3 → 3.4.5
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 +8894 -8711
- package/dist/@pocketprep/ui-kit.js.map +1 -1
- package/dist/@pocketprep/ui-kit.umd.cjs +9 -9
- package/dist/@pocketprep/ui-kit.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/lib/components/Quiz/Question/DropdownExplanation.vue +253 -0
- package/lib/components/Quiz/Question/Paywall.vue +153 -0
- package/lib/components/Quiz/Question.vue +44 -192
- package/package.json +1 -1
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
v-breakpoint:questionEl="breakpoints"
|
|
4
|
+
ref="uikit-question-dropdown-explanation"
|
|
5
|
+
class="uikit-question-dropdown-explanation__dropdown-explanation"
|
|
6
|
+
:class="{
|
|
7
|
+
'uikit-question-dropdown-explanation__dropdown-explanation--show-stats': globalMetrics
|
|
8
|
+
}"
|
|
9
|
+
>
|
|
10
|
+
<div
|
|
11
|
+
v-dark="isDarkMode"
|
|
12
|
+
class="uikit-question-dropdown-explanation__dropdown-explanation-text"
|
|
13
|
+
v-html="question.explanation"
|
|
14
|
+
/>
|
|
15
|
+
<img
|
|
16
|
+
v-if="explanationImageUrl"
|
|
17
|
+
v-dark="isDarkMode"
|
|
18
|
+
class="uikit-question-dropdown-explanation__dropdown-explanation-image"
|
|
19
|
+
:src="explanationImageUrl"
|
|
20
|
+
:alt="`${explanationImageAlt}. Extended image description below.`"
|
|
21
|
+
>
|
|
22
|
+
<PocketButton
|
|
23
|
+
v-if="explanationImageLongAlt"
|
|
24
|
+
v-breakpoint:questionEl="breakpoints"
|
|
25
|
+
type="tertiary-small"
|
|
26
|
+
class="uikit-question-dropdown-explanation__toggle-dropdown-explanation-img-description"
|
|
27
|
+
:class="{
|
|
28
|
+
'uikit-question-dropdown-explanation__toggle-dropdown-explanation-img-description--open':
|
|
29
|
+
showExplanationImageLongAlt,
|
|
30
|
+
'uikit-question-dropdown-explanation__toggle-dropdown-explanation-img-description--no-reference':
|
|
31
|
+
!reference || hideReferences,
|
|
32
|
+
}"
|
|
33
|
+
:is-dark-mode="isDarkMode"
|
|
34
|
+
:aria-expanded="showExplanationImageLongAlt ? 'true' : 'false'"
|
|
35
|
+
@click="emitToggleExplanationImageLongAlt"
|
|
36
|
+
@mousedown.prevent
|
|
37
|
+
>
|
|
38
|
+
<span class="uikit-question-dropdown-explanation__toggle-dropdown-explanation-img-description-text">
|
|
39
|
+
Image Description
|
|
40
|
+
</span>
|
|
41
|
+
<Icon
|
|
42
|
+
class="uikit-question-dropdown-explanation__toggle-dropdown-explanation-img-description-icon"
|
|
43
|
+
:class="{
|
|
44
|
+
'uikit-question-dropdown-explanation__toggle-dropdown-explanation-img-description-icon--up':
|
|
45
|
+
showExplanationImageLongAlt,
|
|
46
|
+
}"
|
|
47
|
+
type="accordionArrow"
|
|
48
|
+
/>
|
|
49
|
+
</PocketButton>
|
|
50
|
+
<div
|
|
51
|
+
v-if="showExplanationImageLongAlt"
|
|
52
|
+
ref="uikit-question-dropdown-explanation__dropdown-explanation-img-description"
|
|
53
|
+
v-dark="isDarkMode"
|
|
54
|
+
v-breakpoint:questionEl="breakpoints"
|
|
55
|
+
class="uikit-question-dropdown-explanation__dropdown-explanation-img-description"
|
|
56
|
+
tabindex="-1"
|
|
57
|
+
v-html="explanationImageLongAlt"
|
|
58
|
+
/>
|
|
59
|
+
<div
|
|
60
|
+
v-if="reference && !hideReferences"
|
|
61
|
+
v-dark="isDarkMode"
|
|
62
|
+
class="uikit-question-dropdown-explanation__dropdown-reference"
|
|
63
|
+
>
|
|
64
|
+
<span class="uikit-question-dropdown-explanation__dropdown-reference-label">Reference: </span>
|
|
65
|
+
<div v-html="reference" />
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
</template>
|
|
69
|
+
|
|
70
|
+
<script lang="ts">
|
|
71
|
+
import { Component, Emit, Prop, Vue } from 'vue-facing-decorator'
|
|
72
|
+
import type { Study } from '@pocketprep/types'
|
|
73
|
+
import Icon from '../../Icons/Icon.vue'
|
|
74
|
+
import PocketButton from '../../Buttons/Button.vue'
|
|
75
|
+
import { breakpoint, dark } from '../../../directives'
|
|
76
|
+
import type { TBreakPointsObject, TChoice, TChoiceKey } from './../question'
|
|
77
|
+
|
|
78
|
+
@Component({
|
|
79
|
+
components: {
|
|
80
|
+
Icon,
|
|
81
|
+
PocketButton,
|
|
82
|
+
},
|
|
83
|
+
directives: {
|
|
84
|
+
dark,
|
|
85
|
+
breakpoint,
|
|
86
|
+
},
|
|
87
|
+
})
|
|
88
|
+
export default class DropdownExplanation extends Vue {
|
|
89
|
+
@Prop() question!: Study.Class.QuestionJSON
|
|
90
|
+
@Prop({ default: [] }) answerKeys!: TChoiceKey[]
|
|
91
|
+
@Prop() choice!: TChoice
|
|
92
|
+
@Prop({ default: null }) globalMetrics!: Study.Class.GlobalQuestionMetricJSON | null
|
|
93
|
+
@Prop({ default: false }) showAnswers!: boolean
|
|
94
|
+
@Prop({ default: false }) isMCR!: boolean
|
|
95
|
+
@Prop({ default: false }) showExplanation!: boolean
|
|
96
|
+
@Prop({ default: null }) explanationImageUrl!: string | null
|
|
97
|
+
@Prop({ default: undefined }) explanationImageAlt!: string | undefined
|
|
98
|
+
@Prop({ default: undefined }) explanationImageLongAlt!: string | undefined
|
|
99
|
+
@Prop({ default: undefined }) reference!: string | undefined
|
|
100
|
+
@Prop({ default: false }) hideReferences!: boolean
|
|
101
|
+
@Prop({ default: false }) isDarkMode!: boolean
|
|
102
|
+
@Prop({ default: null }) questionEl!: Element | null
|
|
103
|
+
@Prop({ default: {
|
|
104
|
+
'mobile': 767,
|
|
105
|
+
'tablet-portrait': 1023,
|
|
106
|
+
'tablet-landscape': 1439,
|
|
107
|
+
} }) breakpoints!: TBreakPointsObject
|
|
108
|
+
|
|
109
|
+
showExplanationImageLongAlt = false
|
|
110
|
+
|
|
111
|
+
@Emit('emitToggleExplanationImageLongAlt')
|
|
112
|
+
emitToggleExplanationImageLongAlt () {
|
|
113
|
+
this.showExplanationImageLongAlt = !this.showExplanationImageLongAlt
|
|
114
|
+
return
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
</script>
|
|
118
|
+
|
|
119
|
+
<style lang="scss">
|
|
120
|
+
@import '../../../styles/colors';
|
|
121
|
+
@import '../../../styles/breakpoints';
|
|
122
|
+
|
|
123
|
+
.uikit-question-dropdown-explanation {
|
|
124
|
+
&__dropdown-explanation {
|
|
125
|
+
display: none;
|
|
126
|
+
|
|
127
|
+
&--tablet-portrait {
|
|
128
|
+
display: block;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&--show-stats {
|
|
132
|
+
padding-bottom: 23px;
|
|
133
|
+
padding-right: 66px;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&__reference-label,
|
|
138
|
+
&__dropdown-reference-label {
|
|
139
|
+
font-weight: 600;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&__toggle-dropdown-explanation-img-description {
|
|
143
|
+
margin-top: 12px;
|
|
144
|
+
margin-bottom: 20px;
|
|
145
|
+
|
|
146
|
+
&--open {
|
|
147
|
+
margin-bottom: 6px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
&--tablet-portrait {
|
|
151
|
+
&.uikit-question-dropdown-explanation__toggle-dropdown-explanation-img-description--no-reference {
|
|
152
|
+
margin-bottom: 4px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
&.uikit-question-dropdown-explanation__toggle-dropdown-explanation-img-description--open {
|
|
156
|
+
margin-bottom: 6px;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
&--mobile {
|
|
161
|
+
margin-top: 16px;
|
|
162
|
+
margin-bottom: 16px;
|
|
163
|
+
|
|
164
|
+
&.uikit-question-dropdown-explanation__toggle-dropdown-explanation-img-description--no-reference {
|
|
165
|
+
margin-bottom: 7px;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
&.uikit-question-dropdown-explanation__toggle-dropdown-explanation-img-description--open {
|
|
169
|
+
margin-bottom: 4px;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
&__toggle-dropdown-explanation-img-description-text {
|
|
175
|
+
outline: none;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
&__toggle-dropdown-explanation-img-description-icon {
|
|
179
|
+
margin-left: 8px;
|
|
180
|
+
|
|
181
|
+
&--up {
|
|
182
|
+
transform: rotate(180deg);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&__dropdown-explanation-text {
|
|
187
|
+
font-size: 16px;
|
|
188
|
+
letter-spacing: -0.1px;
|
|
189
|
+
line-height: 24px;
|
|
190
|
+
font-weight: 400;
|
|
191
|
+
padding-bottom: 6px;
|
|
192
|
+
|
|
193
|
+
p {
|
|
194
|
+
margin: 10px 0;
|
|
195
|
+
|
|
196
|
+
&:first-child {
|
|
197
|
+
margin: 0;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
&__dropdown-explanation-img-description {
|
|
203
|
+
outline: none;
|
|
204
|
+
color: $ash;
|
|
205
|
+
font-size: 15px;
|
|
206
|
+
line-height: 22px;
|
|
207
|
+
margin-bottom: 20px;
|
|
208
|
+
|
|
209
|
+
&--dark {
|
|
210
|
+
color: $fog;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
&--mobile {
|
|
214
|
+
margin-bottom: 16px;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
p {
|
|
218
|
+
margin: 0;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
&__dropdown-explanation-image {
|
|
223
|
+
display: block;
|
|
224
|
+
box-sizing: border-box;
|
|
225
|
+
width: 100%;
|
|
226
|
+
border: 1px solid $fog;
|
|
227
|
+
|
|
228
|
+
&--dark {
|
|
229
|
+
border: 1px solid $jet;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
&__dropdown-reference {
|
|
234
|
+
padding-top: 24px;
|
|
235
|
+
border-top: 1px solid $fog;
|
|
236
|
+
font-size: 15px;
|
|
237
|
+
letter-spacing: -0.1px;
|
|
238
|
+
line-height: 22px;
|
|
239
|
+
font-weight: 400;
|
|
240
|
+
word-break: break-word;
|
|
241
|
+
margin-bottom: -7px;
|
|
242
|
+
|
|
243
|
+
&--dark {
|
|
244
|
+
color: $white;
|
|
245
|
+
border-top-color: rgba($fog, 0.28);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
p {
|
|
249
|
+
margin: 6px 0 8pt 0;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
</style>
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="uikit-question-paywall"
|
|
4
|
+
>
|
|
5
|
+
<div
|
|
6
|
+
v-dark="isDarkMode"
|
|
7
|
+
v-breakpoint:questionEl="breakpoints"
|
|
8
|
+
class="uikit-question-paywall__paywall"
|
|
9
|
+
:class="{ 'uikit-question-paywall__paywall--review': reviewMode }"
|
|
10
|
+
>
|
|
11
|
+
<img
|
|
12
|
+
v-breakpoint:questionEl="breakpoints"
|
|
13
|
+
:src="isDarkMode ? paywallImages['dark'] : paywallImages['light']"
|
|
14
|
+
alt=""
|
|
15
|
+
class="uikit-question-paywall__paywall-image"
|
|
16
|
+
>
|
|
17
|
+
<div
|
|
18
|
+
v-dark="isDarkMode"
|
|
19
|
+
v-breakpoint:questionEl="breakpoints"
|
|
20
|
+
class="uikit-question-paywall__paywall-text"
|
|
21
|
+
>
|
|
22
|
+
You need a Premium Subscription to view this question's answer and explanation.
|
|
23
|
+
</div>
|
|
24
|
+
<PocketButton
|
|
25
|
+
:is-dark-mode="isDarkMode"
|
|
26
|
+
class="uikit-question-paywall__paywall-button"
|
|
27
|
+
@click="emitUpgradeClick"
|
|
28
|
+
>
|
|
29
|
+
Upgrade to Premium
|
|
30
|
+
</PocketButton>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script lang="ts">
|
|
36
|
+
import { Component, Vue, Prop, Emit } from 'vue-facing-decorator'
|
|
37
|
+
import Icon from '../../Icons/Icon.vue'
|
|
38
|
+
import PocketButton from '../../Buttons/Button.vue'
|
|
39
|
+
import { dark, breakpoint } from '../../../directives'
|
|
40
|
+
import type { TBreakPointsObject } from './../question'
|
|
41
|
+
import PaywallImageLight from '../../../assets/question/paywall-light.png'
|
|
42
|
+
import PaywallImageDark from '../../../assets/question/paywall-dark.png'
|
|
43
|
+
|
|
44
|
+
@Component({
|
|
45
|
+
components: {
|
|
46
|
+
Icon,
|
|
47
|
+
PocketButton,
|
|
48
|
+
},
|
|
49
|
+
directives: {
|
|
50
|
+
dark,
|
|
51
|
+
breakpoint,
|
|
52
|
+
},
|
|
53
|
+
})
|
|
54
|
+
export default class Paywall extends Vue {
|
|
55
|
+
@Prop({ default: false }) reviewMode!: boolean
|
|
56
|
+
@Prop({ default: false }) isDarkMode!: boolean
|
|
57
|
+
@Prop({ default: null }) questionEl!: Element | null
|
|
58
|
+
@Prop({ default: {
|
|
59
|
+
'mobile': 767,
|
|
60
|
+
'tablet-portrait': 1023,
|
|
61
|
+
'tablet-landscape': 1439,
|
|
62
|
+
} }) breakpoints!: TBreakPointsObject
|
|
63
|
+
|
|
64
|
+
get paywallImages () {
|
|
65
|
+
return {
|
|
66
|
+
light: PaywallImageLight,
|
|
67
|
+
dark: PaywallImageDark,
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@Emit('upgradeClicked')
|
|
72
|
+
emitUpgradeClick () {
|
|
73
|
+
return true
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<style lang="scss">
|
|
80
|
+
@import '../../../styles/colors';
|
|
81
|
+
@import '../../../styles/breakpoints';
|
|
82
|
+
|
|
83
|
+
.uikit-question-paywall {
|
|
84
|
+
width: 100%;
|
|
85
|
+
display: flex;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
|
|
88
|
+
&__paywall {
|
|
89
|
+
width: 100%;
|
|
90
|
+
max-width: 500px;
|
|
91
|
+
background: $white;
|
|
92
|
+
border-radius: 8px;
|
|
93
|
+
border: 1px solid $steel;
|
|
94
|
+
display: flex;
|
|
95
|
+
flex-direction: column;
|
|
96
|
+
align-items: center;
|
|
97
|
+
justify-content: center;
|
|
98
|
+
|
|
99
|
+
&--dark {
|
|
100
|
+
background: $brand-black;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&--tablet-portrait {
|
|
104
|
+
max-width: 430px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&--review {
|
|
108
|
+
margin-bottom: 20px;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&__paywall-image {
|
|
113
|
+
width: 305px;
|
|
114
|
+
height: 230px;
|
|
115
|
+
margin: 25px auto 21px;
|
|
116
|
+
|
|
117
|
+
&--mobile {
|
|
118
|
+
width: 262px;
|
|
119
|
+
height: 199px;
|
|
120
|
+
margin: 14px auto 18px;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&__paywall-text {
|
|
125
|
+
font-size: 18px;
|
|
126
|
+
line-height: 22px;
|
|
127
|
+
color: $brand-black;
|
|
128
|
+
margin-bottom: 24px;
|
|
129
|
+
font-weight: 600;
|
|
130
|
+
text-align: center;
|
|
131
|
+
max-width: 372px;
|
|
132
|
+
|
|
133
|
+
&--dark {
|
|
134
|
+
color: $white;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&--tablet-portrait {
|
|
138
|
+
max-width: 302px;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
&--mobile {
|
|
142
|
+
max-width: 293px;
|
|
143
|
+
margin-bottom: 22px;
|
|
144
|
+
font-size: 16px;
|
|
145
|
+
line-height: 19px;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&__paywall-button {
|
|
150
|
+
margin-bottom: 36px;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
</style>
|