@pocketprep/ui-kit 3.4.8 → 3.4.10

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.
@@ -176,7 +176,7 @@
176
176
  :question-el="questionEl"
177
177
  :breakpoints="breakpoints"
178
178
  @emitChoiceMouseOver="choiceMouseOver"
179
- @emitChoiceMouseleave="choiceMouseLeave"
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
- <div
237
+ <StatsSummary
238
238
  v-if="globalMetrics"
239
239
  class="uikit-question__stats-summary"
240
- >
241
- <div v-dark="isDarkMode" class="uikit-question__stats-summary-total">
242
- <div class="uikit-question__stats-summary-value">
243
- {{ choiceScores.totalAnswered }}
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"
@@ -384,89 +370,25 @@
384
370
  Return to Question
385
371
  </PocketButton>
386
372
  </div>
387
- <div
388
- v-if="showExplanation && !showPaywall"
389
- v-breakpoint:questionEl="breakpoints"
390
- v-dark="isDarkMode"
373
+ <Explanation
374
+ ref="uikit-question__explanation"
391
375
  class="uikit-question__explanation"
392
- >
393
- <div
394
- ref="explanation"
395
- v-dark="isDarkMode"
396
- class="uikit-question__explanation-title"
397
- tabindex="-1"
398
- >
399
- Explanation Details
400
- </div>
401
- <div
402
- v-dark="isDarkMode"
403
- v-breakpoint:questionEl="breakpoints"
404
- class="uikit-question__explanation-text"
405
- v-html="question.explanation"
406
- />
407
- <img
408
- v-if="explanationImageUrl"
409
- v-dark="isDarkMode"
410
- v-breakpoint:questionEl="breakpoints"
411
- class="uikit-question__explanation-image"
412
- :class="{
413
- 'uikit-question__explanation-image--long-alt': explanationImageLongAlt,
414
- }"
415
- :src="explanationImageUrl"
416
- :alt="`${explanationImageAlt}. Extended image description below.`"
417
- >
418
- <PocketButton
419
- v-if="explanationImageLongAlt"
420
- v-breakpoint:questionEl="breakpoints"
421
- type="tertiary-small"
422
- class="uikit-question__toggle-explanation-img-description"
423
- :class="{
424
- 'uikit-question__toggle-explanation-img-description--open': showExplanationImageLongAlt,
425
- }"
426
- :is-dark-mode="isDarkMode"
427
- :aria-expanded="showExplanationImageLongAlt ? 'true' : 'false'"
428
- @click.stop="toggleExplanationImageLongAlt"
429
- @mousedown.prevent
430
- >
431
- <span class="uikit-question__toggle-explanation-img-description-text">Image Description</span>
432
- <Icon
433
- class="uikit-question__toggle-explanation-img-description-icon"
434
- :class="{
435
- 'uikit-question__toggle-explanation-img-description-icon--up': showExplanationImageLongAlt,
436
- }"
437
- type="accordionArrow"
438
- />
439
- </PocketButton>
440
- <div
441
- v-if="showExplanationImageLongAlt"
442
- ref="uikit-question__explanation-img-description"
443
- v-dark="isDarkMode"
444
- class="uikit-question__explanation-img-description"
445
- tabindex="-1"
446
- v-html="explanationImageLongAlt"
447
- />
448
- <div
449
- v-if="reference && !hideReferences"
450
- v-dark="isDarkMode"
451
- class="uikit-question__reference"
452
- >
453
- <span class="uikit-question__reference-label">Reference: </span>
454
- <div v-html="reference" />
455
- </div>
456
- <div
457
- v-if="!reviewMode"
458
- v-dark="isDarkMode"
459
- class="uikit-question__explanation-close"
460
- tabindex="0"
461
- role="button"
462
- aria-label="Close explanation"
463
- @keydown.enter.stop="toggleExplanation"
464
- @click.stop="toggleExplanation"
465
- @mousedown.prevent
466
- >
467
- <Icon type="close" />
468
- </div>
469
- </div>
376
+ :question="question"
377
+ :show-explanation="showExplanation"
378
+ :show-paywall="showPaywall"
379
+ :review-mode="reviewMode"
380
+ :show-explanation-image-long-alt="showExplanationImageLongAlt"
381
+ :explanation-image-url="explanationImageUrl"
382
+ :explanation-image-alt="explanationImageAlt"
383
+ :explanation-image-long-alt="explanationImageLongAlt"
384
+ :reference="reference"
385
+ :hide-references="hideReferences"
386
+ :is-dark-mode="isDarkMode"
387
+ :question-el="questionEl"
388
+ :breakpoints="breakpoints"
389
+ @toggleExplanationImageLongAlt="toggleExplanationImageLongAlt"
390
+ @toggleExplanation="toggleExplanation"
391
+ />
470
392
  </div>
471
393
  </div>
472
394
  </template>
@@ -485,6 +407,8 @@ import DropdownExplanation from '../Quiz/Question/DropdownExplanation.vue'
485
407
  import Paywall from '../Quiz/Question/Paywall.vue'
486
408
  import Summary from '../Quiz/Question/Summary.vue'
487
409
  import ChoicesContainer from '../Quiz/Question/ChoicesContainer.vue'
410
+ import StatsSummary from '../Quiz/Question/StatsSummary.vue'
411
+ import Explanation from '../Quiz/Question/Explanation.vue'
488
412
  import type { Study } from '@pocketprep/types'
489
413
  import { breakpoint, dark } from '../../directives'
490
414
  import { studyModes } from '../../utils'
@@ -502,6 +426,8 @@ import type { Ref, TQuizMode, TChoiceKey, TChoice, TChoiceScores, TNamesRow, TVi
502
426
  DropdownExplanation,
503
427
  Summary,
504
428
  ChoicesContainer,
429
+ StatsSummary,
430
+ Explanation,
505
431
  },
506
432
  directives: {
507
433
  breakpoint,
@@ -1057,7 +983,9 @@ export default class Question extends Vue {
1057
983
  }
1058
984
  }
1059
985
 
1060
- const longAlt = this.$refs['uikit-question__explanation-img-description'] as Ref
986
+ const explanationComp =
987
+ this.$refs['uikit-question__explanation'] as ComponentPublicInstance | undefined
988
+ const longAlt = explanationComp?.$refs['uikit-question-explanation__explanation-img-description'] as Ref
1061
989
 
1062
990
  // Checking offsetParent tells us which element is visible
1063
991
  if (mcrLongAlt?.offsetParent) {
@@ -1078,14 +1006,17 @@ export default class Question extends Vue {
1078
1006
  const summaryMCRExplanation =
1079
1007
  // eslint-disable-next-line max-len
1080
1008
  summaryMCRComp?.$refs['uikit-question-summary__summary-toggle-explanation-text'] as HTMLElement | undefined
1009
+
1010
+ const choiceContainerComp =
1011
+ this.$refs['uikit-question__choices-container'] as ComponentPublicInstance | undefined
1081
1012
 
1082
1013
  const showExplanationRef = (
1083
- this.$refs['uikit-question__toggle-explanation-text']
1014
+ choiceContainerComp?.$refs['uikit-question-choices-container__toggle-explanation-text']
1084
1015
  ) as Element[] | Element | undefined
1085
1016
 
1086
1017
  if (summaryMCRExplanation) {
1087
1018
  summaryMCRExplanation?.focus()
1088
- } else {
1019
+ } else if (showExplanationRef) {
1089
1020
  const showExplanationEl = (
1090
1021
  showExplanationRef instanceof Array
1091
1022
  ? showExplanationRef[0]
@@ -1117,13 +1048,16 @@ export default class Question extends Vue {
1117
1048
  // eslint-disable-next-line max-len
1118
1049
  summaryMCRComp?.$refs['uikit-question-summary__summary-toggle-explanation-text'] as HTMLElement | undefined
1119
1050
 
1051
+ const choiceContainerComp =
1052
+ this.$refs['uikit-question__choices-container'] as ComponentPublicInstance | undefined
1053
+
1120
1054
  const showExplanationRef = (
1121
- this.$refs['uikit-question__toggle-explanation-text']
1055
+ choiceContainerComp?.$refs['uikit-question-choices-container__toggle-explanation-text']
1122
1056
  ) as Element[] | Element | undefined
1123
1057
 
1124
1058
  if (summaryMCRExplanation) {
1125
1059
  summaryMCRExplanation?.focus()
1126
- } else {
1060
+ } else if (showExplanationRef) {
1127
1061
  const showExplanationEl = (
1128
1062
  showExplanationRef instanceof Array
1129
1063
  ? showExplanationRef[0]
@@ -1418,13 +1352,11 @@ export default class Question extends Vue {
1418
1352
  }
1419
1353
  }
1420
1354
 
1421
- &__toggle-passage-image-description-text,
1422
- &__toggle-explanation-img-description-text {
1355
+ &__toggle-passage-image-description-text {
1423
1356
  outline: none;
1424
1357
  }
1425
1358
 
1426
- &__toggle-passage-image-description-icon,
1427
- &__toggle-explanation-img-description-icon {
1359
+ &__toggle-passage-image-description-icon {
1428
1360
  margin-left: 8px;
1429
1361
 
1430
1362
  &--up {
@@ -1458,186 +1390,6 @@ export default class Question extends Vue {
1458
1390
  }
1459
1391
  }
1460
1392
 
1461
- &__explanation {
1462
- position: relative;
1463
- background-color: $white;
1464
- border: 1px solid rgba($pewter, 0.85);
1465
- border-bottom: 0;
1466
- border-radius: 6px 6px 0 0;
1467
- padding: 42px 60px 72px;
1468
- box-sizing: border-box;
1469
- max-width: 565px;
1470
- min-height: 100%;
1471
-
1472
- &--tablet-landscape {
1473
- max-width: 460px;
1474
- padding: 42px 36px 72px;
1475
- }
1476
-
1477
- &--dark {
1478
- border-color: $slate;
1479
- background-color: $mariner;
1480
- }
1481
- }
1482
-
1483
- &__explanation-close {
1484
- position: absolute;
1485
- width: 30px;
1486
- height: 30px;
1487
- top: 12px;
1488
- right: 12px;
1489
- color: $brand-blue;
1490
- cursor: pointer;
1491
- outline: none;
1492
-
1493
- &:hover {
1494
- color: $brand-black;
1495
- }
1496
-
1497
- &:focus::before {
1498
- content: '';
1499
- left: -1px;
1500
- top: -1px;
1501
- width: 100%;
1502
- height: 100%;
1503
- position: absolute;
1504
- border: 1px solid $brand-blue;
1505
- border-radius: 5px;
1506
- }
1507
-
1508
- &--dark {
1509
- color: $banana-bread;
1510
-
1511
- &:hover {
1512
- color: $butterscotch;
1513
- }
1514
-
1515
- &:focus::before {
1516
- border-color: $banana-bread;
1517
- }
1518
- }
1519
-
1520
- svg {
1521
- width: 100%;
1522
- height: 100%;
1523
- }
1524
- }
1525
-
1526
- &__explanation-title {
1527
- font-weight: 600;
1528
- font-size: 17.5px;
1529
- letter-spacing: -0.1px;
1530
- line-height: 25px;
1531
- outline: none;
1532
-
1533
- &--dark {
1534
- color: $fog;
1535
- }
1536
- }
1537
-
1538
- &__explanation-text {
1539
- font-weight: 400;
1540
- font-size: 16.5px;
1541
- letter-spacing: -0.1px;
1542
- line-height: 26px;
1543
- margin-bottom: 24px;
1544
- word-break: break-word;
1545
-
1546
- &--dark {
1547
- color: $white;
1548
- }
1549
-
1550
- &--tablet-landscape {
1551
- margin-bottom: 24px;
1552
- font-size: 16px;
1553
- line-height: 24px;
1554
- }
1555
-
1556
- strong,
1557
- b {
1558
- font-weight: 600;
1559
- }
1560
- }
1561
-
1562
- &__explanation-image {
1563
- display: block;
1564
- position: relative;
1565
- left: 50%;
1566
- transform: translateX(-50%);
1567
- width: calc(100% + 24px);
1568
- margin-bottom: 24px;
1569
- border: 1px solid $fog;
1570
-
1571
- &--long-alt {
1572
- margin-bottom: 0;
1573
- }
1574
-
1575
- &--dark {
1576
- border: 1px solid $jet;
1577
- }
1578
-
1579
- &--tablet-landscape {
1580
- width: calc(100% + 16px);
1581
- }
1582
- }
1583
-
1584
- &__toggle-explanation-img-description {
1585
- margin-top: 24px;
1586
-
1587
- &--open {
1588
- margin-bottom: 6px;
1589
- }
1590
-
1591
- &--tablet-landscape {
1592
- margin-top: 12px;
1593
- }
1594
- }
1595
-
1596
- &__explanation-img-description {
1597
- outline: none;
1598
- color: $ash;
1599
- font-size: 15px;
1600
- font-weight: 500;
1601
- letter-spacing: -0.2px;
1602
- line-height: 22px;
1603
- margin-bottom: 24px;
1604
-
1605
- &--dark {
1606
- color: $fog;
1607
- }
1608
-
1609
- p {
1610
- margin: 0;
1611
- }
1612
- }
1613
-
1614
- &__reference {
1615
- padding-top: 24px;
1616
- border-top: 1px solid $fog;
1617
- font-size: 15px;
1618
- letter-spacing: -0.1px;
1619
- line-height: 22px;
1620
- font-weight: 600;
1621
- word-break: break-word;
1622
-
1623
- &--dark {
1624
- color: $white;
1625
- border-top-color: rgba($fog, 0.28);
1626
- }
1627
-
1628
- p {
1629
- margin: 6px 0 8pt 0;
1630
- font-size: 15px;
1631
- letter-spacing: -0.1px;
1632
- font-weight: 400;
1633
- font-style: italic;
1634
- }
1635
- }
1636
-
1637
- &__reference-label {
1638
- font-weight: 600;
1639
- }
1640
-
1641
1393
  &__tag-mobile {
1642
1394
  display: none;
1643
1395
  position: absolute;
@@ -1839,143 +1591,6 @@ export default class Question extends Vue {
1839
1591
  }
1840
1592
  }
1841
1593
 
1842
- &__toggle-explanation {
1843
- margin-top: 8px;
1844
- margin-bottom: 8px;
1845
- padding: 0;
1846
- z-index: 2;
1847
-
1848
- &--review-mode {
1849
- display: none;
1850
-
1851
- &.uikit-question__toggle-explanation--tablet-portrait,
1852
- &.uikit-question__toggle-explanation--mobile {
1853
- display: block;
1854
- }
1855
- }
1856
- }
1857
-
1858
- &__toggle-explanation-text {
1859
- outline: none;
1860
- }
1861
-
1862
- &__toggle-explanation-icon {
1863
- margin-left: 5px;
1864
- display: none;
1865
-
1866
- &--tablet-portrait {
1867
- display: initial;
1868
- }
1869
-
1870
- &--up {
1871
- transform: rotate(180deg);
1872
- }
1873
- }
1874
-
1875
- &__strikethrough {
1876
- display: flex;
1877
- align-items: center;
1878
- justify-content: center;
1879
- position: absolute;
1880
- width: 20px;
1881
- height: 22px;
1882
- right: 12px;
1883
- background-color: $gray-background;
1884
- border-radius: 2px;
1885
- z-index: 2;
1886
- outline: none;
1887
- opacity: 0;
1888
-
1889
- &--visible {
1890
- opacity: 1;
1891
- }
1892
-
1893
- &:hover:not(&--active) {
1894
- background-color: rgba($sky-blue, 0.674);
1895
- color: $brand-blue;
1896
- }
1897
-
1898
- &:focus:not(&--active) {
1899
- background-color: $gray-background;
1900
- color: $brand-blue;
1901
-
1902
- &::after {
1903
- content: '';
1904
- position: absolute;
1905
- top: 0;
1906
- bottom: 0;
1907
- left: 0;
1908
- right: 0;
1909
- border: 1px solid $brand-blue;
1910
- border-radius: 2px;
1911
- }
1912
- }
1913
-
1914
- &--dark {
1915
- background-color: $ash;
1916
- color: $white;
1917
-
1918
- &:hover:not(&--active) {
1919
- background-color: rgba($banana-bread, 0.15);
1920
- color: $banana-bread;
1921
- }
1922
-
1923
- &:focus:not(&--active) {
1924
- background-color: rgba($white, 0.15);
1925
- color: $banana-bread;
1926
-
1927
- &::after {
1928
- border-color: $banana-bread;
1929
- }
1930
- }
1931
- }
1932
-
1933
- &--active {
1934
- background-color: $brand-blue;
1935
- color: $white;
1936
-
1937
- &:hover {
1938
- background-color: mix($brand-blue, black, 90%);
1939
- }
1940
-
1941
- &:focus {
1942
- &::before {
1943
- content: '';
1944
- position: absolute;
1945
- top: -2px;
1946
- bottom: -2px;
1947
- left: -2px;
1948
- right: -2px;
1949
- border: 1px solid $brand-blue;
1950
- border-radius: 2px;
1951
- }
1952
- }
1953
-
1954
- &--dark {
1955
- background-color: $banana-bread;
1956
- color: $brand-black;
1957
-
1958
- &:hover {
1959
- background-color: $banana-bread;
1960
- color: $brand-black;
1961
- }
1962
-
1963
- &:focus {
1964
- background-color: $banana-bread !important;
1965
- color: $brand-black !important;
1966
-
1967
- &::before {
1968
- border-color: $banana-bread;
1969
- }
1970
- }
1971
- }
1972
- }
1973
-
1974
- &--tablet-landscape {
1975
- display: none;
1976
- }
1977
- }
1978
-
1979
1594
  &__correct-icon {
1980
1595
  position: absolute;
1981
1596
  top: 12px;
@@ -2111,61 +1726,6 @@ export default class Question extends Vue {
2111
1726
  }
2112
1727
  }
2113
1728
 
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
1729
  &__action-container {
2170
1730
  display: flex;
2171
1731
  justify-content: center;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pocketprep/ui-kit",
3
- "version": "3.4.8",
3
+ "version": "3.4.10",
4
4
  "description": "Pocket Prep UI Kit",
5
5
  "author": "pocketprep",
6
6
  "scripts": {