@pocketprep/ui-kit 3.8.5 → 3.9.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 (159) hide show
  1. package/dist/@pocketprep/ui-kit.css +1 -1
  2. package/dist/@pocketprep/ui-kit.js +14466 -17728
  3. package/dist/@pocketprep/ui-kit.js.map +1 -1
  4. package/dist/@pocketprep/ui-kit.umd.cjs +19 -29
  5. package/dist/@pocketprep/ui-kit.umd.cjs.map +1 -1
  6. package/eslint.config.ts +38 -11
  7. package/lib/SVGDefinitions.vue +32 -35
  8. package/lib/components/Banners/Banner.vue +10 -14
  9. package/lib/components/Blobs/Blob.vue +6 -14
  10. package/lib/components/Blobs/BlobEmptyState.vue +9 -8
  11. package/lib/components/Blobs/blob.d.ts +1 -1
  12. package/lib/components/BundleIcons/BundleIcon.vue +36 -63
  13. package/lib/components/BundleIcons/bundleIcon.d.ts +1 -1
  14. package/lib/components/Bundles/BundleList.vue +71 -59
  15. package/lib/components/Bundles/BundleSearch.vue +93 -117
  16. package/lib/components/Bundles/PremiumPill.vue +6 -12
  17. package/lib/components/Buttons/Button.vue +32 -35
  18. package/lib/components/Buttons/Link.vue +32 -31
  19. package/lib/components/Buttons/Tab.vue +14 -17
  20. package/lib/components/Calendar/Calendar.vue +87 -85
  21. package/lib/components/Charts/Bar.vue +192 -263
  22. package/lib/components/Charts/Pie.vue +55 -61
  23. package/lib/components/Charts/highcharts-wrap.ts +81 -0
  24. package/lib/components/Controls/SegmentControl.vue +26 -24
  25. package/lib/components/Controls/Slider.vue +51 -47
  26. package/lib/components/Controls/ToggleSwitch.vue +33 -31
  27. package/lib/components/EmptyStates/EmptyState.vue +69 -73
  28. package/lib/components/Exams/ExamCard.vue +59 -47
  29. package/lib/components/Exams/ExamMenuCard.vue +30 -28
  30. package/lib/components/Filters/FilterDropdown.vue +83 -86
  31. package/lib/components/Filters/FilterOptions.vue +83 -88
  32. package/lib/components/Forms/Checkbox.vue +27 -27
  33. package/lib/components/Forms/CheckboxOption.vue +30 -30
  34. package/lib/components/Forms/Errors.vue +21 -24
  35. package/lib/components/Forms/Input.vue +71 -59
  36. package/lib/components/Forms/Radio.vue +2 -2
  37. package/lib/components/Forms/RadioButton.vue +8 -8
  38. package/lib/components/Forms/Select.vue +265 -257
  39. package/lib/components/Forms/Textarea.vue +49 -35
  40. package/lib/components/Icons/IconAccordionArrow.vue +7 -9
  41. package/lib/components/Icons/IconActivity.vue +7 -9
  42. package/lib/components/Icons/IconAdd.vue +7 -11
  43. package/lib/components/Icons/IconAddCircle.vue +7 -9
  44. package/lib/components/Icons/IconArrow.vue +7 -9
  45. package/lib/components/Icons/IconBarChart.vue +7 -9
  46. package/lib/components/Icons/IconCalendar.vue +7 -9
  47. package/lib/components/Icons/IconCalendarPicker.vue +7 -9
  48. package/lib/components/Icons/IconChat.vue +7 -9
  49. package/lib/components/Icons/IconCheck.vue +7 -9
  50. package/lib/components/Icons/IconClose.vue +7 -9
  51. package/lib/components/Icons/IconConcept.vue +1 -1
  52. package/lib/components/Icons/IconCorrect.vue +7 -9
  53. package/lib/components/Icons/IconEdit.vue +7 -11
  54. package/lib/components/Icons/IconExam.vue +7 -9
  55. package/lib/components/Icons/IconExternalLink.vue +7 -9
  56. package/lib/components/Icons/IconEyeHide.vue +7 -9
  57. package/lib/components/Icons/IconEyeShow.vue +7 -9
  58. package/lib/components/Icons/IconFilter.vue +7 -9
  59. package/lib/components/Icons/IconFilterActive.vue +7 -9
  60. package/lib/components/Icons/IconFlag.vue +7 -9
  61. package/lib/components/Icons/IconFlagContent.vue +8 -9
  62. package/lib/components/Icons/IconFlagFeedback.vue +8 -10
  63. package/lib/components/Icons/IconFlagFilled.vue +7 -9
  64. package/lib/components/Icons/IconFullView.vue +7 -9
  65. package/lib/components/Icons/IconFullViewActive.vue +7 -9
  66. package/lib/components/Icons/IconGridDrag.vue +2 -2
  67. package/lib/components/Icons/IconHandle.vue +7 -9
  68. package/lib/components/Icons/IconHeart.vue +7 -9
  69. package/lib/components/Icons/IconHelp.vue +7 -9
  70. package/lib/components/Icons/IconHighlight.vue +2 -2
  71. package/lib/components/Icons/IconHourglass.vue +7 -9
  72. package/lib/components/Icons/IconImage.vue +7 -9
  73. package/lib/components/Icons/IconIncorrect.vue +7 -9
  74. package/lib/components/Icons/IconInfo.vue +7 -9
  75. package/lib/components/Icons/IconKeyboard.vue +7 -9
  76. package/lib/components/Icons/IconLaunch.vue +7 -9
  77. package/lib/components/Icons/IconLevelUp.vue +7 -9
  78. package/lib/components/Icons/IconLightbulb.vue +7 -9
  79. package/lib/components/Icons/IconLightning.vue +7 -9
  80. package/lib/components/Icons/IconLink.vue +7 -9
  81. package/lib/components/Icons/IconList.vue +7 -9
  82. package/lib/components/Icons/IconLoading.vue +7 -9
  83. package/lib/components/Icons/IconLoading2.vue +11 -11
  84. package/lib/components/Icons/IconLock.vue +7 -9
  85. package/lib/components/Icons/IconMissedQuestions.vue +7 -9
  86. package/lib/components/Icons/IconMoon.vue +7 -9
  87. package/lib/components/Icons/IconPaginationArrow.vue +7 -9
  88. package/lib/components/Icons/IconPaginationArrowDouble.vue +7 -9
  89. package/lib/components/Icons/IconPassage.vue +7 -9
  90. package/lib/components/Icons/IconPencil.vue +7 -9
  91. package/lib/components/Icons/IconPeople.vue +7 -9
  92. package/lib/components/Icons/IconPercent.vue +7 -9
  93. package/lib/components/Icons/IconPerson.vue +8 -9
  94. package/lib/components/Icons/IconPresent.vue +7 -9
  95. package/lib/components/Icons/IconPreview.vue +7 -9
  96. package/lib/components/Icons/IconQuestions.vue +7 -9
  97. package/lib/components/Icons/IconQuick10.vue +7 -9
  98. package/lib/components/Icons/IconQuickActions.vue +2 -2
  99. package/lib/components/Icons/IconRecommendedFilter.vue +1 -1
  100. package/lib/components/Icons/IconRemoveCircle.vue +7 -9
  101. package/lib/components/Icons/IconReviewFlag.vue +7 -9
  102. package/lib/components/Icons/IconSearch.vue +7 -9
  103. package/lib/components/Icons/IconShare.vue +7 -9
  104. package/lib/components/Icons/IconSideBar.vue +7 -9
  105. package/lib/components/Icons/IconSideBarActive.vue +7 -9
  106. package/lib/components/Icons/IconStar.vue +1 -1
  107. package/lib/components/Icons/IconStopwatch.vue +7 -9
  108. package/lib/components/Icons/IconStrike.vue +7 -9
  109. package/lib/components/Icons/IconSubject.vue +7 -9
  110. package/lib/components/Icons/IconText.vue +7 -9
  111. package/lib/components/Icons/IconTimer.vue +8 -9
  112. package/lib/components/Icons/IconWarning.vue +7 -9
  113. package/lib/components/Icons/icon.d.ts +1 -1
  114. package/lib/components/Loaders/SkeletonLoader.vue +1 -5
  115. package/lib/components/Modal/Modal.vue +23 -29
  116. package/lib/components/Modal/ModalContainer.vue +135 -135
  117. package/lib/components/Onboarding/EmailAuth.vue +66 -70
  118. package/lib/components/Onboarding/MagicCodeEntry.vue +88 -83
  119. package/lib/components/Pagination/QuestionReviewPagination.vue +3 -3
  120. package/lib/components/Pagination/TablePagination.vue +47 -44
  121. package/lib/components/PhonePerson/PhonePerson.vue +18 -18
  122. package/lib/components/PhonePerson/phonePerson.d.ts +1 -1
  123. package/lib/components/Quiz/FlagToggle.vue +45 -44
  124. package/lib/components/Quiz/GlobalMetricsToggle.vue +29 -28
  125. package/lib/components/Quiz/KeyboardShortcutsButton.vue +16 -23
  126. package/lib/components/Quiz/KeyboardShortcutsModal.vue +36 -37
  127. package/lib/components/Quiz/Question/BuildListChoicesContainer.vue +65 -65
  128. package/lib/components/Quiz/Question/ChoicesContainer.vue +5 -5
  129. package/lib/components/Quiz/Question/DropdownExplanation.vue +5 -5
  130. package/lib/components/Quiz/Question/Explanation.vue +6 -6
  131. package/lib/components/Quiz/Question/MPMCChoicesContainer.vue +17 -17
  132. package/lib/components/Quiz/Question/MPMCRadioGroup.vue +2 -2
  133. package/lib/components/Quiz/Question/MatrixChoicesContainer.vue +39 -39
  134. package/lib/components/Quiz/Question/MatrixRadioGroup.vue +6 -6
  135. package/lib/components/Quiz/Question/MobileMatrixChoicesContainer.vue +27 -28
  136. package/lib/components/Quiz/Question/MobileMatrixRadioGroup.vue +2 -2
  137. package/lib/components/Quiz/Question/PassageAndImage.vue +3 -3
  138. package/lib/components/Quiz/Question/PassageAndImageDropdown.vue +7 -7
  139. package/lib/components/Quiz/Question/Paywall.vue +2 -2
  140. package/lib/components/Quiz/Question/QuestionContext.vue +1 -1
  141. package/lib/components/Quiz/Question/StatsSummary.vue +2 -2
  142. package/lib/components/Quiz/Question/Summary.vue +11 -11
  143. package/lib/components/Quiz/Question.vue +90 -82
  144. package/lib/components/Quiz/QuizContainer.vue +1 -1
  145. package/lib/components/Quiz/QuizProgressBar.vue +23 -23
  146. package/lib/components/Quiz/question.d.ts +3 -3
  147. package/lib/components/Search/Pill.vue +16 -19
  148. package/lib/components/Search/Search.vue +52 -47
  149. package/lib/components/SidePanels/SidePanel.vue +168 -174
  150. package/lib/components/Tables/Table.vue +135 -122
  151. package/lib/components/Tables/TableActions.vue +81 -76
  152. package/lib/components/Tables/table.d.ts +1 -1
  153. package/lib/components/Tags/Tag.vue +49 -39
  154. package/lib/components/Toasts/Toast.vue +44 -42
  155. package/lib/components/Tooltips/OverflowTooltip.vue +39 -45
  156. package/lib/components/Tooltips/Tooltip.vue +69 -70
  157. package/lib/directives.ts +4 -4
  158. package/lib/utils.ts +13 -12
  159. package/package.json +27 -28
@@ -3,7 +3,7 @@
3
3
  ref="uikit-exam-search"
4
4
  v-breakpoint="{ breakpoints: { small: smallBreakpoint } }"
5
5
  class="uikit-exam-search"
6
- :class="{ 'uikit-exam-search--bundle-selected': selectedBundle }"
6
+ :class="{ 'uikit-exam-search--bundle-selected': selectedBundle }"
7
7
  >
8
8
  <template v-if="examSearchContainer">
9
9
  <Search
@@ -11,18 +11,18 @@
11
11
  v-breakpoint="{
12
12
  breakpoints: { small: smallBreakpoint },
13
13
  containerEl: examSearchContainer
14
- }"
14
+ }"
15
15
  class="uikit-exam-search__search"
16
16
  placeholder="Search exams"
17
17
  type="white"
18
18
  :is-dark-mode="isDarkMode"
19
19
  />
20
- <div
21
- v-if="examSearchString"
20
+ <div
21
+ v-if="examSearchString"
22
22
  v-breakpoint="{
23
23
  breakpoints: { small: smallBreakpoint },
24
24
  containerEl: examSearchContainer
25
- }"
25
+ }"
26
26
  class="uikit-exam-search__search-results"
27
27
  >
28
28
  <div class="uikit-exam-search__search-results-header">
@@ -34,14 +34,14 @@
34
34
  >
35
35
  {{ filteredExams.length }} Search Result{{ filteredExams.length !== 1 ? 's' : '' }}
36
36
  </span>
37
- <Button
37
+ <PocketButton
38
38
  class="uikit-exam-search__search-reset-btn"
39
39
  type="tertiary-small"
40
40
  :is-dark-mode="isDarkMode"
41
41
  @click="examSearchString = ''"
42
42
  >
43
43
  Browse Instead
44
- </Button>
44
+ </PocketButton>
45
45
  </div>
46
46
  <ul class="uikit-exam-search__search-results-list">
47
47
  <ExamCard
@@ -50,12 +50,12 @@
50
50
  v-breakpoint="{
51
51
  breakpoints: { small: smallBreakpoint },
52
52
  containerEl: examSearchContainer
53
- }"
53
+ }"
54
54
  :is-premium="premiumExamIds.includes(exam.objectId)"
55
55
  :exam="exam"
56
- :bundle="exam.bundle"
56
+ :bundle="exam.bundle"
57
57
  class="uikit-exam-search__search-results-card"
58
- :is-selected="selectedExam && selectedExam.objectId === exam.objectId"
58
+ :is-selected="!!(selectedExam && selectedExam.objectId === exam.objectId)"
59
59
  :is-dark-mode="isDarkMode"
60
60
  @select="selectExam(exam)"
61
61
  />
@@ -71,7 +71,7 @@
71
71
  v-breakpoint="{
72
72
  breakpoints: { small: smallBreakpoint },
73
73
  containerEl: examSearchContainer
74
- }"
74
+ }"
75
75
  class="uikit-exam-search__bundle-list"
76
76
  >
77
77
  <div class="uikit-exam-search__browse-industry-text">
@@ -89,21 +89,21 @@
89
89
  v-breakpoint="{
90
90
  breakpoints: { small: smallBreakpoint },
91
91
  containerEl: examSearchContainer
92
- }"
92
+ }"
93
93
  class="uikit-exam-search__bundle-exam-container"
94
94
  >
95
- <div
95
+ <div
96
96
  v-breakpoint="{
97
97
  breakpoints: { small: smallBreakpoint },
98
98
  containerEl: examSearchContainer
99
- }"
99
+ }"
100
100
  class="uikit-exam-search__bundle-exam-container-top"
101
101
  >
102
102
  <PocketButton
103
103
  v-breakpoint="{
104
104
  breakpoints: { small: smallBreakpoint },
105
105
  containerEl: examSearchContainer
106
- }"
106
+ }"
107
107
  class="uikit-exam-search__bundle-exam-back"
108
108
  :is-dark-mode="isDarkMode"
109
109
  type="tertiary"
@@ -111,11 +111,11 @@
111
111
  >
112
112
  <Icon type="arrow" /> Back to Browse
113
113
  </PocketButton>
114
- <span
114
+ <span
115
115
  v-breakpoint="{
116
116
  breakpoints: { small: smallBreakpoint },
117
117
  containerEl: examSearchContainer
118
- }"
118
+ }"
119
119
  class="uikit-exam-search__bundle-exam-count"
120
120
  tabindex="-1"
121
121
  >
@@ -138,20 +138,20 @@
138
138
  v-breakpoint="{
139
139
  breakpoints: { small: smallBreakpoint },
140
140
  containerEl: examSearchContainer
141
- }"
141
+ }"
142
142
  :exam="exam"
143
143
  :is-dark-mode="isDarkMode"
144
144
  :bundle="exam.bundle"
145
145
  class="uikit-exam-search__search-results-card"
146
146
  :is-premium="premiumExamIds.includes(exam.objectId)"
147
- :is-selected="selectedExam && selectedExam.objectId === exam.objectId"
147
+ :is-selected="!!(selectedExam && selectedExam.objectId === exam.objectId)"
148
148
  @select="selectExam(exam)"
149
149
  />
150
- <div
150
+ <div
151
151
  v-breakpoint="{
152
152
  breakpoints: { small: smallBreakpoint },
153
153
  containerEl: examSearchContainer
154
- }"
154
+ }"
155
155
  class="uikit-exam-search__exam-list-padding"
156
156
  />
157
157
  </div>
@@ -162,95 +162,92 @@
162
162
  </div>
163
163
  </template>
164
164
 
165
- <script lang="ts">
166
- import { Vue, Component, Prop, Watch, Emit } from 'vue-facing-decorator'
167
- import BundleIcon from '../BundleIcons/BundleIcon.vue'
165
+ <script setup lang="ts">
168
166
  import ExamCard from '../Exams/ExamCard.vue'
169
167
  import BundleList from '../Bundles/BundleList.vue'
170
168
  import Search from '../Search/Search.vue'
171
- import Button from '../Buttons/Button.vue'
172
169
  import PocketButton from '../Buttons/Button.vue'
173
170
  import Icon from '../Icons/Icon.vue'
174
171
  import type { Study } from '@pocketprep/types'
175
- import { breakpoint, dark } from '../../directives'
172
+ import { breakpoint as vBreakpoint, dark as vDark } from '../../directives'
173
+ import { computed, ref, useTemplateRef, watch } from 'vue'
176
174
 
177
175
  type TBundleExam = Study.Class.ExamMetadataJSON & { bundle: Study.Class.BundleJSON }
178
176
 
179
- @Component({
180
- components: {
181
- Button,
182
- BundleIcon,
183
- BundleList,
184
- ExamCard,
185
- Search,
186
- PocketButton,
187
- Icon,
188
- },
189
- directives: {
190
- breakpoint,
191
- dark,
192
- },
177
+ const {
178
+ bundles,
179
+ examMetadataById,
180
+ premiumBundleIds = [],
181
+ premiumExamIds = [],
182
+ isDarkMode,
183
+ } = defineProps<{
184
+ bundles: Study.Class.BundleJSON[]
185
+ examMetadataById: { [id: string]: Study.Class.ExamMetadataJSON | undefined }
186
+ premiumBundleIds?: string[]
187
+ premiumExamIds?: string[]
188
+ isDarkMode?: boolean
189
+ }>()
190
+
191
+ const emit = defineEmits<{
192
+ 'search': [searchString: string]
193
+ 'selectBundle': [selectedBundle: Study.Class.BundleJSON]
194
+ 'select': [selectedExam: TBundleExam]
195
+ }>()
196
+
197
+ const selectedExam = ref<TBundleExam | null>(null)
198
+ const selectedBundle = ref<Study.Class.BundleJSON | null>(null)
199
+ const examSearchString = ref('')
200
+ const examDisplayName = ref('')
201
+ const examSearchContainer = useTemplateRef<HTMLElement>('uikit-exam-search')
202
+ const smallBreakpoint = ref(420)
203
+
204
+ const filteredExams = computed(() => {
205
+ return bundleExams.value.filter(exam =>
206
+ `${exam.nativeAppName} ${exam.descriptiveName}`.toLowerCase()
207
+ .includes(examSearchString.value.toLowerCase())
208
+ )
193
209
  })
194
- export default class BundleSearch extends Vue {
195
- @Prop() bundles!: Study.Class.BundleJSON[]
196
- @Prop() examMetadataById!: { [id: string]: Study.Class.ExamMetadataJSON | undefined }
197
- @Prop({ default: () => ([]) }) premiumBundleIds!: string[]
198
- @Prop({ default: () => ([]) }) premiumExamIds!: string[]
199
- @Prop({ default: false }) isDarkMode!: boolean
200
-
201
- selectedExam: TBundleExam | null = null
202
- selectedBundle: Study.Class.BundleJSON | null = null
203
- examSearchString = ''
204
- examDisplayName = ''
205
- examSearchContainer: null | HTMLElement = null
206
- smallBreakpoint = 420
207
-
208
- get filteredExams () {
209
- return this.bundleExams.filter(exam =>
210
- `${exam.nativeAppName} ${exam.descriptiveName}`.toLowerCase()
211
- .includes(this.examSearchString.toLowerCase())
212
- )
213
- }
214
-
215
- get selectedBundleExams () {
216
- const selectedBundle = this.selectedBundle
217
- if (selectedBundle) {
218
- return this.bundleExams.filter(exam => exam.bundle.objectId === selectedBundle.objectId)
219
- } else {
220
- return []
221
- }
210
+
211
+ const selectedBundleExams = computed(() => {
212
+ const selectedBundleVal = selectedBundle.value
213
+ if (selectedBundleVal) {
214
+ return bundleExams.value.filter(exam => exam.bundle.objectId === selectedBundleVal.objectId)
215
+ } else {
216
+ return []
222
217
  }
218
+ })
223
219
 
224
- get bundleExams () {
225
- return Object.values(this.bundles)
226
- .filter((bundle): bundle is NonNullable<typeof bundle> => !!bundle)
227
- .flatMap(bundle => bundle.exams.map(exam => {
228
- const examMetadata = this.examMetadataById[exam.objectId]
229
- if (examMetadata) {
230
- return {
231
- ...examMetadata,
232
- bundle,
233
- }
234
- } else {
235
- return undefined
220
+ const bundleExams = computed(() => {
221
+ return Object.values(bundles)
222
+ .filter((bundle): bundle is NonNullable<typeof bundle> => !!bundle)
223
+ .flatMap(bundle => bundle.exams.map(exam => {
224
+ const examMetadata = examMetadataById[exam.objectId]
225
+ if (examMetadata) {
226
+ return {
227
+ ...examMetadata,
228
+ bundle,
236
229
  }
237
- }))
238
- .filter((exam): exam is NonNullable<typeof exam> => !!exam)
239
- .sort((a, b) => a.nativeAppName?.localeCompare(b.nativeAppName))
240
- }
230
+ } else {
231
+ return undefined
232
+ }
233
+ }))
234
+ .filter((exam): exam is NonNullable<typeof exam> => !!exam)
235
+ .sort((a, b) => a.nativeAppName?.localeCompare(b.nativeAppName))
236
+ })
241
237
 
242
- mounted () {
243
- this.examSearchContainer = this.$refs['uikit-exam-search'] as HTMLElement
244
- }
238
+ const selectExam = (exam: TBundleExam) => {
239
+ selectedExam.value = exam
240
+ examDisplayName.value = exam.nativeAppName
241
+ emit('select', exam)
242
+ }
245
243
 
246
- @Watch('examSearchString')
247
- examSearchStringChanged (newVal: string) {
248
- this.emitSearch(newVal)
249
- }
244
+ watch(examSearchString, (newVal: string) => {
245
+ emit('search', newVal)
246
+ })
250
247
 
251
- @Watch('selectedBundle')
252
- selectedBundleChanged (selectedBundle: Study.Class.BundleJSON) {
253
- this.emitSelectBundle(selectedBundle)
248
+ watch(selectedBundle, (newSelectedBundle: Study.Class.BundleJSON | null) => {
249
+ if (newSelectedBundle) {
250
+ emit('selectBundle', newSelectedBundle)
254
251
 
255
252
  // automatically select first exam
256
253
  setTimeout(() => {
@@ -258,28 +255,7 @@ export default class BundleSearch extends Vue {
258
255
  (firstCard as HTMLElement | undefined)?.focus()
259
256
  }, 1)
260
257
  }
261
-
262
- selectExam (exam: TBundleExam) {
263
- this.selectedExam = exam
264
- this.examDisplayName = exam.nativeAppName
265
- this.emitSelect(exam)
266
- }
267
-
268
- @Emit('search')
269
- emitSearch (searchString: string) {
270
- return searchString
271
- }
272
-
273
- @Emit('selectBundle')
274
- emitSelectBundle (selectedBundle: Study.Class.BundleJSON) {
275
- return selectedBundle
276
- }
277
-
278
- @Emit('select')
279
- emitSelect (exam: TBundleExam) {
280
- return exam
281
- }
282
- }
258
+ })
283
259
  </script>
284
260
 
285
261
  <style lang="scss">
@@ -602,4 +578,4 @@ export default class BundleSearch extends Vue {
602
578
  margin-bottom: 57px;
603
579
  }
604
580
  }
605
- </style>
581
+ </style>
@@ -4,18 +4,12 @@
4
4
  </div>
5
5
  </template>
6
6
 
7
- <script lang="ts">
8
- import { Vue, Component, Prop } from 'vue-facing-decorator'
9
- import { dark } from '../../directives'
7
+ <script setup lang="ts">
8
+ import { dark as vDark } from '../../directives'
10
9
 
11
- @Component({
12
- directives: {
13
- dark,
14
- },
15
- })
16
- export default class PremiumPill extends Vue {
17
- @Prop({ default: false }) isDarkMode!: boolean
18
- }
10
+ defineProps<{
11
+ isDarkMode?: boolean
12
+ }>()
19
13
  </script>
20
14
 
21
15
  <style lang="scss">
@@ -41,4 +35,4 @@ export default class PremiumPill extends Vue {
41
35
  border: 1px solid $banana-bread;
42
36
  }
43
37
  }
44
- </style>
38
+ </style>
@@ -5,7 +5,7 @@
5
5
  :class="{
6
6
  [`uikit-btn--${type}`]: true,
7
7
  [`uikit-btn--${type}--is-loading`]: isLoading,
8
- 'uikit-btn--icon--no-text': !$slots.default?.(),
8
+ 'uikit-btn--icon--no-text': !$slots.default,
9
9
  }"
10
10
  :disabled="disabled"
11
11
  tabindex="0"
@@ -27,7 +27,7 @@
27
27
  v-dark="isDarkMode"
28
28
  class="uikit-btn-icon__icon"
29
29
  :class="{
30
- 'uikit-btn-icon__icon--no-text': !$slots.default?.(),
30
+ 'uikit-btn-icon__icon--no-text': !$slots.default,
31
31
  }"
32
32
  :title="iconTitle"
33
33
  :type="icon"
@@ -37,41 +37,38 @@
37
37
  </button>
38
38
  </template>
39
39
 
40
- <script lang="ts">
41
- import { Vue, Component, Prop, Emit } from 'vue-facing-decorator'
40
+ <script setup lang="ts">
42
41
  import Icon from '../Icons/Icon.vue'
43
42
  import type { TIconType } from '../Icons/icon'
44
- import { dark } from '../../directives'
45
-
46
- type TButtonType = 'primary' | 'primary-yellow' | 'primary-red' | 'secondary'
47
- | 'secondary-yellow-dark' | 'tertiary' | 'tertiary-red' | 'tertiary-small' | 'tertiary-red-small' | 'icon'
48
- | 'icon-yellow' | 'outline' | 'oval-dark'
49
-
50
- @Component({
51
- components: {
52
- Icon,
53
- },
54
- directives: {
55
- dark,
56
- },
57
- })
58
- export default class Button extends Vue {
59
- @Prop({ default: 'primary' }) readonly type!: TButtonType
60
- @Prop({ default: false }) readonly disabled!: boolean
61
- @Prop({ default: false }) readonly isDarkMode!: boolean
62
- @Prop({ default: null }) readonly icon!: TIconType
63
- @Prop({ default: '' }) readonly iconTitle!: string
64
- @Prop({ default: false }) isLoading!: boolean
65
-
66
- buttonClicked (event: Event) {
67
- if (!this.disabled && !this.isLoading) {
68
- this.emitClick(event)
69
- }
70
- }
71
-
72
- @Emit('click')
73
- emitClick (event: Event) {
74
- return event
43
+ import { dark as vDark } from '../../directives'
44
+
45
+ type TButtonType = 'primary' | 'primary-yellow' | 'primary-red' | 'secondary'
46
+ | 'secondary-yellow-dark' | 'tertiary' | 'tertiary-red' | 'tertiary-small' | 'tertiary-red-small' | 'icon'
47
+ | 'icon-yellow' | 'outline' | 'oval-dark'
48
+
49
+ const {
50
+ type = 'primary',
51
+ disabled = false,
52
+ isDarkMode = false,
53
+ icon = null,
54
+ iconTitle = '',
55
+ isLoading = false,
56
+ } = defineProps<{
57
+ type?: TButtonType
58
+ disabled?: boolean
59
+ isDarkMode?: boolean
60
+ icon?: TIconType | null
61
+ iconTitle?: string
62
+ isLoading?: boolean
63
+ }>()
64
+
65
+ const emit = defineEmits<{
66
+ 'click': [clickEvent: Event]
67
+ }>()
68
+
69
+ const buttonClicked = (event: Event) => {
70
+ if (!disabled && !isLoading) {
71
+ emit('click', event)
75
72
  }
76
73
  }
77
74
  </script>
@@ -16,40 +16,41 @@
16
16
  </a>
17
17
  </template>
18
18
 
19
- <script lang="ts">
20
- import { Vue, Component, Prop } from 'vue-facing-decorator'
21
- import { dark } from '../../directives'
19
+ <script setup lang="ts">
20
+ import { dark as vDark } from '../../directives'
22
21
 
23
22
  type TLinkType = 'tertiary' | 'tertiary-red' | 'tertiary-small'
24
23
 
25
- /**
26
- * @see [Designs for Buttons](https://marvelapp.com/adf8ab3/screen/68221507)
27
- */
28
- @Component({
29
- directives: {
30
- dark,
31
- },
32
- emits: [ 'click' ],
33
- })
34
- export default class Link extends Vue {
35
- @Prop({ default: 'tertiary' }) readonly type!: TLinkType
36
- @Prop({ default: '#' }) readonly href!: string
37
- @Prop({ default: '_self' }) readonly target!: string
38
- @Prop({ default: false }) readonly disabled!: boolean
39
- @Prop({ default: false }) readonly hasIcon!: boolean
40
- @Prop({ default: false }) readonly isDarkMode!: boolean
41
-
42
- clicked (event: MouseEvent) {
43
- if (this.disabled) {
44
- event.preventDefault()
45
- event.stopImmediatePropagation()
46
- return
47
- }
48
- if (this.href === '#') {
49
- event.preventDefault()
50
- }
51
- this.$emit('click', event)
24
+ const {
25
+ type = 'tertiary',
26
+ href = '#',
27
+ target = '_self',
28
+ disabled,
29
+ hasIcon,
30
+ isDarkMode,
31
+ } = defineProps<{
32
+ type?: TLinkType
33
+ href?: string
34
+ target?: string
35
+ disabled?: boolean
36
+ hasIcon?: boolean
37
+ isDarkMode?: boolean
38
+ }>()
39
+
40
+ const emit = defineEmits<{
41
+ 'click': [clickEvent: MouseEvent]
42
+ }>()
43
+
44
+ const clicked = (event: MouseEvent) => {
45
+ if (disabled) {
46
+ event.preventDefault()
47
+ event.stopImmediatePropagation()
48
+ return
49
+ }
50
+ if (href === '#') {
51
+ event.preventDefault()
52
52
  }
53
+ emit('click', event)
53
54
  }
54
55
  </script>
55
56
 
@@ -195,4 +196,4 @@ export default class Link extends Vue {
195
196
  cursor: default;
196
197
  }
197
198
  }
198
- </style>
199
+ </style>
@@ -12,24 +12,21 @@
12
12
  </div>
13
13
  </template>
14
14
 
15
- <script lang="ts">
16
- import { Vue, Component, Prop, Emit } from 'vue-facing-decorator'
17
- import { dark } from '../../directives'
15
+ <script setup lang="ts">
16
+ import { dark as vDark } from '../../directives'
18
17
 
19
- @Component({
20
- directives: {
21
- dark,
22
- },
23
- })
24
- export default class Tab extends Vue {
25
- @Prop({ default: false }) disabled!: boolean
26
- @Prop({ default: false }) active!: boolean
27
- @Prop({ default: false }) isDarkMode!: boolean
18
+ defineProps<{
19
+ disabled?: boolean
20
+ active?: boolean
21
+ isDarkMode?: boolean
22
+ }>()
28
23
 
29
- @Emit('click')
30
- emitClick (event: Event) {
31
- return event
32
- }
24
+ const emit = defineEmits<{
25
+ 'click': [clickEvent: Event]
26
+ }>()
27
+
28
+ const emitClick = (event: Event) => {
29
+ emit('click', event)
33
30
  }
34
31
  </script>
35
32
 
@@ -101,4 +98,4 @@ export default class Tab extends Vue {
101
98
  }
102
99
  }
103
100
  }
104
- </style>
101
+ </style>