@pocketprep/ui-kit 3.4.90 → 3.5.1

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 (88) hide show
  1. package/README.md +2 -2
  2. package/dist/@pocketprep/ui-kit.css +1 -0
  3. package/dist/@pocketprep/ui-kit.js +16490 -18228
  4. package/dist/@pocketprep/ui-kit.js.map +1 -1
  5. package/dist/@pocketprep/ui-kit.umd.cjs +11 -11
  6. package/dist/@pocketprep/ui-kit.umd.cjs.map +1 -1
  7. package/eslint.config.ts +111 -0
  8. package/lib/components/Banners/Banner.vue +2 -2
  9. package/lib/components/Bundles/BundleList.vue +1 -1
  10. package/lib/components/Bundles/BundleSearch.vue +43 -12
  11. package/lib/components/Bundles/PremiumPill.vue +2 -2
  12. package/lib/components/Buttons/Button.vue +19 -18
  13. package/lib/components/Buttons/Link.vue +9 -8
  14. package/lib/components/Buttons/Tab.vue +4 -3
  15. package/lib/components/Calendar/Calendar.vue +14 -2
  16. package/lib/components/Charts/Bar.vue +3 -3
  17. package/lib/components/Charts/Pie.vue +4 -4
  18. package/lib/components/Controls/SegmentControl.vue +8 -7
  19. package/lib/components/Controls/Slider.vue +2 -3
  20. package/lib/components/Controls/ToggleSwitch.vue +3 -2
  21. package/lib/components/EmptyStates/EmptyState.vue +3 -2
  22. package/lib/components/Exams/ExamCard.vue +3 -3
  23. package/lib/components/Exams/ExamMenuCard.vue +2 -2
  24. package/lib/components/Filters/FilterDropdown.vue +2 -2
  25. package/lib/components/Filters/FilterOptions.vue +2 -2
  26. package/lib/components/Forms/Checkbox.vue +2 -2
  27. package/lib/components/Forms/CheckboxOption.vue +2 -2
  28. package/lib/components/Forms/Errors.vue +2 -2
  29. package/lib/components/Forms/Input.vue +2 -2
  30. package/lib/components/Forms/Radio.vue +37 -39
  31. package/lib/components/Forms/RadioButton.vue +1 -1
  32. package/lib/components/Forms/Select.vue +7 -6
  33. package/lib/components/Forms/Textarea.vue +2 -2
  34. package/lib/components/Icons/Icon.vue +1 -0
  35. package/lib/components/Icons/IconEdit.vue +4 -2
  36. package/lib/components/Icons/IconFullViewActive.vue +1 -1
  37. package/lib/components/Icons/IconLoading2.vue +1 -3
  38. package/lib/components/Loaders/SkeletonLoader.vue +2 -2
  39. package/lib/components/Messaging/InfoMessage.vue +2 -2
  40. package/lib/components/Modal/Modal.vue +2 -2
  41. package/lib/components/Modal/ModalContainer.vue +2 -2
  42. package/lib/components/Onboarding/EmailAuth.vue +5 -5
  43. package/lib/components/Onboarding/MagicCodeEntry.vue +3 -4
  44. package/lib/components/Pagination/QuestionReviewPagination.vue +23 -21
  45. package/lib/components/Pagination/TablePagination.vue +2 -2
  46. package/lib/components/Quiz/FlagToggle.vue +2 -2
  47. package/lib/components/Quiz/GlobalMetricsToggle.vue +3 -2
  48. package/lib/components/Quiz/KeyboardShortcutsButton.vue +1 -1
  49. package/lib/components/Quiz/KeyboardShortcutsModal.vue +1 -1
  50. package/lib/components/Quiz/Question/ChoicesContainer.vue +99 -132
  51. package/lib/components/Quiz/Question/DropdownExplanation.vue +41 -55
  52. package/lib/components/Quiz/Question/Explanation.vue +49 -59
  53. package/lib/components/Quiz/Question/MatrixChoicesContainer.vue +208 -226
  54. package/lib/components/Quiz/Question/MatrixRadioGroup.vue +7 -6
  55. package/lib/components/Quiz/Question/MobileMatrixChoicesContainer.vue +315 -320
  56. package/lib/components/Quiz/Question/MobileMatrixRadioGroup.vue +14 -11
  57. package/lib/components/Quiz/Question/PassageAndImage.vue +34 -45
  58. package/lib/components/Quiz/Question/PassageAndImageDropdown.vue +39 -49
  59. package/lib/components/Quiz/Question/Paywall.vue +30 -41
  60. package/lib/components/Quiz/Question/QuestionContext.vue +24 -33
  61. package/lib/components/Quiz/Question/StatsSummary.vue +12 -22
  62. package/lib/components/Quiz/Question/Summary.vue +56 -66
  63. package/lib/components/Quiz/Question/composables.ts +71 -0
  64. package/lib/components/Quiz/Question/injectionSymbols.ts +69 -0
  65. package/lib/components/Quiz/Question.vue +810 -1009
  66. package/lib/components/Quiz/QuizContainer.vue +63 -67
  67. package/lib/components/Quiz/QuizProgress.vue +73 -77
  68. package/lib/components/Quiz/QuizProgressBar.vue +3 -2
  69. package/lib/components/Quiz/question.d.ts +4 -4
  70. package/lib/components/Search/Pill.vue +2 -2
  71. package/lib/components/Search/Search.vue +2 -2
  72. package/lib/components/SidePanels/SidePanel.vue +8 -3
  73. package/lib/components/Tables/Table.vue +4 -3
  74. package/lib/components/Tables/TableActions.vue +3 -3
  75. package/lib/components/Tags/Tag.vue +2 -2
  76. package/lib/components/Toasts/Toast.vue +5 -3
  77. package/lib/components/Tooltips/OverflowTooltip.vue +2 -2
  78. package/lib/components/Tooltips/Tooltip.vue +2 -2
  79. package/lib/directives.ts +28 -23
  80. package/lib/pocketprep-export.module.scss +3 -2
  81. package/lib/pocketprep.scss +2 -2
  82. package/lib/styles/_breakpoints.scss +12 -24
  83. package/lib/styles/_colors.scss +0 -1
  84. package/package.json +38 -29
  85. package/stylelint.config.js +38 -0
  86. package/.eslintrc.cjs +0 -74
  87. package/dist/style.css +0 -1
  88. package/stylelint.config.cjs +0 -22
@@ -1,28 +1,31 @@
1
1
  <script setup lang="ts">
2
2
  import RadioButton from '../../Forms/RadioButton.vue'
3
3
  import { dark as vDark } from '../../../directives'
4
+ import type { TMatrixChoiceKey } from '../question'
4
5
 
5
6
  interface Props {
6
- isDarkMode: boolean
7
- choices: string[]
8
- labels: string[]
9
- showAnswers: boolean
10
- disabled: boolean
7
+ isDarkMode?: boolean
8
+ choices?: TMatrixChoiceKey[]
9
+ labels?: string[]
10
+ showAnswers?: boolean
11
+ disabled?: boolean
11
12
  }
12
13
 
13
14
  const props = withDefaults(defineProps<Props>(), {
14
15
  isDarkMode: false,
16
+ choices: () => [],
17
+ labels: () => [],
15
18
  showAnswers: false,
16
19
  disabled: false,
17
20
  })
18
21
 
19
- const selectedChoice = defineModel<string>()
22
+ const selectedChoice = defineModel<TMatrixChoiceKey | null>({ default: null })
20
23
 
21
- const selectChoice = (choiceKey: string) => {
24
+ const selectChoice = (choiceKey: TMatrixChoiceKey) => {
22
25
  selectedChoice.value = choiceKey
23
26
  }
24
27
 
25
- const radioButtonColor = (choice: string) => {
28
+ const radioButtonColor = (choice: TMatrixChoiceKey) => {
26
29
  if (props.showAnswers) {
27
30
  if (choice === selectedChoice.value && selectedChoice.value?.startsWith('a')) {
28
31
  return 'green'
@@ -52,7 +55,7 @@ const stripHtmlTags = (string?: string) => {
52
55
 
53
56
  <template>
54
57
  <ul
55
- v-if="choices.length"
58
+ v-if="choices && choices.length"
56
59
  class="uikit-mobile-matrix-radio-group"
57
60
  v-dark="isDarkMode"
58
61
  role="radiogroup"
@@ -90,8 +93,8 @@ const stripHtmlTags = (string?: string) => {
90
93
  </template>
91
94
 
92
95
  <style lang="scss" scoped>
93
- @import '../../../styles/breakpoints';
94
- @import '../../../styles/colors';
96
+ @use '@/styles/breakpoints' as *;
97
+ @use '@/styles/colors' as *;
95
98
 
96
99
  .uikit-mobile-matrix-radio-group {
97
100
  list-style: none;
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div
3
3
  v-if="showPassageAndImage"
4
- v-breakpoint:questionEl="breakpoints"
4
+ v-breakpoint="breakpointsWithEl"
5
5
  class="uikit-question-passage-and-image"
6
6
  >
7
7
  <div
@@ -20,14 +20,14 @@
20
20
  <img
21
21
  v-if="passageImageUrl"
22
22
  v-dark="isDarkMode"
23
- v-breakpoint:questionEl="breakpoints"
23
+ v-breakpoint="breakpointsWithEl"
24
24
  class="uikit-question-passage-and-image__image"
25
25
  :src="passageImageUrl"
26
26
  :alt="`${passageImageAlt}. Extended image description below.`"
27
27
  >
28
28
  <PocketButton
29
29
  v-if="passageImageLongAlt"
30
- v-breakpoint:questionEl="breakpoints"
30
+ v-breakpoint="breakpointsWithEl"
31
31
  type="tertiary-small"
32
32
  class="uikit-question-passage-and-image__toggle-passage-image-description"
33
33
  :is-dark-mode="isDarkMode"
@@ -66,55 +66,44 @@
66
66
  </div>
67
67
  </template>
68
68
 
69
- <script lang="ts">
70
- import { Component, Emit, Prop, Vue } from 'vue-facing-decorator'
71
- import type { Study } from '@pocketprep/types'
69
+ <script setup lang="ts">
72
70
  import Icon from '../../Icons/Icon.vue'
73
71
  import PocketButton from '../../Buttons/Button.vue'
74
- import { breakpoint, dark } from '../../../directives'
75
- import type { TQuestionPassageAndImageTitle, TBreakPointsObject } from './../question'
76
-
77
- @Component({
78
- components: {
79
- Icon,
80
- PocketButton,
81
- },
82
- directives: {
83
- dark,
84
- breakpoint,
85
- },
86
- })
87
- export default class PassageAndImage extends Vue {
88
- @Prop() question!: Study.Class.QuestionJSON
89
- @Prop({ default: false }) showPassageImageLongAlt!: boolean
90
- @Prop({ default: false }) showPassageAndImage!: boolean
91
- @Prop({ default: null }) passageImageUrl!: string | null
92
- @Prop({ default: '' }) passageImageLongAlt!: string | undefined
93
- @Prop({ default: '' }) passageImageAlt!: string | undefined
94
- @Prop({ default: 'Passage' }) passageAndImageTitle!: TQuestionPassageAndImageTitle
95
- @Prop({ default: false }) isDarkMode!: boolean
96
- @Prop({ default: null }) questionEl!: Element | null
97
- @Prop({ default: {
98
- 'mobile': 767,
99
- 'tablet-portrait': 1023,
100
- 'tablet-landscape': 1439,
101
- } }) breakpoints!: TBreakPointsObject
102
-
103
- @Emit('emitTogglePassageImageLongAlt')
104
- emitTogglePassageImageLongAlt () {
105
- return
106
- }
72
+ import { dark as vDark, breakpoint as vBreakpoint } from '../../../directives'
73
+ import { useQuestionContext } from './composables'
74
+
75
+ const emit = defineEmits<{
76
+ 'emitTogglePassageImageLongAlt': []
77
+ 'emitMoveFocusToPrompt': []
78
+ }>()
79
+
80
+ const {
81
+ // questionEl is used by the breakpoint directive
82
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
83
+ questionEl,
84
+ question,
85
+ showPassageImageLongAlt,
86
+ showPassageAndImage,
87
+ passageImageUrl,
88
+ passageImageLongAlt,
89
+ passageImageAlt,
90
+ passageAndImageTitle,
91
+ isDarkMode,
92
+ breakpointsWithEl,
93
+ } = useQuestionContext()
94
+
95
+ const emitTogglePassageImageLongAlt = () => {
96
+ emit('emitTogglePassageImageLongAlt')
97
+ }
107
98
 
108
- @Emit('emitMoveFocusToPrompt')
109
- emitMoveFocusToPrompt () {
110
- return
111
- }
99
+ const emitMoveFocusToPrompt = () => {
100
+ emit('emitMoveFocusToPrompt')
112
101
  }
113
102
  </script>
114
103
 
115
104
  <style lang="scss">
116
- @import '../../../styles/colors';
117
- @import '../../../styles/breakpoints';
105
+ @use '@/styles/breakpoints' as *;
106
+ @use '@/styles/colors' as *;
118
107
 
119
108
  .uikit-question-passage-and-image {
120
109
  position: relative;
@@ -2,7 +2,7 @@
2
2
  <div
3
3
  v-if="question.passage || passageImageUrl"
4
4
  ref="uikit-question-passage-and-image-dropdown"
5
- v-breakpoint:questionEl="breakpoints"
5
+ v-breakpoint="breakpointsWithEl"
6
6
  v-dark="isDarkMode"
7
7
  class="uikit-question-passage-and-image-dropdown"
8
8
  >
@@ -45,12 +45,12 @@
45
45
  </div>
46
46
  <div
47
47
  v-if="showPassageImageDropdown"
48
- v-breakpoint:questionEl="breakpoints"
48
+ v-breakpoint="breakpointsWithEl"
49
49
  class="uikit-question-passage-and-image-dropdown__passage-and-image-dropdown-container"
50
50
  >
51
51
  <div
52
52
  v-if="question.passage"
53
- v-breakpoint:questionEl="breakpoints"
53
+ v-breakpoint="breakpointsWithEl"
54
54
  class="uikit-question-passage-and-image-dropdown__passage-dropdown-passage"
55
55
  :class="{
56
56
  'uikit-question-passage-and-image-dropdown__passage-dropdown-passage--with-image': passageImageUrl,
@@ -69,7 +69,7 @@
69
69
  >
70
70
  <PocketButton
71
71
  v-if="passageImageLongAlt"
72
- v-breakpoint:questionEl="breakpoints"
72
+ v-breakpoint="breakpointsWithEl"
73
73
  type="tertiary-small"
74
74
  class="uikit-question-passage-and-image-dropdown__toggle-img-dropdown-img-description"
75
75
  :class="{
@@ -98,7 +98,7 @@
98
98
  <div
99
99
  v-if="showPassageImageLongAlt"
100
100
  ref="uikit-question-passage-and-image-dropdown__img-dropdown-img-description"
101
- v-breakpoint:questionEl="breakpoints"
101
+ v-breakpoint="breakpointsWithEl"
102
102
  v-dark="isDarkMode"
103
103
  class="uikit-question-passage-and-image-dropdown__img-dropdown-img-description"
104
104
  tabindex="-1"
@@ -108,52 +108,42 @@
108
108
  </div>
109
109
  </template>
110
110
 
111
- <script lang="ts">
112
- import { Component, Emit, Prop, Vue } from 'vue-facing-decorator'
113
- import type { Study } from '@pocketprep/types'
111
+ <script setup lang="ts">
114
112
  import Icon from '../../Icons/Icon.vue'
115
113
  import PocketButton from '../../Buttons/Button.vue'
116
- import { breakpoint, dark } from '../../../directives'
117
- import type { TQuestionPassageAndImageTitle, TBreakPointsObject } from './../question'
118
-
119
- @Component({
120
- components: {
121
- Icon,
122
- PocketButton,
123
- },
124
- directives: {
125
- dark,
126
- breakpoint,
127
- },
128
- })
129
- export default class PassageAndImageDropdown extends Vue {
130
- @Prop({ default: false }) isDarkMode!: boolean
131
- @Prop() question!: Study.Class.QuestionJSON
132
- @Prop({ default: '' }) imageUrlPrefix!: string
133
- @Prop({ default: null }) passageImageUrl!: string | null
134
- @Prop({ default: false }) showPassageImageLongAlt!: boolean
135
- @Prop({ default: '' }) passageImageLongAlt!: string | undefined
136
- @Prop({ default: '' }) passageImageAlt!: string | undefined
137
- @Prop({ default: 'Passage' }) passageAndImageTitle!: TQuestionPassageAndImageTitle
138
- @Prop({ default: null }) questionEl!: Element | null
139
- @Prop({ default: {
140
- 'mobile': 767,
141
- 'tablet-portrait': 1023,
142
- 'tablet-landscape': 1439,
143
- } }) breakpoints!: TBreakPointsObject
144
-
145
- showPassageImageDropdown = false
146
-
147
- @Emit('togglePassageImageLongAltDropdown')
148
- togglePassageImageLongAltDropdown () {
149
- return
150
- }
114
+ import { dark as vDark, breakpoint as vBreakpoint } from '../../../directives'
115
+ import { useQuestionContext } from './composables'
116
+ import { ref } from 'vue'
117
+
118
+ const emit = defineEmits<{
119
+ 'togglePassageImageLongAltDropdown': []
120
+ }>()
121
+
122
+ const {
123
+ // questionEl is used by the breakpoint directive
124
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
125
+ questionEl,
126
+ question,
127
+ isDarkMode,
128
+ passageImageUrl,
129
+ passageImageAlt,
130
+ passageImageLongAlt,
131
+ showPassageImageLongAlt,
132
+ passageAndImageTitle,
133
+ breakpointsWithEl,
134
+ } = useQuestionContext()
135
+
136
+ const showPassageImageDropdown = ref(false)
137
+
138
+ const togglePassageImageLongAltDropdown = () => {
139
+ emit('togglePassageImageLongAltDropdown')
151
140
  }
152
141
  </script>
153
142
 
154
143
  <style lang="scss">
155
- @import '../../../styles/colors';
156
- @import '../../../styles/breakpoints';
144
+ @use 'sass:color';
145
+ @use '@/styles/breakpoints' as *;
146
+ @use '@/styles/colors' as *;
157
147
 
158
148
  .uikit-question-passage-and-image-dropdown {
159
149
  &__passage-and-image-dropdown-btn {
@@ -172,11 +162,11 @@ export default class PassageAndImageDropdown extends Vue {
172
162
 
173
163
  &:hover {
174
164
  .uikit-question-passage-and-image-dropdown__passage-and-image-dropdown-text {
175
- color: mix($brand-blue, black, 90%);
165
+ color: color.mix($brand-blue, black, 90%);
176
166
  }
177
167
 
178
168
  .uikit-question-passage-and-image-dropdown__passage-and-image-dropdown-arrow {
179
- color: mix($brand-blue, black, 90%);
169
+ color: color.mix($brand-blue, black, 90%);
180
170
  }
181
171
 
182
172
  &::before {
@@ -272,7 +262,7 @@ export default class PassageAndImageDropdown extends Vue {
272
262
  line-height: 24px;
273
263
  font-size: 16px;
274
264
  font-weight: 400;
275
- letter-spacing: -0.1;
265
+ letter-spacing: -0.1px;
276
266
 
277
267
  &--mobile {
278
268
  line-height: 24px;
@@ -326,7 +316,7 @@ export default class PassageAndImageDropdown extends Vue {
326
316
  font-size: 15px;
327
317
  line-height: 22px;
328
318
  font-weight: 500;
329
- letter-spacing: -0.2;
319
+ letter-spacing: -0.2px;
330
320
 
331
321
  &--dark {
332
322
  color: $fog;
@@ -4,19 +4,19 @@
4
4
  >
5
5
  <div
6
6
  v-dark="isDarkMode"
7
- v-breakpoint:questionEl="breakpoints"
7
+ v-breakpoint="breakpointsWithEl"
8
8
  class="uikit-question-paywall__paywall"
9
9
  :class="{ 'uikit-question-paywall__paywall--review': reviewMode }"
10
10
  >
11
11
  <img
12
- v-breakpoint:questionEl="breakpoints"
12
+ v-breakpoint="breakpointsWithEl"
13
13
  :src="isDarkMode ? paywallImages['dark'] : paywallImages['light']"
14
14
  alt=""
15
15
  class="uikit-question-paywall__paywall-image"
16
16
  >
17
17
  <div
18
18
  v-dark="isDarkMode"
19
- v-breakpoint:questionEl="breakpoints"
19
+ v-breakpoint="breakpointsWithEl"
20
20
  class="uikit-question-paywall__paywall-text"
21
21
  >
22
22
  You need a Premium Subscription to view this question's answer and explanation.
@@ -32,53 +32,42 @@
32
32
  </div>
33
33
  </template>
34
34
 
35
- <script lang="ts">
36
- import { Component, Vue, Prop, Emit } from 'vue-facing-decorator'
37
- import Icon from '../../Icons/Icon.vue'
35
+ <script setup lang="ts">
36
+ import { computed } from 'vue'
38
37
  import PocketButton from '../../Buttons/Button.vue'
39
- import { dark, breakpoint } from '../../../directives'
40
- import type { TBreakPointsObject } from './../question'
41
38
  import PaywallImageLight from '../../../assets/question/paywall-light.png'
42
39
  import PaywallImageDark from '../../../assets/question/paywall-dark.png'
43
-
44
- @Component({
45
- components: {
46
- Icon,
47
- PocketButton,
48
- },
49
- directives: {
50
- dark,
51
- breakpoint,
52
- },
53
- })
54
- export default class Paywall extends Vue {
55
- @Prop({ default: false }) reviewMode!: boolean
56
- @Prop({ default: false }) isDarkMode!: boolean
57
- @Prop({ default: null }) questionEl!: Element | null
58
- @Prop({ default: {
59
- 'mobile': 767,
60
- 'tablet-portrait': 1023,
61
- 'tablet-landscape': 1439,
62
- } }) breakpoints!: TBreakPointsObject
63
-
64
- get paywallImages () {
65
- return {
66
- light: PaywallImageLight,
67
- dark: PaywallImageDark,
68
- }
40
+ import { dark as vDark, breakpoint as vBreakpoint } from '../../../directives'
41
+ import { useQuestionContext } from './composables'
42
+
43
+ const emit = defineEmits<{
44
+ 'upgradeClicked': []
45
+ }>()
46
+
47
+ const {
48
+ // questionEl is used by the breakpoint directive
49
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
50
+ questionEl,
51
+ isDarkMode,
52
+ reviewMode,
53
+ breakpointsWithEl,
54
+ } = useQuestionContext()
55
+
56
+ const paywallImages = computed(() => {
57
+ return {
58
+ light: PaywallImageLight,
59
+ dark: PaywallImageDark,
69
60
  }
61
+ })
70
62
 
71
- @Emit('upgradeClicked')
72
- emitUpgradeClick () {
73
- return true
74
- }
63
+ const emitUpgradeClick = () => {
64
+ emit('upgradeClicked')
75
65
  }
76
-
77
66
  </script>
78
67
 
79
68
  <style lang="scss">
80
- @import '../../../styles/colors';
81
- @import '../../../styles/breakpoints';
69
+ @use '@/styles/breakpoints' as *;
70
+ @use '@/styles/colors' as *;
82
71
 
83
72
  .uikit-question-paywall {
84
73
  width: 100%;
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div
3
3
  ref="uikit-question-context"
4
- v-breakpoint:questionEl="breakpoints"
4
+ v-breakpoint="breakpointsWithEl"
5
5
  class="uikit-question-context"
6
6
  tabindex="-1"
7
7
  >
@@ -51,50 +51,41 @@
51
51
  </h2>
52
52
  <div
53
53
  class="uikit-question-context__tag"
54
- v-breakpoint:questionEl="breakpoints"
54
+ v-breakpoint="breakpointsWithEl"
55
55
  >
56
56
  <slot name="tag" />
57
57
  </div>
58
58
  </div>
59
59
  </template>
60
60
 
61
- <script lang="ts">
62
- import { Component, Vue, Prop } from 'vue-facing-decorator'
61
+ <script setup lang="ts">
63
62
  import Icon from '../../Icons/Icon.vue'
64
- import { dark, breakpoint } from '../../../directives'
65
- import type { TQuizMode, TContextIcon, TBreakPointsObject } from './../question'
66
-
67
- @Component({
68
- components: {
69
- Icon,
70
- },
71
- directives: {
72
- dark,
73
- breakpoint,
74
- },
63
+ import { dark as vDark, breakpoint as vBreakpoint } from '../../../directives'
64
+ import { useQuestionContext } from './composables'
65
+
66
+ const {
67
+ // questionEl is used by the breakpoint directive
68
+ questionEl,
69
+ breakpointsWithEl,
70
+ quizLength,
71
+ quizMode,
72
+ questionNumber,
73
+ isDarkMode,
74
+ isCorrect,
75
+ contextIconType,
76
+ showAnswers,
77
+ showMatrixAnswers,
78
+ } = useQuestionContext()
79
+
80
+ defineExpose({
81
+ questionEl,
75
82
  })
76
- export default class QuestionContext extends Vue {
77
- @Prop() quizLength!: number
78
- @Prop({ default: 'quick10' }) quizMode!: TQuizMode
79
- @Prop() questionNumber!: number
80
- @Prop({ default: false }) isDarkMode!: boolean
81
- @Prop({ default: false }) isCorrect!: boolean
82
- @Prop() contextIconType!: TContextIcon
83
- @Prop({ default: null }) questionEl!: Element | null
84
- @Prop({ default: false }) showAnswers!: boolean
85
- @Prop({ default: false }) showMatrixAnswers!: boolean
86
- @Prop({ default: {
87
- 'mobile': 767,
88
- 'tablet-portrait': 1023,
89
- 'tablet-landscape': 1439,
90
- } }) breakpoints!: TBreakPointsObject
91
- }
92
83
 
93
84
  </script>
94
85
 
95
86
  <style lang="scss">
96
- @import '../../../styles/colors';
97
- @import '../../../styles/breakpoints';
87
+ @use '@/styles/breakpoints' as *;
88
+ @use '@/styles/colors' as *;
98
89
 
99
90
  .uikit-question-context {
100
91
  display: flex;
@@ -28,32 +28,22 @@
28
28
  </div>
29
29
  </template>
30
30
 
31
- <script lang="ts">
32
- import { Component, Vue, Prop } from 'vue-facing-decorator'
33
- import type { Study } from '@pocketprep/types'
34
- import { dark, breakpoint } from '../../../directives'
35
- import type { TChoiceScores, TMatrixChoiceScores } from './../question'
36
-
37
-
38
- @Component({
39
- directives: {
40
- dark,
41
- breakpoint,
42
- },
43
- })
44
- export default class StatsSummary extends Vue {
45
- @Prop({ default: null }) globalMetrics!: Study.Class.GlobalQuestionMetricJSON | null
46
- @Prop() choiceScores!: TChoiceScores
47
- @Prop({ default: false }) isDarkMode!: boolean
48
- @Prop({ default: false }) isMatrixQuestion!: boolean
49
- @Prop() matrixChoiceScores!: TMatrixChoiceScores
50
- }
31
+ <script setup lang="ts">
32
+ import { dark as vDark } from '../../../directives'
33
+ import { useQuestionContext } from './composables'
51
34
 
35
+ const {
36
+ globalMetrics,
37
+ choiceScores,
38
+ isDarkMode,
39
+ isMatrixQuestion,
40
+ matrixChoiceScores,
41
+ } = useQuestionContext()
52
42
  </script>
53
43
 
54
44
  <style lang="scss">
55
- @import '../../../styles/colors';
56
- @import '../../../styles/breakpoints';
45
+ @use '@/styles/breakpoints' as *;
46
+ @use '@/styles/colors' as *;
57
47
 
58
48
  .uikit-question-stats-summary {
59
49
  margin-top: 24px;