@pocketprep/ui-kit 3.4.9 → 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.
@@ -370,89 +370,25 @@
370
370
  Return to Question
371
371
  </PocketButton>
372
372
  </div>
373
- <div
374
- v-if="showExplanation && !showPaywall"
375
- v-breakpoint:questionEl="breakpoints"
376
- v-dark="isDarkMode"
373
+ <Explanation
374
+ ref="uikit-question__explanation"
377
375
  class="uikit-question__explanation"
378
- >
379
- <div
380
- ref="explanation"
381
- v-dark="isDarkMode"
382
- class="uikit-question__explanation-title"
383
- tabindex="-1"
384
- >
385
- Explanation Details
386
- </div>
387
- <div
388
- v-dark="isDarkMode"
389
- v-breakpoint:questionEl="breakpoints"
390
- class="uikit-question__explanation-text"
391
- v-html="question.explanation"
392
- />
393
- <img
394
- v-if="explanationImageUrl"
395
- v-dark="isDarkMode"
396
- v-breakpoint:questionEl="breakpoints"
397
- class="uikit-question__explanation-image"
398
- :class="{
399
- 'uikit-question__explanation-image--long-alt': explanationImageLongAlt,
400
- }"
401
- :src="explanationImageUrl"
402
- :alt="`${explanationImageAlt}. Extended image description below.`"
403
- >
404
- <PocketButton
405
- v-if="explanationImageLongAlt"
406
- v-breakpoint:questionEl="breakpoints"
407
- type="tertiary-small"
408
- class="uikit-question__toggle-explanation-img-description"
409
- :class="{
410
- 'uikit-question__toggle-explanation-img-description--open': showExplanationImageLongAlt,
411
- }"
412
- :is-dark-mode="isDarkMode"
413
- :aria-expanded="showExplanationImageLongAlt ? 'true' : 'false'"
414
- @click.stop="toggleExplanationImageLongAlt"
415
- @mousedown.prevent
416
- >
417
- <span class="uikit-question__toggle-explanation-img-description-text">Image Description</span>
418
- <Icon
419
- class="uikit-question__toggle-explanation-img-description-icon"
420
- :class="{
421
- 'uikit-question__toggle-explanation-img-description-icon--up': showExplanationImageLongAlt,
422
- }"
423
- type="accordionArrow"
424
- />
425
- </PocketButton>
426
- <div
427
- v-if="showExplanationImageLongAlt"
428
- ref="uikit-question__explanation-img-description"
429
- v-dark="isDarkMode"
430
- class="uikit-question__explanation-img-description"
431
- tabindex="-1"
432
- v-html="explanationImageLongAlt"
433
- />
434
- <div
435
- v-if="reference && !hideReferences"
436
- v-dark="isDarkMode"
437
- class="uikit-question__reference"
438
- >
439
- <span class="uikit-question__reference-label">Reference: </span>
440
- <div v-html="reference" />
441
- </div>
442
- <div
443
- v-if="!reviewMode"
444
- v-dark="isDarkMode"
445
- class="uikit-question__explanation-close"
446
- tabindex="0"
447
- role="button"
448
- aria-label="Close explanation"
449
- @keydown.enter.stop="toggleExplanation"
450
- @click.stop="toggleExplanation"
451
- @mousedown.prevent
452
- >
453
- <Icon type="close" />
454
- </div>
455
- </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
+ />
456
392
  </div>
457
393
  </div>
458
394
  </template>
@@ -472,6 +408,7 @@ import Paywall from '../Quiz/Question/Paywall.vue'
472
408
  import Summary from '../Quiz/Question/Summary.vue'
473
409
  import ChoicesContainer from '../Quiz/Question/ChoicesContainer.vue'
474
410
  import StatsSummary from '../Quiz/Question/StatsSummary.vue'
411
+ import Explanation from '../Quiz/Question/Explanation.vue'
475
412
  import type { Study } from '@pocketprep/types'
476
413
  import { breakpoint, dark } from '../../directives'
477
414
  import { studyModes } from '../../utils'
@@ -490,6 +427,7 @@ import type { Ref, TQuizMode, TChoiceKey, TChoice, TChoiceScores, TNamesRow, TVi
490
427
  Summary,
491
428
  ChoicesContainer,
492
429
  StatsSummary,
430
+ Explanation,
493
431
  },
494
432
  directives: {
495
433
  breakpoint,
@@ -1045,7 +983,9 @@ export default class Question extends Vue {
1045
983
  }
1046
984
  }
1047
985
 
1048
- 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
1049
989
 
1050
990
  // Checking offsetParent tells us which element is visible
1051
991
  if (mcrLongAlt?.offsetParent) {
@@ -1066,14 +1006,17 @@ export default class Question extends Vue {
1066
1006
  const summaryMCRExplanation =
1067
1007
  // eslint-disable-next-line max-len
1068
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
1069
1012
 
1070
1013
  const showExplanationRef = (
1071
- this.$refs['uikit-question__toggle-explanation-text']
1014
+ choiceContainerComp?.$refs['uikit-question-choices-container__toggle-explanation-text']
1072
1015
  ) as Element[] | Element | undefined
1073
1016
 
1074
1017
  if (summaryMCRExplanation) {
1075
1018
  summaryMCRExplanation?.focus()
1076
- } else {
1019
+ } else if (showExplanationRef) {
1077
1020
  const showExplanationEl = (
1078
1021
  showExplanationRef instanceof Array
1079
1022
  ? showExplanationRef[0]
@@ -1105,13 +1048,16 @@ export default class Question extends Vue {
1105
1048
  // eslint-disable-next-line max-len
1106
1049
  summaryMCRComp?.$refs['uikit-question-summary__summary-toggle-explanation-text'] as HTMLElement | undefined
1107
1050
 
1051
+ const choiceContainerComp =
1052
+ this.$refs['uikit-question__choices-container'] as ComponentPublicInstance | undefined
1053
+
1108
1054
  const showExplanationRef = (
1109
- this.$refs['uikit-question__toggle-explanation-text']
1055
+ choiceContainerComp?.$refs['uikit-question-choices-container__toggle-explanation-text']
1110
1056
  ) as Element[] | Element | undefined
1111
1057
 
1112
1058
  if (summaryMCRExplanation) {
1113
1059
  summaryMCRExplanation?.focus()
1114
- } else {
1060
+ } else if (showExplanationRef) {
1115
1061
  const showExplanationEl = (
1116
1062
  showExplanationRef instanceof Array
1117
1063
  ? showExplanationRef[0]
@@ -1406,13 +1352,11 @@ export default class Question extends Vue {
1406
1352
  }
1407
1353
  }
1408
1354
 
1409
- &__toggle-passage-image-description-text,
1410
- &__toggle-explanation-img-description-text {
1355
+ &__toggle-passage-image-description-text {
1411
1356
  outline: none;
1412
1357
  }
1413
1358
 
1414
- &__toggle-passage-image-description-icon,
1415
- &__toggle-explanation-img-description-icon {
1359
+ &__toggle-passage-image-description-icon {
1416
1360
  margin-left: 8px;
1417
1361
 
1418
1362
  &--up {
@@ -1446,186 +1390,6 @@ export default class Question extends Vue {
1446
1390
  }
1447
1391
  }
1448
1392
 
1449
- &__explanation {
1450
- position: relative;
1451
- background-color: $white;
1452
- border: 1px solid rgba($pewter, 0.85);
1453
- border-bottom: 0;
1454
- border-radius: 6px 6px 0 0;
1455
- padding: 42px 60px 72px;
1456
- box-sizing: border-box;
1457
- max-width: 565px;
1458
- min-height: 100%;
1459
-
1460
- &--tablet-landscape {
1461
- max-width: 460px;
1462
- padding: 42px 36px 72px;
1463
- }
1464
-
1465
- &--dark {
1466
- border-color: $slate;
1467
- background-color: $mariner;
1468
- }
1469
- }
1470
-
1471
- &__explanation-close {
1472
- position: absolute;
1473
- width: 30px;
1474
- height: 30px;
1475
- top: 12px;
1476
- right: 12px;
1477
- color: $brand-blue;
1478
- cursor: pointer;
1479
- outline: none;
1480
-
1481
- &:hover {
1482
- color: $brand-black;
1483
- }
1484
-
1485
- &:focus::before {
1486
- content: '';
1487
- left: -1px;
1488
- top: -1px;
1489
- width: 100%;
1490
- height: 100%;
1491
- position: absolute;
1492
- border: 1px solid $brand-blue;
1493
- border-radius: 5px;
1494
- }
1495
-
1496
- &--dark {
1497
- color: $banana-bread;
1498
-
1499
- &:hover {
1500
- color: $butterscotch;
1501
- }
1502
-
1503
- &:focus::before {
1504
- border-color: $banana-bread;
1505
- }
1506
- }
1507
-
1508
- svg {
1509
- width: 100%;
1510
- height: 100%;
1511
- }
1512
- }
1513
-
1514
- &__explanation-title {
1515
- font-weight: 600;
1516
- font-size: 17.5px;
1517
- letter-spacing: -0.1px;
1518
- line-height: 25px;
1519
- outline: none;
1520
-
1521
- &--dark {
1522
- color: $fog;
1523
- }
1524
- }
1525
-
1526
- &__explanation-text {
1527
- font-weight: 400;
1528
- font-size: 16.5px;
1529
- letter-spacing: -0.1px;
1530
- line-height: 26px;
1531
- margin-bottom: 24px;
1532
- word-break: break-word;
1533
-
1534
- &--dark {
1535
- color: $white;
1536
- }
1537
-
1538
- &--tablet-landscape {
1539
- margin-bottom: 24px;
1540
- font-size: 16px;
1541
- line-height: 24px;
1542
- }
1543
-
1544
- strong,
1545
- b {
1546
- font-weight: 600;
1547
- }
1548
- }
1549
-
1550
- &__explanation-image {
1551
- display: block;
1552
- position: relative;
1553
- left: 50%;
1554
- transform: translateX(-50%);
1555
- width: calc(100% + 24px);
1556
- margin-bottom: 24px;
1557
- border: 1px solid $fog;
1558
-
1559
- &--long-alt {
1560
- margin-bottom: 0;
1561
- }
1562
-
1563
- &--dark {
1564
- border: 1px solid $jet;
1565
- }
1566
-
1567
- &--tablet-landscape {
1568
- width: calc(100% + 16px);
1569
- }
1570
- }
1571
-
1572
- &__toggle-explanation-img-description {
1573
- margin-top: 24px;
1574
-
1575
- &--open {
1576
- margin-bottom: 6px;
1577
- }
1578
-
1579
- &--tablet-landscape {
1580
- margin-top: 12px;
1581
- }
1582
- }
1583
-
1584
- &__explanation-img-description {
1585
- outline: none;
1586
- color: $ash;
1587
- font-size: 15px;
1588
- font-weight: 500;
1589
- letter-spacing: -0.2px;
1590
- line-height: 22px;
1591
- margin-bottom: 24px;
1592
-
1593
- &--dark {
1594
- color: $fog;
1595
- }
1596
-
1597
- p {
1598
- margin: 0;
1599
- }
1600
- }
1601
-
1602
- &__reference {
1603
- padding-top: 24px;
1604
- border-top: 1px solid $fog;
1605
- font-size: 15px;
1606
- letter-spacing: -0.1px;
1607
- line-height: 22px;
1608
- font-weight: 600;
1609
- word-break: break-word;
1610
-
1611
- &--dark {
1612
- color: $white;
1613
- border-top-color: rgba($fog, 0.28);
1614
- }
1615
-
1616
- p {
1617
- margin: 6px 0 8pt 0;
1618
- font-size: 15px;
1619
- letter-spacing: -0.1px;
1620
- font-weight: 400;
1621
- font-style: italic;
1622
- }
1623
- }
1624
-
1625
- &__reference-label {
1626
- font-weight: 600;
1627
- }
1628
-
1629
1393
  &__tag-mobile {
1630
1394
  display: none;
1631
1395
  position: absolute;
@@ -1827,143 +1591,6 @@ export default class Question extends Vue {
1827
1591
  }
1828
1592
  }
1829
1593
 
1830
- &__toggle-explanation {
1831
- margin-top: 8px;
1832
- margin-bottom: 8px;
1833
- padding: 0;
1834
- z-index: 2;
1835
-
1836
- &--review-mode {
1837
- display: none;
1838
-
1839
- &.uikit-question__toggle-explanation--tablet-portrait,
1840
- &.uikit-question__toggle-explanation--mobile {
1841
- display: block;
1842
- }
1843
- }
1844
- }
1845
-
1846
- &__toggle-explanation-text {
1847
- outline: none;
1848
- }
1849
-
1850
- &__toggle-explanation-icon {
1851
- margin-left: 5px;
1852
- display: none;
1853
-
1854
- &--tablet-portrait {
1855
- display: initial;
1856
- }
1857
-
1858
- &--up {
1859
- transform: rotate(180deg);
1860
- }
1861
- }
1862
-
1863
- &__strikethrough {
1864
- display: flex;
1865
- align-items: center;
1866
- justify-content: center;
1867
- position: absolute;
1868
- width: 20px;
1869
- height: 22px;
1870
- right: 12px;
1871
- background-color: $gray-background;
1872
- border-radius: 2px;
1873
- z-index: 2;
1874
- outline: none;
1875
- opacity: 0;
1876
-
1877
- &--visible {
1878
- opacity: 1;
1879
- }
1880
-
1881
- &:hover:not(&--active) {
1882
- background-color: rgba($sky-blue, 0.674);
1883
- color: $brand-blue;
1884
- }
1885
-
1886
- &:focus:not(&--active) {
1887
- background-color: $gray-background;
1888
- color: $brand-blue;
1889
-
1890
- &::after {
1891
- content: '';
1892
- position: absolute;
1893
- top: 0;
1894
- bottom: 0;
1895
- left: 0;
1896
- right: 0;
1897
- border: 1px solid $brand-blue;
1898
- border-radius: 2px;
1899
- }
1900
- }
1901
-
1902
- &--dark {
1903
- background-color: $ash;
1904
- color: $white;
1905
-
1906
- &:hover:not(&--active) {
1907
- background-color: rgba($banana-bread, 0.15);
1908
- color: $banana-bread;
1909
- }
1910
-
1911
- &:focus:not(&--active) {
1912
- background-color: rgba($white, 0.15);
1913
- color: $banana-bread;
1914
-
1915
- &::after {
1916
- border-color: $banana-bread;
1917
- }
1918
- }
1919
- }
1920
-
1921
- &--active {
1922
- background-color: $brand-blue;
1923
- color: $white;
1924
-
1925
- &:hover {
1926
- background-color: mix($brand-blue, black, 90%);
1927
- }
1928
-
1929
- &:focus {
1930
- &::before {
1931
- content: '';
1932
- position: absolute;
1933
- top: -2px;
1934
- bottom: -2px;
1935
- left: -2px;
1936
- right: -2px;
1937
- border: 1px solid $brand-blue;
1938
- border-radius: 2px;
1939
- }
1940
- }
1941
-
1942
- &--dark {
1943
- background-color: $banana-bread;
1944
- color: $brand-black;
1945
-
1946
- &:hover {
1947
- background-color: $banana-bread;
1948
- color: $brand-black;
1949
- }
1950
-
1951
- &:focus {
1952
- background-color: $banana-bread !important;
1953
- color: $brand-black !important;
1954
-
1955
- &::before {
1956
- border-color: $banana-bread;
1957
- }
1958
- }
1959
- }
1960
- }
1961
-
1962
- &--tablet-landscape {
1963
- display: none;
1964
- }
1965
- }
1966
-
1967
1594
  &__correct-icon {
1968
1595
  position: absolute;
1969
1596
  top: 12px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pocketprep/ui-kit",
3
- "version": "3.4.9",
3
+ "version": "3.4.10",
4
4
  "description": "Pocket Prep UI Kit",
5
5
  "author": "pocketprep",
6
6
  "scripts": {