@pocketprep/ui-kit 3.4.53 → 3.4.55

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.
@@ -169,7 +169,11 @@
169
169
  :keyword-definitions="keywordDefinitions"
170
170
  @toggleDropdownExplanationImageLongAlt="toggleDropdownExplanationImageLongAlt"
171
171
  @click="handleClick"
172
- />
172
+ >
173
+ <template #explanationTopExperiment>
174
+ <slot name="explanationTopExperiment"></slot>
175
+ </template>
176
+ </DropdownExplanation>
173
177
  </div>
174
178
  <template v-if="!globalMetrics">
175
179
  <div
@@ -7,6 +7,7 @@
7
7
  'uikit-question-dropdown-explanation__dropdown-explanation--show-stats': globalMetrics
8
8
  }"
9
9
  >
10
+ <slot name="explanationTopExperiment"></slot>
10
11
  <div
11
12
  v-dark="isDarkMode"
12
13
  class="uikit-question-dropdown-explanation__dropdown-explanation-text"
@@ -113,7 +114,7 @@ export default class DropdownExplanation extends Vue {
113
114
  text: this.question.explanation || '',
114
115
  keywordDefinitions: this.keywordDefinitions,
115
116
  isDarkMode: this.isDarkMode,
116
- location: 'dropdown-explanation',
117
+ location: 'explanation',
117
118
  })
118
119
  }
119
120
 
@@ -174,6 +175,12 @@ export default class DropdownExplanation extends Vue {
174
175
  line-height: 24px;
175
176
  font-weight: 400;
176
177
  padding-bottom: 6px;
178
+
179
+ .keyword-highlight {
180
+ span {
181
+ font-size: 16px;
182
+ }
183
+ }
177
184
 
178
185
  p {
179
186
  margin: 10px 0;
@@ -13,6 +13,7 @@
13
13
  >
14
14
  Explanation Details
15
15
  </div>
16
+ <slot name="explanationTopExperiment"></slot>
16
17
  <div
17
18
  v-dark="isDarkMode"
18
19
  v-breakpoint:questionEl="breakpoints"
@@ -233,6 +234,12 @@ export default class Explanation extends Vue {
233
234
  margin-bottom: 24px;
234
235
  word-break: break-word;
235
236
 
237
+ .keyword-highlight {
238
+ span {
239
+ font-size: 16.5px;
240
+ }
241
+ }
242
+
236
243
  &--dark {
237
244
  color: $white;
238
245
  }
@@ -372,8 +372,9 @@ export default class MobileMatrixChoicesContainer extends Vue {
372
372
  this.matrixRadioGrid &&
373
373
  this.matrixRadioGrid[rowIndex]
374
374
  ) {
375
- if (this.matrixRadioGrid[rowIndex] && this.matrixRadioGrid[rowIndex].value) {
376
- return this.matrixRadioGrid[rowIndex].value.startsWith('a')
375
+ const rowVal = this.matrixRadioGrid[rowIndex].value
376
+ if (rowVal) {
377
+ return rowVal.startsWith('a')
377
378
  }
378
379
  return false
379
380
  }
@@ -38,10 +38,11 @@
38
38
  ref="uikit-question-summary__summary-dropdown-explanation"
39
39
  class="uikit-question-summary__summary-dropdown-explanation"
40
40
  >
41
+ <slot name="explanationTopExperiment"></slot>
41
42
  <div
42
43
  v-dark="isDarkMode"
43
44
  class="uikit-question-summary__summary-dropdown-explanation-text"
44
- v-html="question.explanation"
45
+ v-html="summary"
45
46
  />
46
47
  <img
47
48
  v-if="explanationImageUrl"
@@ -118,6 +119,7 @@ import Icon from '../../Icons/Icon.vue'
118
119
  import PocketButton from '../../Buttons/Button.vue'
119
120
  import { breakpoint, dark } from '../../../directives'
120
121
  import type { TBreakPointsObject } from './../question'
122
+ import { highlightKeywordsInText } from '../../../utils'
121
123
 
122
124
  @Component({
123
125
  components: {
@@ -150,11 +152,21 @@ export default class Summary extends Vue {
150
152
  'tablet-portrait': 1023,
151
153
  'tablet-landscape': 1439,
152
154
  } }) breakpoints!: TBreakPointsObject
155
+ @Prop({ default: [] }) keywordDefinitions!: { keyword: string; definition: string }[]
153
156
 
154
157
  get isQuestionCorrect () {
155
158
  return (!this.isMatrixQuestion && this.isCorrect) || (this.isMatrixQuestion && this.isMatrixQuestionCorrect)
156
159
  }
157
160
 
161
+ get summary () {
162
+ return highlightKeywordsInText({
163
+ text: this.question.explanation || '',
164
+ keywordDefinitions: this.keywordDefinitions,
165
+ isDarkMode: this.isDarkMode,
166
+ location: 'explanation',
167
+ })
168
+ }
169
+
158
170
  @Emit('toggleSummaryExplanation')
159
171
  toggleSummaryExplanation () {
160
172
  return
@@ -296,6 +308,12 @@ export default class Summary extends Vue {
296
308
  margin: 0;
297
309
  }
298
310
  }
311
+
312
+ .keyword-highlight {
313
+ span {
314
+ font-size: 16px;
315
+ }
316
+ }
299
317
  }
300
318
 
301
319
  &__summary-dropdown-explanation-image {
@@ -194,6 +194,9 @@
194
194
  @toggleDropdownExplanationImageLongAlt="toggleExplanationImageLongAlt"
195
195
  @click="keywordClick"
196
196
  >
197
+ <template #explanationTopExperiment>
198
+ <slot name="explanationTopExperiment"></slot>
199
+ </template>
197
200
  <template #motivationalMoment="{
198
201
  isCorrect,
199
202
  choiceKey,
@@ -317,9 +320,15 @@
317
320
  :is-dark-mode="isDarkMode"
318
321
  :question-el="questionEl"
319
322
  :breakpoints="breakpoints"
323
+ :keyword-definitions="keywordDefinitions"
324
+ @click="keywordClick"
320
325
  @toggleSummaryExplanation="toggleExplanation"
321
326
  @toggleSummaryExplanationImageLongAlt="toggleExplanationImageLongAlt"
322
- />
327
+ >
328
+ <template #explanationTopExperiment>
329
+ <slot name="explanationTopExperiment"></slot>
330
+ </template>
331
+ </Summary>
323
332
  <slot name="metricsTiles">
324
333
  <StatsSummary
325
334
  v-if="globalMetrics"
@@ -445,7 +454,11 @@
445
454
  @toggleExplanationImageLongAlt="toggleExplanationImageLongAlt"
446
455
  @toggleExplanation="toggleExplanation"
447
456
  @click="keywordClick"
448
- />
457
+ >
458
+ <template #explanationTopExperiment>
459
+ <slot name="explanationTopExperiment"></slot>
460
+ </template>
461
+ </Explanation>
449
462
  </div>
450
463
  </div>
451
464
  </template>
@@ -902,7 +915,7 @@ export default class Question extends Vue {
902
915
  keywordClick (event: MouseEvent) {
903
916
  const target = event.target as HTMLElement
904
917
  if (target.classList.contains('keyword-highlight')) {
905
- const keyword = target.innerHTML
918
+ const keyword = target.innerText
906
919
  const location = target.getAttribute('data-location')
907
920
  const clickLocation = { x: event.clientX, y: event.clientY }
908
921
  return {
@@ -1524,12 +1537,24 @@ export default class Question extends Vue {
1524
1537
  padding-right: 11px;
1525
1538
  font-size: 16.5px;
1526
1539
  line-height: 26px;
1540
+
1541
+ .keyword-highlight {
1542
+ span {
1543
+ font-size: 16.5px;
1544
+ }
1545
+ }
1527
1546
  }
1528
1547
 
1529
1548
  &--explanation#{&}--tablet-landscape {
1530
1549
  padding-top: 22px;
1531
1550
  font-size: 16px;
1532
1551
  line-height: 24px;
1552
+
1553
+ .keyword-highlight {
1554
+ span {
1555
+ font-size: 16px;
1556
+ }
1557
+ }
1533
1558
  }
1534
1559
  }
1535
1560
 
@@ -1545,13 +1570,11 @@ export default class Question extends Vue {
1545
1570
  }
1546
1571
 
1547
1572
  .keyword-highlight--dark.keyword-highlight--active {
1548
- height: 22px;
1549
1573
  background-color: rgba($banana-bread, 0.4);
1550
- border-bottom: none;
1574
+ border-color: transparent !important;
1551
1575
  border-radius: 2px;
1552
1576
 
1553
1577
  &[data-location="explanation"] {
1554
- height: 20px;
1555
1578
  background-color: rgba($banana-bread, 0.4);
1556
1579
  }
1557
1580
  }
@@ -1561,17 +1584,16 @@ export default class Question extends Vue {
1561
1584
  background-color: rgba($banana-bread, 0.25);
1562
1585
  border-radius: 2px 2px 0 0;
1563
1586
  border-bottom: 1.5px solid $banana-bread;
1564
- height: 21px;
1565
- line-height: 22px;
1566
- padding: 0 2px 0 1px;
1587
+ padding: 5.84px 2px 0 1px;
1567
1588
  margin: 0 -2px 0 -1px;
1568
1589
  cursor: pointer;
1590
+ font-size: 10px;
1591
+ line-height: 1;
1569
1592
 
1570
1593
  &[data-location="explanation"] {
1571
- height: 20px;
1572
- line-height: 21px;
1594
+ padding-top: 4.84px;
1573
1595
  background-color: $manilla;
1574
- border-radius: 1px 1px 0 0;
1596
+ border-radius: 2px 2px 0 0;
1575
1597
  }
1576
1598
 
1577
1599
  &:hover:not(&--active) {
@@ -1585,15 +1607,11 @@ export default class Question extends Vue {
1585
1607
  }
1586
1608
 
1587
1609
  &--active {
1588
- height: 22px;
1589
- line-height: 23px;
1590
1610
  background-color: $beach-sand;
1591
- border-bottom: none;
1611
+ border-color: $beach-sand;
1592
1612
  border-radius: 2px;
1593
1613
 
1594
1614
  &[data-location="explanation"] {
1595
- height: 20px;
1596
- line-height: 21px;
1597
1615
  background-color: $beach-sand;
1598
1616
  border-radius: 2px;
1599
1617
  }
@@ -1633,6 +1651,12 @@ export default class Question extends Vue {
1633
1651
  max-width: 492px;
1634
1652
  box-sizing: border-box;
1635
1653
 
1654
+ .keyword-highlight {
1655
+ span {
1656
+ font-size: 17.5px;
1657
+ }
1658
+ }
1659
+
1636
1660
  &--passage-and-image {
1637
1661
  &--mobile {
1638
1662
  margin-bottom: 14px;
package/lib/utils.ts CHANGED
@@ -83,7 +83,8 @@ export const highlightKeywordsInText = (params: {
83
83
  return acc.replace(
84
84
  regex,
85
85
  `$1<span class="keyword-highlight${params.isDarkMode
86
- ? ' keyword-highlight--dark' : ''}" data-location="${params.location}">$2</span>$3`
86
+ ? ' keyword-highlight--dark' : ''}" data-location="${
87
+ params.location}""><span style="pointer-events: none;">$2</span></span>$3`
87
88
  )
88
89
  }, params.text)
89
90
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pocketprep/ui-kit",
3
- "version": "3.4.53",
3
+ "version": "3.4.55",
4
4
  "description": "Pocket Prep UI Kit",
5
5
  "author": "pocketprep",
6
6
  "scripts": {