@pocketprep/ui-kit 3.4.2 → 3.4.4

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.
@@ -74,135 +74,31 @@
74
74
  >
75
75
  Skip to Passage
76
76
  </PocketButton>
77
- <div
77
+ <PassageAndImageDropdown
78
78
  v-if="question.passage || passageImageUrl"
79
- v-breakpoint:questionEl="breakpoints"
80
- v-dark="isDarkMode"
79
+ ref="uikit-question__passage-and-image-dropdown"
81
80
  class="uikit-question__passage-and-image-dropdown"
82
- :class="{ 'uikit-question__passage-and-image-dropdown--review-mode': reviewMode }"
83
- >
84
- <div
85
- v-dark="isDarkMode"
86
- class="uikit-question__passage-and-image-dropdown-btn"
87
- tabindex="0"
88
- role="button"
89
- :aria-expanded="showPassageImageDropdown ? 'true' : 'false'"
90
- @click.stop="showPassageImageDropdown = !showPassageImageDropdown"
91
- @keydown.enter.stop="showPassageImageDropdown = !showPassageImageDropdown"
92
- @mousedown.prevent
93
- >
94
- <Icon
95
- v-if="question.passage"
96
- class="uikit-question__passage-dropdown-icon"
97
- type="passage"
98
- />
99
- <Icon
100
- v-else
101
- class="uikit-question__image-dropdown-icon"
102
- type="image"
103
- />
104
- <span v-dark="isDarkMode" class="uikit-question__passage-and-image-dropdown-text">
105
- {{ showPassageImageDropdown ? 'Hide' : 'Show' }}
106
- {{ passageAndImageTitle }}
107
- </span>
108
- <Icon
109
- v-dark="isDarkMode"
110
- class="uikit-question__passage-and-image-dropdown-arrow"
111
- :class="{
112
- 'uikit-question__passage-and-image-dropdown-arrow--up': showPassageImageDropdown,
113
- }"
114
- type="accordionArrow"
115
- />
116
- </div>
117
- <div
118
- v-if="showPassageImageDropdown"
119
- v-breakpoint:questionEl="breakpoints"
120
- class="uikit-question__passage-and-image-dropdown-container"
121
- >
122
- <div
123
- v-if="question.passage"
124
- v-breakpoint:questionEl="breakpoints"
125
- class="uikit-question__passage-dropdown-passage"
126
- :class="{
127
- 'uikit-question__passage-dropdown-passage--with-image': passageImageUrl,
128
- }"
129
- v-html="question.passage"
130
- />
131
- <img
132
- v-if="passageImageUrl"
133
- v-dark="isDarkMode"
134
- class="uikit-question__image-dropdown-image"
135
- :class="{
136
- 'uikit-question__image-dropdown-image--with-passage': question.passage,
137
- }"
138
- :src="passageImageUrl"
139
- :alt="`${passageImageAlt}. Extended image description below.`"
140
- >
141
- <PocketButton
142
- v-if="passageImageLongAlt"
143
- v-breakpoint:questionEl="breakpoints"
144
- type="tertiary-small"
145
- class="uikit-question__toggle-img-dropdown-img-description"
146
- :class="{
147
- 'uikit-question__toggle-img-dropdown-img-description--open': showPassageImageLongAlt,
148
- }"
149
- :is-dark-mode="isDarkMode"
150
- :aria-expanded="showPassageImageLongAlt ? 'true' : 'false'"
151
- @click.stop="togglePassageImageLongAlt"
152
- @mousedown.prevent
153
- >
154
- <span class="uikit-question__toggle-img-dropdown-img-description-text">Image Description</span>
155
- <Icon
156
- class="uikit-question__toggle-img-dropdown-img-description-icon"
157
- :class="{
158
- 'uikit-question__toggle-img-dropdown-img-description-icon--up': showPassageImageLongAlt,
159
- }"
160
- type="accordionArrow"
161
- />
162
- </PocketButton>
163
- <div
164
- v-if="showPassageImageLongAlt"
165
- ref="uikit-question__img-dropdown-img-description"
166
- v-breakpoint:questionEl="breakpoints"
167
- v-dark="isDarkMode"
168
- class="uikit-question__img-dropdown-img-description"
169
- tabindex="-1"
170
- v-html="passageImageLongAlt"
171
- />
172
- </div>
173
- </div>
174
- <div
81
+ :question="question"
82
+ :question-el="questionEl"
83
+ :breakpoints="breakpoints"
84
+ :is-dark-mode="isDarkMode"
85
+ :review-mode="reviewMode"
86
+ :image-url-prefix="imageUrlPrefix"
87
+ :passage-image-url="passageImageUrl"
88
+ :passage-image-long-alt="passageImageLongAlt"
89
+ :passage-image-alt="passageImageAlt"
90
+ :passage-and-image-title="passageAndImageTitle"
91
+ @emitTogglePassageImageLongAlt="togglePassageImageLongAlt"
92
+ />
93
+ <Paywall
175
94
  v-if="showPaywall"
176
- class="uikit-question__paywall-container"
177
- >
178
- <div
179
- v-dark="isDarkMode"
180
- v-breakpoint:questionEl="breakpoints"
181
- class="uikit-question__paywall"
182
- :class="{ 'uikit-question__paywall--review': reviewMode }"
183
- >
184
- <img
185
- v-breakpoint:questionEl="breakpoints"
186
- :src="isDarkMode ? paywallImages['dark'] : paywallImages['light']"
187
- alt=""
188
- class="uikit-question__paywall-image"
189
- >
190
- <div
191
- v-dark="isDarkMode"
192
- v-breakpoint:questionEl="breakpoints"
193
- class="uikit-question__paywall-text"
194
- >
195
- You need a Premium Subscription to view this question's answer and explanation.
196
- </div>
197
- <PocketButton
198
- :is-dark-mode="isDarkMode"
199
- class="uikit-question__paywall-button"
200
- @click="emitUpgrade"
201
- >
202
- Upgrade to Premium
203
- </PocketButton>
204
- </div>
205
- </div>
95
+ class="uikit-question__paywall"
96
+ :review-Mode="reviewMode"
97
+ :is-dark-mode="isDarkMode"
98
+ :question-el="questionEl"
99
+ :breakpoints="breakpoints"
100
+ @upgradeClicked="emitUpgrade"
101
+ />
206
102
  <div
207
103
  v-if="showAnswers && isTeachReview && isUnanswered"
208
104
  v-dark="isDarkMode"
@@ -920,11 +816,11 @@ import type { ITableColumn, ITableSortSettings } from '../Tables/table'
920
816
  import Table from '../Tables/Table.vue'
921
817
  import OverflowTooltip from '../Tooltips/OverflowTooltip.vue'
922
818
  import QuestionContext from '../Quiz/Question/QuestionContext.vue'
819
+ import PassageAndImageDropdown from '../Quiz/Question/PassageAndImageDropdown.vue'
820
+ import Paywall from '../Quiz/Question/Paywall.vue'
923
821
  import type { Study } from '@pocketprep/types'
924
822
  import { breakpoint, dark } from '../../directives'
925
823
  import { studyModes } from '../../utils'
926
- import PaywallImageLight from '../../assets/question/paywall-light.png'
927
- import PaywallImageDark from '../../assets/question/paywall-dark.png'
928
824
  import type { Ref, TQuizMode, TChoiceKey, TChoice, TChoiceScores, TNamesRow, TViewNames } from './question'
929
825
 
930
826
  @Component({
@@ -934,6 +830,8 @@ import type { Ref, TQuizMode, TChoiceKey, TChoice, TChoiceScores, TNamesRow, TVi
934
830
  Table,
935
831
  OverflowTooltip,
936
832
  QuestionContext,
833
+ PassageAndImageDropdown,
834
+ Paywall,
937
835
  },
938
836
  directives: {
939
837
  breakpoint,
@@ -995,13 +893,6 @@ export default class Question extends Vue {
995
893
  isSortDisabled: true,
996
894
  }]
997
895
 
998
- get paywallImages () {
999
- return {
1000
- light: PaywallImageLight,
1001
- dark: PaywallImageDark,
1002
- }
1003
- }
1004
-
1005
896
  get breakpoints () {
1006
897
  // Passing the container element (typically QuizContainer) allows us to bind to that element's width
1007
898
  if (this.containerEl) {
@@ -1441,12 +1332,17 @@ export default class Question extends Vue {
1441
1332
 
1442
1333
  if (this.showPassageImageLongAlt) {
1443
1334
  setTimeout(() => {
1444
- const mobileLongAlt = this.$refs['uikit-question__img-dropdown-img-description'] as Ref
1335
+ const mobileLongAltComp =
1336
+ this.$refs['uikit-question__passage-and-image-dropdown'] as ComponentPublicInstance | undefined
1337
+ const mobileImgDropdownImgDescription =
1338
+ // eslint-disable-next-line max-len
1339
+ mobileLongAltComp?.$refs['uikit-question-passage-and-image-dropdown__img-dropdown-img-description'] as HTMLElement | undefined
1340
+
1445
1341
  const longAlt = this.$refs['uikit-question__passage-image-description'] as Ref
1446
1342
 
1447
1343
  // Checking offsetParent tells us which element is visible
1448
- if (mobileLongAlt?.offsetParent) {
1449
- mobileLongAlt.focus()
1344
+ if (mobileImgDropdownImgDescription?.offsetParent) {
1345
+ mobileImgDropdownImgDescription.focus()
1450
1346
  } else if (longAlt?.offsetParent) {
1451
1347
  longAlt.focus()
1452
1348
  }
@@ -1806,7 +1702,6 @@ export default class Question extends Vue {
1806
1702
 
1807
1703
  &__toggle-passage-image-description-text,
1808
1704
  &__toggle-explanation-img-description-text,
1809
- &__toggle-img-dropdown-img-description-text,
1810
1705
  &__toggle-dropdown-explanation-img-description-text,
1811
1706
  &__toggle-summary-dropdown-explanation-img-description-text {
1812
1707
  outline: none;
@@ -1814,7 +1709,6 @@ export default class Question extends Vue {
1814
1709
 
1815
1710
  &__toggle-passage-image-description-icon,
1816
1711
  &__toggle-explanation-img-description-icon,
1817
- &__toggle-img-dropdown-img-description-icon,
1818
1712
  &__toggle-dropdown-explanation-img-description-icon,
1819
1713
  &__toggle-summary-dropdown-explanation-img-description-icon {
1820
1714
  margin-left: 8px;
@@ -2137,182 +2031,6 @@ export default class Question extends Vue {
2137
2031
  }
2138
2032
  }
2139
2033
 
2140
- &__passage-and-image-dropdown-btn {
2141
- position: relative;
2142
- display: flex;
2143
- align-items: center;
2144
- border: 1px solid rgba($pewter, 0.85);
2145
- border-radius: 5px;
2146
- box-shadow: 0 1px 4px 0 rgba($ash, 0.3);
2147
- box-sizing: border-box;
2148
- height: 50px;
2149
- padding: 15px 57px 16px 48px;
2150
- margin: -1px;
2151
- cursor: pointer;
2152
- outline: none;
2153
-
2154
- &:hover {
2155
- .uikit-question__passage-and-image-dropdown-text {
2156
- color: mix($brand-blue, black, 90%);
2157
- }
2158
-
2159
- .uikit-question__passage-and-image-dropdown-arrow {
2160
- color: mix($brand-blue, black, 90%);
2161
- }
2162
-
2163
- &::before {
2164
- content: '';
2165
- left: -2px;
2166
- top: -2px;
2167
- width: 100%;
2168
- height: 100%;
2169
- border: 2px solid $slate;
2170
- position: absolute;
2171
- border-radius: 5px;
2172
- }
2173
- }
2174
-
2175
- &:focus::before {
2176
- content: '';
2177
- left: -3px;
2178
- top: -3px;
2179
- width: calc(100% + 4px);
2180
- height: calc(100% + 4px);
2181
- border: 1px solid $brand-blue;
2182
- position: absolute;
2183
- border-radius: 8px;
2184
- }
2185
-
2186
- &--dark {
2187
- box-shadow: 0 1px 4px 0 rgba($jet, 0.3);
2188
- border-color: $slate;
2189
-
2190
- &:hover {
2191
- .uikit-question__passage-and-image-dropdown-text {
2192
- color: $butterscotch;
2193
- }
2194
-
2195
- .uikit-question__passage-and-image-dropdown-arrow {
2196
- color: $butterscotch;
2197
- }
2198
-
2199
- &::before {
2200
- border-color: rgba($white, 0.6);
2201
- }
2202
- }
2203
-
2204
- &:focus::before {
2205
- border-color: $banana-bread;
2206
- }
2207
- }
2208
- }
2209
-
2210
- &__passage-and-image-dropdown-text {
2211
- font-size: 16px;
2212
- line-height: 24px;
2213
- font-weight: 600;
2214
- color: $brand-blue;
2215
-
2216
- &--dark {
2217
- color: $banana-bread;
2218
- }
2219
- }
2220
-
2221
- &__passage-dropdown-icon,
2222
- &__image-dropdown-icon {
2223
- position: absolute;
2224
- left: 17px;
2225
- width: 19px;
2226
- }
2227
-
2228
- &__passage-and-image-dropdown-arrow {
2229
- position: absolute;
2230
- right: 20px;
2231
- color: $brand-blue;
2232
-
2233
- &--dark {
2234
- color: $banana-bread;
2235
- }
2236
-
2237
- &--up {
2238
- transform: rotate(180deg);
2239
- }
2240
- }
2241
-
2242
- &__passage-and-image-dropdown-container {
2243
- padding: 14px 15px 16px 16px;
2244
-
2245
- &--mobile {
2246
- padding: 12px 15px 16px 15px;
2247
- }
2248
- }
2249
-
2250
- &__passage-dropdown-passage {
2251
- box-sizing: border-box;
2252
- margin: 14px 20px 24px 17px;
2253
- line-height: 24px;
2254
- font-size: 16px;
2255
- font-weight: 400;
2256
- letter-spacing: -0.1;
2257
-
2258
- &--mobile {
2259
- line-height: 24px;
2260
- font-size: 16px;
2261
- }
2262
-
2263
- &--with-image {
2264
- margin-bottom: 16px;
2265
- }
2266
- }
2267
-
2268
- &__image-dropdown-image {
2269
- display: block;
2270
- box-sizing: border-box;
2271
- width: 100%;
2272
- border: 1px solid $fog;
2273
-
2274
- &--with-passage {
2275
- padding-top: 0;
2276
- }
2277
-
2278
- &--dark {
2279
- border: 1px solid $jet;
2280
- }
2281
- }
2282
-
2283
- &__toggle-img-dropdown-img-description {
2284
- margin-top: 16px;
2285
-
2286
- &--open {
2287
- margin-bottom: 8px;
2288
- }
2289
- }
2290
-
2291
- &__img-dropdown-img-description {
2292
- outline: none;
2293
- color: $ash;
2294
- font-size: 15px;
2295
- line-height: 22px;
2296
- font-weight: 500;
2297
- letter-spacing: -0.2;
2298
-
2299
- &--dark {
2300
- color: $fog;
2301
- }
2302
-
2303
- &--tablet-landscape {
2304
- margin-bottom: 4px;
2305
- }
2306
-
2307
- &--tablet-portrait {
2308
- margin-bottom: 0;
2309
- }
2310
-
2311
- p {
2312
- margin: 0;
2313
- }
2314
- }
2315
-
2316
2034
  &__unanswered-teach-review-label {
2317
2035
  margin-bottom: 12px;
2318
2036
  display: flex;
@@ -3274,76 +2992,5 @@ export default class Question extends Vue {
3274
2992
  margin-top: 24px;
3275
2993
  }
3276
2994
  }
3277
-
3278
- &__paywall-container {
3279
- width: 100%;
3280
- display: flex;
3281
- justify-content: center;
3282
- }
3283
-
3284
- &__paywall {
3285
- width: 100%;
3286
- max-width: 500px;
3287
- background: $white;
3288
- border-radius: 8px;
3289
- border: 1px solid $steel;
3290
- display: flex;
3291
- flex-direction: column;
3292
- align-items: center;
3293
- justify-content: center;
3294
-
3295
- &--dark {
3296
- background: $brand-black;
3297
- }
3298
-
3299
- &--tablet-portrait {
3300
- max-width: 430px;
3301
- }
3302
-
3303
- &--review {
3304
- margin-bottom: 20px;
3305
- }
3306
- }
3307
-
3308
- &__paywall-image {
3309
- width: 305px;
3310
- height: 230px;
3311
- margin: 25px auto 21px;
3312
-
3313
- &--mobile {
3314
- width: 262px;
3315
- height: 199px;
3316
- margin: 14px auto 18px;
3317
- }
3318
- }
3319
-
3320
- &__paywall-text {
3321
- font-size: 18px;
3322
- line-height: 22px;
3323
- color: $brand-black;
3324
- margin-bottom: 24px;
3325
- font-weight: 600;
3326
- text-align: center;
3327
- max-width: 372px;
3328
-
3329
- &--dark {
3330
- color: $white;
3331
- }
3332
-
3333
- &--tablet-portrait {
3334
- max-width: 302px;
3335
- }
3336
-
3337
- &--mobile {
3338
- max-width: 293px;
3339
- margin-bottom: 22px;
3340
- font-size: 16px;
3341
- line-height: 19px;
3342
- }
3343
- }
3344
-
3345
- &__paywall-button {
3346
- margin-bottom: 36px;
3347
- }
3348
2995
  }
3349
2996
  </style>
@@ -20,6 +20,8 @@ export type TChoiceScores = Partial<Record<TChoiceKey, number>> & {
20
20
  answeredCorrectly: number
21
21
  }
22
22
 
23
+ export type TQuestionPassageAndImageTitle = 'Passage + Image' | 'Image' | 'Passage'
24
+
23
25
  export type TNamesRow = {
24
26
  id: string
25
27
  nameOne: string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pocketprep/ui-kit",
3
- "version": "3.4.2",
3
+ "version": "3.4.4",
4
4
  "description": "Pocket Prep UI Kit",
5
5
  "author": "pocketprep",
6
6
  "scripts": {