@pocketprep/ui-kit 3.4.90 → 3.5.0

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.
Files changed (28) hide show
  1. package/dist/@pocketprep/ui-kit.js +14834 -16036
  2. package/dist/@pocketprep/ui-kit.js.map +1 -1
  3. package/dist/@pocketprep/ui-kit.umd.cjs +12 -12
  4. package/dist/@pocketprep/ui-kit.umd.cjs.map +1 -1
  5. package/dist/style.css +1 -1
  6. package/lib/components/Bundles/BundleSearch.vue +41 -11
  7. package/lib/components/Pagination/QuestionReviewPagination.vue +21 -19
  8. package/lib/components/Quiz/Question/ChoicesContainer.vue +95 -129
  9. package/lib/components/Quiz/Question/DropdownExplanation.vue +39 -53
  10. package/lib/components/Quiz/Question/Explanation.vue +47 -57
  11. package/lib/components/Quiz/Question/MatrixChoicesContainer.vue +211 -224
  12. package/lib/components/Quiz/Question/MatrixRadioGroup.vue +5 -4
  13. package/lib/components/Quiz/Question/MobileMatrixChoicesContainer.vue +321 -319
  14. package/lib/components/Quiz/Question/MobileMatrixRadioGroup.vue +7 -6
  15. package/lib/components/Quiz/Question/PassageAndImage.vue +32 -43
  16. package/lib/components/Quiz/Question/PassageAndImageDropdown.vue +32 -43
  17. package/lib/components/Quiz/Question/Paywall.vue +28 -39
  18. package/lib/components/Quiz/Question/QuestionContext.vue +23 -31
  19. package/lib/components/Quiz/Question/StatsSummary.vue +10 -20
  20. package/lib/components/Quiz/Question/Summary.vue +54 -64
  21. package/lib/components/Quiz/Question/composables.ts +71 -0
  22. package/lib/components/Quiz/Question/injectionSymbols.ts +69 -0
  23. package/lib/components/Quiz/Question.vue +788 -988
  24. package/lib/components/Quiz/QuizContainer.vue +36 -34
  25. package/lib/components/Quiz/question.d.ts +4 -4
  26. package/lib/directives.ts +27 -22
  27. package/lib/styles/_breakpoints.scss +6 -12
  28. package/package.json +4 -4
@@ -1,12 +1,12 @@
1
1
  <template>
2
2
  <div
3
3
  v-if="showExplanation && !showPaywall"
4
- v-breakpoint:questionEl="breakpoints"
4
+ v-breakpoint="breakpointsWithEl"
5
5
  v-dark="isDarkMode"
6
6
  class="uikit-question-explanation"
7
7
  >
8
8
  <div
9
- ref="explanation"
9
+ ref="explanationRef"
10
10
  v-dark="isDarkMode"
11
11
  class="uikit-question-explanation__explanation-title"
12
12
  tabindex="-1"
@@ -16,14 +16,14 @@
16
16
  <slot name="explanationTopExperiment" />
17
17
  <div
18
18
  v-dark="isDarkMode"
19
- v-breakpoint:questionEl="breakpoints"
19
+ v-breakpoint="breakpointsWithEl"
20
20
  class="uikit-question-explanation__explanation-text"
21
21
  v-html="explanation"
22
22
  />
23
23
  <img
24
24
  v-if="explanationImageUrl"
25
25
  v-dark="isDarkMode"
26
- v-breakpoint:questionEl="breakpoints"
26
+ v-breakpoint="breakpointsWithEl"
27
27
  class="uikit-question-explanation__explanation-image"
28
28
  :class="{
29
29
  'uikit-question-explanation__explanation-image--long-alt': explanationImageLongAlt,
@@ -33,7 +33,7 @@
33
33
  >
34
34
  <PocketButton
35
35
  v-if="explanationImageLongAlt"
36
- v-breakpoint:questionEl="breakpoints"
36
+ v-breakpoint="breakpointsWithEl"
37
37
  type="tertiary-small"
38
38
  class="uikit-question-explanation__toggle-explanation-img-description"
39
39
  :class="{
@@ -87,63 +87,53 @@
87
87
  </div>
88
88
  </template>
89
89
 
90
- <script lang="ts">
91
- import { Component, Emit, Prop, Vue } from 'vue-facing-decorator'
92
- import type { Study } from '@pocketprep/types'
90
+ <script setup lang="ts">
91
+ import { computed } from 'vue'
93
92
  import Icon from '../../Icons/Icon.vue'
94
93
  import PocketButton from '../../Buttons/Button.vue'
95
- import { breakpoint, dark } from '../../../directives'
96
- import type { TBreakPointsObject } from './../question'
94
+ import { dark as vDark, breakpoint as vBreakpoint } from '../../../directives'
97
95
  import { highlightKeywordsInText } from '../../../utils'
98
-
99
- @Component({
100
- components: {
101
- Icon,
102
- PocketButton,
103
- },
104
- directives: {
105
- dark,
106
- breakpoint,
107
- },
96
+ import { useQuestionContext } from './composables'
97
+
98
+ const emit = defineEmits<{
99
+ 'toggleExplanationImageLongAlt': []
100
+ 'toggleExplanation': []
101
+ }>()
102
+
103
+ const {
104
+ // questionEl is used by the breakpoint directive
105
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
106
+ questionEl,
107
+ question,
108
+ showExplanation,
109
+ showExplanationImageLongAlt,
110
+ showPaywall,
111
+ explanationImageUrl,
112
+ explanationImageAlt,
113
+ explanationImageLongAlt,
114
+ reference,
115
+ hideReferences,
116
+ isDarkMode,
117
+ reviewMode,
118
+ breakpointsWithEl,
119
+ keywordDefinitions,
120
+ } = useQuestionContext()
121
+
122
+ const explanation = computed(() => {
123
+ return highlightKeywordsInText({
124
+ text: question.value.explanation || '',
125
+ keywordDefinitions: keywordDefinitions.value,
126
+ isDarkMode: isDarkMode.value,
127
+ location: 'explanation',
128
+ })
108
129
  })
109
- export default class Explanation extends Vue {
110
- @Prop() question!: Study.Class.QuestionJSON
111
- @Prop({ default: false }) showExplanation!: boolean
112
- @Prop({ default: false }) showPaywall!: boolean
113
- @Prop({ default: false }) showExplanationImageLongAlt!: boolean
114
- @Prop({ default: null }) explanationImageUrl!: string | null
115
- @Prop({ default: undefined }) explanationImageAlt!: string | undefined
116
- @Prop({ default: undefined }) explanationImageLongAlt!: string | undefined
117
- @Prop({ default: false }) reviewMode!: boolean
118
- @Prop({ default: undefined }) reference!: string | undefined
119
- @Prop({ default: false }) hideReferences!: boolean
120
- @Prop({ default: false }) isDarkMode!: boolean
121
- @Prop({ default: null }) questionEl!: Element | null
122
- @Prop({ default: {
123
- 'mobile': 767,
124
- 'tablet-portrait': 1023,
125
- 'tablet-landscape': 1439,
126
- } }) breakpoints!: TBreakPointsObject
127
- @Prop({ default: [] }) keywordDefinitions!: { keyword: string; definition: string }[]
128
-
129
- get explanation () {
130
- return highlightKeywordsInText({
131
- text: this.question.explanation || '',
132
- keywordDefinitions: this.keywordDefinitions,
133
- isDarkMode: this.isDarkMode,
134
- location: 'explanation',
135
- })
136
- }
137
-
138
- @Emit('toggleExplanationImageLongAlt')
139
- toggleExplanationImageLongAlt () {
140
- return
141
- }
142
130
 
143
- @Emit('toggleExplanation')
144
- toggleExplanation () {
145
- return
146
- }
131
+ const toggleExplanationImageLongAlt = () => {
132
+ emit('toggleExplanationImageLongAlt')
133
+ }
134
+
135
+ const toggleExplanation = () => {
136
+ emit('toggleExplanation')
147
137
  }
148
138
  </script>
149
139