@pocketprep/ui-kit 3.4.5 → 3.4.7

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.
@@ -32,7 +32,7 @@
32
32
  }"
33
33
  :is-dark-mode="isDarkMode"
34
34
  :aria-expanded="showExplanationImageLongAlt ? 'true' : 'false'"
35
- @click="emitToggleExplanationImageLongAlt"
35
+ @click="toggleDropdownExplanationImageLongAlt"
36
36
  @mousedown.prevent
37
37
  >
38
38
  <span class="uikit-question-dropdown-explanation__toggle-dropdown-explanation-img-description-text">
@@ -68,7 +68,7 @@
68
68
  </template>
69
69
 
70
70
  <script lang="ts">
71
- import { Component, Emit, Prop, Vue } from 'vue-facing-decorator'
71
+ import { Component, Emit, Prop, Vue, Watch } from 'vue-facing-decorator'
72
72
  import type { Study } from '@pocketprep/types'
73
73
  import Icon from '../../Icons/Icon.vue'
74
74
  import PocketButton from '../../Buttons/Button.vue'
@@ -92,7 +92,7 @@ export default class DropdownExplanation extends Vue {
92
92
  @Prop({ default: null }) globalMetrics!: Study.Class.GlobalQuestionMetricJSON | null
93
93
  @Prop({ default: false }) showAnswers!: boolean
94
94
  @Prop({ default: false }) isMCR!: boolean
95
- @Prop({ default: false }) showExplanation!: boolean
95
+ @Prop({ default: false }) showExplanationImageLongAlt!: boolean
96
96
  @Prop({ default: null }) explanationImageUrl!: string | null
97
97
  @Prop({ default: undefined }) explanationImageAlt!: string | undefined
98
98
  @Prop({ default: undefined }) explanationImageLongAlt!: string | undefined
@@ -105,12 +105,9 @@ export default class DropdownExplanation extends Vue {
105
105
  'tablet-portrait': 1023,
106
106
  'tablet-landscape': 1439,
107
107
  } }) breakpoints!: TBreakPointsObject
108
-
109
- showExplanationImageLongAlt = false
110
108
 
111
- @Emit('emitToggleExplanationImageLongAlt')
112
- emitToggleExplanationImageLongAlt () {
113
- this.showExplanationImageLongAlt = !this.showExplanationImageLongAlt
109
+ @Emit('toggleDropdownExplanationImageLongAlt')
110
+ toggleDropdownExplanationImageLongAlt () {
114
111
  return
115
112
  }
116
113
  }
@@ -79,7 +79,7 @@
79
79
  }"
80
80
  :is-dark-mode="isDarkMode"
81
81
  :aria-expanded="showPassageImageLongAlt ? 'true' : 'false'"
82
- @click="emitTogglePassageImageLongAlt"
82
+ @click="togglePassageImageLongAltDropdown"
83
83
  @mousedown.prevent
84
84
  >
85
85
  <span
@@ -110,7 +110,7 @@
110
110
  </template>
111
111
 
112
112
  <script lang="ts">
113
- import { Component, Emit, Prop, Vue } from 'vue-facing-decorator'
113
+ import { Component, Emit, Prop, Vue, Watch } from 'vue-facing-decorator'
114
114
  import type { Study } from '@pocketprep/types'
115
115
  import Icon from '../../Icons/Icon.vue'
116
116
  import PocketButton from '../../Buttons/Button.vue'
@@ -133,6 +133,7 @@ export default class PassageAndImageDropdown extends Vue {
133
133
  @Prop({ default: false }) reviewMode!: boolean
134
134
  @Prop({ default: '' }) imageUrlPrefix!: string
135
135
  @Prop({ default: null }) passageImageUrl!: string | null
136
+ @Prop({ default: false }) showPassageImageLongAlt!: boolean
136
137
  @Prop({ default: '' }) passageImageLongAlt!: string | undefined
137
138
  @Prop({ default: '' }) passageImageAlt!: string | undefined
138
139
  @Prop({ default: 'Passage' }) passageAndImageTitle!: TQuestionPassageAndImageTitle
@@ -144,12 +145,10 @@ export default class PassageAndImageDropdown extends Vue {
144
145
  } }) breakpoints!: TBreakPointsObject
145
146
 
146
147
  showPassageImageDropdown = false
147
- showPassageImageLongAlt = false
148
148
 
149
- @Emit('emitTogglePassageImageLongAlt')
150
- emitTogglePassageImageLongAlt () {
151
- this.showPassageImageLongAlt = !this.showPassageImageLongAlt
152
- return this.showPassageImageLongAlt
149
+ @Emit('togglePassageImageLongAltDropdown')
150
+ togglePassageImageLongAltDropdown () {
151
+ return
153
152
  }
154
153
  }
155
154
  </script>
@@ -0,0 +1,375 @@
1
+ <template>
2
+ <div
3
+ v-dark="isDarkMode"
4
+ v-breakpoint:questionEl="breakpoints"
5
+ ref="uikit-question-summary"
6
+ class="uikit-question-summary"
7
+ >
8
+ <div class="uikit-question-summary__summary-title">
9
+ {{ isCorrect ? 'Correct': isUnanswered ? 'Unanswered' : 'Incorrect' }}
10
+ </div>
11
+ <PocketButton
12
+ v-breakpoint:questionEl="breakpoints"
13
+ type="tertiary-small"
14
+ class="uikit-question-summary__summary-toggle-explanation"
15
+ :class="{ 'uikit-question-summary__summary-toggle-explanation': reviewMode }"
16
+ :is-dark-mode="isDarkMode"
17
+ :aria-expanded="showExplanation ? 'true' : 'false'"
18
+ @click="toggleSummaryExplanation"
19
+ @mousedown.prevent
20
+ >
21
+ <span
22
+ ref="uikit-question-summary__summary-toggle-explanation-text"
23
+ class="uikit-question-summary__summary-toggle-explanation-text"
24
+ tabindex="-1"
25
+ >{{ showExplanation ? 'Hide' : 'Show' }} Explanation</span>
26
+ <Icon
27
+ v-breakpoint:questionEl="breakpoints"
28
+ type="accordionArrow"
29
+ class="uikit-question-summary__summary-toggle-explanation-icon"
30
+ :class="{
31
+ 'uikit-question-summary__summary-toggle-explanation-icon--up': showExplanation,
32
+ }"
33
+ />
34
+ </PocketButton>
35
+ <div
36
+ v-if="showExplanation"
37
+ v-breakpoint:questionEl="breakpoints"
38
+ ref="uikit-question-summary__summary-dropdown-explanation"
39
+ class="uikit-question-summary__summary-dropdown-explanation"
40
+ >
41
+ <div
42
+ v-dark="isDarkMode"
43
+ class="uikit-question-summary__summary-dropdown-explanation-text"
44
+ v-html="question.explanation"
45
+ />
46
+ <img
47
+ v-if="explanationImageUrl"
48
+ v-dark="isDarkMode"
49
+ class="uikit-question-summary__summary-dropdown-explanation-image"
50
+ :src="explanationImageUrl"
51
+ :alt="`${explanationImageAlt}. Extended image description below.`"
52
+ >
53
+ <PocketButton
54
+ v-if="explanationImageLongAlt"
55
+ v-breakpoint:questionEl="breakpoints"
56
+ type="tertiary-small"
57
+ class="uikit-question-summary__toggle-summary-dropdown-explanation-img-description"
58
+ :class="{
59
+ 'uikit-question-summary__toggle-summary-dropdown-explanation-img-description--open':
60
+ showExplanationImageLongAlt,
61
+ 'uikit-question-summary__toggle-summary-dropdown-explanation-img-description--no-reference':
62
+ !reference || hideReferences,
63
+ }"
64
+ :is-dark-mode="isDarkMode"
65
+ :aria-expanded="showExplanationImageLongAlt ? 'true' : 'false'"
66
+ @click.stop="toggleSummaryExplanationImageLongAlt"
67
+ @mousedown.prevent
68
+ >
69
+ <span class="uikit-question-summary__toggle-summary-dropdown-explanation-img-description-text">
70
+ Image Description
71
+ </span>
72
+ <Icon
73
+ class="uikit-question-summary__toggle-summary-dropdown-explanation-img-description-icon"
74
+ :class="{
75
+ 'uikit-question-summary__toggle-summary-dropdown-explanation-img-description-icon--up':
76
+ showExplanationImageLongAlt,
77
+ }"
78
+ type="accordionArrow"
79
+ />
80
+ </PocketButton>
81
+ <div
82
+ v-if="showExplanationImageLongAlt"
83
+ ref="uikit-question-summary__summary-dropdown-explanation-img-description"
84
+ v-dark="isDarkMode"
85
+ v-breakpoint:questionEl="breakpoints"
86
+ class="uikit-question-summary__summary-dropdown-explanation-img-description"
87
+ tabindex="-1"
88
+ v-html="explanationImageLongAlt"
89
+ />
90
+ <div
91
+ v-if="reference && !hideReferences"
92
+ v-dark="isDarkMode"
93
+ class="uikit-question-summary__summary-dropdown-reference"
94
+ >
95
+ <span class="uikit-question-summary__summary-dropdown-reference-label">Reference: </span>
96
+ <div v-html="reference" />
97
+ </div>
98
+ </div>
99
+ <Icon
100
+ v-if="isCorrect"
101
+ v-dark="isDarkMode"
102
+ type="correct"
103
+ class="uikit-question-summary__summary-correct-icon"
104
+ />
105
+ <Icon
106
+ v-else
107
+ v-dark="isDarkMode"
108
+ type="incorrect"
109
+ class="uikit-question-summary__summary-incorrect-icon"
110
+ />
111
+ </div>
112
+ </template>
113
+
114
+ <script lang="ts">
115
+ import { Component, Emit, Prop, Vue, Watch } from 'vue-facing-decorator'
116
+ import type { Study } from '@pocketprep/types'
117
+ import Icon from '../../Icons/Icon.vue'
118
+ import PocketButton from '../../Buttons/Button.vue'
119
+ import { breakpoint, dark } from '../../../directives'
120
+ import type { TBreakPointsObject } from './../question'
121
+
122
+ @Component({
123
+ components: {
124
+ Icon,
125
+ PocketButton,
126
+ },
127
+ directives: {
128
+ dark,
129
+ breakpoint,
130
+ },
131
+ })
132
+ export default class Summary extends Vue {
133
+ @Prop() question!: Study.Class.QuestionJSON
134
+ @Prop({ default: false }) showExplanation!: boolean
135
+ @Prop({ default: false }) showExplanationImageLongAlt!: boolean
136
+ @Prop({ default: null }) explanationImageUrl!: string | null
137
+ @Prop({ default: undefined }) explanationImageAlt!: string | undefined
138
+ @Prop({ default: undefined }) explanationImageLongAlt!: string | undefined
139
+ @Prop({ default: undefined }) reference!: string | undefined
140
+ @Prop({ default: false }) hideReferences!: boolean
141
+ @Prop({ default: false }) isCorrect!: boolean
142
+ @Prop({ default: false }) isUnanswered!: boolean
143
+ @Prop({ default: false }) reviewMode!: boolean
144
+ @Prop({ default: false }) isDarkMode!: boolean
145
+ @Prop({ default: null }) questionEl!: Element | null
146
+ @Prop({ default: {
147
+ 'mobile': 767,
148
+ 'tablet-portrait': 1023,
149
+ 'tablet-landscape': 1439,
150
+ } }) breakpoints!: TBreakPointsObject
151
+
152
+ @Emit('toggleSummaryExplanation')
153
+ toggleSummaryExplanation () {
154
+ return
155
+ }
156
+
157
+ @Emit('toggleSummaryExplanationImageLongAlt')
158
+ toggleSummaryExplanationImageLongAlt () {
159
+ return
160
+ }
161
+ }
162
+ </script>
163
+
164
+ <style lang="scss">
165
+ @import '../../../styles/colors';
166
+ @import '../../../styles/breakpoints';
167
+
168
+ .uikit-question-summary {
169
+ position: relative;
170
+ background-color: $white;
171
+ width: 100%;
172
+ max-width: 492px;
173
+ margin-top: 24px;
174
+ padding: 11px 46px 11px 15px;
175
+ box-sizing: border-box;
176
+ border-radius: 5px;
177
+ box-shadow: 0 1px 6px 0 rgba($fog, 0.6);
178
+
179
+ &--dark {
180
+ background: $brand-black;
181
+ border: 1px solid $slate;
182
+ box-shadow: 0 1px 4px 0 rgba($jet, 0.3);
183
+ }
184
+
185
+ &--tablet-portrait {
186
+ display: inline-block;
187
+ }
188
+
189
+ &__summary-title {
190
+ font-weight: 600;
191
+ font-size: 15.5px;
192
+ line-height: 22px;
193
+ }
194
+
195
+ &__summary-toggle-explanation {
196
+ margin-top: 8px;
197
+ margin-bottom: 8px;
198
+ padding: 0;
199
+
200
+ &--review-mode {
201
+ display: none;
202
+
203
+ &.uikit-question-summary__summary-toggle-explanation--tablet-portrait {
204
+ display: block;
205
+ }
206
+ }
207
+ }
208
+
209
+ &__summary-toggle-explanation-text {
210
+ outline: none;
211
+ }
212
+
213
+ &__summary-toggle-explanation-icon {
214
+ margin-left: 5px;
215
+ display: none;
216
+
217
+ &--tablet-portrait {
218
+ display: initial;
219
+ }
220
+
221
+ &--up {
222
+ transform: rotate(180deg);
223
+ }
224
+ }
225
+
226
+ &__toggle-summary-dropdown-explanation-img-description {
227
+ margin-top: 12px;
228
+ margin-bottom: 20px;
229
+
230
+ &--open {
231
+ margin-bottom: 6px;
232
+ }
233
+
234
+ &--tablet-portrait {
235
+ &.uikit-question-summary__toggle-summary-dropdown-explanation-img-description--no-reference {
236
+ margin-bottom: 4px;
237
+ }
238
+
239
+ &.uikit-question-summary__toggle-summary-dropdown-explanation-img-description--open {
240
+ margin-bottom: 6px;
241
+ }
242
+ }
243
+
244
+ &--mobile {
245
+ margin-top: 16px;
246
+ margin-bottom: 16px;
247
+
248
+ &.uikit-question-summary__toggle-summary-dropdown-explanation-img-description--no-reference {
249
+ margin-bottom: 7px;
250
+ }
251
+
252
+ &.uikit-question-summary__toggle-summary-dropdown-explanation-img-description--open {
253
+ margin-bottom: 4px;
254
+ }
255
+ }
256
+ }
257
+
258
+ &__toggle-summary-dropdown-explanation-img-description-text {
259
+ outline: none;
260
+ }
261
+
262
+ &__toggle-summary-dropdown-explanation-img-description-icon {
263
+ margin-left: 8px;
264
+
265
+ &--up {
266
+ transform: rotate(180deg);
267
+ }
268
+ }
269
+
270
+ &__summary-dropdown-explanation {
271
+ display: none;
272
+
273
+ &--tablet-portrait {
274
+ display: block;
275
+ }
276
+ }
277
+
278
+ &__summary-dropdown-explanation-text {
279
+ font-size: 16px;
280
+ letter-spacing: -0.1px;
281
+ line-height: 24px;
282
+ font-weight: 400;
283
+ padding-bottom: 6px;
284
+
285
+ p {
286
+ margin: 10px 0;
287
+
288
+ &:first-child {
289
+ margin: 0;
290
+ }
291
+ }
292
+ }
293
+
294
+ &__summary-dropdown-explanation-image {
295
+ display: block;
296
+ box-sizing: border-box;
297
+ width: 100%;
298
+ border: 1px solid $fog;
299
+
300
+ &--dark {
301
+ border: 1px solid $jet;
302
+ }
303
+ }
304
+
305
+ &__summary-dropdown-reference {
306
+ padding-top: 24px;
307
+ border-top: 1px solid $fog;
308
+ font-size: 15px;
309
+ letter-spacing: -0.1px;
310
+ line-height: 22px;
311
+ font-weight: 400;
312
+ word-break: break-word;
313
+ margin-bottom: -7px;
314
+
315
+ &--dark {
316
+ color: $white;
317
+ border-top-color: rgba($fog, 0.28);
318
+ }
319
+
320
+ p {
321
+ margin: 6px 0 8pt 0;
322
+ }
323
+ }
324
+
325
+ &__summary-dropdown-reference-label {
326
+ font-weight: 600;
327
+ }
328
+
329
+ &__summary-correct-icon {
330
+ position: absolute;
331
+ top: 12px;
332
+ right: 10px;
333
+ width: 22px;
334
+ height: 22px;
335
+ color: $cadaverous;
336
+
337
+ &--dark {
338
+ color: $jungle-green;
339
+ }
340
+ }
341
+
342
+ &__summary-incorrect-icon {
343
+ position: absolute;
344
+ top: 12px;
345
+ right: 10px;
346
+ width: 22px;
347
+ height: 22px;
348
+ color: $pepper;
349
+
350
+ &--dark {
351
+ color: $rosa;
352
+ }
353
+ }
354
+
355
+ &__summary-dropdown-explanation-img-description {
356
+ outline: none;
357
+ color: $ash;
358
+ font-size: 15px;
359
+ line-height: 22px;
360
+ margin-bottom: 20px;
361
+
362
+ &--dark {
363
+ color: $fog;
364
+ }
365
+
366
+ &--mobile {
367
+ margin-bottom: 16px;
368
+ }
369
+
370
+ p {
371
+ margin: 0;
372
+ }
373
+ }
374
+ }
375
+ </style>