@pocketprep/ui-kit 2.0.40 → 3.0.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 (305) hide show
  1. package/{.eslintrc.js → .eslintrc.cjs} +16 -17
  2. package/dist/@pocketprep/ui-kit.js +18856 -0
  3. package/dist/@pocketprep/ui-kit.js.map +1 -0
  4. package/dist/@pocketprep/ui-kit.umd.cjs +28 -0
  5. package/dist/@pocketprep/ui-kit.umd.cjs.map +1 -0
  6. package/dist/style.css +1 -0
  7. package/index.d.ts +6 -62
  8. package/lib/SVGDefinitions.vue +85 -0
  9. package/lib/assets/emojis/tada.png +0 -0
  10. package/lib/assets/halftones/halftone-black.png +0 -0
  11. package/lib/assets/halftones/halftone-blue.png +0 -0
  12. package/lib/assets/halftones/halftone-green.png +0 -0
  13. package/lib/assets/halftones/halftone-purple.png +0 -0
  14. package/lib/assets/halftones/halftone-red.png +0 -0
  15. package/lib/assets/halftones/halftone-yellow.png +0 -0
  16. package/lib/assets/question/paywall-dark.png +0 -0
  17. package/lib/assets/question/paywall-light.png +0 -0
  18. package/lib/components/Banners/Banner.md +41 -0
  19. package/lib/components/Banners/Banner.vue +87 -0
  20. package/lib/components/BundleIcons/AMTA.vue +134 -0
  21. package/lib/components/BundleIcons/BundleIcon.md +60 -0
  22. package/lib/components/BundleIcons/BundleIcon.vue +111 -0
  23. package/lib/components/Bundles/BundleList.md +63 -0
  24. package/lib/components/Bundles/BundleList.vue +170 -0
  25. package/lib/components/Bundles/BundleSearch.md +195 -0
  26. package/lib/components/Bundles/BundleSearch.vue +573 -0
  27. package/lib/components/Bundles/PremiumPill.md +23 -0
  28. package/lib/components/Bundles/PremiumPill.vue +43 -0
  29. package/lib/components/Buttons/Button.md +99 -0
  30. package/lib/components/Buttons/Button.vue +496 -0
  31. package/lib/components/Buttons/Link.md +58 -0
  32. package/lib/components/Buttons/Link.vue +192 -0
  33. package/lib/components/Buttons/Tab.md +35 -0
  34. package/lib/components/Buttons/Tab.vue +103 -0
  35. package/lib/components/Calendar/Calendar.md +18 -0
  36. package/lib/components/Calendar/Calendar.vue +162 -0
  37. package/lib/components/Charts/Bar.md +123 -0
  38. package/lib/components/Charts/Bar.vue +364 -0
  39. package/lib/components/Charts/Pie.md +23 -0
  40. package/lib/components/Charts/Pie.vue +105 -0
  41. package/lib/components/Controls/SegmentControl.md +47 -0
  42. package/lib/components/Controls/SegmentControl.vue +117 -0
  43. package/lib/components/Controls/Slider.md +67 -0
  44. package/lib/components/Controls/Slider.vue +358 -0
  45. package/lib/components/Controls/ToggleSwitch.md +56 -0
  46. package/lib/components/Controls/ToggleSwitch.vue +160 -0
  47. package/lib/components/Exams/ExamCard.md +45 -0
  48. package/lib/components/Exams/ExamCard.vue +257 -0
  49. package/lib/components/Exams/ExamMenuCard.md +90 -0
  50. package/lib/components/Exams/ExamMenuCard.vue +218 -0
  51. package/lib/components/Filters/FilterDropdown.md +59 -0
  52. package/lib/components/Filters/FilterDropdown.vue +176 -0
  53. package/lib/components/Filters/FilterOptions.md +65 -0
  54. package/lib/components/Filters/FilterOptions.vue +265 -0
  55. package/lib/components/Filters/filterOptions.d.ts +10 -0
  56. package/lib/components/Forms/Checkbox.md +52 -0
  57. package/lib/components/Forms/Checkbox.vue +184 -0
  58. package/lib/components/Forms/CheckboxOption.md +37 -0
  59. package/lib/components/Forms/CheckboxOption.vue +173 -0
  60. package/lib/components/Forms/Errors.md +23 -0
  61. package/lib/components/Forms/Errors.vue +109 -0
  62. package/lib/components/Forms/Input.md +63 -0
  63. package/lib/components/Forms/Input.vue +310 -0
  64. package/lib/components/Forms/Radio.md +66 -0
  65. package/lib/components/Forms/Radio.vue +312 -0
  66. package/lib/components/Forms/Select.md +133 -0
  67. package/lib/components/Forms/Select.vue +670 -0
  68. package/lib/components/Forms/Textarea.md +57 -0
  69. package/lib/components/Forms/Textarea.vue +157 -0
  70. package/lib/components/Icons/Icon.md +146 -0
  71. package/lib/components/Icons/Icon.vue +192 -0
  72. package/lib/components/Icons/IconAccordionArrow.md +7 -0
  73. package/lib/components/Icons/IconAccordionArrow.vue +23 -0
  74. package/lib/components/Icons/IconActivity.md +7 -0
  75. package/lib/components/Icons/IconActivity.vue +21 -0
  76. package/lib/components/Icons/IconAdd.md +7 -0
  77. package/lib/components/Icons/IconAdd.vue +19 -0
  78. package/lib/components/Icons/IconAddCircle.md +7 -0
  79. package/lib/components/Icons/IconAddCircle.vue +22 -0
  80. package/lib/components/Icons/IconArrow.md +7 -0
  81. package/lib/components/Icons/IconArrow.vue +21 -0
  82. package/lib/components/Icons/IconBarChart.md +7 -0
  83. package/lib/components/Icons/IconBarChart.vue +23 -0
  84. package/lib/components/Icons/IconCalendar.md +7 -0
  85. package/lib/components/Icons/IconCalendar.vue +19 -0
  86. package/lib/components/Icons/IconCheck.md +7 -0
  87. package/lib/components/Icons/IconCheck.vue +21 -0
  88. package/lib/components/Icons/IconClose.md +7 -0
  89. package/lib/components/Icons/IconClose.vue +23 -0
  90. package/lib/components/Icons/IconCorrect.md +7 -0
  91. package/lib/components/Icons/IconCorrect.vue +19 -0
  92. package/lib/components/Icons/IconEdit.md +7 -0
  93. package/lib/components/Icons/IconEdit.vue +21 -0
  94. package/lib/components/Icons/IconExam.md +7 -0
  95. package/lib/components/Icons/IconExam.vue +34 -0
  96. package/lib/components/Icons/IconExternalLink.md +7 -0
  97. package/lib/components/Icons/IconExternalLink.vue +30 -0
  98. package/lib/components/Icons/IconEyeHide.md +7 -0
  99. package/lib/components/Icons/IconEyeHide.vue +21 -0
  100. package/lib/components/Icons/IconEyeShow.md +7 -0
  101. package/lib/components/Icons/IconEyeShow.vue +21 -0
  102. package/lib/components/Icons/IconFilter.md +7 -0
  103. package/lib/components/Icons/IconFilter.vue +19 -0
  104. package/lib/components/Icons/IconFilterActive.md +7 -0
  105. package/lib/components/Icons/IconFilterActive.vue +20 -0
  106. package/lib/components/Icons/IconFlag.md +7 -0
  107. package/lib/components/Icons/IconFlag.vue +25 -0
  108. package/lib/components/Icons/IconFlagFeedback.md +11 -0
  109. package/lib/components/Icons/IconFlagFeedback.vue +24 -0
  110. package/lib/components/Icons/IconFlagFilled.md +7 -0
  111. package/lib/components/Icons/IconFlagFilled.vue +22 -0
  112. package/lib/components/Icons/IconFullView.md +7 -0
  113. package/lib/components/Icons/IconFullView.vue +30 -0
  114. package/lib/components/Icons/IconFullViewActive.md +7 -0
  115. package/lib/components/Icons/IconFullViewActive.vue +28 -0
  116. package/lib/components/Icons/IconHandle.md +7 -0
  117. package/lib/components/Icons/IconHandle.vue +23 -0
  118. package/lib/components/Icons/IconHeart.md +7 -0
  119. package/lib/components/Icons/IconHeart.vue +19 -0
  120. package/lib/components/Icons/IconHelp.md +7 -0
  121. package/lib/components/Icons/IconHelp.vue +25 -0
  122. package/lib/components/Icons/IconHourglass.md +7 -0
  123. package/lib/components/Icons/IconHourglass.vue +22 -0
  124. package/lib/components/Icons/IconImage.md +7 -0
  125. package/lib/components/Icons/IconImage.vue +21 -0
  126. package/lib/components/Icons/IconIncorrect.md +7 -0
  127. package/lib/components/Icons/IconIncorrect.vue +21 -0
  128. package/lib/components/Icons/IconInfo.md +7 -0
  129. package/lib/components/Icons/IconInfo.vue +24 -0
  130. package/lib/components/Icons/IconKeyboard.md +7 -0
  131. package/lib/components/Icons/IconKeyboard.vue +25 -0
  132. package/lib/components/Icons/IconLaunch.md +7 -0
  133. package/lib/components/Icons/IconLaunch.vue +25 -0
  134. package/lib/components/Icons/IconLightning.md +7 -0
  135. package/lib/components/Icons/IconLightning.vue +21 -0
  136. package/lib/components/Icons/IconList.md +7 -0
  137. package/lib/components/Icons/IconList.vue +26 -0
  138. package/lib/components/Icons/IconLoading.md +7 -0
  139. package/lib/components/Icons/IconLoading.vue +65 -0
  140. package/lib/components/Icons/IconLoading2.md +7 -0
  141. package/lib/components/Icons/IconLoading2.vue +52 -0
  142. package/lib/components/Icons/IconLock.md +7 -0
  143. package/lib/components/Icons/IconLock.vue +23 -0
  144. package/lib/components/Icons/IconMissedQuestions.md +7 -0
  145. package/lib/components/Icons/IconMissedQuestions.vue +22 -0
  146. package/lib/components/Icons/IconMoon.md +7 -0
  147. package/lib/components/Icons/IconMoon.vue +25 -0
  148. package/lib/components/Icons/IconPaginationArrow.md +7 -0
  149. package/lib/components/Icons/IconPaginationArrow.vue +23 -0
  150. package/lib/components/Icons/IconPassage.md +7 -0
  151. package/lib/components/Icons/IconPassage.vue +22 -0
  152. package/lib/components/Icons/IconPencil.md +7 -0
  153. package/lib/components/Icons/IconPencil.vue +19 -0
  154. package/lib/components/Icons/IconPeople.md +7 -0
  155. package/lib/components/Icons/IconPeople.vue +25 -0
  156. package/lib/components/Icons/IconQuestions.md +7 -0
  157. package/lib/components/Icons/IconQuestions.vue +25 -0
  158. package/lib/components/Icons/IconQuick10.md +7 -0
  159. package/lib/components/Icons/IconQuick10.vue +23 -0
  160. package/lib/components/Icons/IconRemoveCircle.md +7 -0
  161. package/lib/components/Icons/IconRemoveCircle.vue +22 -0
  162. package/lib/components/Icons/IconReviewFlag.md +7 -0
  163. package/lib/components/Icons/IconReviewFlag.vue +32 -0
  164. package/lib/components/Icons/IconSearch.md +7 -0
  165. package/lib/components/Icons/IconSearch.vue +23 -0
  166. package/lib/components/Icons/IconShare.md +7 -0
  167. package/lib/components/Icons/IconShare.vue +31 -0
  168. package/lib/components/Icons/IconSideBar.md +7 -0
  169. package/lib/components/Icons/IconSideBar.vue +26 -0
  170. package/lib/components/Icons/IconSideBarActive.md +7 -0
  171. package/lib/components/Icons/IconSideBarActive.vue +28 -0
  172. package/lib/components/Icons/IconStopwatch.md +7 -0
  173. package/lib/components/Icons/IconStopwatch.vue +22 -0
  174. package/lib/components/Icons/IconStrike.md +60 -0
  175. package/lib/components/Icons/IconStrike.vue +23 -0
  176. package/lib/components/Icons/IconSubject.md +7 -0
  177. package/lib/components/Icons/IconSubject.vue +22 -0
  178. package/lib/components/Icons/IconText.md +7 -0
  179. package/lib/components/Icons/IconText.vue +22 -0
  180. package/lib/components/Icons/IconWarning.md +7 -0
  181. package/lib/components/Icons/IconWarning.vue +22 -0
  182. package/lib/components/Modal/Modal.md +31 -0
  183. package/lib/components/Modal/Modal.vue +133 -0
  184. package/lib/components/Modal/ModalContainer.md +96 -0
  185. package/lib/components/Modal/ModalContainer.vue +208 -0
  186. package/lib/components/Onboarding/EmailAuth.md +40 -0
  187. package/lib/components/Onboarding/EmailAuth.vue +218 -0
  188. package/lib/components/Onboarding/MagicCodeEntry.md +20 -0
  189. package/lib/components/Onboarding/MagicCodeEntry.vue +189 -0
  190. package/lib/components/PhonePerson/PhonePerson.md +36 -0
  191. package/lib/components/PhonePerson/PhonePerson.vue +48 -0
  192. package/lib/components/PhonePerson/phoneperson-IT@2x.png +0 -0
  193. package/lib/components/PhonePerson/phoneperson-auto@2x.png +0 -0
  194. package/lib/components/PhonePerson/phoneperson-behavioralhealth@2x.png +0 -0
  195. package/lib/components/PhonePerson/phoneperson-emt@2x.png +0 -0
  196. package/lib/components/PhonePerson/phoneperson-essentials@2x.png +0 -0
  197. package/lib/components/PhonePerson/phoneperson-finance@2x.png +0 -0
  198. package/lib/components/PhonePerson/phoneperson-fitness@2x.png +0 -0
  199. package/lib/components/PhonePerson/phoneperson-medical@2x.png +0 -0
  200. package/lib/components/PhonePerson/phoneperson-nursing@2x.png +0 -0
  201. package/lib/components/PhonePerson/phoneperson-nursingschool@2x.png +0 -0
  202. package/lib/components/PhonePerson/phoneperson-professional@2x.png +0 -0
  203. package/lib/components/PhonePerson/phoneperson-skilledtrades@2x.png +0 -0
  204. package/lib/components/Quiz/FlagToggle.md +37 -0
  205. package/lib/components/Quiz/FlagToggle.vue +124 -0
  206. package/lib/components/Quiz/GlobalMetricsToggle.md +46 -0
  207. package/lib/components/Quiz/GlobalMetricsToggle.vue +124 -0
  208. package/lib/components/Quiz/KeyboardShortcutsButton.md +18 -0
  209. package/lib/components/Quiz/KeyboardShortcutsButton.vue +102 -0
  210. package/lib/components/Quiz/KeyboardShortcutsModal.md +71 -0
  211. package/lib/components/Quiz/KeyboardShortcutsModal.vue +261 -0
  212. package/lib/components/Quiz/Question.md +579 -0
  213. package/lib/components/Quiz/Question.vue +3262 -0
  214. package/lib/components/Quiz/QuizContainer.md +91 -0
  215. package/lib/components/Quiz/QuizContainer.vue +207 -0
  216. package/lib/components/Quiz/QuizProgress.md +122 -0
  217. package/lib/components/Quiz/QuizProgress.vue +188 -0
  218. package/lib/components/Quiz/QuizProgressBar.md +131 -0
  219. package/lib/components/Quiz/QuizProgressBar.vue +96 -0
  220. package/lib/components/Search/Pill.md +37 -0
  221. package/lib/components/Search/Pill.vue +117 -0
  222. package/lib/components/Search/Search.md +44 -0
  223. package/lib/components/Search/Search.vue +341 -0
  224. package/lib/components/SidePanels/SidePanel.md +126 -0
  225. package/lib/components/SidePanels/SidePanel.vue +592 -0
  226. package/lib/components/Tables/StudyTable.md +136 -0
  227. package/lib/components/Tables/Table.vue +497 -0
  228. package/lib/components/Tables/TableActions.vue +199 -0
  229. package/lib/components/Tables/TablePagination.md +19 -0
  230. package/lib/components/Tables/TablePagination.vue +109 -0
  231. package/lib/components/Tables/TeachTable.md +696 -0
  232. package/lib/components/Toasts/Toast.md +35 -0
  233. package/lib/components/Toasts/Toast.vue +213 -0
  234. package/lib/components/Tooltips/OverflowTooltip.md +14 -0
  235. package/lib/components/Tooltips/OverflowTooltip.vue +68 -0
  236. package/lib/components/Tooltips/Tooltip.md +72 -0
  237. package/lib/components/Tooltips/Tooltip.vue +143 -0
  238. package/lib/directives.ts +213 -0
  239. package/lib/index.ts +108 -0
  240. package/{pocketprep-export.module.scss → lib/pocketprep-export.module.scss} +2 -2
  241. package/{pocketprep.scss → lib/pocketprep.scss} +16 -18
  242. package/{styles → lib/styles}/_colors.scss +1 -1
  243. package/lib/styles/fonts.css +149 -0
  244. package/lib/utils.ts +53 -0
  245. package/package.json +76 -56
  246. package/{stylelint.config.js → stylelint.config.cjs} +6 -3
  247. package/assets/Fonts.md +0 -114
  248. package/assets/Images.md +0 -2
  249. package/assets/Styleguidist.vue +0 -11
  250. package/dist/@pocketprep/ui-kit.common.js +0 -29726
  251. package/dist/@pocketprep/ui-kit.common.js.map +0 -1
  252. package/dist/@pocketprep/ui-kit.umd.js +0 -29745
  253. package/dist/@pocketprep/ui-kit.umd.js.map +0 -1
  254. package/dist/@pocketprep/ui-kit.umd.min.js +0 -33
  255. package/dist/@pocketprep/ui-kit.umd.min.js.map +0 -1
  256. package/dist/demo.html +0 -1
  257. package/src/directives.d.ts +0 -2
  258. package/src/shims.d.ts +0 -19
  259. package/src/utils.d.ts +0 -51
  260. package/styles/Colors.md +0 -53
  261. package/styles/Styles.md +0 -4
  262. package/styles/_fonts.scss +0 -149
  263. package/tests/shims-test.d.ts +0 -9
  264. /package/{assets → lib/assets}/fonts/muli/muli-400.eot +0 -0
  265. /package/{assets → lib/assets}/fonts/muli/muli-400.svg +0 -0
  266. /package/{assets → lib/assets}/fonts/muli/muli-400.ttf +0 -0
  267. /package/{assets → lib/assets}/fonts/muli/muli-400.woff +0 -0
  268. /package/{assets → lib/assets}/fonts/muli/muli-400.woff2 +0 -0
  269. /package/{assets → lib/assets}/fonts/muli/muli-400italic.eot +0 -0
  270. /package/{assets → lib/assets}/fonts/muli/muli-400italic.svg +0 -0
  271. /package/{assets → lib/assets}/fonts/muli/muli-400italic.ttf +0 -0
  272. /package/{assets → lib/assets}/fonts/muli/muli-400italic.woff +0 -0
  273. /package/{assets → lib/assets}/fonts/muli/muli-400italic.woff2 +0 -0
  274. /package/{assets → lib/assets}/fonts/muli/muli-600.eot +0 -0
  275. /package/{assets → lib/assets}/fonts/muli/muli-600.svg +0 -0
  276. /package/{assets → lib/assets}/fonts/muli/muli-600.ttf +0 -0
  277. /package/{assets → lib/assets}/fonts/muli/muli-600.woff +0 -0
  278. /package/{assets → lib/assets}/fonts/muli/muli-600.woff2 +0 -0
  279. /package/{assets → lib/assets}/fonts/muli/muli-600italic.eot +0 -0
  280. /package/{assets → lib/assets}/fonts/muli/muli-600italic.svg +0 -0
  281. /package/{assets → lib/assets}/fonts/muli/muli-600italic.ttf +0 -0
  282. /package/{assets → lib/assets}/fonts/muli/muli-600italic.woff +0 -0
  283. /package/{assets → lib/assets}/fonts/muli/muli-600italic.woff2 +0 -0
  284. /package/{assets → lib/assets}/fonts/muli/muli-700.eot +0 -0
  285. /package/{assets → lib/assets}/fonts/muli/muli-700.svg +0 -0
  286. /package/{assets → lib/assets}/fonts/muli/muli-700.ttf +0 -0
  287. /package/{assets → lib/assets}/fonts/muli/muli-700.woff +0 -0
  288. /package/{assets → lib/assets}/fonts/muli/muli-700.woff2 +0 -0
  289. /package/{assets → lib/assets}/fonts/muli/muli-700italic.eot +0 -0
  290. /package/{assets → lib/assets}/fonts/muli/muli-700italic.svg +0 -0
  291. /package/{assets → lib/assets}/fonts/muli/muli-700italic.ttf +0 -0
  292. /package/{assets → lib/assets}/fonts/muli/muli-700italic.woff +0 -0
  293. /package/{assets → lib/assets}/fonts/muli/muli-700italic.woff2 +0 -0
  294. /package/{assets → lib/assets}/images/amta.svg +0 -0
  295. /package/{assets → lib/assets}/images/favicon.ico +0 -0
  296. /package/{assets → lib/assets}/images/thumb-large-dark.svg +0 -0
  297. /package/{assets → lib/assets}/images/thumb-large.svg +0 -0
  298. /package/{assets → lib/assets}/images/thumb-small-dark.svg +0 -0
  299. /package/{assets → lib/assets}/images/thumb-small.svg +0 -0
  300. /package/{src → lib}/components/BundleIcons/bundleIcon.d.ts +0 -0
  301. /package/{src → lib}/components/Icons/icon.d.ts +0 -0
  302. /package/{src → lib}/components/PhonePerson/phonePerson.d.ts +0 -0
  303. /package/{src → lib}/components/Tables/table.d.ts +0 -0
  304. /package/{styles → lib/styles}/_breakpoints.scss +0 -0
  305. /package/{styles/_normalize.scss → lib/styles/normalize.css} +0 -0
@@ -0,0 +1,176 @@
1
+ <template>
2
+ <div class="filter">
3
+ <div class="filter-button">
4
+ <Link
5
+ v-dark="isDarkMode"
6
+ :has-icon="true"
7
+ :aria-expanded="showFilterDropdown ? 'true' : 'false'"
8
+ class="filter-button__link"
9
+ :class="{
10
+ 'filter-button__link--open': showFilterDropdown,
11
+ 'filter-button__link--responsive': responsiveButton,
12
+ }"
13
+ role="button"
14
+ type="tertiary"
15
+ tabindex="0"
16
+ @keypress.enter="showFilterDropdown"
17
+ @click="showFilterDropdown = !showFilterDropdown"
18
+ >
19
+ <Icon
20
+ type="filter"
21
+ class="filter-button__icon"
22
+ />
23
+ <span class="filter-button__text">
24
+ {{ filterLabel }}
25
+ </span>
26
+ </Link>
27
+ </div>
28
+ <div
29
+ v-if="showFilterDropdown"
30
+ v-dark="isDarkMode"
31
+ class="filter-dropdown"
32
+ :class="{
33
+ [`filter-dropdown--${align}`]: true,
34
+ [`filter-dropdown--${size}`]: true
35
+ }"
36
+ >
37
+ <FilterOptions
38
+ :radio-entries="radioOptions"
39
+ :checkbox-entries="checkboxOptions"
40
+ />
41
+ </div>
42
+ </div>
43
+ </template>
44
+
45
+ <script lang="ts">
46
+ import { Component, Emit, Prop, Vue, Watch } from 'vue-facing-decorator'
47
+ import Link from '../Buttons/Link.vue'
48
+ import Icon from '../Icons/Icon.vue'
49
+ import FilterOptions from '../Filters/FilterOptions.vue'
50
+ import { dark } from '../../directives'
51
+ import type { TRadioOption, TCheckboxOption } from './filterOptions'
52
+
53
+ @Component({
54
+ components: {
55
+ FilterOptions,
56
+ Icon,
57
+ Link,
58
+ },
59
+ directives: {
60
+ dark,
61
+ },
62
+ })
63
+
64
+ export default class FilterDropdown extends Vue {
65
+ @Prop() radioEntries!: TRadioOption[]
66
+ @Prop() checkboxEntries!: TCheckboxOption[]
67
+ @Prop() filterLabel!: string
68
+ @Prop({ default: 'right' }) align!: 'left' | 'right'
69
+ @Prop({ default: 'small' }) size!: 'small' | 'large'
70
+ @Prop({ default: false }) isDarkMode!: boolean
71
+ @Prop({ default: false }) responsiveButton!: boolean
72
+
73
+ radioOptions = [ ...this.radioEntries ]
74
+ checkboxOptions = [ ...this.checkboxEntries ]
75
+
76
+ showFilterDropdown: boolean | 'checkbox' = false
77
+
78
+ mounted () {
79
+ document.addEventListener('click', this.clickListener)
80
+ document.addEventListener('keydown', this.keydownListener)
81
+ }
82
+
83
+ keydownListener (e: KeyboardEvent) {
84
+ if (e.code === 'Escape') {
85
+ e.stopPropagation()
86
+ this.showFilterDropdown = false
87
+ }
88
+ }
89
+ clickListener (e: MouseEvent) {
90
+ if (this.showFilterDropdown) {
91
+ const targetEl = e.target as HTMLElement
92
+ if (!targetEl?.closest('.filter')
93
+ && this.showFilterDropdown !== 'checkbox'
94
+ && document.body.contains(targetEl)
95
+ ) {
96
+ this.showFilterDropdown = false
97
+ }
98
+ }
99
+ }
100
+
101
+ beforeUnmount () {
102
+ document.removeEventListener('click', this.clickListener)
103
+ document.removeEventListener('keydown', this.keydownListener)
104
+ }
105
+
106
+ @Watch('checkboxOptions')
107
+ checkboxOptionsChanged (newVal: TCheckboxOption[], oldVal: TCheckboxOption[]) {
108
+ const newEnabledFilters = newVal.filter(o => o.enabled)
109
+ const oldEnabledFilters = oldVal.filter(o => o.enabled)
110
+ if (newEnabledFilters.length !== oldEnabledFilters.length) {
111
+ this.emitUpdateModelValue(newVal)
112
+ }
113
+ }
114
+ @Watch('checkboxEntries')
115
+ checkboxOptionChanged (newVal: TCheckboxOption[]) {
116
+ this.checkboxOptions = [ ...newVal ]
117
+ }
118
+
119
+ @Watch('radioOptions')
120
+ radioOptionsChanged (newVal: TRadioOption[], oldVal: TRadioOption[]) {
121
+ const newEnabledFilters = newVal
122
+ const oldEnabledFilters = oldVal
123
+ if (newEnabledFilters.length !== oldEnabledFilters.length) {
124
+ this.emitUpdateModelValue(newVal)
125
+ }
126
+ }
127
+ @Watch('radioEntries')
128
+ radioOptionChanged (newVal: TRadioOption[]) {
129
+ this.radioOptions = [ ...newVal ]
130
+ }
131
+
132
+ @Emit('update:modelValue')
133
+ emitUpdateModelValue (options: TCheckboxOption[] | TRadioOption[]) {
134
+ return options
135
+ }
136
+ }
137
+
138
+ </script>
139
+
140
+ <style lang="scss">
141
+ @import '../../styles/colors';
142
+ @import '../../styles/breakpoints';
143
+
144
+ .filter {
145
+ .filter-button {
146
+ padding-bottom: 12px;
147
+
148
+ &__link {
149
+ &--open {
150
+ color: $brand-black !important;
151
+
152
+ &--dark {
153
+ color: $butterscotch !important;
154
+ }
155
+ }
156
+
157
+ &--responsive {
158
+ div {
159
+ @include breakpoint(black-bear) {
160
+ display: none;
161
+ }
162
+ }
163
+ }
164
+ }
165
+
166
+ &__icon {
167
+ vertical-align: middle;
168
+ padding-bottom: 1px;
169
+ }
170
+
171
+ &__text {
172
+ vertical-align: middle;
173
+ }
174
+ }
175
+ }
176
+ </style>
@@ -0,0 +1,65 @@
1
+ ```vue
2
+ <template>
3
+ <div>
4
+ <FilterOptions
5
+ :radioEntries="radioEntries"
6
+ :checkboxEntries="checkboxEntries"
7
+ class="multiple"
8
+ />
9
+ <FilterOptions
10
+ :radioEntries="[]"
11
+ :checkboxEntries="checkboxEntries"
12
+ >
13
+ <template #radioLabel></template>
14
+ </FilterOptions>
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ export default {
20
+ data () {
21
+ return {
22
+ checkboxEntries: [
23
+ {
24
+ id: 'airway',
25
+ label: 'Airway, Respiration, & Ventilation (18)',
26
+ enabled: false,
27
+ },
28
+ {
29
+ id: 'cardio',
30
+ label: 'Cardiology & Resuscitation (9)',
31
+ enabled: false,
32
+ },
33
+ {
34
+ id: 'ems',
35
+ label: 'EMS Operations (5)',
36
+ enabled: false,
37
+ },
38
+ {
39
+ id: 'medical',
40
+ label: 'Medical; Obstetrics & Gynecology (6)',
41
+ enabled: false,
42
+ },
43
+ {
44
+ id: 'trauma',
45
+ label: 'Trauma (10)',
46
+ enabled: false,
47
+ }
48
+ ],
49
+ radioEntries: [
50
+ { label: 'All Answered', value: 'all' },
51
+ { label: 'Correct', value: 'correct' },
52
+ { label: 'Incorrect', value: 'incorrect' },
53
+ { label: 'Flagged', value: 'flagged' },
54
+ ]
55
+ }
56
+ }
57
+ }
58
+ </script>
59
+
60
+ <style>
61
+ .multiple {
62
+ margin-bottom: 10px;
63
+ }
64
+ </style>
65
+ ```
@@ -0,0 +1,265 @@
1
+ <template>
2
+ <div
3
+ v-dark
4
+ class="filter-options"
5
+ :class="{
6
+ [`filter-options--${align}`]: true,
7
+ [`filter-options-${size}`]: true
8
+ }"
9
+ >
10
+ <slot name="radioLabel">
11
+ <div
12
+ v-if="radioOptions.length > 0"
13
+ v-dark
14
+ class="filter-options__label"
15
+ :class="{ 'filter-options__label--active': showRadioOptions }"
16
+ :aria-expanded="showFilterDropdown ? 'true' : 'false'"
17
+ @click="showRadioOptions = !showRadioOptions; showCheckboxOptions = false;"
18
+ @mousedown.prevent
19
+ >
20
+ <slot name="radioLabelText">
21
+ <span>FILTER BY QUESTION TYPE</span>
22
+ </slot>
23
+ <slot name="radioLabelIcon">
24
+ <Icon
25
+ v-dark="isDarkMode"
26
+ type="accordionArrow"
27
+ class="filter-options__arrow"
28
+ />
29
+ </slot>
30
+ </div>
31
+ </slot>
32
+ <slot name="radio">
33
+ <Radio
34
+ v-if="showRadioOptions"
35
+ v-model="radioEntry"
36
+ aria-live="polite"
37
+ :data="radioOptions"
38
+ class="filter-options__radio"
39
+ />
40
+ </slot>
41
+ <slot name="checkboxLabel">
42
+ <div
43
+ v-if="radioOptions.length > 0"
44
+ v-dark
45
+ class="filter-options__label"
46
+ :class="{ 'filter-options__label--active': showCheckboxOptions }"
47
+ :aria-expanded="showFilterDropdown ? 'true' : 'false'"
48
+ @click="showCheckboxOptions = !showCheckboxOptions; showRadioOptions = false;"
49
+ @mousedown.prevent
50
+ >
51
+ <slot name="checkboxLabelText">
52
+ <span>FILTER BY SUBJECT</span>
53
+ </slot>
54
+ <slot name="checkboxLabelIcon">
55
+ <Icon
56
+ v-dark="isDarkMode"
57
+ type="accordionArrow"
58
+ class="filter-options__arrow"
59
+ />
60
+ </slot>
61
+ </div>
62
+ <div
63
+ v-else
64
+ v-dark
65
+ class="filter-options__label"
66
+ :class="{ 'filter-options__label--active': showCheckboxOptions }"
67
+ :aria-expanded="showFilterDropdown ? 'true' : 'false'"
68
+ >
69
+ <slot name="checkboxLabelText">
70
+ <span>FILTER BY SUBJECT</span>
71
+ </slot>
72
+ </div>
73
+ </slot>
74
+ <slot name="checkbox">
75
+ <div
76
+ v-if="showCheckboxOptions || radioOptions.length === 0"
77
+ class="filter-options__checkbox"
78
+ >
79
+ <CheckboxOption
80
+ v-for="option in checkboxOptions"
81
+ :key="option.id"
82
+ v-model="option.enabled"
83
+ v-dark="isDarkMode"
84
+ :label="option.label"
85
+ class="filter-options__option"
86
+ @click="option.enabled = !option.enabled"
87
+ />
88
+ </div>
89
+ </slot>
90
+ </div>
91
+ </template>
92
+
93
+ <script lang="ts">
94
+ import { Component, Emit, Prop, Vue, Watch } from 'vue-facing-decorator'
95
+ import CheckboxOption from '../Forms/CheckboxOption.vue'
96
+ import Link from '../Buttons/Link.vue'
97
+ import Radio from '../Forms/Radio.vue'
98
+ import { dark } from '../../directives'
99
+ import type { TRadioOption, TCheckboxOption } from './filterOptions'
100
+
101
+ @Component({
102
+ components: {
103
+ CheckboxOption,
104
+ Link,
105
+ Radio,
106
+ },
107
+ directives: {
108
+ dark,
109
+ },
110
+ })
111
+
112
+
113
+ export default class FilterOptions extends Vue {
114
+ @Prop({ default: '' }) defaultRadioEntry?: string
115
+ @Prop() radioEntries!: TRadioOption[]
116
+ @Prop() checkboxEntries!: TCheckboxOption[]
117
+ @Prop({ default: 'right' }) align!: 'left' | 'right'
118
+ @Prop({ default: 'small' }) size!: 'small' | 'large'
119
+ @Prop({ default: false }) isDarkMode!: boolean
120
+
121
+ radioOptions = [ ...this.radioEntries ]
122
+ checkboxOptions = [ ...this.checkboxEntries ]
123
+
124
+ showFilterDropdown: boolean | 'checkbox' = false
125
+ showRadioOptions = true
126
+ showCheckboxOptions = false
127
+
128
+ radioEntry: { label: string; value: string } | null = this.radioOptions.find(
129
+ o => o.value === this.defaultRadioEntry
130
+ ) || null
131
+
132
+ stringHasSpaces (val: string) {
133
+ return val.includes(' ')
134
+ }
135
+
136
+ keydownListener (e: KeyboardEvent) {
137
+ if (e.code === 'Escape') {
138
+ e.stopPropagation()
139
+ this.showFilterDropdown = false
140
+ }
141
+ }
142
+ clickListener (e: MouseEvent) {
143
+ if (this.showFilterDropdown) {
144
+ const targetEl = e.target as HTMLElement
145
+ if (!targetEl?.closest('.filter')
146
+ && this.showFilterDropdown !== 'checkbox'
147
+ && document.body.contains(targetEl)
148
+ ) {
149
+ this.showFilterDropdown = false
150
+ }
151
+ }
152
+ }
153
+
154
+ mounted () {
155
+ document.addEventListener('click', this.clickListener)
156
+ document.addEventListener('keydown', this.keydownListener)
157
+ }
158
+
159
+ @Watch('checkboxOptions')
160
+ checkboxOptionsChanged (newVal: TCheckboxOption[], oldVal: TCheckboxOption[]) {
161
+
162
+ const newEnabledFilters = newVal.filter(o => o.enabled)
163
+ const oldEnabledFilters = oldVal.filter(o => o.enabled)
164
+ if (newEnabledFilters.length !== oldEnabledFilters.length) {
165
+ this.emitUpdateModelValue(newVal)
166
+ }
167
+ }
168
+ @Watch('checkboxEntries')
169
+ checkboxOptionChanged (newVal: TCheckboxOption[]) {
170
+ this.checkboxOptions = [ ...newVal ]
171
+ }
172
+
173
+ @Watch('radioOptions')
174
+ radioOptionsChanged (newVal: TRadioOption[], oldVal: TRadioOption[]) {
175
+ const newEnabledFilters = newVal
176
+ const oldEnabledFilters = oldVal
177
+ if (newEnabledFilters.length !== oldEnabledFilters.length) {
178
+ this.emitUpdateModelValue(newVal)
179
+ }
180
+ }
181
+ @Watch('radioEntries')
182
+ radioOptionChanged (newVal: TRadioOption[]) {
183
+ this.radioOptions = [ ...newVal ]
184
+ }
185
+
186
+ @Emit('update:modelValue')
187
+ emitUpdateModelValue (options: TCheckboxOption[] | TRadioOption[]) {
188
+ return options
189
+ }
190
+ }
191
+
192
+ </script>
193
+
194
+ <style lang="scss">
195
+ @import '../../styles/colors';
196
+ @import '../../styles/breakpoints';
197
+
198
+ .filter-options {
199
+ background: $white;
200
+ border-radius: 8px;
201
+ box-shadow: 0 6px 22px 0 rgba($brand-black, 0.1);
202
+ padding-bottom: 20px;
203
+ box-sizing: border-box;
204
+ width: 100%;
205
+ max-width: 250px;
206
+ font-weight: 500;
207
+ max-height: 305px;
208
+ overflow: auto;
209
+
210
+ &__label {
211
+ display: flex;
212
+ color: $slate;
213
+ font-size: 12px;
214
+ letter-spacing: 0.24px;
215
+ line-height: 16px;
216
+ text-align: left;
217
+ padding: 13px 20px;
218
+
219
+ &--active svg {
220
+ transform: rotate(180deg);
221
+ }
222
+
223
+ &:focus {
224
+ &::before {
225
+ content: '';
226
+ left: -6px;
227
+ top: -2px;
228
+ width: calc(100% + 12px);
229
+ height: 100%;
230
+ border: 1px solid $brand-blue;
231
+ position: absolute;
232
+ border-radius: 6px;
233
+ }
234
+ }
235
+
236
+ &--dark {
237
+ color: $pewter;
238
+
239
+ &:focus::before {
240
+ border-color: $banana-bread;
241
+ }
242
+ }
243
+
244
+ span {
245
+ margin-right: 6px;
246
+ }
247
+
248
+ svg {
249
+ color: $brand-blue;
250
+ width: 11px;
251
+ height: 10px;
252
+ }
253
+ }
254
+
255
+ &__radio {
256
+ padding-left: 20px;
257
+ }
258
+
259
+ &__option {
260
+ padding-left: 14px;
261
+ margin: 0 6px;
262
+ line-height: 18px;
263
+ }
264
+ }
265
+ </style>
@@ -0,0 +1,10 @@
1
+ export type TRadioOption = {
2
+ label: string
3
+ value: string
4
+ }
5
+
6
+ export type TCheckboxOption = {
7
+ id: string
8
+ label: string
9
+ enabled: boolean
10
+ }
@@ -0,0 +1,52 @@
1
+ ```vue
2
+ <template>
3
+ <div>
4
+ <div class="light">
5
+ <Checkbox v-model="checkboxValue1" />
6
+ <Checkbox v-model="checkboxValue2" :disabled="true" />
7
+ <Checkbox v-model="checkboxValue3" />
8
+ <Checkbox v-model="checkboxValue4" :disabled="true" />
9
+ <Checkbox v-model="checkboxValue5" />
10
+ <Checkbox v-model="checkboxValue6" :disabled="true" />
11
+ </div>
12
+ <div class="dark">
13
+ <Checkbox :isDarkMode="true" v-model="checkboxValue1" />
14
+ <Checkbox :isDarkMode="true" v-model="checkboxValue2" :disabled="true" />
15
+ <Checkbox :isDarkMode="true" v-model="checkboxValue3" />
16
+ <Checkbox :isDarkMode="true" v-model="checkboxValue4" :disabled="true" />
17
+ <Checkbox :isDarkMode="true" v-model="checkboxValue5" />
18
+ <Checkbox :isDarkMode="true" v-model="checkboxValue6" :disabled="true" />
19
+ </div>
20
+ </div>
21
+ </template>
22
+
23
+ <script>
24
+ export default {
25
+ data() {
26
+ return {
27
+ checkboxValue1: true,
28
+ checkboxValue2: true,
29
+ checkboxValue3: null,
30
+ checkboxValue4: null,
31
+ checkboxValue5: false,
32
+ checkboxValue6: false,
33
+ }
34
+ }
35
+ }
36
+ </script>
37
+
38
+ <style>
39
+ .light,
40
+ .dark {
41
+ padding: 30px;
42
+ }
43
+
44
+ .dark {
45
+ background-color: #1f3545;
46
+ }
47
+
48
+ .uikit-checkbox {
49
+ margin-bottom: 10px;
50
+ }
51
+ </style>
52
+ ```