@pocketprep/ui-kit 3.4.0 → 3.4.2

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.
@@ -523,6 +523,7 @@ export default class Select extends Vue {
523
523
 
524
524
  &__input {
525
525
  cursor: text !important;
526
+ padding-right: 32px;
526
527
 
527
528
  &--error {
528
529
  border: 1px solid $red-pegasus;
@@ -535,6 +536,10 @@ export default class Select extends Vue {
535
536
 
536
537
  &__value {
537
538
  user-select: none;
539
+ overflow: hidden;
540
+ text-overflow: ellipsis;
541
+ white-space: nowrap;
542
+ padding-right: 32px;
538
543
 
539
544
  &--subtext {
540
545
  height: 60px;
@@ -0,0 +1,158 @@
1
+ <template>
2
+ <div
3
+ ref="uikit-question-context"
4
+ v-breakpoint:questionEl="breakpoints"
5
+ class="uikit-question-context"
6
+ tabindex="-1"
7
+ >
8
+ <slot name="contextIcon">
9
+ <Icon
10
+ v-dark="isDarkMode"
11
+ class="uikit-question-context__icon"
12
+ :type="contextIconType"
13
+ />
14
+ </slot>
15
+ <h2
16
+ v-if="quizMode === 'qotd'"
17
+ v-dark="isDarkMode"
18
+ class="uikit-question-context__text"
19
+ >
20
+ Question of the Day
21
+ </h2>
22
+ <h2
23
+ v-else
24
+ v-dark="isDarkMode"
25
+ class="uikit-question-context__text"
26
+ :aria-label="`Question ${
27
+ questionNumber
28
+ }${
29
+ quizMode !== 'timed'
30
+ ? ` of ${quizLength}`
31
+ : ''
32
+ }${
33
+ showAnswers
34
+ ? isCorrect
35
+ ? ', Answered Correctly'
36
+ : ', Answered Incorrectly'
37
+ : ''
38
+ }`"
39
+ aria-live="assertive"
40
+ >
41
+ <div class="uikit-question-context__current-index" aria-hidden="true">
42
+ Question {{ questionNumber }}
43
+ </div>
44
+ <div
45
+ v-if="quizMode !== 'timed'"
46
+ class="uikit-question-context__quiz-length"
47
+ aria-hidden="true"
48
+ >
49
+ / {{ quizLength }}
50
+ </div>
51
+ </h2>
52
+ <div
53
+ class="uikit-question-context__tag"
54
+ v-breakpoint:questionEl="breakpoints"
55
+ >
56
+ <slot name="tag" />
57
+ </div>
58
+ </div>
59
+ </template>
60
+
61
+ <script lang="ts">
62
+ import { Component, Vue, Prop } from 'vue-facing-decorator'
63
+ 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
+ },
75
+ })
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: {
86
+ 'mobile': 767,
87
+ 'tablet-portrait': 1023,
88
+ 'tablet-landscape': 1439,
89
+ } }) breakpoints!: TBreakPointsObject
90
+ }
91
+
92
+ </script>
93
+
94
+ <style lang="scss">
95
+ @import '../../../styles/colors';
96
+ @import '../../../styles/breakpoints';
97
+
98
+ .uikit-question-context {
99
+ display: flex;
100
+ flex-direction: column;
101
+ align-items: center;
102
+ flex-shrink: 0;
103
+ margin-bottom: 28px;
104
+ padding-top: 60px;
105
+ outline: none;
106
+
107
+ &--tablet-landscape {
108
+ padding-top: 42px;
109
+ }
110
+
111
+ &--tablet-portrait {
112
+ padding-top: 52px;
113
+ }
114
+
115
+ &--mobile {
116
+ padding-top: 22px;
117
+ margin-bottom: 28px;
118
+ }
119
+
120
+ &__icon {
121
+ margin-bottom: 8px;
122
+ margin-left: 6px;
123
+ color: $ash;
124
+
125
+ &--dark {
126
+ color: $fog;
127
+ }
128
+ }
129
+
130
+ &__tag {
131
+ margin-top: 8px;
132
+ margin-bottom: -5px;
133
+
134
+ &--mobile {
135
+ display: none;
136
+ }
137
+ }
138
+
139
+ &__text {
140
+ display: flex;
141
+ font-size: 14px;
142
+ font-weight: 600;
143
+ letter-spacing: 0.2px;
144
+ line-height: 17px;
145
+ color: $ash;
146
+ margin: 0;
147
+
148
+ &--dark {
149
+ color: $fog;
150
+ }
151
+ }
152
+
153
+ &__quiz-length {
154
+ margin-left: 5px;
155
+ font-weight: 500;
156
+ }
157
+ }
158
+ </style>
@@ -34,65 +34,27 @@
34
34
  }"
35
35
  >
36
36
  <slot name="context">
37
- <div
37
+ <QuestionContext
38
38
  ref="uikit-question__context"
39
39
  v-breakpoint:questionEl="breakpoints"
40
40
  class="uikit-question__context"
41
41
  tabindex="-1"
42
+ :quiz-length="quizLength"
43
+ :quiz-mode="quizMode"
44
+ :question-number="questionNumber"
45
+ :is-dark-mode="isDarkMode"
46
+ :context-icon-type="contextIconType"
47
+ :show-answers="showAnswers"
48
+ :question-el="questionEl"
49
+ :breakpoints="breakpoints"
42
50
  >
43
- <slot name="contextIcon">
44
- <Icon
45
- v-dark="isDarkMode"
46
- class="uikit-question__context-icon"
47
- :type="contextIconType"
48
- />
49
- </slot>
50
- <slot name="contextText">
51
- <h2
52
- v-if="quizMode === 'qotd'"
53
- v-dark="isDarkMode"
54
- class="uikit-question__context-text"
55
- >
56
- Question of the Day
57
- </h2>
58
- <h2
59
- v-else
60
- v-dark="isDarkMode"
61
- class="uikit-question__context-text"
62
- :aria-label="`Question ${
63
- questionNumber
64
- }${
65
- quizMode !== 'timed'
66
- ? ` of ${quizLength}`
67
- : ''
68
- }${
69
- showAnswers
70
- ? isCorrect
71
- ? ', Answered Correctly'
72
- : ', Answered Incorrectly'
73
- : ''
74
- }`"
75
- aria-live="assertive"
76
- >
77
- <div class="uikit-question__current-index" aria-hidden="true">
78
- Question {{ questionNumber }}
79
- </div>
80
- <div
81
- v-if="quizMode !== 'timed'"
82
- class="uikit-question__quiz-length"
83
- aria-hidden="true"
84
- >
85
- / {{ quizLength }}
86
- </div>
87
- </h2>
88
- </slot>
89
- <div
90
- class="uikit-question__tag"
91
- v-breakpoint:questionEl="breakpoints"
92
- >
51
+ <template #contextIcon>
52
+ <slot name="contextIcon" />
53
+ </template>
54
+ <template #tag>
93
55
  <slot name="tag" />
94
- </div>
95
- </div>
56
+ </template>
57
+ </QuestionContext>
96
58
  </slot>
97
59
  <div
98
60
  ref="prompt"
@@ -951,42 +913,19 @@
951
913
 
952
914
  <script lang="ts">
953
915
  import { Component, Vue, Prop, Watch, Emit } from 'vue-facing-decorator'
916
+ import type { ComponentPublicInstance } from 'vue'
954
917
  import PocketButton from '../Buttons/Button.vue'
955
918
  import Icon from '../Icons/Icon.vue'
956
919
  import type { ITableColumn, ITableSortSettings } from '../Tables/table'
957
920
  import Table from '../Tables/Table.vue'
958
921
  import OverflowTooltip from '../Tooltips/OverflowTooltip.vue'
922
+ import QuestionContext from '../Quiz/Question/QuestionContext.vue'
959
923
  import type { Study } from '@pocketprep/types'
960
924
  import { breakpoint, dark } from '../../directives'
961
925
  import { studyModes } from '../../utils'
962
926
  import PaywallImageLight from '../../assets/question/paywall-light.png'
963
927
  import PaywallImageDark from '../../assets/question/paywall-dark.png'
964
-
965
- type TChoiceKey = `${'a' | 'd'}${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}`
966
- type TChoice = { text?: string; key: TChoiceKey }
967
- type TChoiceScores = Partial<Record<TChoiceKey, number>> & {
968
- totalAnswered: number
969
- answeredCorrectly: number
970
- }
971
- type TQuizMode = 'qotd' | 'quick10' | 'timed' | 'weakest' | 'missed' | 'custom'
972
- type Ref = HTMLElement | null
973
- type TNamesRow = {
974
- id: string
975
- nameOne: string
976
- isFlaggedByNameOne: boolean
977
- nameTwo?: string
978
- isFlaggedByNameTwo?: boolean
979
- nameThree?: string
980
- isFlaggedByNameThree?: boolean
981
- }
982
-
983
- type TViewNames = {
984
- [ key: string ]: {
985
- id: string
986
- name: string
987
- isFlaggedByStudent: boolean
988
- }[]
989
- }
928
+ import type { Ref, TQuizMode, TChoiceKey, TChoice, TChoiceScores, TNamesRow, TViewNames } from './question'
990
929
 
991
930
  @Component({
992
931
  components: {
@@ -994,6 +933,7 @@ type TViewNames = {
994
933
  Icon,
995
934
  Table,
996
935
  OverflowTooltip,
936
+ QuestionContext,
997
937
  },
998
938
  directives: {
999
939
  breakpoint,
@@ -1238,7 +1178,8 @@ export default class Question extends Vue {
1238
1178
  this.moveFocusToPrompt()
1239
1179
  } else if (this.autoFocusPrompt === false) {
1240
1180
  setTimeout(() => {
1241
- const contextEl = this.$refs['uikit-question__context'] as HTMLElement | undefined
1181
+ const contextComp = this.$refs['uikit-question__context'] as ComponentPublicInstance | undefined
1182
+ const contextEl = contextComp?.$refs['uikit-question-context'] as HTMLElement | undefined
1242
1183
  contextEl?.focus()
1243
1184
  }, 0)
1244
1185
  }
@@ -2091,66 +2032,6 @@ export default class Question extends Vue {
2091
2032
  font-weight: 600;
2092
2033
  }
2093
2034
 
2094
- &__context {
2095
- display: flex;
2096
- flex-direction: column;
2097
- align-items: center;
2098
- flex-shrink: 0;
2099
- margin-bottom: 28px;
2100
- padding-top: 60px;
2101
- outline: none;
2102
-
2103
- &--tablet-landscape {
2104
- padding-top: 42px;
2105
- }
2106
-
2107
- &--tablet-portrait {
2108
- padding-top: 52px;
2109
- }
2110
-
2111
- &--mobile {
2112
- padding-top: 22px;
2113
- }
2114
- }
2115
-
2116
- &__context-icon {
2117
- margin-bottom: 8px;
2118
- margin-left: 6px;
2119
- color: $ash;
2120
-
2121
- &--dark {
2122
- color: $fog;
2123
- }
2124
- }
2125
-
2126
- &__context-text {
2127
- display: flex;
2128
- font-size: 14px;
2129
- font-weight: 600;
2130
- letter-spacing: 0.2px;
2131
- line-height: 17px;
2132
- color: $ash;
2133
- margin: 0;
2134
-
2135
- &--dark {
2136
- color: $fog;
2137
- }
2138
- }
2139
-
2140
- &__quiz-length {
2141
- margin-left: 5px;
2142
- font-weight: 500;
2143
- }
2144
-
2145
- &__tag {
2146
- margin-top: 8px;
2147
- margin-bottom: -5px;
2148
-
2149
- &--mobile {
2150
- display: none;
2151
- }
2152
- }
2153
-
2154
2035
  &__tag-mobile {
2155
2036
  display: none;
2156
2037
  position: absolute;
@@ -0,0 +1,39 @@
1
+ export type Ref = HTMLElement | null
2
+
3
+ export type TChoiceKey = `${'a' | 'd'}${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}`
4
+
5
+ export type TQuizMode = 'qotd' | 'quick10' | 'timed' | 'weakest' | 'missed' | 'custom'
6
+
7
+ // eslint-disable-next-line max-len
8
+ export type TContextIcon = 'quick10' | 'calendar' | 'missedQuestions' | 'subject' | 'stopwatch' | 'exam' | 'levelup' | 'pencil'
9
+
10
+ export type TBreakPointsObject = {
11
+ mobile: number
12
+ tabletPortrait: number
13
+ tabletLandscape: number
14
+ }
15
+
16
+ export type TChoice = { text?: string; key: TChoiceKey }
17
+
18
+ export type TChoiceScores = Partial<Record<TChoiceKey, number>> & {
19
+ totalAnswered: number
20
+ answeredCorrectly: number
21
+ }
22
+
23
+ export type TNamesRow = {
24
+ id: string
25
+ nameOne: string
26
+ isFlaggedByNameOne: boolean
27
+ nameTwo?: string
28
+ isFlaggedByNameTwo?: boolean
29
+ nameThree?: string
30
+ isFlaggedByNameThree?: boolean
31
+ }
32
+
33
+ export type TViewNames = {
34
+ [ key: string ]: {
35
+ id: string
36
+ name: string
37
+ isFlaggedByStudent: boolean
38
+ }[]
39
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pocketprep/ui-kit",
3
- "version": "3.4.0",
3
+ "version": "3.4.2",
4
4
  "description": "Pocket Prep UI Kit",
5
5
  "author": "pocketprep",
6
6
  "scripts": {