@pocketprep/ui-kit 3.4.1 → 3.4.3

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.
@@ -0,0 +1,351 @@
1
+ <template>
2
+ <div
3
+ v-if="question.passage || passageImageUrl"
4
+ ref="uikit-question-passage-and-image-dropdown"
5
+ v-breakpoint:questionEl="breakpoints"
6
+ v-dark="isDarkMode"
7
+ class="uikit-question-passage-and-image-dropdown"
8
+ :class="{ 'uikit-question-passage-and-image-dropdown__passage-and-image-dropdown--review-mode': reviewMode }"
9
+ >
10
+ <div
11
+ v-dark="isDarkMode"
12
+ class="uikit-question-passage-and-image-dropdown__passage-and-image-dropdown-btn"
13
+ tabindex="0"
14
+ role="button"
15
+ :aria-expanded="showPassageImageDropdown ? 'true' : 'false'"
16
+ @click.stop="showPassageImageDropdown = !showPassageImageDropdown"
17
+ @keydown.enter.stop="showPassageImageDropdown = !showPassageImageDropdown"
18
+ @mousedown.prevent
19
+ >
20
+ <Icon
21
+ v-if="question.passage"
22
+ class="uikit-question-passage-and-image-dropdown__passage-dropdown-icon"
23
+ type="passage"
24
+ />
25
+ <Icon
26
+ v-else
27
+ class="uikit-question-passage-and-image-dropdown__image-dropdown-icon"
28
+ type="image"
29
+ />
30
+ <span
31
+ v-dark="isDarkMode"
32
+ class="uikit-question-passage-and-image-dropdown__passage-and-image-dropdown-text"
33
+ >
34
+ {{ showPassageImageDropdown ? 'Hide' : 'Show' }}
35
+ {{ passageAndImageTitle }}
36
+ </span>
37
+ <Icon
38
+ v-dark="isDarkMode"
39
+ class="uikit-question-passage-and-image-dropdown__passage-and-image-dropdown-arrow"
40
+ :class="{
41
+ 'uikit-question-passage-and-image-dropdown__passage-and-image-dropdown-arrow--up':
42
+ showPassageImageDropdown,
43
+ }"
44
+ type="accordionArrow"
45
+ />
46
+ </div>
47
+ <div
48
+ v-if="showPassageImageDropdown"
49
+ v-breakpoint:questionEl="breakpoints"
50
+ class="uikit-question-passage-and-image-dropdown__passage-and-image-dropdown-container"
51
+ >
52
+ <div
53
+ v-if="question.passage"
54
+ v-breakpoint:questionEl="breakpoints"
55
+ class="uikit-question-passage-and-image-dropdown__passage-dropdown-passage"
56
+ :class="{
57
+ 'uikit-question-passage-and-image-dropdown__passage-dropdown-passage--with-image': passageImageUrl,
58
+ }"
59
+ v-html="question.passage"
60
+ />
61
+ <img
62
+ v-if="passageImageUrl"
63
+ v-dark="isDarkMode"
64
+ class="uikit-question-passage-and-image-dropdown__image-dropdown-image"
65
+ :class="{
66
+ 'uikit-question-passage-and-image-dropdown__image-dropdown-image--with-passage': question.passage,
67
+ }"
68
+ :src="passageImageUrl"
69
+ :alt="`${passageImageAlt}. Extended image description below.`"
70
+ >
71
+ <PocketButton
72
+ v-if="passageImageLongAlt"
73
+ v-breakpoint:questionEl="breakpoints"
74
+ type="tertiary-small"
75
+ class="uikit-question-passage-and-image-dropdown__toggle-img-dropdown-img-description"
76
+ :class="{
77
+ 'uikit-question-passage-and-image-dropdown__toggle-img-dropdown-img-description--open':
78
+ showPassageImageLongAlt,
79
+ }"
80
+ :is-dark-mode="isDarkMode"
81
+ :aria-expanded="showPassageImageLongAlt ? 'true' : 'false'"
82
+ @click="emitTogglePassageImageLongAlt"
83
+ @mousedown.prevent
84
+ >
85
+ <span
86
+ class="uikit-question-passage-and-image-dropdown__toggle-img-dropdown-img-description-text"
87
+ >
88
+ Image Description
89
+ </span>
90
+ <Icon
91
+ class="uikit-question-passage-and-image-dropdown__toggle-img-dropdown-img-description-icon"
92
+ :class="{
93
+ 'uikit-question-passage-and-image-dropdown__toggle-img-dropdown-img-description-icon--up':
94
+ showPassageImageLongAlt,
95
+ }"
96
+ type="accordionArrow"
97
+ />
98
+ </PocketButton>
99
+ <div
100
+ v-if="showPassageImageLongAlt"
101
+ ref="uikit-question-passage-and-image-dropdown__img-dropdown-img-description"
102
+ v-breakpoint:questionEl="breakpoints"
103
+ v-dark="isDarkMode"
104
+ class="uikit-question-passage-and-image-dropdown__img-dropdown-img-description"
105
+ tabindex="-1"
106
+ v-html="passageImageLongAlt"
107
+ />
108
+ </div>
109
+ </div>
110
+ </template>
111
+
112
+ <script lang="ts">
113
+ import { Component, Emit, Prop, Vue } from 'vue-facing-decorator'
114
+ import type { Study } from '@pocketprep/types'
115
+ import Icon from '../../Icons/Icon.vue'
116
+ import PocketButton from '../../Buttons/Button.vue'
117
+ import { breakpoint, dark } from '../../../directives'
118
+ import type { TQuestionPassageAndImageTitle, TBreakPointsObject } from './../question'
119
+
120
+ @Component({
121
+ components: {
122
+ Icon,
123
+ PocketButton,
124
+ },
125
+ directives: {
126
+ dark,
127
+ breakpoint,
128
+ },
129
+ })
130
+ export default class PassageAndImageDropdown extends Vue {
131
+ @Prop({ default: false }) isDarkMode!: boolean
132
+ @Prop() question!: Study.Class.QuestionJSON
133
+ @Prop({ default: false }) reviewMode!: boolean
134
+ @Prop({ default: '' }) imageUrlPrefix!: string
135
+ @Prop({ default: null }) passageImageUrl!: string | null
136
+ @Prop({ default: '' }) passageImageLongAlt!: string | undefined
137
+ @Prop({ default: '' }) passageImageAlt!: string | undefined
138
+ @Prop({ default: 'Passage' }) passageAndImageTitle!: TQuestionPassageAndImageTitle
139
+ @Prop({ default: null }) questionEl!: Element | null
140
+ @Prop({ default: {
141
+ 'mobile': 767,
142
+ 'tablet-portrait': 1023,
143
+ 'tablet-landscape': 1439,
144
+ } }) breakpoints!: TBreakPointsObject
145
+
146
+ showPassageImageDropdown = false
147
+ showPassageImageLongAlt = false
148
+
149
+ @Emit('emitTogglePassageImageLongAlt')
150
+ emitTogglePassageImageLongAlt () {
151
+ this.showPassageImageLongAlt = !this.showPassageImageLongAlt
152
+ return this.showPassageImageLongAlt
153
+ }
154
+ }
155
+ </script>
156
+
157
+ <style lang="scss">
158
+ @import '../../../styles/colors';
159
+ @import '../../../styles/breakpoints';
160
+
161
+ .uikit-question-passage-and-image-dropdown {
162
+ &__passage-and-image-dropdown-btn {
163
+ position: relative;
164
+ display: flex;
165
+ align-items: center;
166
+ border: 1px solid rgba($pewter, 0.85);
167
+ border-radius: 5px;
168
+ box-shadow: 0 1px 4px 0 rgba($ash, 0.3);
169
+ box-sizing: border-box;
170
+ height: 50px;
171
+ padding: 15px 57px 16px 48px;
172
+ margin: -1px;
173
+ cursor: pointer;
174
+ outline: none;
175
+
176
+ &:hover {
177
+ .uikit-question-passage-and-image-dropdown__passage-and-image-dropdown-text {
178
+ color: mix($brand-blue, black, 90%);
179
+ }
180
+
181
+ .uikit-question-passage-and-image-dropdown__passage-and-image-dropdown-arrow {
182
+ color: mix($brand-blue, black, 90%);
183
+ }
184
+
185
+ &::before {
186
+ content: '';
187
+ left: -2px;
188
+ top: -2px;
189
+ width: 100%;
190
+ height: 100%;
191
+ border: 2px solid $slate;
192
+ position: absolute;
193
+ border-radius: 5px;
194
+ }
195
+ }
196
+
197
+ &:focus::before {
198
+ content: '';
199
+ left: -3px;
200
+ top: -3px;
201
+ width: calc(100% + 4px);
202
+ height: calc(100% + 4px);
203
+ border: 1px solid $brand-blue;
204
+ position: absolute;
205
+ border-radius: 8px;
206
+ }
207
+
208
+ &--dark {
209
+ box-shadow: 0 1px 4px 0 rgba($jet, 0.3);
210
+ border-color: $slate;
211
+
212
+ &:hover {
213
+ .uikit-question-passage-and-image-dropdown__passage-and-image-dropdown-text {
214
+ color: $butterscotch;
215
+ }
216
+
217
+ .uikit-question-passage-and-image-dropdown__passage-and-image-dropdown-arrow {
218
+ color: $butterscotch;
219
+ }
220
+
221
+ &::before {
222
+ border-color: rgba($white, 0.6);
223
+ }
224
+ }
225
+
226
+ &:focus::before {
227
+ border-color: $banana-bread;
228
+ }
229
+ }
230
+ }
231
+
232
+ &__passage-dropdown-icon,
233
+ &__image-dropdown-icon {
234
+ position: absolute;
235
+ left: 17px;
236
+ width: 19px;
237
+ }
238
+
239
+ &__passage-and-image-dropdown-text {
240
+ font-size: 16px;
241
+ line-height: 24px;
242
+ font-weight: 600;
243
+ color: $brand-blue;
244
+
245
+ &--dark {
246
+ color: $banana-bread;
247
+ }
248
+ }
249
+
250
+ &__passage-and-image-dropdown-arrow {
251
+ position: absolute;
252
+ right: 20px;
253
+ color: $brand-blue;
254
+
255
+ &--dark {
256
+ color: $banana-bread;
257
+ }
258
+
259
+ &--up {
260
+ transform: rotate(180deg);
261
+ }
262
+ }
263
+
264
+ &__passage-and-image-dropdown-container {
265
+ padding: 14px 15px 16px 16px;
266
+
267
+ &--mobile {
268
+ padding: 12px 15px 16px 15px;
269
+ }
270
+ }
271
+
272
+ &__passage-dropdown-passage {
273
+ box-sizing: border-box;
274
+ margin: 14px 20px 24px 17px;
275
+ line-height: 24px;
276
+ font-size: 16px;
277
+ font-weight: 400;
278
+ letter-spacing: -0.1;
279
+
280
+ &--mobile {
281
+ line-height: 24px;
282
+ font-size: 16px;
283
+ }
284
+
285
+ &--with-image {
286
+ margin-bottom: 16px;
287
+ }
288
+ }
289
+
290
+ &__image-dropdown-image {
291
+ display: block;
292
+ box-sizing: border-box;
293
+ width: 100%;
294
+ border: 1px solid $fog;
295
+
296
+ &--with-passage {
297
+ padding-top: 0;
298
+ }
299
+
300
+ &--dark {
301
+ border: 1px solid $jet;
302
+ }
303
+ }
304
+
305
+ &__toggle-img-dropdown-img-description {
306
+ margin-top: 16px;
307
+
308
+ &--open {
309
+ margin-bottom: 8px;
310
+ }
311
+ }
312
+
313
+ &__toggle-img-dropdown-img-description-text {
314
+ outline: none;
315
+ }
316
+
317
+
318
+ &__toggle-img-dropdown-img-description-icon {
319
+ margin-left: 8px;
320
+
321
+ &--up {
322
+ transform: rotate(180deg);
323
+ }
324
+ }
325
+
326
+ &__img-dropdown-img-description {
327
+ outline: none;
328
+ color: $ash;
329
+ font-size: 15px;
330
+ line-height: 22px;
331
+ font-weight: 500;
332
+ letter-spacing: -0.2;
333
+
334
+ &--dark {
335
+ color: $fog;
336
+ }
337
+
338
+ &--tablet-landscape {
339
+ margin-bottom: 4px;
340
+ }
341
+
342
+ &--tablet-portrait {
343
+ margin-bottom: 0;
344
+ }
345
+
346
+ p {
347
+ margin: 0;
348
+ }
349
+ }
350
+ }
351
+ </style>
@@ -0,0 +1,158 @@
1
+ <template>
2
+ <div
3
+ ref="uikit-question-context"
4
+ v-breakpoint:questionEl="breakpoints"
5
+ class="uikit-question-context"
6
+ tabindex="-1"
7
+ >
8
+ <slot name="contextIcon">
9
+ <Icon
10
+ v-dark="isDarkMode"
11
+ class="uikit-question-context__icon"
12
+ :type="contextIconType"
13
+ />
14
+ </slot>
15
+ <h2
16
+ v-if="quizMode === 'qotd'"
17
+ v-dark="isDarkMode"
18
+ class="uikit-question-context__text"
19
+ >
20
+ Question of the Day
21
+ </h2>
22
+ <h2
23
+ v-else
24
+ v-dark="isDarkMode"
25
+ class="uikit-question-context__text"
26
+ :aria-label="`Question ${
27
+ questionNumber
28
+ }${
29
+ quizMode !== 'timed'
30
+ ? ` of ${quizLength}`
31
+ : ''
32
+ }${
33
+ showAnswers
34
+ ? isCorrect
35
+ ? ', Answered Correctly'
36
+ : ', Answered Incorrectly'
37
+ : ''
38
+ }`"
39
+ aria-live="assertive"
40
+ >
41
+ <div class="uikit-question-context__current-index" aria-hidden="true">
42
+ Question {{ questionNumber }}
43
+ </div>
44
+ <div
45
+ v-if="quizMode !== 'timed'"
46
+ class="uikit-question-context__quiz-length"
47
+ aria-hidden="true"
48
+ >
49
+ / {{ quizLength }}
50
+ </div>
51
+ </h2>
52
+ <div
53
+ class="uikit-question-context__tag"
54
+ v-breakpoint:questionEl="breakpoints"
55
+ >
56
+ <slot name="tag" />
57
+ </div>
58
+ </div>
59
+ </template>
60
+
61
+ <script lang="ts">
62
+ import { Component, Vue, Prop } from 'vue-facing-decorator'
63
+ import Icon from '../../Icons/Icon.vue'
64
+ import { dark, breakpoint } from '../../../directives'
65
+ import type { TQuizMode, TContextIcon, TBreakPointsObject } from './../question'
66
+
67
+ @Component({
68
+ components: {
69
+ Icon,
70
+ },
71
+ directives: {
72
+ dark,
73
+ breakpoint,
74
+ },
75
+ })
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: {
86
+ 'mobile': 767,
87
+ 'tablet-portrait': 1023,
88
+ 'tablet-landscape': 1439,
89
+ } }) breakpoints!: TBreakPointsObject
90
+ }
91
+
92
+ </script>
93
+
94
+ <style lang="scss">
95
+ @import '../../../styles/colors';
96
+ @import '../../../styles/breakpoints';
97
+
98
+ .uikit-question-context {
99
+ display: flex;
100
+ flex-direction: column;
101
+ align-items: center;
102
+ flex-shrink: 0;
103
+ margin-bottom: 28px;
104
+ padding-top: 60px;
105
+ outline: none;
106
+
107
+ &--tablet-landscape {
108
+ padding-top: 42px;
109
+ }
110
+
111
+ &--tablet-portrait {
112
+ padding-top: 52px;
113
+ }
114
+
115
+ &--mobile {
116
+ padding-top: 22px;
117
+ margin-bottom: 28px;
118
+ }
119
+
120
+ &__icon {
121
+ margin-bottom: 8px;
122
+ margin-left: 6px;
123
+ color: $ash;
124
+
125
+ &--dark {
126
+ color: $fog;
127
+ }
128
+ }
129
+
130
+ &__tag {
131
+ margin-top: 8px;
132
+ margin-bottom: -5px;
133
+
134
+ &--mobile {
135
+ display: none;
136
+ }
137
+ }
138
+
139
+ &__text {
140
+ display: flex;
141
+ font-size: 14px;
142
+ font-weight: 600;
143
+ letter-spacing: 0.2px;
144
+ line-height: 17px;
145
+ color: $ash;
146
+ margin: 0;
147
+
148
+ &--dark {
149
+ color: $fog;
150
+ }
151
+ }
152
+
153
+ &__quiz-length {
154
+ margin-left: 5px;
155
+ font-weight: 500;
156
+ }
157
+ }
158
+ </style>